mpiktas / midasr

R package for mixed frequency time series data analysis.
http://mpiktas.github.io/midasr/
Other
73 stars 34 forks source link

Not possible to estimate MIDAS model, more parameters than observations // midasr package #72

Closed MSkred closed 4 years ago

MSkred commented 4 years ago

Hello!

u_midas <- midas_u(y~ mls(x1, 0:2, 3) + mls(x2, 0:2, 3) +
                   mls(x3, 0:2, 3) + mls(x4, 0:2, 3) + mls(x5, 0:2, 3) +
                   mls(x6, 0:2, 3) + mls(x7, 0:2, 3) + mls(x6, 0:2, 3) +
                   mls(x9, 0:2, 3) + mls(x10, 0:2, 3) + mls(x11, 0:2, 3) +
                   mls(x12, 0:2, 3) + mls(x13, 0:2, 3) + mls(x14, 0:2, 3) +
                   mls(x15, 0:2, 3) + mls(x16, 0:2, 3) + mls(x17, 0:2, 3) +
                   mls(x18, 0:2, 3) + mls(x19, 0:2, 3) + mls(x20, 0:2, 3) +
                   mls(x21, 0:2, 3) + mls(x22, 0:2, 3) + mls(x23, 0:2, 3) +
                   mls(x24, 0:2, 3) + mls(x25, 0:2, 3) + mls(x26, 0:2, 3) +
                   mls(x27, 0:2, 3) + mls(x28, 0:2, 3) + mls(x29, 0:2, 3) +
                   mls(x30, 0:2, 3) + mls(x31, 0:2, 3) + mls(x32, 0:2, 3) +
                   mls(x34, 0:2, 3))

I am trying to fit an unrestricted MIDAS model to quarterly data (y) with monthly data (x1, x2,... x34). However, when I run this code I get the following error message :

Error in midas_r.fit(prepmd) : 
  Not possible to estimate MIDAS model, more parameters than observations

I tried with the function midas_u and it works but I only have coefficient for some variables. Moreover, I need to use midas_r because I am interested in the rmse of U-MIDAS in a recursive out-of-sample forecast (and hence need to use the average_forecast function). Note that I have 56 observations for y but using only 36 in the model. Any help on this issue is more than welcomed!

@vzemlys

skhub12 commented 4 years ago

Hi I am facing a similar issue - also I am trying to understand the mls(x,k,m) function that you defined here - shouldn't your m = 12 in case of monthly data?

vzemlys commented 4 years ago

m is the frequency ratio, if y is yearly and x is monthly then it is 12, if y is quarterly and x is monthly then it is 3

skhub12 commented 4 years ago

What if Y is monthly and X is weekly then it is 14/3 or NA?

vzemlys commented 4 years ago

m can only be integer in mls. For aligning data which has non-integer frequency ratio, use function mlsd, which aligns based on date.