Learn R Programming

hatchR (version 0.3.2)

fit_model: Fit B&M model 2 to new data using stats::nls()

Description

Generate your own custom parameterized models for predicting hatching and emergence phenology.

Usage

fit_model(temp, days, species = NULL, development_type = NULL)

Value

List with fit model object, model coefficients, model specifications data.frame, and plot of observations and model fit.

Arguments

temp

Numeric vector of temperatures

days

Numeric vector of days to hatch or emerge

species

Character string of species name (e.g., "sockeye")

development_type

Character string of development type: "hatch" or "emerge"

Details

hatchR also includes functionality to generate your own custom parameterized models for predicting hatching and emergence phenology. Importantly, the custom parameterization relies on the model format developed from model 2 of Beacham and Murray (1990), which we chose because of its overall simplicity and negligible loss of accuracy. See Beacham and Murray (1990) and Sparks et al. (2019) for more specific discussion regarding model 2 and the development of the effective value approach.

Examples

Run this code
library(hatchR)
# vector of temperatures
temperature <- c(2, 5, 8, 11, 14)
# vector of days to hatch
days_to_hatch <- c(194, 87, 54, 35, 28)
bt_hatch_mod <- fit_model(
  temp = temperature,
  days = days_to_hatch, species = "sockeye", development_type = "hatch"
)

Run the code above in your browser using DataLab