Code Monkey home page Code Monkey logo

Comments (6)

vzemlys avatar vzemlys commented on June 14, 2024

Yes the code is correct, i.e. it should run. Note using 252 days it is not a problem in midasr, the problem is whether the data supports that. Are you replicating with the data in the article?

from midasr.

shelmonlu avatar shelmonlu commented on June 14, 2024

Thank you for your reply!
As indicated in the article, I collect the data from both CRSP and Schwert’s website (I can roughly replicate table 1). After I rehandling the data, I have 876 monthly observations and 19272 daily observations ( I keep 22 daily observations per month, if a month has less than 22 observations, I use NA at the beginning of that month). Then I get the following result:

eqr<-midas_r(month ~ mls(day, 0:251, 22, nealmon), start = list(day = c(1, -0.006, -0.0002)))

MIDAS regression model
model: month ~ mls(day, 0:251, 22, nealmon)
(Intercept) day1 day2 day3
-0.0004250 0.9999963 -0.0059980 -0.0007948

My understanding is that day1 represents the coefficient of mls function (or the gamma), day2 and day3 represent k1 and k2 in the weights function. Please correct me if I misunderstand the results. My day1 coefficient is very close to 1, which is the number I provided. However, I should get something close to 2.6. I am wondering if this problem is due to my data or due to the initial value I provided?

And when I check the mls(day, 0:251, 22, nealmon) matrix, the first 11 lines are NAs. I am also wondering if this is acceptable?

from midasr.

vzemlys avatar vzemlys commented on June 14, 2024

Can you post the screenshot of the model in the article? Your understanding is correct, so the reason for the result which you do not like is the alignment of the data. Look into eqr$model to see that months and days are aligned properly. NA in the first lines are perfectly normal, since you always lose data at the beginning of the sample due to lags.

If you are sure that the data is aligned properly and you are using the same sample, then you can always check the value of NLS objective function with the parameters in the article. The value of objective function for fitted coefficients can be calculated with the following code:

eqr$fn0(coef(eqr))

Supply parameters of article (the order is important!) and then compare the values. If yours is the smaller one, then it means your values are correct and the optimisation method used in the article did not converge properly. If yours is larger then you need to try different optimisation methods. The JSS article contains examples of how to do that. Note this step can only be done when you ensure that the nealmon specification and the data is the same as used in article.

from midasr.

shelmonlu avatar shelmonlu commented on June 14, 2024

In the paper, they use:
model
weights
They multiply the weighted average of r^2 with 22 to aggregate the volatility into the monthly level. The question is about 22 in the model. I am wondering if I should also time 22 to my daily observations before I run the regression model, or I should incorporate the 22 into one of the initial parameters provided?

from midasr.

vzemlys avatar vzemlys commented on June 14, 2024

from midasr.

shelmonlu avatar shelmonlu commented on June 14, 2024

Thank you, Dr. Zemlys! I really appreciate your help.

from midasr.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.