```mermaid
graph LR
treatment --> |indirect\npath a\n0.034| t1
t1 --> |indirect\npath b\n0.27\npersistence| t2
treatment --> |direct\npath d\n0.01| t2
```
```r
# simulate
model_sim <- glue('
t1 ~ 0.034*treatment + 0.5*t0
t2 ~ 0.01*treatment + 0.27*t1 + 0.5*t0
')
# recover
model <- "
# mediator model (a path)
t1 ~ a*treatment + c1*t0
# full model (b and d paths)
t2 ~ d*treatment + b*t1 + c2*t0
indirect := a*b
total := d + (a*b)
direct := total - indirect
prop_med := (a*b)/(d + (a*b))
"
```
Conclusions
- To estimate persistence, fit `t2 ~ t0 + t1` (i.e., coefficient for `t1`).
- Ratios of treatment coefficients from `t1 ~ treatment + t0` and `t2 ~ treatment + t0` do not reflect persistence is there is a non-zero direct effect. If direct effect is exactly 0, then results will be identical.
- To get indirect (i.e., mediation effect), fit the full mediation model.