Hi
I was not able to adjust the loop and use rangestat.
What I want to do is:
1- Using a 5 year rolling regression:
So I should be running a regression using data for the first 5 years in the sample (for example 1990 to 1994) and calculate the fitted and residual values, keep the fitted value and residual for each observation for the regression in which it serves as the last observation, then move one year forward and drop one year (i.e. from 1991 to 1995), and then calculate the fitted and residual values , and so on.
How can I use rangestat here ?
2- In another code, I want to do the same but using a recursive regression (increasing windows, where I add one year each time without dropping a year)
Can I also use rangestat here?
I will be so thankful if someone can help with these issues...and produce efficient and time-saving codes! dependent variable is ret , independent variables are x y z . (firm id is "permno", and time id is "yr" )
Many many thanks
I was not able to adjust the loop and use rangestat.
What I want to do is:
1- Using a 5 year rolling regression:
So I should be running a regression using data for the first 5 years in the sample (for example 1990 to 1994) and calculate the fitted and residual values, keep the fitted value and residual for each observation for the regression in which it serves as the last observation, then move one year forward and drop one year (i.e. from 1991 to 1995), and then calculate the fitted and residual values , and so on.
How can I use rangestat here ?
2- In another code, I want to do the same but using a recursive regression (increasing windows, where I add one year each time without dropping a year)
Can I also use rangestat here?
I will be so thankful if someone can help with these issues...and produce efficient and time-saving codes! dependent variable is ret , independent variables are x y z . (firm id is "permno", and time id is "yr" )
Many many thanks
Comment