Dear R-Users,
How can I put a pre-defined regression model into to an object of class lm
in order to use the predict.lm function.
A simplified example:
I would normally run a regression analysis on a dataset,
> germany<-lm(RENT~AGE1, in.mi01)
> summary(germany)
Call:
lm(formula = RENT ~ AGE1, data = in.mi01)
Residuals:
Min 1Q Median 3Q Max
-12.193 -3.646 -1.009 2.101 49.025
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 13.283639 0.063020 210.78 <2e-16 ***
AGE1 -0.091030 0.003231 -28.17 <2e-16 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 6.044 on 19802 degrees of freedom
Multiple R-Squared: 0.03854, Adjusted R-squared: 0.03849
F-statistic: 793.7 on 1 and 19802 DF, p-value: < 2.2e-16
and then use the predict.lm function which uses the above specified
regression equation: RENT=13.283639-0.091030*AGE1
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
[[alternative HTML version deleted]]
______________________________________________
[email protected] 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.