svydesign syntax and deviance!

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

svydesign syntax and deviance!

rwanuza
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.
Regards.

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: svydesign syntax and deviance!

Thomas Lumley
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

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: svydesign syntax and deviance!

rwanuza
Thank you Thomas,
 if i understand what you say below i need to use glm in order to have the
deviance and consider it for the model with svyglm and choose the best
model. I use  glm and svyglm for two models but don't have deviance for the
svyglm. As i need to choose with the two models it is correct to use the
deviance from glm model for the svyglm.
Regards.

2010/7/31 Thomas Lumley <[hidden email]>

> 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
>

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: svydesign syntax and deviance!

Thomas Lumley
On Sat, 31 Jul 2010, aline uwimana wrote:

> Thank you Thomas,
>  if i understand what you say below i need to use glm in order to have the deviance and consider it for the model with svyglm and choose the best model. I
> use  glm and svyglm for two models but don't have deviance for the svyglm. As i need to choose with the two models it is correct to use the deviance from
> glm model for the svyglm.

No. It isn't correct to use the deviance at all.  The deviance is based on the likelihood for independent sampling, and that is not what you have.

    -thomas

Thomas Lumley
Professor of Biostatistics
University of Washington, Seattle

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.