How to consider time from vaccination on final outbreak size I want to evaluate the effect of vaccination on the risk of infection during outbreaks and the change in efficacy due to the time passed from vaccination. I would like to achieve a causal interpretation of the results if possible.
The data reports the number of cases over the total at the end of each outbreak, divided by vaccination status, and the average time from vaccination (in months) for each vaccination group. The setting is nursing homes.
I am trying to imagine the causal flow of these variables using DAGs but I am not sure if the time from vaccination should be considered an independent ancestor of the outcome (fig1) or a descendant of the vaccination (fig2).


Consequently, I am struggling to model my question in a regression setting, that is: the effect of vaccination (Vax) in determine infection risk (rate of infected at the end of the outbreak), and how the effect of time from vaccination (VaxTime) changes Vax effect. Should I adjust for both VaxTime and VaxTime * Vax (eq1), or for VaxTime only (eq2)?
$$eq. 1:\ f(y) = \beta_0 + \beta_1 Vax + \beta_2 VaxTime + \beta_3 VaxTime * Vax + ...$$
$$eq. 2:\ f(y) = \beta_0 + \beta_1 Vax + \beta_3 VaxTime * Vax + ...$$
(here I omit a random intercept for the individual outbreaks and the nursing home characteristics)
Finally, I wonder if I should include time from vaccination at all to consider the full effect of the vaccination.
 A: If Vax represents a fraction of individuals vaccinated in a facility
The time since vaccination might be considered a moderator of the effect of vaccination, implicit in your including it in an interaction term with the vaccination prevalence. There's some difficulty forcing this scenario into DAGs; see for example Weinberg, Can DAGs Clarify Effect Modification?, Epidemiology 18: 569–572 (2007).
With respect to including time since vaccination as a predictor outside of its interaction term, that's typically the best practice. It seems particularly important here, as it's quite possible that there will be no substantial interaction between time and prevalence of vaccinations but that time on its own is important (on the log-odds scale; presumably you're doing logistic regression for these binomial outcomes), given that there have been vaccinations. You don't want to miss that possibility.
There's a good chance that there won't be a monotonic association between that time and outcome. Vaccinations very close to your evaluation times at the end of outbreaks won't have had enough opportunity to provide immunity; immunity from vaccinations long before the evaluation times might well have waned in the interim. There will need to be some flexible modeling of time.*
A potential difficulty will be that the coefficient(s) reported for Time from Vax in the interaction model of equation 1 will be at a value of Vax = 0, which might seem to makes no sense if Vax is a continuous measure. For interpretability of reported coefficients it might help to re-center the Vax values around some typical value, even though predictions from the model should be the same in any case.
If Vax is a 0/1 indicator of whether a facility has had vaccinations
This is a much simpler scenario. With Vax = 0 being no vaccinations, recognize that the interaction term is just a product, and specify VaxTime = 0 when Vax = 0. Under your equation 2, for cases with Vax = 0 you have:
$$ f(y) = \beta_0$$
For cases with Vax = 1 you have:
$$ f(y) = \beta_0 + \beta_1 + \beta_3 \text{VaxTime}$$
That is, the interaction term VaxTime*Vax is non-zero only when Vax = 1; it's thus identical to VaxTime. That interaction term can be represented just as VaxTime, covering both Vax = 0 and Vax = 1 situations if you code VaxTime as 0 when Vax = 0. Your two equations then are equivalent, except that $\beta_3$ in your second equation would be numerically equivalent to $\beta_2+\beta_3$ in the first.
As noted above, you should model VaxTime as some flexible function g(VaxTime); the above simplification of the interaction term to a term g(VaxTime) holds.
I'd worry about causal inference if this wasn't a randomized trial, as the characteristics of an institution making a choice not to vaccinate might also carry over to other policies that could affect disease outbreaks.

*A similar argument might be made for your Vax predictor if it's continuous, as things like herd immunity can lead to its having non-linear associations with outcome.
