Closed as4456 closed 6 years ago
Any updates on this, would be helpful.
Yes your equation makes sense.
Note that strictly speaking months and weeks do not align. I do not know how you get your data, but assuming that weekly data comes at certain day of the week you cannot assume that month has four or five weeks. For example september 2017 starts on friday and ends on saturday. If your weekly data comes at fridays, then your first week of september has only one day compared to the other four. If your data comes at mondays, then you have 4 weeks with the first week having only 4 days. So weeks will not have the same weight in your data, and this will pose problems for interpretation.
If you have daily data you should use it instead. If you have weekly data then it is better to come up with some realignment scheme, because your monthly data will not be aligned with weekly data.
I can only speak in generalities, because I do not know the source of your data. Usually nature of the data gives the suggestion how to naturaly align it.
This is the data file. I extract the first factor from the weekly vars to be used as the regressor, but you can use any of the weekly vars for reference. Input_data_2.xlsx
You have a situation where weekly data comes on the same weekday. So if you want to forecast a monthly variable you will always have a problem. The last weekly data point for the current month will come at a different day, anywhere from 1 to 6 days before the next month data. Naturally this means that it has a different weight for each month. The MIDAS setup is not really suited for such kind of data. You can simply ignore this, but again you will need to realign the data yourself, since midas_r
function expects that the number of high frequency periods in one low frequency period is fixed throughout the sample. I suggest using midas_r_simple
where you supply already aligned high frequency data.
I'm so sad, I don't know what's wrong with the code. The midas_r can't work on r.
@Newliyidie Please file a new issue with minimal reproducible example. Note that all CRAN packages are tested and if the package is on CRAN it is guaranteed that it works on R. Here is the check page for the midasr package: https://cran.r-project.org/web/checks/check_results_midasr.html
Thank you so much for replying me. The problem is just like picture above. I don't know what's wrong and so sad.
Something is wrong with your R installation. I can only suggest clean resintall. Also I am suspicious of what installation method you are using.
I just follow the steps from the guide. Thank you very much. I try to resintall.
Which guide to be precise? Not all guides guide very well.
I am a new learner about R, would you like to offer some advice, for example about book or others?
I always recommend to start with R manual which is quite good. Then read Hadley Wickham's R for data science book, which is available online for free. To get an idea what motivated creation of R and how it was designed to use and which problems to solve, I recommend https://www.stats.ox.ac.uk/pub/MASS4/. R has evolved a lot and it can do lots of other things well, but its power is still in solving statistical problems. It turned out however that the particular approach used for solving that is very powerful and can be applied elsewhere.
Ok, I get it. Thank you very much.
Hi, Lets say if I have a monthly variable to nowcast/forecast using 4 weekly variables. I want to estimate the monthly value for Aug 2017. I have the weekly values of all the 4 weekly vars till Sep 1.
Could you tell me how to set up the midas eqn. Lets say, if the monthly variable depends on its first own lag and past 6 weeks . Assuming I have the value till end of August for the weekly variables, does the following eqn make sense: beta0 <- midas_r(y ~ mls(y, 1, 1) + mls(x, 0:6, 4, nbeta),
start = list(xx = c(1.7, 1, 5))) I have few other doubts, could you tell me how to get the forecasted values for y for the 4 weeks of August. Also there are times, where there will be 5 weekly values in a month. How to tackle this. Also if I would like to automate this, how do I pass the starting lag (0 here ) as a variable.
Sorry for the long post. Thanks