I would like to calculate the SDs of Quartiles in one code using a weighted analysis with the survey package.
With the means of the Quartiles it works like this:
svyby(~ x, by = ~as.factor(var_in_quartiles), design = weights, FUN = svymean)
With output:
as.factor(WAISTquart) x se
1 1 1.467615 0.05541616
2 2 1.389899 0.06070003
3 3 1.294789 0.04032355
4 4 1.156874 0.02414524
If I try this with svysd to get SDs i get the error:
Error: $ operator is invalid for atomic vectors
Anyone know a solution? Or just recalulate the SDs with the given SEs?