This package was developed by Tom Elliott to assist researchers in fitting size-selectivity models to experimental trawl data. The models are fit using Bayesian models which are highly flexible and at least as useful as the traditionally used frequentist models (such as GLM's and GLMMS).
Installation and basic usage
To install, you'll need to have make sure you can install and run
R2jags. Once you have that set up, you can install
BSM. Here's how that's done using
Usage is fairly straightforward, and is fairly similar to most modelling syntax.
library(BSM) data <- data.frame(len = seq(5, 20, by = 1), y = c(0, 1, 1, 0, 4, 6, 15, 23, 26, 38, 38, 28, 59, 37, 24, 13), n = c(3, 5, 8, 12, 19, 15, 20, 26, 29, 40, 39, 28, 59, 37, 24, 13)) ## Define a data object and plot it: dat <- bsmData(y1 = y, n = n, length = len, data = data) plot(dat) ## Fit a selectivity model: fit <- bsm(dat) summary(fit)
The best resource is currently Chapter 7 of my Masters Thesis, or else you can read up on the various arguments to the main functions,
- fix up implementation of factors to enable easy "no intercept" model for various parameters,
L50 ~ mesh + haul - 1