Statalist The Stata Listserver

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

Re: st: hascons option with xtmixed?

From   "Jacki Buros" <>
Subject   Re: st: hascons option with xtmixed?
Date   Tue, 1 May 2007 09:42:28 -0400

Perhaps I should clarify the nature of the question with some context.

I'm evaluating a multilevel model with 2 groups (1 dichotomous
variable) and repeated obs within a variable named id. Let's consider,
first, an analogous model in a non-multilevel context which may be
specified with -regress-.

There are (at least) two ways to specify this:

1:  groupA is dummy variable with values 1,0
    code: regress y groupA
    interpretation: coeff:groupA estimates mean difference, y of
groupA - y of not_groupA

2:  groupA same as above; not_groupA is dummy coded 0,1 where groupA is 1,0
    code: regress y groupA not_groupA, hascons
    interpretation: coeff:groupA estimates mean of y among groupA

These two models are exactly equivalent, they are just specified
differently. If one were to use option -nocons- instead of -hascons-
in the 2nd case the model degrees of freedom appear to be incorrect. I
could be wrong, but I believe this only affects the wald chi2 and
corresponding p-value.

Taking this to the multilevel context, not having the -hascons- option
for xtmixed is rather clumsy, because I sometimes want to see the
group-level variance\covariance of y, by using the command

. xtmixed y groupA non_groupA, nocons || id: groupA not_groupA, nocons
var cov(uns)

but, using -nocons-, I have 2 model degrees of freedom where I should
really only have 1. Ideally I would want to use -hascons-. I can get
the correct values using only the dummy for groupA, but here I'm
seeing the variance\covariance for the mean among not_groupA and the
difference between groupA and not_groupA (though the models appear to
be equivalent):

. xtmixed y groupA || id: groupA, var cov(uns)

Does this make any sense? If I want to evaluate the first case, I
clearly can. But I'm ignoring what appear to be incorrect degrees of
freedom and an incorrect Wald chi2 for the time being, and instead
getting these values from the subsequent specification of the same

So, why am I writing? I would like to know the following,

1) Are my variance/covariance structure when using -xtmixed- with
nocons as above correct, or is there some complication I should be
aware of?
2) Is there a work-around to give me a single model output with the
correct information?

Thanks for reading, help would be appreciated ..


On 4/30/07, Jacki Buros <> wrote:
Hi Statalisters,

I'm wondering if anyone knows why there is no -hascons- option for
xtmixed, analogous to the one provided for -regress-.

Up until now I've been using -nocons- (and ignoring the reported wald
chi2 and model degrees of freedom) when specifying an xtmixed model in
which I provide a constant term. If I need these I simply specify the
same model using different terms to get them.

Is this a bad idea? I have found that, with Stata, there tends to be a
good reason for this type of thing. Any insight would be most

*   For searches and help try:

*   For searches and help try:

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