Simulate from a gamma-Poisson posterior predictive distribution
Source:R/pois_gamma.R
sim_pred_gamma_pois.RdSimulates 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.
Arguments
- theta_sim_vals
A numeric matrix with
nrow(data)columns. Each row oftheta_sim_valscontains binomial success probabilities simulated from their posterior distribution.- data
A 2-column numeric matrix: the numbers of successes in column 1 and the corresponding numbers of trials in column 2.
- nrep
A numeric scalar. The number of replications of the original dataset simulated from the posterior predictive distribution. If
nrepis greater thannrow(theta_sim_vals)thennrepis set equal tonrow(theta_sim_vals).
Value
A numeric matrix with nrep columns. Each column contains
a draw from the posterior predictive distribution of the number of
successes.
Examples
pump_res <- hef(model = "gamma_pois", data = pump)
pump_sim_pred <- sim_pred_gamma_pois(pump_res$theta_sim_vals, pump, 50)