# st: std error covariances between equations

 From "FEIVESON, ALAN H. (AL) (JSC-SD) (NASA)" To "'statalist'" Subject st: std error covariances between equations Date Fri, 13 Sep 2002 14:42:23 -0500

```Hello -

In Stata multi-equation models,  Let L1, L2, ..,Lp etc. be the respective
linear combinations of explanatory variables that make up the "equations".
In fitting these models, I have often experienced a need to generalize
_predict's "stdp" capability to include cross-equation covariances such as
Cov(L1-hat, L2-hat). With these covariances, I can then run a parametric
bootstrap on functions of L1, L2, ..Lp  under the assumption that (L1-hat,
L2-hat,..,Lp-hat) is distributed multivariate normal. To do this, one needs
an estimate of the covariance matrix of the L-hats.

For simplicity, assume p = 2, with n1 terms making up L1 and n2 terms in L2.

Using the current version of _predict (in Stata 7), I can get a new variable
containing the estimated variance of L1-hat by commands such as

. predict se1,eq(L1) stdp
. gen var1 = se1^2

Similarly, I can get the estimated variance of  L2-hat. But I can't think of
a convenient way to get an estimate of Cov(L1-hat, L2-hat).  Sure, I can get
the (n1+n2) x (n1+n2) covariance matrix V, for all the coefficients together
and compute what I want, but it's a nuisance keeping track of which elements
of V correspond to L1, etc.  - especially if I am varying the names and
numbers of these components in multiple runs of the estimation process. This
is what _predict does so nicely if you only want Var(L1-hat).

So I am asking the astute programmers out there if there is any interest in
writing a new version of _predict which would allow something like
. predict cov12,eq(1 2)  stdcovp

where the option "stdcovp" signifies that a covariance between two
"equations" is desired. Of course, like standard errors of individual L's,
the values of these covariances would in general change as their component
predictor variables change. That's why the results could not be stored in a
matrix, but would have to be stored as separate variables such as cov11,
cov12, cov22, cov33,  etc. So rather than have the user type in something
like

. predict cov12,eq(1 2)  stdcovp
. predict cov22,eq(2 2)  stdcovp
. predict cov13,eq(1 3)  stdcovp
. predict cov23,eq(2 3)  stdcovp
. predict cov33,eq(3 3)  stdcovp

it would be better to simply have a command such as

. predict cov,eq(_all) stdcovp

which would automatically generate cov11, cov21, cov22, etc.

Does any else have a need for this, or would anyone care to undertake the
programming effort?

Al Feiveson

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/
```