fit_curve | R Documentation |
Fit a curve using a parametric function from
phenopix::greenProcess()
.
fit_curve(ts, cycles, fit = c("gu", "klosterman"))
ts |
Time series in |
cycles |
Cycles allocation (data table generated by |
fit |
Fitting function among |
A named list of n
elements (being n
the number of IDs included
in ts
). Each element is a named list of m
elements (being m
the
number of detected cycles).
Each element is a list including the following elements:
fit
: the fitted curve as returned by phenopix
fitting functions;
ts
: a data table of fitted values, containing the columns
date
(date of the record) and
value
(fitted value);
maxval
: the date of the maximum value in the cycles
(obtained from input cycles
and here reported).
Luigi Ranghetti, PhD (2020) luigi@ranghetti.info
# Load input data
data("ts_filled")
data("dt_cycles")
# Standard interpolation
cf <- fit_curve(ts_filled, dt_cycles)
plot(ts_filled, fitted = cf)
# Interpolation using a different method
cf_2 <- fit_curve(ts_filled, dt_cycles, fit = "no")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.