Learn R Programming

eDITH (version 1.0.0)

posterior_pred_sim_eDITH: Predictive posterior simulations from an eDITH run

Description

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.

Usage

posterior_pred_sim_eDITH(x, river, nParamSets = 10000, nDrawsPerParamSet = 10, 
	verbose = FALSE)

Value

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.

Arguments

x

List as produced by run_eDITH_BT.

river

A river object generated via aggregate_river.

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?

Details

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.

See Also

DHARMa.

Examples

Run this code
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)

Run the code above in your browser using DataLab