| dm.detrend.fit | R Documentation |
Creates detrended standardized dendrometer series from objects returned by [dm.growth.fit()] or [dm.growth.fit.double()].
The function compares the original daily dendrometer series ('x$original_daily_data') with the fitted growth curve from 'x$fitted_data'. Because fitted values are stored on the processed scale used for modelling, the function first reconstructs fitted values on the original daily scale by adding back the seasonal baseline (the first non-missing original daily value of each series within each vegetation season).
Residuals are then calculated as:
residual = observed_{daily} - fitted_{original\ scale}
To obtain a detrended standardized series with mean equal to 1 and no negative
values, residuals are transformed within each series × season_label as:
z = \frac{residual - \min(residual) + \epsilon}{\mathrm{mean}(residual - \min(residual) + \epsilon)}
where \epsilon > 0 is a small constant ensuring strictly positive values.
If all residuals within a season are identical, the standardized series
becomes a constant vector of 1.
dm.detrend.fit(
x,
series = NULL,
seasons = NULL,
epsilon = 1e-06,
keep_na_rows = FALSE
)
x |
An object of class |
series |
Optional character vector of dendrometer series to retain.
Default is |
seasons |
Optional character vector of vegetation-season labels to
retain. Default is |
epsilon |
Small positive constant added after shifting residuals by their
seasonal minimum. Default is |
keep_na_rows |
Logical. If |
The function uses x$original_daily_data, which must be present in the
input object. If the object was created by an older version of
[dm.growth.fit()] or [dm.growth.fit.double()] that did not store
original_daily_data, the function will stop with an informative error.
Standardization is carried out separately within each vegetation season. This
means the mean of the detrended standardized series is 1 for each
series × season_label, not necessarily across the entire dataset.
A list of class "dm_detrended" with elements:
The matched function call.
Wide-format tibble with metadata columns and one detrended standardized series column per dendrometer.
Long-format tibble containing original daily values, reconstructed fitted values on the original scale, residuals, shifted residuals, and detrended standardized values.
Per-series and per-season summary table containing baseline values and residual standardization parameters.
The original x$fit_statistics table.
data(gf_nepa17)
fit1 <- dm.growth.fit(
df = gf_nepa17,
TreeNum = 1:2,
method = "gompertz",
year_mode = "yearly",
verbose = FALSE
)
det1 <- dm.detrend.fit(fit1)
head(det1$detrended_data)
head(det1$parameters)
fit2 <- dm.growth.fit.double(
df = gf_nepa17,
TreeNum = 1,
method = "gompertz",
year_mode = "yearly",
verbose = FALSE
)
det2 <- dm.detrend.fit(fit2)
head(det2$detrended_long)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.