sim_pred_beta_binom: Simulate from a beta-binomial posterior predictive...

View source: R/binom_beta.R

sim_pred_beta_binomR Documentation

Simulate from a beta-binomial posterior predictive distribution


Simulates nrep draws from the posterior predictive distribution of the beta-binomial model described in hef. This function is called within hef when the argument nrep is supplied.


sim_pred_beta_binom(theta_sim_vals, data, nrep)



A numeric matrix with nrow(data) columns. Each row of theta_sim_vals contains binomial success probabilities simulated from their posterior distribution.


A 2-column numeric matrix: the numbers of successes in column 1 and the corresponding numbers of trials in column 2.


A numeric scalar. The number of replications of the original dataset simulated from the posterior predictive distribution. If nrep is greater than nrow(theta_sim_vals) then nrep is set equal to nrow(theta_sim_vals).


A numeric matrix with nrep columns. Each column contains a draw from the posterior predictive distribution of the number of successes.


rat_res <- hef(model = "beta_binom", data = rat)
rat_sim_pred <- sim_pred_beta_binom(rat_res$theta_sim_vals, rat, 50)

paulnorthrop/bang documentation built on April 17, 2022, 2:12 a.m.