# NOT RUN {
data(dataspm); fish <- as.matrix(dataspm)
pars <- log(c(r=0.24,K=5150,Binit=2800,0.15))
ans <- fitSPM(pars,dataspm,schaefer=TRUE,maxiter=1000)
boots <- spmboot(ans$estimate,fishery=fish,iter=5,schaefer=TRUE)
dynam <- boots$dynam
bootpar <- boots$bootpar
rows <- colnames(bootpar)
columns <- c(c(0.025,0.05,0.5,0.95,0.975),"Mean")
bootCI <- matrix(NA,nrow=length(rows),ncol=length(columns),
dimnames=list(rows,columns))
for (i in 1:length(rows)) {
tmp <- sort(bootpar[,i])
qtil <- quantile(tmp,probs=c(0.025,0.05,0.5,0.95,0.975),na.rm=TRUE)
bootCI[i,] <- c(qtil,mean(tmp,na.rm=TRUE))
}
round(bootCI,3) # we have used only 5 bootstraps, normally use
pairs(bootpar[,c("r","K","Binit","MSY")]) # 1000, 2000, or more
# }
Run the code above in your browser using DataLab