fitSPM: fitSPM fits a surplus production model

View source: R/spm.r

fitSPMR Documentation

fitSPM fits a surplus production model

Description

fitSPM fits a surplus production model (either Schaefer or Fox) by applying optim twice. Being automated it is recommended that this only be used once plausible initial parameters have been identified (through rules of thumb or trial and error). It uses negLL to apply a negative log-likelihood, assuming log-normal ressidual errors. The output object is the usual object output from optim. The $par values can be used in displayModel to plot the outcome, or in bootspm to conduct bootstrap sampling of the residuals from the CPUE model fit to gain an appreciation of any uncerainty in the analysis. It uses the magnitude function to set the values of the parscale parameters.

Usage

fitSPM(pars, fish, schaefer = TRUE, maxiter = 1000)

Arguments

pars

the initial parameter values to start the search for the optimum

fish

the matrix containing the fishery data 'year', 'catch', and 'cpue' as a minimum.

schaefer

if TRUE, the default, then simpspm is used to fit the Schaefer model. If FALSE then the Fox model is fitted.

maxiter

the maximum number of iterations to be used in each optim run

Value

an optim output object as a list

Examples

## Not run: 
 data(dataspm)
 pars <- c(r=0.2,K=6000,Binit=2800)
 ans <- fitSPM(pars,dataspm$fish,schaefer=TRUE,maxiter=1000)
 outoptim(ans)
 ansF <- fitSPM(pars,dataspm$fish,schaefer=FALSE,maxiter=1000) 
 outoptim(ansF)

## End(Not run)

haddonm/datalowSA documentation built on Nov. 5, 2023, 6:40 p.m.