# [R] Logit Regressions, Clustering etc

Thomas Lumley tlumley at u.washington.edu
Tue Jan 29 18:46:52 CET 2008

```The 'sandwich' package has sandwich standard errors of various sorts for a
generalized linear models. I don't know if it handles the proportional
odds model.

-thomas

On Tue, 29 Jan 2008, Paul Sweeting wrote:

> Hi
>
> 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
> regression..."
>
> I'm loathe to start learning another stats package, so if anyone is able to
> help...!
>
> Thanks
>
> Paul
>
>
>> Hi
>
>> 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 =
> "logit"))
>> summary(res1_l)
>
>> ...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)
>> summary(res1_l)
>
>> ..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")
>> summary(res1)
>
>> 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
> output
>> for a logit and an ordered logit regression
>
>> Thanks in advance for your help.
>
>> ______________________________________________
>> R-help at r-project.org 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.
>
> ______________________________________________
> R-help at r-project.org 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.
>

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

More information about the R-help mailing list