# NOT RUN {
data(twoindex)
fish <- as.matrix(twoindex)
pars <- log(c(0.04,155000,0.4,0.3))
bestSP <- nlm(f=negLLM,p=pars,funk=simpspmM,indat=fish,
schaefer=TRUE,logobs=log(fish[,c("cpue1","cpue2")]),
steptol=1e-06,harvpen=TRUE)
namepar <- c("r", "K", "Binit","sigma")
outfit(bestSP,parnames=namepar) # best fitting estimates
# if 'Either ~local min or steptol too small try 'steptol=1e-05'
# plotprep(width=7,height=5,newdev=FALSE) # for external plot
answer <- plotspmmod(bestSP$estimate,indat=fish,
plotprod=TRUE,maxy=3.4)
# }
Run the code above in your browser using DataLab