aspmLL | R Documentation |
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
aspmLL(par, infish, inglb, inprops)
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 |
a scalar that is the negative log-likelihood using normal random errors
## 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.