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

loading in spawner/recruit data #27

Open
katyshelby opened this issue Feb 8, 2023 · 3 comments
Open

loading in spawner/recruit data #27

katyshelby opened this issue Feb 8, 2023 · 3 comments

Comments

@katyshelby
Copy link

Hello,

I am attempting to load in data to do a simple ricker and beverton holt spawner recruit models on some spring chinook data. The data I have is number of spawner fish and coresponding number of recruits (recruits have already been calculated for different ages and added together for each year corresponding to spawners) from 1981-2017. I am having trouble getting the matrix to read in correctly to identify/recognize ssb and rec.

It seems like the "nsher" data is most similar to mine, I have tried to get my CSV data in the same format. But have been unsusccessful.

Can you help me with the code to get this data loaded in FLQuant?

Attached is the code I have so far (some of it working and some of it not) and the csv file I am reading the data in from.
NasonSR.csv
FLR_SpawnerRecruitCode.txt

Thank you!
Katy

@iagomosqueira
Copy link
Member

The FLSR class you see in the nsher example contains two slots with the input data: rec and ssb. Those need to be created as separate FLQuant objects. See the example code, where the rows are extracted from the data frame and given to the FLQuant() function, together with the year dimnames and the units of measurement. Please adjust those if my assumption (numbers of fish) is incorrect.

Is numbers of fish, rather than spanwer biomass, a good proxy of Total Egg Production for this stock?

I hope the script is clear, but please do not hesitate asking for any clarification.
nason.R.txt

@katyshelby
Copy link
Author

katyshelby commented Feb 9, 2023 via email

@iagomosqueira
Copy link
Member

The code as it stands assumes recruitment age is 1, so matches recruitment with adult biomass, or numbers, one year before.

If the recruits data refers to an accumulated number of returns, the values need to be matched with a year lag, by calling

nssb <- FLQuant(dat['ssb',], dimnames=list(age='all', year=1981:2017),
  units="1")

nrec <- FLQuant(dat['rec',], dimnames=list(age='1', year=1982:2018),
  units="1")

In this way the first ssb value (349) will be matched with the first rec value (549), even if they do not really represent numbers of age 1 recruits. You can then fit them to Ricker and Beverton & Holt models, in different formulations.

profile() gives you a likelihood profile of the model fit. You can then predict future recruitment levels by calling

predict(nasrr, ssb=FLQuant(c(10, 100, 200, 500)))

I assume there are more sophisticated ways of analyzing salmon SRR data, e.g. Fleischman et al, 2013, but FLCore only provides methods for fitting and applying the basic SRR curves.

The FLSRTMB package provides a few extra tools, like fitting via a TMB implementation based on a steepness formulation. But again, nothing salmon specific yet.

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

2 participants