[R] Risk differences with survey package

Michael.Laviolette at dhhs.state.nh.us Michael.Laviolette at dhhs.state.nh.us
Mon Mar 7 18:50:09 CET 2011


I'm trying to use the survey package to calculate a risk difference with
confidence interval for binge drinking between sexes. Variables are
X_RFBING2 (Yes, No) and SEX. Both are factors. I can get the group
prevalences easily enough with

result <- svyby(~X_RFBING2, ~SEX, la04.svy, svymean, na.rm = TRUE)

and then extract components from the svyby object with SE() and coef() to
do the computations. This gives the correct results, but I'd like to set
this up as a contrast and am having difficulty. What is the best way to do
it?

Thanks!



More information about the R-help mailing list