powered by
altnegLL calculates negLLM using the simplification from Haddon (2011) using the ssq calculated within the function spm
altnegLL(inp, indat)
a single value, the negative log-likelihood
a vector of model parameters (r,K,Binit)
a matrix with at least columns 'year', 'catch', and 'cpue'
data(dataspm) pars <- log(c(r=0.2,K=6000,Binit=2800,sigma=0.2)) ans <- fitSPM(pars,fish=dataspm,schaefer=TRUE,maxiter=1000) outfit(ans) altnegLL(ans$estimate,dataspm) # should be -12.12879
Run the code above in your browser using DataLab