Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Defining lags in stock recruitment relationship #13

Open
marchtaylor opened this issue Feb 9, 2017 · 4 comments
Open

Defining lags in stock recruitment relationship #13

marchtaylor opened this issue Feb 9, 2017 · 4 comments

Comments

@marchtaylor
Copy link
Contributor

I was wondering how FLBEIA treats lags in the stock recruitment relationship (SRR).

In FLR, the fitting of SRRs (via FLSR and fmle) and subsequent projection (via fwd) both take into consideration the age of the lowest class when determining a lag.

I am using 2 stocks for which the lower age class is not age 1; haddock uses age=0 and saithe uses age=3. In my first FLBEIA simulation, I only defined one historical year (2015) and three projection years (2016-2018) - So, I would expect to have a problem predicting the recruitment of saithe in 2016, since I did not provide a SSB for time minus 3 years (e.g. 2013). To the contrary, I see no discontinuities in the saithe projection of recruitment. Eventually I will include more historical years in order to get this lagged recruitment correct, but, in the meantime, I would like to know why the run was actually successful.

Hopefully someone can point me in the right direction to correctly condition the SRRs in my model.

Thanks in advance for any advice.

@iagomosqueira
Copy link
Member

If the FLSR object is being created from an FLStock, then the recruitment age is taken by default from the dimnames of stock.n, as in as.FLSR()

rec.age = dims(stock.n(object))$min

dims() will convert the dimnames from character to numeric. This is then used to subset with the corresponding lag, by turning it again into a character.

rec <- [email protected][as.character(rec.age),]
ssb <- ssb(object)

Now, I am not sure how FLBEIA is then using this, but you could start by checking the FLSR objects being created and see if they are correct. I hope @dorleta or @AgurtzaneUrtizberea can answer that.

@marchtaylor
Copy link
Contributor Author

Thanks Iago.
Yes, as I mentioned in the question, I did do this check with FLSR and found it to correctly model the lag. Here's an example:


# setup
library(FLCore)  
library(FLash)  
library(FLAssess)  

data("ple4")

# coerce to stock with lowest age=2 
ple4sm <- trim(ple4, age=2:range(ple4)["max"])

# create SRR and fit
ple4smsrr <- as.FLSR(ple4sm)
model(ple4smsrr) <- "ricker"
ple4smsrr <- fmle(ple4smsrr)
plot(ple4smsrr)


# compare years considered for ssb and rec
head(cbind(
  ssb=colnames(ssb(ple4smsrr)),
  rec=colnames(rec(ple4smsrr))
))


# projection
ctrl_target <- data.frame(
  year = range(ple4sm)["maxyear"]+1,
  rel.year = range(ple4sm)["maxyear"],
  quantity = "f",
  val = 1
)
ctrl_obj <- fwdControl(ctrl_target)

ple4sm <- stf(ple4sm, 1)
range(ple4)
range(ple4sm)
ple4sm <- fwd(ple4sm, ctrl = ctrl_obj, sr = ple4smsrr)

# compare projected recruitment
a <- params(ple4smsrr)["a"]
b <- params(ple4smsrr)["b"]
S <- ssb(ple4sm)[,ac(2007)]
c(a*S*exp(-b*S), rec(ple4sm)[,ac(2009)])

@dorleta
Copy link
Contributor

dorleta commented Feb 10, 2017 via email

@marchtaylor
Copy link
Contributor Author

Hi Dorleta - Thanks for this information!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants