Compute Log Predictive Distributions for Logistic Regression of a 'brms' Fit
Source:R/log_pred_dist_bern.R
log_pred_dist_bern.RdCalculates the log probability mass function (log-PMF) and log cumulative distribution function (log-CDF) for a logistic model based on a fitted 'brms' model.
Value
A list containing:
lpmf_hat: numeric matrix of log-PMF values (posterior draws × observations).lcdf_hat: numeric matrix of log-CDF values (posterior draws × observations).
Details
The function extracts the posterior predictions of the Bernoulli component
(structural zeros) using posterior.pred() for the mean parameter ("mu").
For each observation:
Computes the log-PMF of the observed binary outcome.
Computes the log-CDF (upper-tail probability) of the observed outcome.
This produces matrices of size \(M \times N\), where \(M\) is the number of posterior draws and \(N\) is the number of observations.