aspmLL: aspmLL negative log-likelihood for the ASPM

View source: R/aspm.r

aspmLLR Documentation

aspmLL negative log-likelihood for the ASPM

Description

aspmLL is the negative log-likelihood for normally distributed data, set-up for use with the ASPM model fitting. It would be necessary to log-transform the original data to convert log-normal data to normal. This includes a penalty function that is the SSQ of the catch vs predicted catch, which should invariably be ~0 when the fully selected harvest rates are plausible; meaning are below 75

Usage

aspmLL(par, infish, inglb, inprops)

Arguments

par

the dynamics relies on many parameters sitting in the global environment in particular ages, nages, maxage, M, maa, waa, sela, fish, and nyrs. 'pars' can contain either two or three parameters. 1) is the log-transformed average unfished recruitment, inR0. 2) is the variability around the index of relative abundance (cpue) during the fitting process, and if is present 3) is the initial depletion level initdepl, which if present will be fitted as well.

infish

the fish data.frame from readdata or built in dataset

inglb

the glb data.frame from readdata or built in dataset

inprops

the props data.frame from readdata or built in dataset

Value

a scalar that is the negative log-likelihood using normal random errors

Examples

## Not run: 
data(fishdat)
fish <- fishdat$fish
glb <- fishdat$glb
props <- fishdat$props
pars <- c(14,0.3)
dynamics(pars,fish,glb,props)
aspmLL(pars,fish,glb,props)      # should be 5.171
pars <- c(14.0,0.3,0.95) # logR0, sigCE, depletion
dynamics(pars,fish,glb,props)    # note the harvest rates of 85% exploitable biomass
aspmLL(pars,fish,glb,props)      # should be 114.9547
pars <- c(14,0.3)
bestL <- optim(pars,aspmLL,method="Nelder-Mead",infish=fish,inglb=glb,inprops=props,
               control=list(maxit = 1000, parscale = c(10,0.1)))
outoptim(bestL)
fishery <- dynamics(bestL$par,fish,glb,props)
print(round(fishery,4)) 

## End(Not run)

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