Skip to content

Commit be99518

Browse files
seabbs-botseabbs
andcommitted
docs: add marginal model section to model guide vignette
Closes #534. Adds a section describing the marginal model approach which integrates out latent variables analytically using the primarycensored package, with signposts to primarycensored vignettes for mathematical details. Co-authored-by: Sam Abbott <contact@samabbott.co.uk>
1 parent 13d05ae commit be99518

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

vignettes/model.Rmd

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,4 +177,26 @@ y_i &\sim \text{Unif}(s_{L, i}, s_{R, i}) \\
177177
$$
178178
As before, $g_P(z \, | \, p_{L, i}, p_{R, i})$ represents the conditional distribution of the primary event given lower $P_L$ and upper $P_R$ bounds; this is equivalent to modelling the incidence in primary events.
179179

180+
# The marginal model
181+
182+
The marginal model corrects for the same biases as the latent model but integrates out the exact event times analytically rather than sampling latent variables.
183+
This approach uses the primary event censored distribution implemented in the [`primarycensored`](https://primarycensored.epinowcast.org/) package.
184+
185+
Under the assumption that the forward distribution is shift-invariant (i.e. $f_x = f$ for all $x$), the double censoring probability from Section \@ref(interval-censoring) simplifies to
186+
$$
187+
\mathrm{Pr}(S_L < S < S_R \mid P_L < P < P_R) = \int_{P_L}^{P_R} g_P(x \mid P_L, P_R) \left[F(S_R - x) - F(S_L - x)\right] \text{d}x.
188+
$$
189+
For common delay and primary event distributions, such as gamma or lognormal delays with uniform primary events, `primarycensored` provides closed-form analytical solutions to this integral.
190+
For other combinations, numerical integration is used.
191+
192+
Right truncation at time $T$ is handled by normalising the likelihood as in the latent model:
193+
$$
194+
\mathcal{L}(\mathbf{Y} \mid \mathbf{\theta}) = \prod_i \frac{\mathrm{Pr}(S_{L,i} < S_i < S_{R,i} \mid P_{L,i} < P_i < P_{R,i})}{\int_{P_{L,i}}^{P_{R,i}} g_P(z \mid P_{L,i}, P_{R,i}) F(T - z) \, \text{d}z}.
195+
$$
196+
197+
Since no latent variables are required, identical observations can be aggregated and the likelihood computed once per unique combination of delay, censoring windows, and covariates.
198+
This makes the marginal model substantially more efficient than the latent model for larger datasets, particularly with daily-censored data where many observations share the same structure.
199+
200+
For the mathematical details of primary event censored distributions, including the survival function derivation and closed-form solutions for specific distributions, see `vignette("why-it-works", package = "primarycensored")` and `vignette("analytic-solutions", package = "primarycensored")`.
201+
180202
## References {-}

0 commit comments

Comments
 (0)