[R] Logit Regressions, Clustering etc

Paul Sweeting mail at paulsweeting.co.uk
Tue Jan 29 18:42:00 CET 2008


Sorry to bother the list again, but no-one has so far been able to suggest
any help for the query below.  As an added incentive, I have been asked "why
don't you do this in Stata? It's just a case of adding a flag in the

I'm loathe to start learning another stats package, so if anyone is able to




>I am carrying out some logit regressions and want to (a) make sure I'm
>taking the right approach and (b) work out how to carry out some additional
>analysis.  So, to carry out a logit regression where the dependent variable
>is a factor db, I use something like:

>res1_l <- glm(formula = db ~ y1 + 
 + y5, family = binomial(link =

>...which is, I hope correct.  I also need to carry out an ordered logit
>regression.  Is this as simple as:

>res1_l <- polr(formula = db ~ y1 + 
 + y5)

>..with db being a factor which has more levels than just "0" and "1"?

>Assuming it is, the part I am really struggling with is the calculation of
>robust standard errors to allow for clustering.  In an "ordinary"
>regression, I’ve used survreg, where the data has also been censored, e.g.:

>res1 <- survreg(formula = Surv(ip, db_Censor) ~ y1 + 
 y5 + cluster(db_ID),
>dist = "gaussian")

>This has the benefit of giving a nice clear display of the naïve standard
>error as well as the robust one - is there any way of getting similar
>for a logit and an ordered logit regression

>Thanks in advance for your help.

>R-help at r-project.org mailing list
>PLEASE do read the posting guide
>and provide commented, minimal, self-contained, reproducible code.

More information about the R-help mailing list