Statalist The Stata Listserver

[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: rho in xtreg

From   Joseph Coveney <>
To   Statalist <>
Subject   Re: st: rho in xtreg
Date   Wed, 08 Mar 2006 15:35:11 +0900

Stas Kolenikov wrote:

There are two intrinsic impediments. First, -rho- is treated as an
ancillary parameter in -xtreg-: it does not estimate its standard
errors or anything. You can get around this with -mle- option that
will estimate the sigma's, and then you would have to form -rho- and
its standard error from there. Second, I am not aware of any
statistically justified methodology of comparing two coefficient
estimates in two models the way you want. In any nested model testing,
you are imposing some restrictions, like setting the coefficient of
gender equal to zero (effectively omitting it). This is not a
restriction on -rho-, however. I don't think you can compare
unrestricted estimates in two estimated models -- at least if they are
estimated on the same data set. If they were estimated on independent
data sets, then you could test them assuming covariance is equal to
zero, so the test would be effectively a two-sample t-test.

A better way for you to go is to use some sort of structural equation
modeling with multiple group comparisons where you would be allowing
-sigma_u- and -sigma_e- to vary between males and females. If you are
brave enough, you can dig into -xtreg- code (saving it under a
different name, of course) to allow the variance parameters to be
dependent on some covariates, like gender, and then test if those
heteroskedastic models are significantly different from the regular
-xtreg-. If not, you may want to (ask your students to) locate
appropriate structural equation modeling software (AMOS, LISREL,
M-plus, EQS) on your campus to run a model like that. This might also
be doable in -gllamm-.

Note that you are assuming quite restrictive things here like known
linear part of the model, known distribution, and known form of
heteroskedasticity. While you can interpret the panel regression
models as fitting linear regression models with some variations for
the panel structure, with a nice feature of being the MLEs if the data
just happened to be normal, you need to put more thought into the


Would it be illegitimate to assume that the covariances between sexes for
sigma_u and for sigma_e are zero despite coming from the same dataset?

It seems as if there would be a gain in efficiency if sigma_u and sigma_e
for both sexes could be estimated in the same model rather than separately.
When fitted by -xtreg- in separate models, sigma_u is estimated with only
low precision for women (see below) compared to when estimated in the same
model.  To go the route of a t-test of rho's separately estimated
with -xtreg if sex/if !sex, vce(bootstrap/jackknife)- would seem weaker,
given the low precision for women if estimated separately.

If I have everything correctly specified (at least the variances add up),
then the -xtmixed- section of the do file below tests equality of separate
Level-2 (random effects) variances between sexes estimated jointly.  This
assumes that the residual variance is the same between sexes.  (In contrast,
the post yesterday tested whether the residual variances differed, assuming
that the Level-2 variances are the same between sexes.)

The final segment of the do-file below jointly tests both components of rho
between sex, if I've got everything right.  It uses -gllamm-,
because -xtmixed- doesn't allow for structured residual covariance matrixes
yet.  Including sex among the fixed effects causes convergence problems for
the -xtmixed- examples, so I omitted it from -gllamm- for consistency.

Stas's admonition about restrictive assumptions is well taken, but would the
assumptions be any more onerous in this context than what they would be in
other, more familiar, applications of linear mixed models fitted by
iterative maximum likelihood methods?

Joseph Coveney

set more off
sysuse bplong
* Tests equality between sexes of sigma_u--complements yesterday's
xi i.when
xtreg bp _Iwhen, i(patient) mle nolog
display _b[/sigma_u]^2
// Individual estimates of sigma_u
xtreg bp _Iwhen_2 if sex, i(patient) mle nolog
xtreg bp _Iwhen_2 if !sex, i(patient) mle nolog
// Combined estimates of sigma_u
xtmixed bp _Iwhen_2 || sex: R.patient || sex:, mle nolrtest nolog
estat recov
// Test reduced model
estimates store A
xtmixed bp _Iwhen_2 || sex: R.patient, mle nolrtest nolog
// (Same as -xtmixed bp _Iwhen_2 || patient:, mle-)
estat recov
lrtest A .
estimates drop _all
* Jointly tests equality between sexes of both sigma_u and sigma_e
quietly tabulate sex, generate(sex_)
eq het: sex_1 sex_2
gllamm bp _Iwhen_2, i(patient sex) s(het) adapt nolog
estimates store A
gllamm bp _Iwhen_2, i(patient) adapt nolog
lrtest A .

*   For searches and help try:

© Copyright 1996–2021 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index