[R] Survey-weighted ordered logistic regression

Thomas Lumley tlumley at u.washington.edu
Tue Jul 18 18:41:47 CEST 2006

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

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 Lumley			Assoc. Professor, Biostatistics
tlumley at u.washington.edu	University of Washington, Seattle

More information about the R-help mailing list