R/tune.R
bisect.Rd
The plain bisection algorithm (Burden & Douglas, 1985) is employed here to
find the value of a given forecast target quantity (e.g. fbar
) for which
a selected value of a performance statistic is obtained over a chosen period.
bisect(
stock,
sr,
deviances = rec(stock) %=% 1,
metrics,
refpts,
statistic,
years,
pyears = years,
tune,
prob,
tol = 0.01,
maxit = 15,
verbose = TRUE
)
Burden, Richard L.; Faires, J. Douglas (1985), "2.1 The Bisection Algorithm", Numerical Analysis (3rd ed.), PWS Publishers, ISBN 0-87150-857-5
data(ple4)
stock <- propagate(stf(ple4, end=2118), 100)
srr <- predictModel(model=rec~a*ssb*exp(-b*ssb), params=FLPar(a=5.20, b=1.65e-6))
# GENERATE SRR deviances
devs <- ar1rlnorm(rho=0.4, 2018:2118, iters=100, meanlog=0, sdlog=0.5)
# DEFINE Fp05 statistic
statistic <- list(FP05=list(~yearMeans((SB/SBlim) < 1), name="P.05",
desc="ICES P.05"))
# CALL bisect over 100 years, Fp.05 calculated over last 50.
fp05fwd <- bisect(stock, sr=srr, deviances=devs, metrics=list(SB=ssb),
refpts=FLPar(SBlim=150000), statistic=statistic, years=2018:2118,
pyears=2069:2118, tune=list(fbar=c(0.1, 1)), prob=0.05)
#> [1] fbar: 0.1 - prob: 0 - diff: -0.05
#> [2] fbar: 1 - prob: 1 - diff: 0.95
#> [3] fbar: 0.55 - prob: 0.998 - diff: 0.948
#> [4] fbar: 0.325 - prob: 0 - diff: -0.05
#> [5] fbar: 0.4375 - prob: 0.1284 - diff: 0.0784
#> [6] fbar: 0.38125 - prob: 2e-04 - diff: -0.0498
#> [7] fbar: 0.409375 - prob: 0.0118 - diff: -0.0382
#> [8] fbar: 0.4234375 - prob: 0.0398 - diff: -0.0102
#> [9] fbar: 0.43046875 - prob: 0.0694 - diff: 0.0194
#> [10] fbar: 0.426953125 - prob: 0.0528 - diff: 0.0028