
Create a function to calculate the marginalised log likelihood for double censored and truncated delay distributions
Source:R/gen.R
epidist_gen_log_lik.Rd
This function creates a log likelihood function that calculates the marginal
likelihood for a single observation by integrating over the latent primary
and secondary event windows. The integration is performed numerically using
primarycensored::dpcens()
which handles the double censoring and truncation
of the delay distribution.
Arguments
- family
A description of the response distribution and link function to be used in the model. Every family function has a link argument allowing users to specify the link function to be applied on the response variable. If not specified, default links are used. For details of all supported families see
brmsfamily()
. Commonly used, such aslognormal()
, are also reexported as part ofepidist
.
Value
A function that calculates the marginal log likelihood for a single observation. The prep object must have the following variables:
vreal1
: relative observation timevreal2
: primary event windowvreal3
: secondary event window
Details
The marginal likelihood accounts for uncertainty in both the primary and secondary event windows by integrating over their possible values, weighted by their respective uniform distributions.
See also
brms::log_lik()
for details on the brms log likelihood interface.
Other gen:
epidist_gen_posterior_epred()
,
epidist_gen_posterior_predict()