Code:
code #1 capture program drop one_regression program define one_regression regress rt mkt mkt2 predict resid, resid summ resid, detail gen double skewness = r(skewness) gen obs = r(N) gen double mean = r(mean) end bysort stock_id mdate (date): gen high = cond(_n==1., mdate, -11) rangerun one_regression, by(stock_id) interval(mdate -11 0) collapse(mean) mdate obs stock_id skewness, by (stock year month) order stock year month mdate obs stock_id skewness
Code:
Code #2 capture program drop one_regression program define one_regression regress rt mkt mkt2 predict resid, resid summ resid, detail gen double sd = r(sd) gen double skewness = r(skewness) gen obs = r(N) gen double mean = r(mean) end rangerun one_regression, interval(mdate -11 0) by(stock_id) collapse(mean) mdate obs stock_id skewness , by (stock year month) order stock year month mdate obs stock_id skewness
Code:
bysort stock_id mdate (date): gen high = cond(_n==1., mdate, -11)
0 Response to A small clarification!
Post a Comment