I have an experimental data set in which each subject experienced 2 trial types (call them "control" vs "experimental") and 8 trials within each type. Each trial is associated with a single response measurement (call it "output").
My current linear mixed model includes the fixed effect of trial type, the fixed effect of trial number (i.e. chronological order), the interaction of the two, the random effect of individual intercepts, the random effect of individual by trial type (i.e. individual differences in the effect of trial type on "output"), and the random effect of individual by trial number (i.e. individual differences in slope with respect to trial number). The R syntax I am using is:
Model <- lmer(output ~ Trial_Number + Trial_Type + Trial_Number:Trial_Type + (1|Subject) + (0 + Trial_Type|Subject) + (0 + Trial_Number|Subject), data = MyData)
What I would LIKE to do is estimate the random slopes term for trial number SEPARATELY for each trial type (control vs. experimental). Based on what I've looked up on my own, I think it should look something like the following:
Model <- lmer(output ~ Trial_Number + Trial_Type + Trial_Number:Trial_Type + (1|Subject) + (0 + Trial_Type|Subject) + (0 + Trial_Number|Trial_Type/Subject), data = MyData)
...but I am not sure because I couldn't find an example that was exactly parallel to my setup. Will this code accomplish what I am trying to do? Thanks in advance for any advice!!
EDIT (based on Robert Long's comment)
Here is a link to a portion of my data: https://docs.google.com/spreadsheets/d/121_IWJAJJg6X-SpD5Egqh7JBbTi4Byb8L0fPgtQ-mdI/edit?usp=sharing
For the fixed effects: I expect that output values for the experimental trials will on average be larger than for the control trials (main effect of trial type). I also expect that output values will generally decrease with increasing trial number (main effect of trial number). Finally, I expect that the slopes with respect to trial number will be steeper for the experimental trials than for the control trials (interaction effect). [note: I left this interaction effect out of the original post, and have modified the above text/models to include it.]
For the random effects: I expect that individual subjects will have different average levels of the output variable (random individual intercepts), as well as different changes in response to the experimental treatment (random effect of individual by trial type). The tricky part is the individual differences in slope with respect to trial number, because I expect (and would like to demonstrate statistically) that these will look markedly different for the control trials as opposed to the experimental trials. I've included a simplified theoretical figure (not from my real data!) illustrating what I expect to see (different colors represent different individuals, each point is a measurement of the output, and each line is a trendline):
Calculating the random effect of individual by trial number without grouping the trials by experimental vs. control would demonstrate the variance among individuals' average slopes w/respect to trial number (as shown in the figure below), but I'm much more interested in looking at the differences between the experimental and control trials. Is it not possible to look at the main effect of Trial Type and its effect on among-individual slope variance (w/respect to Trial Number) in the same model?
Thanks so much for your help!!