Statalist The Stata Listserver

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

st: Explaining strange xtgee results

From   Jason Bond <>
To   <>
Subject   st: Explaining strange xtgee results
Date   Mon, 28 Aug 2006 18:40:06 -0700

Hello. My dataset is attached.

list x y id

shows the 3 variables I'm using:

scatter x y


line y x if id == 1 || line y x if id == 2 || line y x if id == 3 || line y x if id == 4 || line y x if id == 5 || line y x if id == 6 || line y x if id == 7

show the linked lines. So I have 7 pairs of observations, each of which is positively correlated. However, the overall trend of the between the pairs of points is negative, similar to Figure 1.1b in Diggle et al.'s book.

Running the simple population averaged model:

xtgee y x, i(id)

gives a negative estimate of the slope for x. If I separate out the (baseline) cross sectional effect from the longitudinal (time 2 - time 1) effect, and run the same model

xtgee y x1rep x2diff, i(id)

where x1rep is just x repeated and x2rep is defined as x2 - x1, I get a negative relationship for the cross-sectional effect and a positive relationship for the longitudinal effect (which I expected). I am sort of surprised that I am getting a negative estimate for the slope of x in the gee model above though.

If I run a mixed model using:

xtmixed y x || id:

I get a positive estimate for the slope estimate of x. Is there something that I'm simply not seeing here? Thanks much,


Attachment: Example-gee-data.dta
Description: Binary data

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