| gdd_calc | R Documentation |
Fits a temperature-dependent development model to constant- temperature data. By default the classic linear degree-day model
V = (T - C) / K
is fitted by ordinary least
squares, yielding the developmental threshold temperature C
(deg C) and the effective accumulated temperature K
(degree-days). Nonlinear models describing the full response curve
(optimum and upper threshold included) are available via
model.
gdd_calc(
data,
temp_col = NULL,
duration_col = NULL,
by = NULL,
model = c("linear", "logan", "lactin", "briere1", "briere2", "wang", "auto"),
start = NULL,
conf_level = 0.95,
min_n = 3,
maxiter = 1000
)
data |
A data.frame with at least a temperature column and a duration column. |
temp_col, duration_col |
Column names (auto-detected by default). |
by |
Grouping variable(s), e.g. |
model |
Single model name or |
start |
Optional named list of starting values for a nonlinear
model, e.g. |
conf_level |
Confidence level, default 0.95. |
min_n |
Minimum rows per group, default 3. |
maxiter |
Iteration limit passed to |
Available models:
"linear" (default): V = (T - C)/K. Analytic OLS;
the only model providing K.
"logan": Logan-6 (Logan et al. 1976). Does NOT define
a lower threshold; gives T_m and T_{opt}.
"lactin": Lactin et al. (1995). \lambda < 0 lets
the curve cross zero, so the lower threshold is derived
numerically.
"briere1": V = aT(T - T_0)\sqrt{T_m - T}
(Briere et al. 1999); T_0 is the lower threshold.
"briere2": V = aT(T - T_0)(T_m - T)^{1/m};
m adds flexibility.
"wang": Wang et al. (1982), 7 parameters — needs at
least 9 temperature points.
"auto": fits all candidates and selects the best per
group by AICc; the full comparison table is stored in
object$comparison.
Nonlinear fits use nls (port algorithm,
bounded) with heuristic starting values and deterministic restarts
(start entries not belonging to the fitted model are
ignored). Standard errors are asymptotic; derived quantities
(Topt, Vmax, numerically derived C) carry no
SE. Each nonlinear model requires at least (number of parameters +
2) temperature points.
A "gdd" object: results (summary table, one row
per group; the selected model in "auto" mode), fits
(per-group details), data (cleaned data), and
comparison (model comparison table, "auto" only).
[gdd_read()], [gdd_check()], [gdd_compare()], [gdd_predict()], [gdd_plot()], [gdd_export()], [gdd_daily()]
# csv example shipped with the package (inst/extdata)
f <- system.file("extdata", "gdd_example.csv", package = "insectecol")
df <- gdd_read(f)
fit1 <- gdd_calc(df, by = "stage") # linear (default)
fit2 <- gdd_calc(df, by = "stage", model = "briere1") # nonlinear
fit3 <- gdd_calc(df, by = "stage", model = "auto") # AICc selection
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.