Solved – Using a time series model to forecast future values in R

forecastingrtime series

I would like to use a set of weather-related historical data to fit a time series (let's say 1970-2000, Fourier terms plus ARIMA terms), but then use the fit on recent data (i.e., the last week/month of data) to forecast the upcoming day/week/month. All of the functions that I've found forecast from the endpoint of the dataset used to fit.

Can someone point me in the right direction? Or let me know it doesn't exist and I have to write it out the long way (i.e. Tomorrow = fit$coef[1]*Yesterday + ...)?

Best Answer

The difficulty you may have with auto.arima (and arima) is that I believe you'll have to do some futzing around to accomplish your task. The predict method for arima predicts n.ahead steps beyond the end of your training data. But your training data is from 1970-2000, while you're wanting to predict in 2011-2012 (I assume). It wouldn't make sense to tell it (with monthly data) to forecast 130 months beyond the end of your training data. And in fact it sounds like you do have, say, 2011 data and want to use that to predict 2012.

I wish I knew enough about the process to offer an answer beyond, "Now you need to take the ARIMA coefficients and create your own predict.arima function." If your process is ARI (no MA), you could use R's ar, whose predict function actually does allow you to enter new data (say 2011) to predict from. You could do the I part (differencing) yourself with R's diff function. No exogenous variables, though.

Related Question