[R] svydesign syntax and deviance!

Thomas Lumley
Fri, 30 Jul 2010 23:23:16 -0000

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