1
$\begingroup$

I'm using the DLM package to estimate a multivariate time series, I wanna check the out of sample forecasting, by estimating the residuals for 1, 6, 12 months ahead forecast? How can I calculate the 6 and 12 months ahead forcast like the kalman filter does for 1 month ahead forecast?

Thanks

Since this question is too general I update it.

My question was: I have a times series which go from 1970 to 1990, and I want to check if my model gives a good out of sample fit. In order to do so I divide my dataset in two parts and starting from January 1980 I calculate 1 month ahead forecast errors, by dlm (f). Than I want to calculate 12 months ahead forecast errors, so once my t is january 1980 then february 1980, and so on. I would like to know if there's a way to do so?

Thanks

Maybe is better to specify my question a little more, because I did a mistake, sorry. I estimate the model recursevely from 1970:1 to 1980:1 (dlm), , at t=1980:1 I estimate y(t+12) and I compare it with the real y(t+12), then I estimate y(t+12) but t=1980:2, and so on. I would like to know which is the way to do it automically? Cause I thought that i can ran a dlm and use the dlmForecast and change every time the dataset through the window command, but I don't think it's the right way. Maybe for (i in 1:10){ fit = dlmFilter((window(data, start=1, end=12+i),mod), dlmForcast(FIT, nahed=12)

$\endgroup$
3
  • $\begingroup$ You need to provide a bit more detail. You can obviously forecast 12 months worth and then calculate residuals, so I'm guessing there's more to your request than that. $\endgroup$
    – Wayne
    Commented Dec 23, 2011 at 14:44
  • $\begingroup$ My question was: I have a times series which go from 1980 to 1990, and I want to check if my model gives a good out of sample fit. In order to do so I divide my dataset in two parts and starting from January 1980 I calculate 1 month ahead forecast errors, by dlm (f). Than I want to calculate 12 months ahead forecast errors, so once my t is january 1980 then february 1980, and so on. I would like to know if there's a way to do so? $\endgroup$
    – Frank
    Commented Jan 2, 2012 at 12:02
  • $\begingroup$ You divide your data into two parts, let's say 1980-1987, on which you train your DLM, and then 1988-1990 on which you test. From your trained DLM, you predict 24 months (1988-1990), then simply compare that data to the actual 1988-1990. That gives you 12-month-ahead forecast errors for a year (1989). If you want to modify your DLM to actually take a year's worth of data at a time and predict a year out, that's more complicated. $\endgroup$
    – Wayne
    Commented Jan 2, 2012 at 14:49

2 Answers 2

1
$\begingroup$

If you have data up to and including $t$ and you want to forecast time $t+12$, you might add NA values from $t+1$ to $t+12$; see also this question.

$\endgroup$
4
  • $\begingroup$ It isn't clear from the original question whether they're trying to directly calculate $t+12$, which is possible if you structure the problem correctly, or whether they have a DLM that won't forecast with the default procedure because it's variable. $\endgroup$
    – Wayne
    Commented Dec 23, 2011 at 15:04
  • $\begingroup$ My question was: I have a times series which go from 1980 to 1990, and I want to check if my model gives a good out of sample fit. In order to do so I divide my dataset in two parts and starting from January 1980 I calculate 1 month ahead forecast errors, by dlm (f). Than I want to calculate 12 months ahead forecast errors, so once my t is january 1980 then february 1980, and so on. I would like to know if there's a way to do so? $\endgroup$
    – Frank
    Commented Jan 2, 2012 at 12:01
  • $\begingroup$ So, did you estimate your model with data prior to January 1980? Otherwise, what I understand from what you write would not be an out of sample forecast. $\endgroup$
    – F. Tusell
    Commented Jan 2, 2012 at 13:56
  • $\begingroup$ no I wrote my question wrong, for example data 1970-1990 2 parts 1970-1980 and 1980-1990. $\endgroup$
    – Frank
    Commented Jan 3, 2012 at 22:06
0
$\begingroup$

Before checking forecast accuracy did you check to see if the parameters had changed over time or of the variance of the errors changed over time ? Or if there were omitted deterministic input series that would be suggested by Intervention Detection procedures ala R. Tsay and others. Try Googling "automatic intervention detection" and similar searches for help on this.

$\endgroup$

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.