Skip to contents

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.

Usage

epidist_gen_log_lik(family)

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 as lognormal(), are also reexported as part of epidist.

Value

A function that calculates the marginal log likelihood for a single observation. The prep object must have the following variables:

  • vreal1: relative observation time

  • vreal2: primary event window

  • vreal3: 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()