vignettes/a04_diagnosing_problems.Rmd
a04_diagnosing_problems.Rmd
In some cases, models might produce warnings about high Pareto K statistics (> 0.7). These may reflect a model that is too flexible for the data being used, in which case the model might need to be changed. In some cases, ‘moment matching’ may be used to improve diagnostics; an example of this is below.
# replace this with your own data frame
d = data.frame("Year"= 2002:2014,
"Takes" = c(0, 0, 0, 0, 0, 0, 0, 0, 1, 3, 0, 0, 0),
"expansionRate" = c(24, 22, 14, 32, 28, 25, 30, 7, 26, 21, 22, 23, 27),
"Sets" = c(391, 340, 330, 660, 470, 500, 330, 287, 756, 673, 532, 351, 486))
This model has a constant bycatch rate and Poisson distribution,
fit = fit_bycatch(Takes ~ 1, data=d, time="Year", effort="Sets", family="poisson",
time_varying = FALSE)
If the ‘fit’ object produced errors about the Pareto K statistics
being high, we could use moment matching in the loo
package,
##
## Computed from 1500 by 13 log-likelihood matrix.
##
## Estimate SE
## elpd_loo -11.0 5.8
## p_loo 1.7 1.3
## looic 22.0 11.6
## ------
## MCSE of elpd_loo is 0.1.
## MCSE and ESS estimates assume MCMC draws (r_eff in [0.3, 0.4]).
##
## All Pareto k estimates are good (k < 0.69).
## See help('pareto-k-diagnostic') for details.