[R] Subpopulations in Complex Surveys
Thompson, Trevor
tkt2 at cdc.gov
Mon Feb 24 14:02:03 CET 2003
For svymean, can't you just pass the subpopulation into the design argument?
> svymean(~crc10yr, design=nhis.design[nhis.design$variables$age>=50,],
na.rm=TRUE)
crc10yr
0.3461349
attr(,"var")
[,1]
[1,] 2.903020e-05
> svyglm(crc10yr~I(age>=50)+0, design=nhis.design)
Stratified 1 - level Cluster Sampling design
With ( 678 ) clusters.
Call: svyglm(formula = crc10yr ~ I(age >= 50) + 0, design = nhis.design)
Coefficients:
I(age >= 50)FALSE I(age >= 50)TRUE
0.1109 0.3461
Degrees of Freedom: 17802 Total (i.e. Null); 17800 Residual
Null Deviance: 0.1394
Residual Deviance: 0.09631 AIC: 6.601
-trevor
-----Original Message-----
From: Thomas Lumley [mailto:tlumley at u.washington.edu]
Sent: Sunday, February 23, 2003 1:17 PM
To: TyagiAnupam at aol.com
Cc: r-help at stat.math.ethz.ch
Subject: Re: [R] Subpopulations in Complex Surveys
On Wed, 19 Feb 2003 TyagiAnupam at aol.com wrote:
> Hi,
> is there a way to analyze subpopulations (e.g. women over 50, those who
> answered "yes" to a particular question) in a survey using Survey package?
> Other packages (e.g. Stata, SUDAAN) do this with a subpopulation option to
> identify the subpopulation for which the analysis shoud be done. I did not
> see this option in the Survey package. Is there another way to do this?
>
Not directly.
This only really matters for svymean. For the regression models it's just
a convenience as you can specify a model that has an interaction with the
subpopulation indicator to get estimates and standard errors in the
subpopulation.
For svymean you can use a regression model too:
Instead of a hypothetical svymean(~x, design=d, subpop=race==2) do
svyglm(x~I(race==2)+0, design=d)
I need to work out if there's a general way to handle subpopulations or
whether it needs to be coded on a case by case basis.
-thomas
______________________________________________
R-help at stat.math.ethz.ch mailing list
http://www.stat.math.ethz.ch/mailman/listinfo/r-help
More information about the R-help
mailing list