Raffaello Vardavas
2012-Dec-11 02:26 UTC
[R] glm - predict logistic regression - entering the betas manually.
Dear All, I know this may be a trivial question. In the past I have used glm to make logistic regressions on data. The output creates an object with the results of the logistic regression. This object can then be used to make predictions. Great. I have a different problem. I need to make predictions from a logistic regression taken from a paper. Thus I need to (by hand) enter the reported odds ratios, compute the betas and enter these into an object in order to use the predict. Sure, I can write a function myself (the logit function) to make these predictions. But I was wondering how one can do this by creating a glm output object by entering this manually and then use the predict. I couldn't find any helpful site. Thanks. RAff. [[alternative HTML version deleted]]
Greg Snow
2012-Dec-11 18:04 UTC
[R] glm - predict logistic regression - entering the betas manually.
It may be overkill, but you can specify the model pieces using the offset function in the model, then the predictions work out (at least for my simple trial case). Something like: fit <- glm( y ~ 0+offset(-1 + 2*x), family=binomial, data=data.frame(y=0, x=0) ) predict( fit, newdata=data.frame(x=seq(-1,1, length.out=25)), type='response' ) On Mon, Dec 10, 2012 at 7:26 PM, Raffaello Vardavas <r_vardavas@hotmail.com>wrote:> > Dear All, > > I know this may be a trivial question. > > In the past I have used glm to make logistic regressions on data. The > output creates an object with the results of the logistic regression. This > object can then be used to make predictions. > > Great. > > I have a different problem. I need to make predictions from a logistic > regression taken from a paper. Thus I need to (by hand) enter the reported > odds ratios, compute the betas and enter these into an object in order to > use the predict. > > Sure, I can write a function myself (the logit function) to make these > predictions. But I was wondering how one can do this by creating a glm > output object by entering this manually and then use the predict. > > I couldn't find any helpful site. > > Thanks. > > RAff. > > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help@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. >-- Gregory (Greg) L. Snow Ph.D. 538280@gmail.com [[alternative HTML version deleted]]
Seemingly Similar Threads
- remote connection to an Oracle database - using RODBC - RMySQL..?
- lattice package - wireframe plot : adding more than one surface and addiding a curve overlaid on the plot
- survplot function
- Plotting number of patients at risk below survival curve
- XML and odfWeave