Displaying 1 result from an estimated 1 matches for "dhanes".
Did you mean:
hanes
2010 Jun 03
1
problem with 'svyby' function from SURVEY package
Hello,
I'm using a complex survey dataset and my goal is to simply spit out a bunch of probability-weighted outcome variable means for the different levels of covariate. So I first define the structure of the study design (I'm using the CDC's NHANES data):
dhanes <- svydesign(id=~PSU, strat=~STRATA, weight=~lab_weight, data=final, nest=TRUE)
No problem there.
Now I use the "svyby" function as follows:
svyby(~outcome, ~covariate, design=dhanes, svymean, na.rm=T) -> haha
print(haha)
covariate outcome se.outcome
1 1 0.4961189 0...