Below is the code that i used to calculate monthly residuals following Fama and French three Factor model using within month daily data:
egen ccode = group(stock)
egen count_check = count(rt), by(stock month)
drop if count_check <17
egen ccode_month_year = group(stock month year)
gen resid_reg =.
egen max = max(ccode_month_year)
disp max
for values i = 1(1)6022 {
regress rt mkt smb hml if ccode_month_year==`i'
predict temp , resid
replace resid_reg = temp if ccode_month_year==`i'
drop temp
}
Could someone help me to modify this code so that instead of saving regression residuals each month, it generates sum of three slope coefficients of the regression as output.
Related Posts with Rolling Regression for cross section
global or local seed setting in loopDear all, I want to run a loop in which the seed changes for every single run: Code: forvalues m…
Finding unique values between variablesI am trying to find values that exist in one data set and not another. I have a child table that lik…
[Offering $20 Amazon Gift Card] How to use Propensity Score Matching / Nearest Neighbor Matching with a Difference in Differences modelDear all, Background: In this simplified dataset example, I am trying to perform causal inference …
R^2 value of a hetprobit regressionHow do I get the R^2 value of a hetprobit regression? …
Next day dummy variableDear Stata experts, To better present my question, here is a sample of my data, which consists of 3…
Subscribe to:
Post Comments (Atom)
0 Response to Rolling Regression for cross section
Post a Comment