Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to use polystep in a midas_r formula? #91

Open
Theo24K opened this issue Aug 16, 2023 · 3 comments
Open

how to use polystep in a midas_r formula? #91

Theo24K opened this issue Aug 16, 2023 · 3 comments

Comments

@Theo24K
Copy link

Theo24K commented Aug 16, 2023

Hi,
i dont know how to use the step function specification. how to set starting value for polystep, i cant find any examples.

@Theo24K
Copy link
Author

Theo24K commented Aug 17, 2023

step <- midas_r(y~mls(y,1,1)+mls(xx,0:3,3,polystep),start = list(xx=list(c(1,2,3,4),3,3,a=c(2,2,2)))), for example, i tried this,and error:Error in polystep(c(xx1 = 1, xx2 = 2, xx3 = 3, xx4 = 4), 4L, 3) :
argument "a" is missing, with no default
came out, how to set the starting value properly?

@vzemlys
Copy link
Member

vzemlys commented Aug 17, 2023

You should supply a into mls, not in start. The following should work:

step <- midas_r(y~mls(y,1,1)+mls(xx,0:3,3,polystep,a=c(2,2,2)),start = list(xx=list(c(1,2,3,4))))

Starting values are only needed for the parameters of weight function which are optimized. In step function parameter a is fixed.

@Theo24K
Copy link
Author

Theo24K commented Aug 17, 2023

Thanks!
I encountered a new error when using average_forecast(), like this,
avgf09.fixed <- average_forecast(list(nealmon09,almonp09,beta0.09,betan.09,step.09),data = list(y=y,xx=xx),
insample = 1:47,outsample = 48:50,
type = 'fixed',
measures = c("MSE","MAPE","MASE"),
fweights=c("EW","BICW","MSFE","DMSFE"))
Error in midas_r.fit(prepmd) :
The optimisation algorithm of MIDAS regression failed with the following message:
Error in if (sum(nb) < eps) { : missing value where TRUE/FALSE needed

Please try other starting values or a different optimisation function
how to solve this ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants