knitr::opts_chunk$set(echo = TRUE)
library(bycatch) library(loo) set.seed(123)
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,
loo_stats <- loo(fit$fitted_model, moment_match = TRUE) print(loo_stats)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.