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]

RE: st: ANOVA repeated measures

From   "Lythgoe, Dan" <>
To   "''" <>
Subject   RE: st: ANOVA repeated measures
Date   Tue, 6 Nov 2012 15:16:50 +0000


‘ANCOVA’ code would be as follows when reshaped wide:

reg postbal prebal i.flush

This is comparing the postbal between flush groups, correcting for the prebal. You might then want to do some residual diagnostics:

predict yhat
predict stu, rstudent
qnorm stu
scatter stu yhat

I don't think that the -bysort- command you are using is doing what you intend; I think this would run two separate paired t-tests whereas you want an unpaired comparison of the two groups.
Many thanks
Dan Lythgoe

From: [] On Behalf Of Rune Nielsen
Sent: 06 November 2012 14:29
Subject: Re: st: ANOVA repeated measures

Thank you for your kind answer. 
The linear mixed model is probably to difficult for me at the moment since I'm just trying to summarize some preliminary analyses and don't have the opportunity right now to do extensive reading. 

I've tried analyzing on the difference scores, but got the impression of somehow loosing power. When I reshaped the dataset (to wide), stratified by flush and did t-tests on the difference I found significant results (bysort flush: ttest bal1=bal2). But when I did as you recommended they where not even close to significant (ttest baldiff by(flush)). 

Would you be able to provide an example of an ancova syntax? 

Again, thank you!

Best wishes from Rune

Rune Nielsen, MD, PhD, postdoctoral fellow
Institute of Medicine
Department of Thoracic Medicine
Haukeland University Hospital
N-5021 Bergen
6. nov. 2012 kl. 15:04 skrev "JVerkuilen (Gmail)" <>:

Hmmm, well you have a few choices as to how to analyze these data. One
is simply to convert to difference scores (post - pre) and do a
two-sample t-test comparing the flush and non-flush group. This uses
the subjects as their own controls.

There is an equivalent linear mixed model (depending on how you
estimate the model it will be exactly equivalent, or just close). Wit
the data laid out long, use -xtmixed- you'd use a subject indicator
and flush as a fixed effects predictor.

You could also decide to use an ANCOVA approach. Reshape wide and use
the pre as a regressor along with the intervention.

It's not 100% clear which is the right thing to do. A lot depends on
how correlated pre and post are likely to be for the controls.

On Tue, Nov 6, 2012 at 8:55 AM, Rune Nielsen <> wrote:

Dear statalist members,

We have done a simple pilot study where we measure the number of bacteria on
the tip of a bronchoscope two times on the same 20 subjects. Half of these
subjects have received an intervention to reduce the number of bacteria. So
in a long dataset with 40 observations  I have the following variables
Idnr - subject ID
meas - binary variable indicating first (=1) or second (=2) measurement
flush - binary variable whether the subject have received (=1) or not (=0)
the intervention
bal - measurement of bacterial load

What I would like to do, is to test whether the difference between
measurement 1 and measurement 2 is  depending on whether they have received
the intervention. I've tried various ANOVA syntaxes, but my limited
knowledge won't quite get me there.

Probably this reveals my incompetence, but nevertheless I hope for an answer
that is understandable for a non-statisician.

Best wishes,

Rune Nielsen

Rune Nielsen, MD, PhD, postdoctoral fellow
Institute of Medicine
Department of Thoracic Medicine
Haukeland University Hospital
N-5021 Bergen

JVVerkuilen, PhD

"Thus the typical citizen drops down to a lower level of mental
performance as soon as he enters the political field. He argues and
analyzes in a way which he would readily recognize as infantile within
the sphere of his real interests. He becomes a primitive again. His
thinking becomes associative and affective."  ---Joseph A. Schumpeter,
Capitalism, Socialism and Democracy, 1950, p. 262.
*   For searches and help try:

*   For searches and help try:

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