shokru / mlfactor.github.io

Website dedicated to a book on machine learning for factor investing
198 stars 95 forks source link

Regarding the Fama-Macbeth Regression #74

Open mandarpriya opened 1 year ago

mandarpriya commented 1 year ago

Sir, I used the methodology as shown in the book Tidy Finance with R and obtained the Beta. So now how should i do the second step of Fama-Macbeth . I was going through the procedure in the book, and I really aprreciate for the data for replication. But there too for the first step for my data i am able to get the results but for the second step i am getting errors. So here is the attachment based on the work for Beta . I would be eagerly waiting for your reply. thanks Mandar RStudio-EDQhXi.pdf

shokru commented 1 year ago

Hello Mandar, in full disclosure I did not open the file. But if you have well-defined betas after the first step and if you have test asset (stock) returns, then, for each POINT IN TIME, when you regress across the betas obtained in the first step, the values of the lambdas (coefficients) should be well defined. Basically, if all inputs are well-defined and have the correct shape/size, there is no reason why you should obtain errors after using the lm(...) function.