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? ********************************************************* Prediction is very difficult, especially about the future. -- Niels Bohr
Dear all, Could I have any method or set the graphical parameter (par(...)) to let each character have the same width when I print out some string , like "w" is too wide , "i" is too thin. Thank's very much Best Regards Ken
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
In a message dated 2/23/03 1:19:39 PM Eastern Standard Time, tlumley@u.washington.edu writes:> On Wed, 19 Feb 2003 TyagiAnupam@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 >Thanks a lot for the answer. Is there a way to get quantiles and cross-tabulations in subpopulations? If I think of proportion as mean of binary indicator (y: "got milk?"=1), can I use the solution above for proportions in subpopulations? svyglm(y~I(race==2)+0, design=d) If I create a binary indicator for a subpopulation (men over 50), can I use it with svytable? svytable( ~y+z,design=d) --anupam. ********************************************************* Prediction is very difficult, especially about the future. -- Niels Bohr ********************************************************* [[alternate HTML version deleted]]
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
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? >Ok, there is a new version of survey (1.1) that will appear on CRAN over the next few days that handles subsets as subpopulations in the sense used by Stata. There is a function subset.survey.design that makes it easy to select subsets, eg black<-subset(dnhanes, race==1) but subsets resulting from dropping NAs or from the subset argument to svyglm or svycoxph are handled the same way. -thomas Thomas Lumley Asst. Professor, Biostatistics tlumley at u.washington.edu University of Washington, Seattle