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$
6
  • $\begingroup$ How about simply using a moving average? $\endgroup$
    – Feng Mai
    Commented Jan 19, 2012 at 15:52
  • $\begingroup$ My series needs several fourier terms, and after that is an ARIMA (1,1,5) process. $\endgroup$
    – Nicole
    Commented Jan 19, 2012 at 16:06
  • $\begingroup$ You mention fourier and ARIMA: is this a univariate problem, or multivariate? $\endgroup$
    – Wayne
    Commented Jan 19, 2012 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
    Commented Jan 20, 2012 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
    Commented Jan 20, 2012 at 13:54

1 Answer 1

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$
2
  • $\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
    Commented Jan 20, 2012 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
    Commented Jan 20, 2012 at 18:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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