[R] modeling logit(y/n) using lrm
Peter Dalgaard
p.dalgaard at biostat.ku.dk
Sat Jun 17 08:44:29 CEST 2006
"Kevin E. Thorpe" <kevin.thorpe at utoronto.ca> writes:
> Hamilton, Cody wrote:
> > I have a dataset at a hospital level (as opposed to the patient level)
> > that contains number of patients experiencing events (call this number
> > y), and the number of patients eligible for such events (call this
> > number n). I am trying to model logit(y/n) = XBeta. In SAS this can be
> > done in PROC LOGISTIC or GENMOD with a model statement such as: model
> > y/n = <predictors>;. Can this be done using lrm from the Hmisc library
> > without restructuring the dataset so that for each hospital there is one
> > row with y = 1 and one row with y = 0 and then using the weight option
> > in lrm to weight these two responses by the number of 'successes' and
> > 'failures' for that hospital, respectively? I would like to avoid the
> > restructuring, and I understand that the use of the weight function is
> > not compatible with a lot of the validation functions available in Hmisc
> > (validate, bootcov, etc.).
>
> I don't know about lrm, but for glm you can do
> glm(cbind(y,m)~ ...) where y is number of successes and
> m is the number of failures.
glm(y/n~..., binomial, weight=n....)
should work as well. I suspect that this passes trough to lrm, too.
> So, you might try that.
>
> > Cody Hamilton, Ph.D
> >
> > Institute for Health Care Research and Improvement
> >
> > Baylor Health Care System
> >
> > (214) 265-3618
> >
>
>
> --
> Kevin E. Thorpe
> Biostatistician/Trialist, Knowledge Translation Program
> Assistant Professor, Department of Public Health Sciences
> Faculty of Medicine, University of Toronto
> email: kevin.thorpe at utoronto.ca Tel: 416.946.8081 Fax: 416.946.3297
>
> ______________________________________________
> R-help at 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
>
--
O__ ---- Peter Dalgaard Øster Farimagsgade 5, Entr.B
c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K
(*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907
More information about the R-help
mailing list