[R] how to fit a weighted logistic regression?

Frank E Harrell Jr f.harrell at vanderbilt.edu
Wed Dec 15 11:53:12 CET 2004


Kerry Bush wrote:
> I tried lrm in library(Design) but there is always
> some error message. Is this function really doing the
> weighted logistic regression as maximizing the
> following likelihood:
> 
> \sum w_i*(y_i*\beta*x_i-log(1+exp(\beta*x_i)))
> 
> Does anybody know a better way to fit this kind of
> model in R?
> 
> FYI: one example of getting error message is like:
> 
>>x=runif(10,0,3)
>>y=c(rep(0,5),rep(1,5))
>>w=rep(1/10,10)
>>fit=lrm(y~x,weights=w)
> 
> Warning message: 
> currently weights are ignored in model validation and
> bootstrapping lrm fits in: lrm(y ~ x, weights = w) 
> 
> although the model can be fit, the above output
> warning makes me uncomfortable. Can anybody explain
> about it a little bit?

The message means exactly what it says.  Model validation in Design 
currently cannot incorporate weights for lrm.  Everything else is OK.

Frank Harrell

> 
> Best wishes,
> Feixia
> 
> ______________________________________________
> 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
> 


-- 
Frank E Harrell Jr   Professor and Chair           School of Medicine
                      Department of Biostatistics   Vanderbilt University




More information about the R-help mailing list