Returns a brms custom family for the joint distribution of a pair of
counts (y1, y2), constructed by trivariate reduction: y1 = N_s + N1 and
y2 = N_s + N2, where N_s ~ Poisson(mu), N1 ~ Poisson(lambdaone), and
N2 ~ Poisson(lambdatwo) are mutually independent given their rates. All
three rates have a log link.
Use bipois() when both counts were recorded on every row. brms drops any
row with a missing value of y1 or y2. If only one source has missing
counts, make that source y1 and use bipois_partialobs(), which keeps
every row in the model.
y1 is the response. y2 is passed as supplementary integer data through
the brms vint() addition term:
brm(
bf(y1 | vint(y2) ~ ...),
family = bipois(),
stanvars = bipois_stanvars(),
data = dat
)This template is for the native parameterisation. To fit the model in the
congruence–bias parameterisation, which we recommend, write the formula
with bf_mfd().
Usage
bipois()
bipois_stanvars()
log_lik_bipois(i, prep)
posterior_predict_bipois(i, prep, ...)
posterior_epred_bipois(prep)Value
bipois() returns a brms custom_family object. bipois_stanvars()
returns a stanvars object holding the Stan code for the corresponding
_lpmf. log_lik_bipois() returns a numeric vector of log-densities,
one per posterior draw, for observation i.
posterior_predict_bipois() returns an integer vector of draws of y1
from its marginal distribution, one per posterior draw, for observation
i. posterior_epred_bipois() returns a numeric matrix of
mu + lambdaone, with posterior draws in rows and observations in
columns.
Details
The correlation between the two counts cannot be negative, because it is generated by the shared component, which is part of both counts.
brms requires every custom family to have a dpar named mu. In bipois(),
mu is the rate of the shared component, not the mean of either count.
brms also rejects dpar names that end in a digit, so the exclusive rates
are lambdaone and lambdatwo, written \(\lambda_1\) and
\(\lambda_2\) in the documentation.
See also
bipois_partialobs() for partially observed pairs; binegbin()
for the overdispersed counterpart; vignette("prediction") for the
prediction functions.