Open katyshelby opened 1 year ago
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
Hello!
Thank you for this code, I will try to run ASAP and follow up if necessary.
To answer your question, I am hoping to be able to use the FLR package to generate BH and Ricker spawner recruit curves. The data I have is number of spawners, and number of recruits. The recruits are number of adult fish returning from that spawner year. For example, for 2017 spawners, the associated number of recruits are Age 3 fish that returned in 2020 + age 4 fish returned in 2021 + age 5 fish returned in 2022.
Will the spawner recruit models in the FLR package accommodate this type of data?
Any info that you can pass along regarding the application of FLR for this type of data would be much appreciated!
Thanks! Katy
From: Iago Mosqueira @.> Sent: Thursday, February 9, 2023 12:23 AM To: flr/doc @.> Cc: Shelby, Katy K (DFW) @.>; Author @.> Subject: Re: [flr/doc] loading in spawner/recruit data (Issue #27)
External Email
The FLSRhttps://gcc02.safelinks.protection.outlook.com/?url=http%3A%2F%2Fflr-project.org%2FFLCore%2Freference%2FFLSR.html&data=05%7C01%7Ckaty.shelby%40dfw.wa.gov%7Ceb54076ffeb94abfbf5308db0a76e598%7C11d0e217264e400a8ba057dcc127d72d%7C0%7C0%7C638115278016225942%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=zVmdWube94Mc96IlL0wvLVIDq1IOHTIsahb1PWsXEhc%3D&reserved=0 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.txthttps://gcc02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fflr%2Fdoc%2Ffiles%2F10694879%2Fnason.R.txt&data=05%7C01%7Ckaty.shelby%40dfw.wa.gov%7Ceb54076ffeb94abfbf5308db0a76e598%7C11d0e217264e400a8ba057dcc127d72d%7C0%7C0%7C638115278016382596%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=dY0f2wNyePuxq5Nq43r7Qz2BkDFjAFUrnPOm2XAbAlo%3D&reserved=0
- Reply to this email directly, view it on GitHubhttps://gcc02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fflr%2Fdoc%2Fissues%2F27%23issuecomment-1423804331&data=05%7C01%7Ckaty.shelby%40dfw.wa.gov%7Ceb54076ffeb94abfbf5308db0a76e598%7C11d0e217264e400a8ba057dcc127d72d%7C0%7C0%7C638115278016382596%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=N0lHafSDIKfr3Hv%2Bilco8vLal9PLI%2BU9uvz%2Bp%2FVb%2F4w%3D&reserved=0, or unsubscribehttps://gcc02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FASTQXN4SPL4PLIL6TS25CRDWWSSPLANCNFSM6AAAAAAUVXQCKU&data=05%7C01%7Ckaty.shelby%40dfw.wa.gov%7Ceb54076ffeb94abfbf5308db0a76e598%7C11d0e217264e400a8ba057dcc127d72d%7C0%7C0%7C638115278016382596%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=Qk4Se9cQIXy0NYCXFXFISsfOAl1m3a0yOOSNue7rQs0%3D&reserved=0. You are receiving this because you authored the thread.Message ID: @.***>
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.
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