View source: R/dm.growth.fit.R
| dm.growth.fit | R Documentation |
Fits cumulative growth curves to daily dendrometer series using one of
several supported methods: generalized additive model "gam",
Gompertz "gompertz", logistic "logistic", Richards
"richards", local regression "loess", or smoothing spline
"spline".
The function:
resamples dendrometer data to daily maxima using [dendro.resample()],
assigns each daily observation to a vegetation season,
optionally converts daily stem-size values to cumulative growth
with fit_GRO = TRUE,
fits one curve per series and season with
year_mode = "yearly" or one pooled curve across retained seasons
with year_mode = "pooled",
estimates growing-season timing from the fitted cumulative-growth curve,
additionally identifies active-growth timing from the fitted growth-rate curve.
For Gompertz, logistic, and Richards fits, the asymptote parameter
a, representing maximum seasonal growth, can optionally be fixed to
the observed maximum cumulative growth for that series and vegetation season.
This is controlled by fix_a_to_observed_max.
dm.growth.fit(
df,
TreeNum = "all",
method = c("gam", "gompertz", "logistic", "richards", "loess", "spline"),
years = "all",
year_mode = c("yearly", "pooled"),
fit_GRO = TRUE,
site_mode = c("NH", "SH", "CS"),
custom_veg_season = c(275, 274),
growth_fraction = c(0.1, 0.9),
min_unique_growth = 10,
rate_threshold_fraction = 0.1,
fix_a_to_observed_max = FALSE,
fixed_a_multiplier = 1,
start_value_gompertz_parameters = list(a = NA_real_, b = NA_real_, k = NA_real_),
start_value_richards_parameters = list(a = NA_real_, k = NA_real_, t0 = NA_real_, v =
1),
loess_span = 0.2,
spline_df = 10,
verbose = TRUE
)
df |
A data frame or tibble. The first column must be a timestamp
|
TreeNum |
Either |
method |
Fitting method. One of |
years |
Either |
year_mode |
Either |
fit_GRO |
Logical. If |
site_mode |
Vegetation season definition. One of |
custom_veg_season |
Numeric vector of length two giving the start and
end day-of-year for custom vegetation seasons in |
growth_fraction |
Numeric vector of length two giving the lower and
upper fractions of final fitted seasonal growth used to define cumulative
growth onset and cessation, for example |
min_unique_growth |
Minimum number of unique non-missing cumulative growth values required before a fit is attempted. |
rate_threshold_fraction |
Numeric scalar between 0 and 1. Active-growth dates are derived from the fitted growth-rate curve as the first and last days where fitted growth rate exceeds this fraction of the peak fitted growth rate. |
fix_a_to_observed_max |
Logical. If |
fixed_a_multiplier |
Numeric multiplier applied to the observed maximum
when |
start_value_gompertz_parameters |
Optional named list with starting
values for Gompertz fits. Supported names are |
start_value_richards_parameters |
Optional named list with starting
values for Richards and logistic fits. Supported names are |
loess_span |
Span used when |
spline_df |
Degrees of freedom used when |
verbose |
Logical. If |
The first column of df is treated as the time column and renamed to
"TIME" internally. If it is not already a date-time object, the
function attempts to parse it using [lubridate::parse_date_time()].
growth_start_* and growth_end_* are based on cumulative fitted
growth. rate_start_* and rate_end_* are based on the fitted
growth-rate curve.
For Gompertz, logistic, and Richards models, a is the upper asymptote.
When fix_a_to_observed_max = TRUE, this parameter is not estimated by
nonlinear least squares. Instead, it is fixed to:
a = max(y_{obs}) \times fixed\_a\_multiplier
where y_{obs} is the observed cumulative growth for that series and
vegetation season.
An object of class "dm_growth_fit" with elements:
The matched function call.
Raw daily dendrometer data after resampling to daily maxima and assigning vegetation seasons, but before centering and optional cumulative-growth transformation.
Daily processed data used for fitting.
Daily fitted values on the full vegetation-season grid.
Table with fit-level statistics and estimated timing.
Table with fit-level model parameters and convergence information.
Vegetation seasons retained for fitting.
[summary.dm_growth_fit()], [print.dm_growth_fit()]
# fit <- dm.growth.fit(
# df = dendro_data,
# TreeNum = "all",
# method = "gompertz",
# year_mode = "yearly",
# fit_GRO = TRUE,
# fix_a_to_observed_max = TRUE
# )
# fit2 <- dm.growth.fit(
# df = dendro_data,
# TreeNum = "all",
# method = "richards",
# year_mode = "yearly",
# fit_GRO = TRUE,
# fix_a_to_observed_max = TRUE,
# fixed_a_multiplier = 1.02
# )
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.