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

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

From   "Michael I. Lichter" <>
Subject   st: specifying random effects in -xtmixed- for pretest/posttest clustered design
Date   Thu, 02 Apr 2009 19:42:27 -0400

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.


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