[R] svydesign syntax and deviance!

Thomas Lumley tlumley at u.washington.edu
Sat Jul 31 01:23:16 CEST 2010


On Sat, 31 Jul 2010, aline uwimana wrote:

> This message is for those familiar with the survey package. I need to do regression logistic and choose the best model which explain the impact of the
> indepndent variables by using AIC,BIC,...
> 
> > sum.coef<-summary(svyglm(y~x1+x2+x3, design=design, family=quasibinomial(), data=data))$deviance
> 
>  is this the correct way for obtaining the deviance.


You can use the deviance() function to get a number.  This number isn't really the deviance, because svyglm() doesn't use maximum likelihood estimation. It doesn't have a chi-squared distribution, for example.  It is the deviance that would be computed if the weights were precision weights and were rescaled to sum to the sample size. There isn't a real deviance.

The reason this number is reported is that, although differences in deviance do not have a chi-squared distribution, they do asymptotically have a known distribution and this gives the Rao-Scott 'working deviance' tests. These tests are widely used for loglinear models but also apply to generalized linear models and the Cox model. The function regTermTest() does Rao-Scott tests with the method="LRT" option.

    -thomas

Thomas Lumley
Professor of Biostatistics
University of Washington, Seattle


More information about the R-help mailing list