initproj.r

text/plain — 1.7 KB

File contents

years<-2001:2025                               # prediction years
histyears<- (1950:2000)                       # historical fishing period
selF1<-0
selF2<-0.25
selF3<-0.1                                # Chosen as historical F
selF4<-0.8                                # Chosen as Fcrash

Linf<-160
k<-0.1
beta<-3
cond<-0.02
ages<-1:14
t0<-0
la<-Linf*(1-exp(-k*(ages-t0)))            # Mean length at age
la<-round(la,2)
wa<-cond*la**beta/1000                    # Mean weight at age in kg
wa<-round(wa,2)

s50<-5                                    # Age at 50% selection
sa<-round(1/(1+exp(-1.1*(ages-s50))),2)   # Selection at age
p50<-5.5
pa<-round(1/(1+exp(-2*(ages-p50))),2)   # Proportion mature at age

M<-0.2
CV.R<-0.4
CV.N<-0.3
CV.pred<-0.3
#CV.R<-0
#CV.N<-0
#CV.pred<-0



alpha<-1/srfun(selF4,M,sa,wa,pa)               # Make this Fcrash
K<-20000

Frange<-(0:(selF4*100))/100         # Range for plotting
sr<-sapply(Frange,srfun,M,sa,wa,pa)
yr<-sapply(Frange,yrfun,M,sa,wa)
Srange<-K*(alpha*sr-1)
Srange<-ifelse(Srange>0,Srange,0)
Rrange<-alpha*Srange/(1+Srange/K)
Yrange<-yr*Rrange
#par(mfrow=c(2,2))
#plot(Frange,yr,type='l',lwd=3)
#plot(Frange,sr,type='l',lwd=3)
#plot(Srange,Rrange,type='l',lwd=3)
#
# Start with a virgin stock at B0 (before any fishing)
#
Finitial<-0
Zinitial<-Finitial*sa+M
srinitial<-srfun(Finitial,M,sa,wa,pa)
Sinitial<-K*(alpha*srinitial-1)
Rinitial<-alpha*Sinitial/(1+Sinitial/K)
Ninitial<-Rinitial*exp(cumsum(-c(0,Zinitial[1:(length(Zinitial)-1)])))
#
# Fish with Fhist for a period of histyears
#
Fhist<-selF3
tmp<-project(histyears,Ninitial,Fhist,sa,M,wa,alpha,K)
Ncurrent<-tmp$N
Yhist<-tmp$Y
Shist<-tmp$S
#barplot(Nhist,names.arg=ages)
#plot(Srange,Yrange,type='l',lwd=3)
#lines(Srange,0.10*Srange,lwd=3,col="blue")