An embedded and charset-unspecified text was scrubbed... Name: not available Url: https://stat.ethz.ch/pipermail/r-help/attachments/20070209/ebc0c689/attachment.pl
LM Model
3 messages · Simon P. Kempf, Peter Flom, Mark Lyman
"Simon P. Kempf" <simon.kempf at web.de> 2/9/2007 1:36 am >>> asked
<<<< But I want to skip the lm function and specify my own regression equation RENT= 15 -0.15*AGE1 and then use the predict.lm function. However, in order to use the predict.lm function I need an object of class lm. Is there any way to do so? Or maybe somebody has another solution?
Maybe I am missing something, but why not just write the formula without the predict.lm? e.g <<< AGE1 <- c(18, 19, 20, 21) RENT= 15 -0.15*AGE1 RENT
Peter Thanks in advance, Simon ______________________________________________ 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 and provide commented, minimal, self-contained, reproducible code.
Simon P. Kempf <simon.kempf <at> web.de> writes: [SNIP]
But I want to skip the lm function and specify my own regression equation RENT= 15 -0.15*AGE1 and then use the predict.lm function. However, in order to use the predict.lm function I need an object of class lm. Is there any way to do so? Or maybe somebody has another solution? Thanks in advance, Simon
Here is one way. Take a look at help(offset), help(lm), and help(lm.predict).
xx <- runif(30) yy <- rnorm(30) mydata<-data.frame(xx,yy) lm(yy~offset(15*rep(1,30))+offset(-0.15*xx)-1,mydata)
Mark Lyman