Closed DataMinerR closed 10 years ago
What data are you using?
I am using the simulated data from the guide on page 12, just exactly as given in the guide. So I only replicated the results on page 23...
Which version of the package are you using? You can see the version with sesionInfo()
command on R prompt.
It is: midasr_0.1
Ok, will look into that. I suspect that there might be an issue with either the starting values, or the sample used in estimation, note the difference is not that large.
Right, I have noticed it too, that the difference is small. The function updates the parameters every time it generates a new out-of-sample forecast, doesn't it? I also speculated that the function uses the same set of parameters which were estimated at the beginning, as they are shown in the bestlist...
Yes the parameters are updated. To be more precise, when forecasting, the parameters from the fitted model are used as starting values, and the model is fitted again with the in-sample provided. I will investigate more.
Since you are increasing insample, you are doing the recursive forecast. The default option is fixed forecast, i.e. we use the coefficients of the same insample for all the forecasts. Use ftype="recursive"
and you will get the desired behaviour, i.e. the forecasts will match.
Please close the issue, if you are able to replicate the behaviour with ftype="recursive"
.
Great, it works now! Concerning my last question, does the function calculate three-step forecasts for the periods 201-250, or for the periods 203:252?
Thanks a lot!
The answer is for the periods 201-250, since otherwise it would not be possible to calculate out-of-sample fit statistics, i.e. there are no values of y
available for periods 251:253.
In the user's guide on the pages 23-24 there is a demonstration of the function
select_and_forecast
. This function calculates, among other things, forecasts according to supplied specifications. The given example calculates one-step-, two-step- and three-step-ahead out-of-sample forecasts 50 times.In order to check my understanding, I tried to calculate the forecasts "manually" using the suggested models (every time the first of the suggested models for each horizon).
I manage to get the first values of the forecasts for each horizon:
Preparation of the data for the first forecasts:
Calculate one-step-ahead forecast per hand with cbfc$bestlist[[1]][[1]]:
Calculate two-step-ahead forecast per hand with cbfc$bestlist[[2]][[1]]:
Calculate three-step-ahead forecast per hand with cbfc$bestlist[[3]][[1]]:
Expand the data by one low-frequency period in order to calculate the next forecasts:
Let's try to calculate the second three-sep-ahead forecast using the expanded data:
As can be seen, the result of the last commmand ist:
21.94055
but the functionselect_and_forecast
gives:cbfc$forecasts[[3]]$forecast[2,1] : 21.96188
What am I doing wrong here?
One more question:
In the case of three-step-ahead forecasts, does the function
select_and_forecast
calculate forecasts for the periods 201-250, or for the periods 203:252, because the first forecast is calculated using the first 200 values of the observations, so that the first three-step-ahead forecast is for the period 203? If the first is true, the forecasting procedure must start by 198, or?Thank you in advance!