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

Re: st: specifying random effects in -xtmixed- for pretest/posttest clustered design

From   "Michael I. Lichter" <>
Subject   Re: st: specifying random effects in -xtmixed- for pretest/posttest clustered design
Date   Fri, 03 Apr 2009 14:56:22 -0400

Thanks for the response, Jeph, but that's not the model I'm trying to fit. I'm pretty sure that I don't want random effects for condition (C) or time*condition (TC); those should be fixed effects only. In any event, without member (M) in the model, how does -xtmixed- know that I have two measurements per subject rather than a whole bunch of measurements per group (G)? I need -xtmixed- to know that members (M) are nested within groups (G), and T is nested within M, and since -xtmixed- doesn't pay any attention to -xtset-, that needs to be in the model specification somewhere, no? Thanks again.


Jeph Herrin wrote:

 xtmixed y cond t tc || g: cond t tc

this tells -xtmixed- to estimate random effects across group
for cond, t, and tc.

I don't know what murray means by including M as a random
effect (and don't feel like pulling his book off the shelf
to check), but I'm pretty sure you don't want that unless
you have multiple records per person per time point.


Michael I. Lichter wrote:
I am having difficulties figuring out how to specify the random effects in -xtmixed- for my study design, and I haven't been able to find anything helpful in the archives or the manual.

My study is a standard cluster-randomized, two-condition, two-time-point trial with balanced allocation of clusters to conditions and only moderate variation in cluster size, with no stratification, crossing, matching, or anything else. Suppose I have one record per time point per person with variables:

c - study condition (control or intervention)
t - time point (pretest or post-test)
m - ID # for individual enrolled in trial
g - group #
y - study result

I am taking my guidance from David Murray's DESIGN AND ANALYSIS OF GROUP-RANDOMIZED TRIALS and trying to follow his example for what he calls an "unadjusted time x condition analysis" for "nested cohort designs" (pp. 296-311). The model, with subscripts omitted, looks like this: Y = mu + c + t + tc + G + M + TG + MT + e, where mu is the grand mean, tc is the interaction effect t*c (same for TG and MT), and G, M, TG, and MT are random effects.

Is any of these correct given the model?

xtmixed y cond t tc || G: || M: || TG: || MT: xtmixed y cond t tc || G: TG || M: MT xtmixed y cond t tc || G: M TG MT None of the above converge successfully with my data, but that doesn't mean they're all wrong ... Obviously, I'm unclear on how the specification of random effects works.

FWIW, Murray provides the following SAS code (with my variable names; and "ddf = 4,4,4" is for a specific example):

proc mixed info order=internal noclprint;
       class C G M T;
       model Y = C T C*T /ddf = 4,4,4 ddfm = res;
       repeated T /type = cs subject = M(G*C) r = 1 to 3 rcorr = 1 to 3;
       random G(C) TG(C);
       lsmeans C*T /slice=C slice=T c1 e;
       estimate `(I3 - I0)-(C3-C0)' C*T 1 -1 -1 1/cl e;

I can run this in SAS, but the value of doing so is diminished by the fact that Murray's commands and annotations are about 10 years out of date; I'd rather do it in Stata if possible.


*   For searches and help try:

Michael I. Lichter, Ph.D.
Research Assistant Professor & NRSA Fellow
UB Department of Family Medicine / Primary Care Research Institute
UB Clinical Center, 462 Grider Street, Buffalo, NY 14215
Office: CC 125 / Phone: 716-898-4751 / E-Mail:

*   For searches and help try:

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