Let's imagine I am interested in the association between happiness
and pain
.
I run a study where I ask participants to rate both feelings, daily, for several days. However, I couldn't get all participants to start at the same time
so I will have to include calendar date in analysis, as I know it affects happiness.
I record whether my participants take any medication (pill
) that affects pain. I also found some great literature that suggests that both apple juice
and green tea
affect happiness and pain.
In that scenario I have both confounding variables and variables competing for exposure. I created a DAG (following this great comment) to decide which one is which. Based on my data I have the following graph:
Original DAG
EDIT: New DAG
Where:
- $time$ is confounding variable because $time \rightarrow happiness$ EDIT: $time \rightarrow happiness/pain$
- $juice$ & $tea$ are confounding variables because $juice/tea \rightarrow happiness \rightarrow pain \leftarrow juice/tea $
- $pill$ is competing exposure because $pill \rightarrow pain$
Based on that DAG interpretation I build a model
m1 <- lmer(pain ~ happiness + pill + time + (1 + time | participant) + (1 | juice) + (1 | tea)
With that model I hope to account for the effect of time
, which is a continuous variable. I entered juice
and tea
as crossed random effects because they change with time and the level of both depends on participant. Lastly, I entered pill
as a fixed effect since it is a categorical yes/no variable to denote presence/absence of medication.
- Is my interpretation of DAG correct?
- Does my model reflect my DAG?