Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at

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

st: specifying zero covariance in xtmixed

From   Johan Sundström <>
To   "" <>
Subject   st: specifying zero covariance in xtmixed
Date   Mon, 27 Aug 2012 12:27:34 +1000

Hi Statalisters!

I have data at two timepoints from a randomized clinical trial of a blood
pressure-lowering drug, with "sbp" as a continuous dependent variable, and
"time", "id" and "treat" as logically named independent variables. I want
to know how much of the apparent variability in response to a blood
pressure drug is between-person variability, and how much is within-person
variability. I want the following random effects components: random
intercept, random time effects, and random treatment effects. The problem
is that
because of the randomized structure, I want to specify that there can't be
any covariance between "treat" and the intercept. I could do the model
below, it has the variance components I want, but I don't want a three
level model because "treat" only has two groups (too little for a level of
its own):

xtmixed sbp treat time || treat: time, cov(uns) nocon || id: treat,
cov(uns) nocon || id: time, cov(uns) var

I've tried the following (similar to the suggestion on p. 362 in the
wonderful Rabe-Hesketh Skrondal book; p. 325 in xt.pdf), and it works; but
it gives me separate variance components for both treatment groups:

gen tr_0=treat==0
gen tr_1=treat==1
gen t_tr0=time*tr_0
gen t_tr1=time*tr_1
xtmixed sbp treat time || id: t_tr0 tr_0, cov(uns) nocon || id: t_tr1
tr_1, cov(uns) nocon var

I would like to have a single measure of the variance components for the
whole sample. Does anyone have a suggestion of how I could specify the
two-level model I want?


Johan Sundstrom
Uppsala University

*   For searches and help try:

© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index