View source: R/FUNCTION_calcDetModelFit.R
calcDetModelFit | R Documentation |
This function calculates Ricker Model parameters for spawner-recruit data using a simple linear regression of log(R/S) ~ S. Note that these are simple deterministic model fits intended for rapid testing of input data! Use of gls() function from nlme and AR1 version of deterministic fit, using gls(), contributed by Hamachan Hamazaki (ADFG).
calcDetModelFit(
sr_obj,
sr.scale = 10^6,
min.obs = 15,
resids = FALSE,
fn.use = "lm",
ar1 = FALSE
)
sr_obj |
a data frame with Year and Spn, logRpS , and Rec (Data for 1 Stock!). Other variables can be there but are not used (RpS, Qual, ExpF etc) |
min.obs |
min number of S-R pairs needed to fit a model |
resids |
if TRUE, add the residuals to the output |
fn.use |
default is "lm" to use lm() from Base R. Alternative is "gls" to use the gls() function from the nlme package. |
ar1 |
if TRUE, *and* if data set has no missing years, then calculate the Ricker fit with lag-1 autoregression. Note: this uses gls(), regardless of what setting is provided for the gls argument |
ricker.fit <- calcDetModelFit(SR_Sample[SR_Sample$Stock == "Stock1",],min.obs = 10)
print(ricker.fit)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.