Draw replicated numerator and denominator responses from the posterior
predictive distribution: at each posterior draw the two fitted means are
assembled from that draw's parameters, and a response is drawn from the
family at those means. The replicates are what pp_check() compares the
observed data against.
Usage
# S3 method for class 'ratiod_fit'
posterior_predict(object, ndraws = NULL, ...)Value
A list with y_num_rep and y_denom_rep, each a draws-by-observation
matrix, plus y_num and y_denom, the observed responses. A family with a
fixed denominator (the binomial arms, whose denominator is the trial count)
reports the trials as y_denom_rep.
Examples
# \donttest{
set.seed(4)
n <- 40
df <- data.frame(
count = rpois(n, 12),
total = rpois(n, 80),
x = rnorm(n)
)
fit <- tratio(count | total ~ x, data = df,
family = ratiod_poisson_gamma(),
control = list(iter = 400, chains = 1, seed = 1))
rep <- posterior_predict(fit, ndraws = 50)
dim(rep$y_num_rep)
#> [1] 50 40
# }