View source: R/posterior_pred_sim_eDITH.R
posterior_pred_sim_eDITH | R Documentation |
This function performs predictive posterior simulations from a run of the eDITH model (via run_eDITH_BT
).
These can be used for diagnostics purposes, in particular to assess scaled (quantile) residuals via the
DHARMa
package.
posterior_pred_sim_eDITH(x, river, nParamSets = 10000, nDrawsPerParamSet = 10,
verbose = FALSE)
x |
List as produced by |
river |
A |
nParamSets |
Number of unique parameter sets sampled from the posterior distribution. |
nDrawsPerParamSet |
Number of simulations run per parameter set. |
verbose |
Logical. Should updates be printed on the console? |
nParamSets
can be higher than the number of unique parameter sets in the posterior distribution,
since the sampling of posterior parameter sets is operated with replacement.
A matrix with dimensions length(x$data$ID)
-by-nParamSets*nDrawsPerParamSet
. Each column is a
predictive posterior simulation. Each row corresponds to a site where eDNA data were observed
(corresponding to the entries of argument data
in run_eDITH_BT
. Matrix entries are
eDNA values (either concentrations or read numbers) predicted by the model for a given predictive posterior
simulation at a given observational site.
DHARMa
.
library(DHARMa)
data(outSample)
data(wigger)
data(dataC)
pps <- posterior_pred_sim_eDITH(outSample, wigger, nParamSets = 1000)
# reduced nParamSets for illustrative purposes
sim.out <- createDHARMa(pps, dataC$values)
plot(sim.out)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.