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]
Related Posts with Compute covariance and store in column
Confusion w/ panel data, fixed effects, dummies, clustered standard errors etcHey STATA community, I currently do a project and now I am stuck in the data analysis. Therefore, I…
Do I have too many clusters?I have a cross-section of children from a survey sample (IHDS-2011). I want to cluster the standard …
Comparing two models with different dependent variables after an IV regressionDear Stata users, I have two models with the same independant variables on the same dataset. Model…
subsetByVIF -- An ado file that selects a subset of covariates constrained by variance inflation factors (VIFs)subsetByVIF selects subsets of the covariates such that each covariate in a given subset has a VIF t…
Bootstrapping error in opreg Hi. I'm running opreg with Stata11 on an unbalanced panel with 1155996 firm-level observations. I h…
Subscribe to:
Post Comments (Atom)
0 Response to Compute covariance and store in column
Post a Comment