Hi
I have a little R problem. I have created a GLM model in R and now I want to
predict some values outside the values I have in the model (extrapolate).
I have this code:
fitted.model4 <- glm(Yval ~ time, family=gaussian, data=Fuel)
The question is - How do I predict a value of Yval ie with a value of time 340
and also get confidence/prediction intervals for Yvar?
I have tried the predict.glm but cannot make it work - any suggestions how
to do this using predict.glm?
****
Yval are 312 fuel prices ranging from 60 to 140 and time is a sequence from
1 to 312.
The GLM summary output is as follows:
Deviance Residuals:
Min 1Q Median 3Q Max
-24.978 -4.033 -0.391 4.747 15.323
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 79.698229 0.871830 91.42 <2e-16 ***
seq(1:312) 0.180127 0.004828 37.31 <2e-16 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05
'.' 0.1 ' ' 1
(Dispersion parameter for gaussian family taken to be 59.00219)
Null deviance: 100408 on 311 degrees of freedom
Residual deviance: 18291 on 310 degrees of freedom
AIC: 2161.6
Number of Fisher Scoring iterations: 2
On 3/2/06, Laurits S?gaard Nielsen <laurits at lauritsnielsen.dk> wrote:> Hi > > I have a little R problem. I have created a GLM model in R and now I want to > predict some values outside the values I have in the model (extrapolate). > >myglm <- glm( some stuff here) whatever <- some-new-hypothetical-data-you-create predict (myglm, newdata=whatever, type="response") I have hints on this in Rtips http://pj.freefaculty.org/R/Rtips.html#7.5 -- Paul E. Johnson Professor, Political Science 1541 Lilac Lane, Room 504 University of Kansas