Dear Stata community:
I have the following simple question. Suppose I have panel data and 10 variables. My data is from year 1989 to 2016.
How can I compute the variance-covariance matrix for each year and store it as a variable?
I know if I use:
correlate d1-d10, covariance
I get variance-covariance for all the years from 1989-2016.
I have the following simple question. Suppose I have panel data and 10 variables. My data is from year 1989 to 2016.
How can I compute the variance-covariance matrix for each year and store it as a variable?
I know if I use:
correlate d1-d10, covariance
I get variance-covariance for all the years from 1989-2016.
CompanyID | YEAR | d1 | d2 | d3 | d4 | d5 | d6 | d7 | d8 | d9 | d10 |
1 | 1989 | 0.1 | 3 | 3 | 3 | 3 | 20 | 21 | 22 | 23 | 24 |
1 | 1990 | 5 | 2 | 2 | 2 | 5 | 20 | 19 | 18 | 17 | 16 |
1 | 1991 | 6 | 2 | 2 | 2 | 6 | 20 | 25 | 30 | 35 | 40 |
2 | 1989 | 20 | 2 | 2 | 2 | 7 | 20 | 19 | 18 | 17 | 16 |
2 | 1990 | 7 | 2 | 2 | 2 | 8 | 20 | 19 | 18 | 17 | 16 |
2 | 1991 | 10 | 2 | 2 | 2 | 9 | 20 | 19 | 18 | 17 | 16 |
Comment