0
$\begingroup$

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 + ...)?

$\endgroup$
  • $\begingroup$ How about simply using a moving average? $\endgroup$ – Feng Mai Jan 19 '12 at 15:52
  • $\begingroup$ My series needs several fourier terms, and after that is an ARIMA (1,1,5) process. $\endgroup$ – Nicole Jan 19 '12 at 16:06
  • $\begingroup$ You mention fourier and ARIMA: is this a univariate problem, or multivariate? $\endgroup$ – Wayne Jan 19 '12 at 19:14
  • $\begingroup$ So basically you just want to know how to make R predict some new data from a ready model? If so, you could make it more clear and add some details about what packages are you using, etc. $\endgroup$ – user88 Jan 20 '12 at 10:50
  • $\begingroup$ it is going to be a multivariate problem eventually, but for now it is univariate. yes, I want to predict, maybe that's why I'm not finding what I need, I've been searching for tools to "forecast". I am currently testing arima() and auto.arima() using xreg for the fourier terms. To keep it simple, let's say I have: fit = auto.arima(data), but now I have data.latest, and I want to use the fitted terms in "fit" to forecast/predict off of data.latest. I'm going to look around for "predict", thank you $\endgroup$ – Nicole Jan 20 '12 at 13:54
1
$\begingroup$

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.

$\endgroup$
  • $\begingroup$ Thanks Wayne, you are interpreting my problem correctly. I've looked into predict() today, which someone else also suggested off of this thread, and wasn't finding a way to do what I need to do, so I think you are correct, and I need to write it myself. That's fine, it will take me more time, but if it was already written I sure didn't want to be reinventing wheels. Unfortunately each dataset has its own (p,d,q) process, and they do have several MA terms. Thanks again. $\endgroup$ – Nicole Jan 20 '12 at 17:14
  • $\begingroup$ @Nicole: it may be possible to use arima, but it appears to me that all it saves of the original data is the residuals (innovations), though it wants to predict from the end of the original data forwards. R has LOTS of packages, though, so there may be something that works. I'd suggest looking in the CRAN website's (cran.r-project.org) Task Views to get a feel for what's out there. $\endgroup$ – Wayne Jan 20 '12 at 18:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.