aspminit.r

text/r-latex aspminit.r — 2.0 KB

File contents

# aspminit.r 
#
# Set up initial values for age-structured dynamic stock-production models
#
# Set up data-nephrops specific
yrs<-1980:1998                 # actual data years
ages<-3:6                      # actual ages
# Annual catch data
Y<-c(2398,2520,2603,2672,2459,2385,2564,
     2712,2240,1866,1692,2157,2230,2381,
     2238,1027,1633,1228,1411)
# Annual abundance index
I<-c(45.5,51.8,51.5,47.8,45.6,56.4,61.3,
     52.6,39.9,36.0,40.0,42.1,51.3,
     51.4,38.0,27.0,35.2,31.3,38.9)
wts<-c(8,14,23,34,46,60,75,89,104,119,131,145,159,175) # Wt ages 3-16, MRI 2011 report
# Number of ages and years
g<-length(ages)                # Number of true age groups
totyrs<-length(Y)              # Number of years
# Initialize values of all parameters 
# Some will later be estimated - others simply fixed at assumed values
M<-rep(0.3,(g+1))              # Natural mortality
aveRecr<-100
selpat<-c(0.1,0.333,0.667,1,1) # Selection pattern-might estimate-probably not
q<-1                           # Initial value of catchability
Fvec<-rep(0.5,totyrs)          # Annual fishing mortality
# now set up an appropriate mean weight at age for age grps 1:g and plus grp
Zplus<-cumsum(g:(g+9))*M[g+1]  # cumZ values in the plus group
Nplus<-aveRecr*exp(-Zplus)     # age structure in plus group
wtplus<-sum(Nplus*wts[(g+1):(g+10)])/sum(Nplus) # mean wt in plus grp
w<-c(wts[1:g],wtplus)           # Weight at age 3-6 from MRI 2011 report
# Initial stock size: Assume equilibrium
Ninit<-aveRecr*exp(-cumsum(c(0,M))[1:g]) # only true ages
Ninit<-c(Ninit,aveRecr*exp(-g*M[g+1])/(1-exp(-M[g+1])))# Append the plus group
# Alternatively, sum up instead of using a formula:
#
# Ninit<-aveRecr*exp(-cumsum(c(0,rep(0.3,100))))
# Ninit<-c(Ninit[1:g],sum(Ninit[(g+1):100])) 
Rvec<-rep(aveRecr,totyrs)      # Initial values of annual recruitment

# Put the initial values of parameters to be estimated into a vector
parameters<-c(log(Fvec),log(Rvec),log(q))     # Initial values of all parameters