Hi Paul,

Here is a link to a diagram of what I was thinking to do:
http://goo.gl/brWwlo

m <- lmer(y ~ Time * (A + B) + (1 + time | ID), data = within(thedata, {
  Time <- Time - 5
})
summary(m)

where A and B are dummy vectors for each treatment that are 0 prior to
treatment being administered and 1 thereafter (and obviously if someone is
in A, all 0s for B, and vice versa).

Time is rescaled so that 0 is the first assessment _after_ treatment, thus
the simple main effects of A and B represent the difference in expected
intercepts for A and B, relative to the average expected point, without
treatment having occurred.

I do not necessarily think that study time is the best choice, because it
makes the assumption that there is no time trend --- rather I would allow a
time trend, just not allow it to vary between treatment condition, prior to
treatment actually being administered (presuming of course that
randomization occurred, preferably after the first four assessments so that
there is not even the possibility of experimenter effects).

Have a random intercept, and perhaps also a random time slope -- that would
be the simplest with the same random time slope, but allow mean differences
in time slope after treatment, but of course you could also make those
treatment time differences random, perhaps even need to depending whether
there is heterogenous response to it.

In that model, some additional components that would be interesting:

the difference in the A B simple effects, capturing at time 5 (immediately
post treatment), what are the differences between treatment groups in the
difference from the expected value had treatment not been administered?
 And likewise the difference in the differences in the A B time slopes (how
different are the differences from the time slope had treatment not
occurred).  Those could be obtained with a different coding scheme, or just
calculated from the model post hoc.

Cheers,

Joshua




On Sun, Dec 15, 2013 at 10:57 AM, Paul Johnson <pauljohn32@gmail.com> wrote:

> Greetings
>
> I could use some help thinking through a random effects design question.
>
> A student came with data that is an intervention study. Quite a few
> variables were collected on each of 4 weekly visits, before the
> intervention. There were 2 intervention levels, A and B. After that, there
> were 3 followup visits.  The research question is "does either A or B have
> an effect on Y, taking into account the baseline levels established by the
> 4 preliminary measurements."
>
>
> Visualize like that
>
> ID  Time  Treatment  StudyTime X1 Y1 Y2
> 1    1         0                     0            23  44  40
> 1    2         0                     0            10  33  21
> 1    3         0                     0            33 44  50
> 1    4         0                     0              . . .
> 1    5         A                    1
> 1    6         A                    2
> 1    7         A                    3
> 2    1         0                     0
> 2    2         0                     0
> 2    3         0                     0
> 2    4         0                     0
> 2    5         B                    1
> 2    6         B                    2
> 2    7         B                    3
>
> Note that in the 4 pre-treatment points, I have the value of Treatment set
> at 0, as if to assume there can be no effect from a treatment which has not
> yet been applied.
>
> Plots indicate the subjects are not homogeneous (intra-individual
> differences), so I'm thinking a random intercept is in order.
>
> What lmer formula would you write out? Maybe check for coarse treatment
> effect
>
> lmer(Y1 ~ Treatment + X1 + (1 | ID), data = dat)
>
> I was thinking of enforcing the idea that the pre-treatment scores should
> be assumed to have the same expected value and estimate a bent line change
>
> lmer(Y1 ~ Treatment * StudyTime + X1 + (1 | ID), data = dat)
>
> I'd be grateful for any ideas you have to share, or pointers to
> articles/books we should get.
>
> I do not have the data in hand, I may get it soon, I may be able to answer
> your "what happens if" questions.
>
> Here are some bits I'm curious about, I expect you see lots of other
> troubles:
>
> 1. There are 4 pre-treatment values, and 3 post-treatment values.  What
> problems flow from that imbalance?
>
> Some here suggest we take the easy road and calculate a pre-treatment mean
> and a post-treatment mean and then model the difference.
>
> 2. My formula above estimate the random effect with all 7 time points. My
> intuition is that it should be based on 4 scores in the baseline period,
> and then applied as an estimate in the following periods.  What magic words
> am I missing here?
>
> So far, we've been playing with the monkey-business of missing observations
> and how to best do multiple imputations. That turns out to be not obvious
> or easy, but we make some headway.  There are 10 "complete" imputed
> datasets in the long format.
>
> pj
> --
> Paul E. Johnson
> Professor, Political Science      Assoc. Director
> 1541 Lilac Lane, Room 504      Center for Research Methods
> University of Kansas                 University of Kansas
> http://pj.freefaculty.org               http://quant.ku.edu
>
>         [[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-mixed-models@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
>



-- 
Joshua Wiley
Ph.D. Student, Health Psychology
University of California, Los Angeles
http://joshuawiley.com/
Senior Analyst - Elkhart Group Ltd.
http://elkhartgroup.com

	[[alternative HTML version deleted]]

