My data are the following. I want to compute the covariance of dclose and dclose_lag for each ticker2.
have 194 tickers so I need 194 covariances.
How can I create a column consisting of the covariances?
I have already computed the variance for the first ticker2, but I can not create a loop.
That is the command i used to compute the covariance for the 1st ticker2:
correlate dclose dclose_lag if ticker2==1, covariance
gen float covname = r(cov_12)
[ATTACH=CONFIG]temp_12655_1543336407433_604[/ATTACH]
0 Response to Compute covariance and store in column
Post a Comment