Git Product home page Git Product logo

flref's Introduction

FLRef

Easy computation of reference points

flref's People

Contributors

henning-winker avatar iagomosqueira avatar

Stargazers

 avatar  avatar  avatar

Watchers

James Cloos avatar  avatar  avatar  avatar  avatar

flref's Issues

computeFbrps gives negative yield and recruitment

I was running a bootstrap SR on my stock object and some of the runs resulted in reference points that were higher than fcrash and which gave negative yield and recruitment. Presumably the correct behaviour in this case should be zero yield and recruitment.
Here is some code to illustrate the issue:

library(stockassessment)
library(FLCore)
library(FLfse)
library(FLRef)

SAMfit <- fitfromweb('whg.7b-ce-k_WGCSE22_RevRec_2023')
stk <- SAM2FLStock(SAMfit,catch_estimate = T)
`
# one of the iterations in my bootstrap that gives strange results
i <- c(19L, 10L, 6L, 24L, 14L, 2L, 13L, 18L, 22L, 14L, 6L, 1L, 19L, 
            19L, 8L, 6L, 23L, 12L, 6L, 8L, 7L, 11L, 17L, 4L)  
y <- as.FLSR(stk,model='ricker')
rec(y) <- rec(y)[, i]
ssb(y) <- ssb(y)[, i]
sr <- srrTMB(y, spr0 = mean(spr0y(stk)))

brps <- computeFbrps(stock = stk, sr = sr, proxy = 'sprx', f0.1 = TRUE)
brps@refpts
# fmax and spr.30 are higher than fcrash and give negative yield and recr

I think the steepness of the SR is so low that the entire SR curve is below the replacement line:

# following https://www.fao.org/3/v8400e/V8400E02.htm - plot replacement line (fig 6)
fi <- an(fbar(brps))
## SPR vector corresponding to these F's
spri <- an(spr(brps))
## reference points
rpi <- refpts(brps)

par(mfrow = c(1, 2))
## SPR
plot(fi, spri, type = "l", bty = "l", xlab = "Fbar", ylab = "SPR", ylim = c(0, max(spri)))

## SR
pars <- params(brps)
curve(pars["a"] * x * (exp(-pars["b"] * x)),
      from = 0, to = 1e5, bty = "l",
      xlab = "SSB", ylab = "Recruitment", xaxs = "i", yaxs = "i",
      main = "No point of intersection with replacement line")
abline(c(0, 1/spri[idx]), col = "blue")

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.