[R] Analysis of Complex Survey Data

Thomas Lumley tlumley at u.washington.edu
Tue Jul 22 01:46:19 CEST 2003


On Tue, 22 Jul 2003 Sue_Paul at moh.govt.nz wrote:

> Hi all I would like to perform a logistic regression analysis on some
> complex survey data with R, but am not sure if there are functions
> within R that will enable me to do so.

svyglm() in the survey package will fit generalised linear models to
complex survey data.


> Also, are there any extensions of
> the "cor" function that would enable me to incorporate survey weights
> when calculating correlation coefficients for bivariate data. Any help
> on this matter will be greatly appreciated. Many thanks in advance.
>

There's nothing built in for correlations. You can use svyvar() to get the
covariance matrix and get the correlations from that
eg

   covmat<-svyvar(~var1+var2+var3, design=mysurvey)
   vars<-diag(covmat)
   corrmat<- covmat/sqrt(vars%*%t(vars))

What you can't get easily is standard errors for these correlations.

	-thomas

Thomas Lumley			Assoc. Professor, Biostatistics
tlumley at u.washington.edu	University of Washington, Seattle




More information about the R-help mailing list