modeler | R Documentation |
A versatile function for performing non-linear least squares optimization on grouped data. It supports customizable optimization methods, flexible initial/fixed parameters, and parallel processing.
modeler(
data,
x,
y,
grp,
keep,
fn = "fn_lin_plat",
parameters = NULL,
lower = -Inf,
upper = Inf,
fixed_params = NULL,
method = c("subplex", "pracmanm", "anms"),
subset = NULL,
options = modeler.options(),
control = list()
)
data |
A |
x |
The name of the column in |
y |
The name of the column in |
grp |
Column(s) in |
keep |
Names of columns to retain in the output. Defaults to |
fn |
A string. The name of the function used for curve fitting.
Example: |
parameters |
A numeric vector, named list, or
Defaults to |
lower |
A numeric vector specifying lower bounds for parameters. Defaults to |
upper |
A numeric vector specifying upper bounds for parameters. Defaults to |
fixed_params |
A list or
Defaults to |
method |
A character vector specifying optimization methods.
Check available methods using |
subset |
A vector (optional) containing levels of |
options |
A list of additional options. See
|
control |
A list of control parameters to be passed to the optimization function. For example: |
An object of class modeler
, which is a list containing the following elements:
param
Data frame containing optimized parameters and related information.
dt
Data frame with input data, fitted values, and residuals.
metrics
Metrics and summary of the models.
execution
Total execution time for the analysis.
response
Name of the response variable analyzed.
keep
Metadata retained based on the keep
argument.
fun
Name of the curve-fitting function used.
parallel
List containing parallel execution details (if applicable).
fit
List of fitted models for each group.
library(flexFitR)
data(dt_potato)
explorer <- explorer(dt_potato, x = DAP, y = c(Canopy, GLI), id = Plot)
# Example 1
mod_1 <- dt_potato |>
modeler(
x = DAP,
y = GLI,
grp = Plot,
fn = "fn_lin_pl_lin",
parameters = c(t1 = 38.7, t2 = 62, t3 = 90, k = 0.32, beta = -0.01),
subset = 195
)
plot(mod_1, id = 195)
print(mod_1)
# Example 2
mod_2 <- dt_potato |>
modeler(
x = DAP,
y = Canopy,
grp = Plot,
fn = "fn_lin_plat",
parameters = c(t1 = 45, t2 = 80, k = 0.9),
subset = 195
)
plot(mod_2, id = 195)
print(mod_2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.