Re: [R] Survey-weighted ordered logistic regression

From: Thomas Lumley <tlumley_at_u.washington.edu>
Date: Wed 19 Jul 2006 - 02:41:47 EST

On Tue, 18 Jul 2006, Debarchana Ghosh wrote:

> Hi,
>
> I am trying to fit a model with an ordered response variable (3 levels) and
> 13 predictor variables. The sample has complex survey design and I've used
> 'svydesign' command from the survey package to specify the sampling design.
> After reading the manual of 'svyglm' command, I've found that you can fit a
> logistic regression (binary response variable) by specifying the
> family=binomial in svyglm function. However I'm unable to fit an ordered
> logistic model in 'svyglm function'.
>

You can do this most easily using withReplicates(). If you have a survey object created with svydesign, use as.svrepdesign() to turn it into a replicate-weights object and then do eg

library(MASS)
ologit <- withReplicates( repwtdesign,

                 quote(coef(polr(y~x1+x2+x3+x4, weights=.weights))))

You will get a lot of (harmless) warnings about "non-integer #successes in a binomial glm!". This will not give you standard errors for the intercept terms - if you want them you can do

ologit.int <- withReplicates( repwtdesign,

                 quote(polr(y~x1+x2+x3+x4, weights=.weights)$zeta))


You could also use svymle() and get Taylor linearisation standard errors, but that would require writing out the loglikelihood and its gradient, which is tedious (although you could borrow most of it from MASS::polr)

         -thomas

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

______________________________________________
R-help@stat.math.ethz.ch 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. Received on Wed Jul 19 02:59:04 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Wed 19 Jul 2006 - 04:18:58 EST.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.