Create a function to draw from the posterior predictive distribution for a latent model
Source:R/gen.R
epidist_gen_posterior_predict.Rd
This function creates a function that draws from the posterior predictive
distribution for a latent model using primarycensored::rpcens()
to handle
censoring and truncation. The returned function takes a prep
argument from
brms
and returns posterior predictions. This is used internally by
brms::posterior_predict()
to generate predictions for latent models.
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 takes a prep
argument from brms and returns a
matrix of posterior predictions, with one row per posterior draw and one
column per observation. The prep
object must have the following variables:
vreal1
: relative observation timevreal2
: primary event windowvreal3
: secondary event window
See also
brms::posterior_predict()
for details on how this is used within
brms
, primarycensored::rpcens()
for details on the censoring approach
Other gen:
epidist_gen_posterior_epred()