calcDetModelFit: calcDetModelFit

View source: R/FUNCTION_calcDetModelFit.R

calcDetModelFitR Documentation

calcDetModelFit

Description

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).

Usage

calcDetModelFit(
  sr_obj,
  sr.scale = 10^6,
  min.obs = 15,
  resids = FALSE,
  fn.use = "lm",
  ar1 = FALSE
)

Arguments

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

Examples

ricker.fit <- calcDetModelFit(SR_Sample[SR_Sample$Stock == "Stock1",],min.obs = 10)
print(ricker.fit)

SOLV-Code/RapidRicker documentation built on Jan. 14, 2025, 9:36 a.m.