R/one_way_anova.R
sim_pred_hanova1.RdSimulates nrep draws from the posterior predictive distribution
of the one-way hierarchical ANOVA model described in hanova1.
This function is called within hanova1 when the argument
nrep is supplied.
sim_pred_hanova1(theta_sim_vals, sim_vals, fac, nrep)A numeric matrix with length(fac) columns.
Each row of theta_sim_vals contains normal means simulated from
their posterior distribution.
A numeric matrix with length(fac) columns.
Each row of sim_vals contains normal standard deviations \(\sigma\)
simulated from their posterior distribution.
The argument fac to hanova1, that is,
a vector of class factor indicating group membership.
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.
RCP26_2 <- temp2[temp2$RCP == "rcp26", ]
temp_res <- hanova1(resp = RCP26_2[, 1], fac = RCP26_2[, 2])
sim_pred <- sim_pred_hanova1(temp_res$theta_sim_vals, temp_res$sim_vals,
RCP26_2[, 2], 50)