I don't think that this approach is appropriate here. Each iteration after
the 1st the lm/predict combination will assume that the new data is exact when
in fact it is an estimate with some error involved. To properly do this you
need to take into account that variability. There is a time series task view on
CRAN that may point you to better tools.
--
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.snow at imail.org
801.408.8111
> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-
> project.org] On Behalf Of Dave Evens
> Sent: Thursday, June 16, 2011 11:33 AM
> To: r-help at r-project.org
> Subject: [R] prediction intervals
>
>
>
> Dear members,
>
> I'm fitting linear model using "lm" which has numerous
auto-regressive
> terms as well as other explanatory variables. In order to calculate
> prediction intervals, i've used a for-loop as the auto-regressive
> parameters need to be updated each time so that a new forecast and
> corresponding prediction interval can be calculated.
>
> I'm fitting a number of these models which have different values for
> the response variable and possibly different explanatory variables. The
> response is temperature in fahrenheit (F), and the different models are
> for cities. So each city has its own fitted linear model for
> temperature. I'm assuming that they're independent models for the
time
> being, I want to combine the results across all cities and have overall
> prediction intervals. Because I assuming that they're independent can I
> just add together the degrees of freedom from each model (i.e. total
> degrees of freedom=df1+df2+...) and the variance-covariance matrices
> (i.e. V=V1+V2+...) in order to calcalate the overall prediction
> intervals?
>
> Any help would be most appreciated.
>
> Regards,
> Dave
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at 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.