initproj-sl30.r

text/r-latex initproj-sl30.r — 1.3 KB

File contents

selF1<-0
selF2<-0.25
selF3<-0.35
selF4<-1.1                                # 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

years<-1:25

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)

Fhist<-selF3
Zhist<-Fhist*sa+M
srhist<-srfun(Fhist,M,sa,wa,pa)
Shist<-K*(alpha*srhist-1)
Rhist<-alpha*Shist/(1+Shist/K)
Nhist<-Rhist*exp(cumsum(-c(0,Zhist[1:(length(Zhist)-1)])))
#barplot(Nhist,names.arg=ages)
#plot(Srange,Yrange,type='l',lwd=3)
#lines(Srange,0.10*Srange,lwd=3,col="blue")