Closed pvdmeulen closed 2 years ago
Sorry for late reply. Use the formula interface:
midas_u(y~mls(y,1,1)+fmls(x, 1, 3))
instead of
midas_u(y~MX31+MY)
I have the problem with forecast function to the new data: Error in point_forecast.midas_r(object, newdata = newdata, method = method, : Missing variables in newdata. Please supply the data for all the variables (excluding the response variable) in regression
Did you solve the problem? I have the same problem and i do not know how to fix it, thank you very much
If it's the 'missing variables in newdata' issue you're referring to, see my fourth edit. Not sure if the package has changed since I last encountered this so your milage may vary!
When using forecast make sure that all the variables which are present in the formula interface exist in the data which is passed into newdata argument.
Good Morning, I have having the same problem as stated above
See my last comment
Error (see reproducible example below)
For the past few days I have been having issues with the
average_forecast
function in midasr. The error in question is:May have found the issue, probably a bug with midas_u and/or defining MIDAS lag structures beforehand. Code works for now with slight tweaks. See below.
Context
For context, I select the same time window for both my quarterly indepedent variable
y
and monthly regressorsx_1
,x_2
, andx_3
, and there are no missing values (56 quarterly observations and 168 monthly observations). My complete datasety_ts
etc. starts at 2004 Q1 (M1 forx
) and runs to 2018 Q1 (M6 forx
).I split the whole sample into a training sample and a testing sample:
So, my training sample runs from 2004 to 2012 and contains 32 observations, and the full sample contains 56 (in the quarterly index). Then, I create MIDAS lag structures:
and estimate
midas_u
models:Then, just running this:
results in the error:
and so I define
ee = 1
before runningaverage_forecast
again, resulting in the error in the title. Does anyone know where I went wrong? There must be a mismatch of data somewhere that I'm not seeing. I have tried other arbitrary values foree
as well.(hopefully this is relatively easy to reproduce with generic variable names)
Thanks, any help is appreciated :)
Edit:
I get the same issue when defining lists containing the training sample and the testing sample, like so:
and using the
forecast
function inmidasr
:Edit 2:
Estimating the unrestricted MIDAS models using the restricted MIDAS estimation function
midas_r
withstart = NULL
(as in the user guide) results in an error as well:r11 <- midas_r(y ~ MX1 + MY, start = NULL)
Edit 3:
Forecasting with the
predict.lm
function works fine (using the same variables as the example below) for some reason:EDIT 4: FOUND THE ISSUE!
The code works fine when using
midas_r
(withstart = NULL
) and defining lag structures inside the regression instead of beforehand.The 'ee' issue still shows up when running
midas_u
and omittingstart = NULL
. Bug?Reproducible example: