[R-sig-ME] measuring carry-over effects in mixed models
Phillip Alday
me @end|ng |rom ph||||p@|d@y@com
Wed Mar 2 07:03:52 CET 2022
On 1/3/22 11:53 pm, Simon Harmel wrote:
> Dear Phillip,
>
> Thank you for your response. Could you possibly elaborate on
> "Depending on the exact nature of the carryover effect"?
>
Really just whether you meant something like correlated errors (so
classic AR models) or something more particular based on domain
knowledge (for example a convolution of successive impulses in certain
signal processing domains). The lead/lag solution basically just makes
all the usual assumptions for a linear model, it's just that you have to
consider the collinearity of any relevant covariate/predictor with
itself at a previous time point.
If you include your lagged dependent variable/response as a predictor,
then you have to be a little bit careful with having measurement error /
"errors within variables" because predictors are generally assumed to be
measured without error. (In y_(t) ~ 1 + y_(t-1), you know have the noise
of y on the wrong side.) That's a bigger topic than I have time for at
the moment, but I think I've dropped enough keywords for further
searching and/or setting up your simulations to see what happens.
> Also, how are the "lead/lag predictors" often created?
There are ways to do this in base R, but they can be a little bit tricky
with nested/grouped data, so I would go with the tidverse group_by() +
lag(): https://dplyr.tidyverse.org/reference/lead-lag.html
>
> My data has the following general structure.
>
> m<-"
> student group time
> 1 C 0
> 1 C 1
> 1 C 2
> 1 C 3
> 1 T 0
> 1 T 1
> 1 T 2
> 1 T 3
> 2 C 0
> 2 C 1
> 2 C 2
> 2 C 3
> 2 T 0
> 2 T 1
> 2 T 2
> 2 T 3"
>
> data <- read.table(text=m,h=T)
>
> Simon
>
>
> On Tue, Mar 1, 2022 at 11:12 PM Phillip Alday <me using phillipalday.com> wrote:
>>
>> Depending on the exact nature of the carryover effect, the usual
>> suspects would be:
>>
>> 1. using an autoregressive model of some type
>> 2. including lead/lag predictors in your model, e.g.
>> lmer(y ~ time*group*prev_time + [covariates] + (1 | student))
>>
>> But note that the initial timepoint doesn't have a prev_time and so
>> there is a missing value there.
>>
>> Phillip
>>
>> On 17/2/22 12:32 pm, Simon Harmel wrote:
>>> Hello All,
>>>
>>> I'm analyzing the data from my longitudinal study whose design can be
>>> depicted as (view the following in plain text):
>>>
>>> O1 X1 O2 X2 O3 X3 O4
>>> O1 O2 O3 O4
>>>
>>> where Xs denote subtitled videos given to the treatment group and Os
>>> denote measurement occasions.
>>>
>>> My current model is: lmer(y ~ time*group + [covariates] + (1 | student))
>>>
>>> However, I'm also interested in measuring the "carry-over effects" of
>>> watching subtitled videos at each occasion to the subsequent
>>> occasions.
>>>
>>> For instance, I want to know how much watching the subtitled video at
>>> the first occasion (O1) impacts the treated students' performance at
>>> later occasions (O2 and O3) etc.
>>>
>>> I wonder if any changes to my model can enable me to measure these
>>> carry-over effects or if any other R package may provide such
>>> functionality?
>>>
>>> Many thanks,
>>> Simon
>>>
>>> _______________________________________________
>>> R-sig-mixed-models using r-project.org mailing list
>>> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
>>>
More information about the R-sig-mixed-models
mailing list