[R-sig-ME] Starting point for modeling a within-subject design
Simon Harmel
@|m@h@rme| @end|ng |rom gm@||@com
Tue Oct 8 04:19:09 CEST 2024
Dear Mixed-Effects Experts,
Suppose a causal mechanism where a normally distributed outcome is impacted
by condition (a binary factor variable), and a mediator (a
continuous variable) that sits between the condition and outcome.
Here, all subjects get to taste both conditions by counterbalancing. That
is, based on chance, some will first get one condition at one point, and
later, they will get another condition.
In a sense, this is a within-subject design with a data structure like:
subject condition outcome mediator
1 complex 25.1 6
1 simple 11.0 4
2 complex 24.3 7
2 simple 12.2 3
QUESTIONS:
1) Can we think of this model as a multivariate model where the outcome and
mediator are indeed 2 correlated DVs that are impacted by condition?
2) Given that the same participants get both levels of condition, should
levels of condition in each subject be correlated at the latent level as in
(condition | subject) and/or possibly at the residual level as in nlme::
corClasses?
3) Is there any frequentist software to analyze such data, and if not, does
the following bayesian model sound like a good "starting point"?
library(brms)
mediator_formula <- bf(mediator ~ condition + (condition | subject))
outcome_formula <- bf(outcome ~ condition + mediator + (condition |
subject))
model <- brm(mediator_formula + outcome_formula,
data = DATA,
seed = 123,
chains = 4,
iter = 10000)
Thank you all for your expertise,
Simon
[[alternative HTML version deleted]]
More information about the R-sig-mixed-models
mailing list