
(out-of-sample) Expected Log-posterior Density (ELPD) based on adrm and sdm objects.
Source: R/elpd_gq.R
elpd.RdConsidering a new dataset (across the same sites), computes
the out-of-sample ELPD based on the DRM passed as drm.
Usage
elpd(x, ...)
# S3 method for class 'adrm'
elpd(x, new_data, past_data, f_test, seed = 1, cores = 1, ...)
# S3 method for class 'sdm'
elpd(x, new_data, seed = 1, cores = 1, ...)Arguments
- x
A
listobject containing the output from thefit_drm()(orfit_sdm()) function.- ...
additional parameters to be passed to
elpd- new_data
a
data.framewith the dataset at which we wish to obtain predictions. Note that, thisdata.framemust contain the response variable used when fitting the DRM as well.- past_data
a
data.framewith the dataset last year used in model fitting. Only needed whenf_testis not missing or when estimating survival.- f_test
a
matrixinforming the instantaneous fishing mortality rates at each age (columns) and timepoint (rows).- seed
a seed used for the forecasts. Forecasts are obtained through Monte Carlo samples from the posterior predictive distribution. Therefore, a
seedis needed to ensure the results' reproducibility.- cores
number of threads used for the forecast. If four chains were used in the
drm, then four (or less) threads are recommended.
Value
an object of class "CmdStanGQ" containing the ELPD
function evaluated at each data point given each sample from the
posterior.