Hi all,
I am running simple time-series regression to exam stock liquidity in financial market. This is a panel dataset and each stock has an unique ID number in ID column. The dataset contains 120 stocks in the past 3 years. Column "year" documents the year variable.
My regression is like: y= a + bx + c
Here, I want to run regression for each stock and extract the coefficients of b and its corresponding t -values.
In the end I should get 120 coefficients and t-values.
My is code is like:
However, I can't get the desired results. Can someone help me ? THANKS !
I am running simple time-series regression to exam stock liquidity in financial market. This is a panel dataset and each stock has an unique ID number in ID column. The dataset contains 120 stocks in the past 3 years. Column "year" documents the year variable.
My regression is like: y= a + bx + c
Here, I want to run regression for each stock and extract the coefficients of b and its corresponding t -values.
In the end I should get 120 coefficients and t-values.
My is code is like:
Code:
gen beta_x=. qui levelsof ID if ID > 0 & ID < 121 , local(year) foreach v of local year{ qui reg y x,r if ID == `v' qui replace beta_x= _b[_x] if ID == `v' } **Use collapse to summarize data** collapse beta_x, by(ID) outreg2 using c_1, bdec(3) stats (coef tstat) excel replace dec(2)
However, I can't get the desired results. Can someone help me ? THANKS !
Comment