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
Generating new ID variable taking into account duplicates across 2 other variablesFirst time poster, so I’m sorry for any errors… I have two ID variables (ID1 and ID2). I want to cr…
Replicating Excel Intercept/SlopeI have four variables, y1-y4 that I would like to regress on four fixed x's, x1-x4. (I have taken th…
Multilevel model with olog?I usally use the command: mixed dep_var || country_var: Problem is that my dependent variable is o…
Creating space between bar chartsHi, I am using Stata 17 and need help in bar charts. Below is an example of my dataset: Code: * E…
how to calculate pseudo-R2 using imputed data in a multinomial logistic regressionDear all, I would like to calculate the pseudo-R2 for my multinomial logistic regression in multipl…
Subscribe to:
Post Comments (Atom)
0 Response to Compute covariance and store in column
Post a Comment