Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, is already up and running.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: Re: using the test command within group

From   "Joseph Coveney" <>
To   <>
Subject   st: Re: using the test command within group
Date   Sun, 3 Mar 2013 16:05:20 +0900

Jordan Silberman wrote:

I have a mixed-effects logistic model (xtmelogit) that includes a
group variable (grp = 1 or 2) and 2 predictors (x1 and x2). I'd like
to use the test command (or perhaps some other command) to test the
hypothesis that x1 and x2 are equally strong predictors of the
dependent variable for subjects in group 2 only. It would of course be
easy to do this with the test command if I wanted to test this
hypothesis for the full sample (test x1 = x2). But I can't find a way
to test this hypothesis for just one level of the group variable.


It sounds like the logistic analogue of what I believe econometricians call a
Chow test.  If so, then take a look at .  

If you want to test the equality of the regression coefficients for group 2,
couldn't you add interaction terms and then test?  Something like:

    xtmelogit response i.grp##c.(x1 x2) || subjects: 
    test (_b[x1] + _b[2.grp#x1]) = (_b[x2] + _b[2.grp#x2])

If yours are observational data, then I'm guessing that the coefficients would
have the usual logistic regression sensitivity to omitted variables.

Joseph Coveney

clear *
set more off
set seed `=date("2013-03-03", "YMD")'
set seed0 `=date("2013-03-03", "YMD")'
quietly set obs 200
generate byte grp = 1 + (_n > _N / 2)

generate int subject = _n
generate double x1 = runiform()
generate double x2 = runiform()
generate double xb = x1 - x2
quietly replace xb = x1 + x2 if grp == 2

generate k = 50
quietly expand k

genbinomial response, xbeta(xb) // -findit genbinomial-
quietly compress

xtgee response c.(x1 x2) if grp == 2, i(subject) family(binomial) nolog
xtgee response i.grp##c.(x1 x2), i(subject) family(binomial) nolog
lincom _b[x1] + _b[2.grp#x1]
lincom _b[x2] + _b[2.grp#x2]

test (_b[x1] + _b[2.grp#x1]) = (_b[x2] + _b[2.grp#x2])


*   For searches and help try:

© Copyright 1996–2016 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index