1. If the model has Poisson link function for the outcome is the traditional a*b approach to calculating indirect effects biased (I believe it is in the same way as is the case for logistic regression)? If so how should one correct for this?

2. Should I include a moderation between the mediator and the time-point to calculate the b path?

Code:

```
#data_structure:
#time_point (factor) = 0 (baseline) 1 (12 month follow-up) 2 (24 month follow-up)
#intervention (factor) = 1 (intervention) 0 (control)
#mediator (continous)
#outcome (count)
#id (participant id)
# Model Intervention to Mediator
M1 <- bf(mediator ~ time_point*intervention + (1|id))
# Mediator and Intervention Predicting Outcome
# --- Should the mediator be moderated by time point here? ---- #
M2 <- bf(outcome ~ time_point*intervention + mediator + (1|id), family = poisson)
# Run the model
mediation_mod <- brm(M2 + M1,
data=d_short_2,
iter=6000,
warmup=1500,
control = list(adapt_delta = .95))
# Extract critical paths
# 12 month follow-up intervention effect on mediator
a1 <- posterior_samples(mediation_mod,"mediator_time_point1:intervention")[,1]
# 24 moth follow-up intervention effect on mediator
a2 <- posterior_samples(mediation_mod,"mediator_time_point2:intervention")[,1]
# Mediator on Outcome
b <- posterior_samples(mediation_mod,"outcome_mediator")[,1]
# 12 month follow-up direct effect of intervention on outcome
c_prime1 <- posterior_samples(mediation_mod,"ccrshuttles_time_point1:intervention")[,1]
# 24 month follow-up direct effect of intervention on outcome
c_prime2 <- posterior_samples(mediation_mod,"ccrshuttles_time_point2:intervention")[,1]
# Calcualte indirect and total effects
# Indirect Effect: Time 1
mean(a1*b); quantile(a1*b, probs = c(.025, .975))
# Indirect Effect: Time 2
mean(a2*b); quantile(a2*b, probs = c(.025, .975))
# Total Effect: Time 1
mean(a1*b + c_prime1); quantile(a1*b + c_prime1, probs = c(.025, .975))
# Total Effect: Time 2
mean(a2*b + c_prime2); quantile(a2*b + c_prime2, probs = c(.025, .975))
```