[R] Logit Regressions, Clustering etc
Paul Sweeting
mail at paulsweeting.co.uk
Wed Jan 30 10:36:40 CET 2008
Fantastic - I new it would be straightforward if I could only find the
function!
Many thanks
Paul
-----Original Message-----
From: Frank E Harrell Jr [mailto:f.harrell at vanderbilt.edu]
Sent: 29 January 2008 20:30
To: Paul Sweeting
Cc: r-help at r-project.org
Subject: Re: [R] Logit Regressions, Clustering etc
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
library(Design)
f <- lrm(Y ~ x1 + x2 + ..., x=TRUE, y=TRUE)
g <- robcov(f, subjectID)
anova(g)
summary(g)
etc.
Frank
>
>
>> 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, Ive 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.
>
--
Frank E Harrell Jr Professor and Chair School of Medicine
Department of Biostatistics Vanderbilt University
More information about the R-help
mailing list