I'm trying to understand how to either adjust my data, model it differently, or both.
I have an experiment where the subject is given a test, then an Intervention
(A or B), then given another test. I want to see what the main effect of the intervention is on the difference between pre and post intervention scores.
The data
My dataset looks like this:
Subject Session Condition Intervention Difficulty Score
1 1 Pre A 1 80
1 1 Post A 2 70
1 2 Pre B 2 75
1 2 Post B 2 80
.
.
.
50 9 Pre A 5 80
50 9 Post A 6 70
50 10 Pre A 6 65
50 10 Post A 5 80
What I tried
Originally, I set up my model as repeated measures ANOVA like this:
modelA <- aov(dScore ~ Intervention + Error(Subject/Intervention))
Where dScore
is the difference in Score
between the Pre and Post intervention for a given Session
.
Problems
I have two problems with this model:
First, the testing protocol during the study dictates that when a subject performs particularly well, the difficulty of the test is increased. Similarly when the subject performs poorly, the difficulty is decreased. You can see how that might look in the dummy data above.
To this end, my ideas are to either apply a z-score within difficulty levels - creating ZScore
, or add Difficulty
as a covariate.
Second, there are some subjects who received both interventions during the course of the study, and others that only received one or the other. This currently isn't being accounted for in the model, as far as I can tell.
My ideas for solutions
The idea I have is to use a mixed effects model instead of a repeated measures ANOVA. Something like this:
modelB <- lme(dScore ~ Intervention + Difficulty, random = ~ 1 + Intervention | Subject)
Or, splitting Condition
back out but using ZScore
instead of dScore
:
modelC <- lme(ZScore ~ Condition*Intervention, random = ~ 1 + Condition | Subject)
Can someone explain to me whether these are sensible approaches, or what I can be doing differently?
Difficulty
is very reasonable too. I think that z-scoring thedScore
is unnecessary at first instance, I would do it only for estimation purposes usually. I do not understand why you do not modelScore
directly and useCondition
as a covariate. Otherwise how can you assess what is the associatedDifficulty
anyway? BTW isDifficulty
also a binary variable or it just happens you have values1/2
on the snippet you show? (+1, nice question. Welcome to the community.) $\endgroup$Difficulty
isn't binary, it's an ordinal with 7 possible values. I'll edit my snippet to clear up the confusion. $\endgroup$Score
directly, that seems closer to what I want but I start to get confused about how to model all the moving parts. Are you suggestingScore ~ Condition*Difficulty + Intervention
, with1 + Condition|Subject
as the random term? $\endgroup$Condition
andDifficulty
are properly accounted and you control forSubject
specific effects within aCondition
. Just a note: Are you sure you do not want1|Condition\Subject
?(Condition|Subject)
specifies that the effects ofCondition
vary across levels ofSubject
, which OK, it is plausible but really really pessimistic. $\endgroup$Condition
varying across levels ofSubject
is not what I intended at all. $\endgroup$