Learn R Programming

metafolio (version 0.1.0)

fit_ricker: Fit Ricker linear regression

Description

Fit a Ricker curve to spawner-recruit data and return the intercept (a) and slope (b). The model is fit via the RcppArmadillo package for speed..

Usage

fit_ricker(S, R)

Arguments

S

Spawners as a numeric vector.

R

Recruits or returns as a numeric vector.

Value

A named list with components a for the intercept and b for the slope.

Examples

Run this code
# NOT RUN {
S <- seq(100, 1000, length.out = 100)
v_t <- rnorm(100, 0, 0.1)
R <- mapply(ricker_v_t, spawners = S, v_t = v_t, a = 1.9, b = 900, d = 1)
plot(S, log(R/S))
fit_ricker(S, R)
# }

Run the code above in your browser using DataLab