View source: R/fit_multiple_curves.R
fit_multiple_curves | R Documentation |
A function that fits multiple curves with nls.
fit_multiple_curves(
x,
y,
formula_list = list(as.formula(y ~ a * x + b), as.formula(y ~ a * x^2 + b * x + c)),
variable_name = "x",
list_of_start_parameters_lists = list(list(a = 0, b = 10), list(a = 0, b = 0, c =
12)),
list_of_static_parameters_lists = list(list(), list()),
title = "random fit",
subtitle = "no filename",
show_try = FALSE,
save_plot = FALSE,
save_path = "output_directory_licorfiles/plots/",
list_of_lower_bounds = list(NULL, NULL),
list_of_upper_bounds = list(NULL, NULL)
)
x |
The variable values. |
y |
The dependent values. |
variable_name |
A string of the name of the variable, default is x. |
title |
The title of the plot. |
subtitle |
The subtitle of the plot. Filename is reccomended. Used for the saved plot name. |
save_plot |
The boolean to check if the plots have to be saved. |
save_path |
The path sting to save the plot if save_plot is TRUE. |
formula |
The formula to use for fitting the data, default is linear. |
list_of_start_parameters |
The list of starting parameters. |
manual_check |
The boolean if the plots are manually checked or not. |
A list of parameters that are fitted.
Sam Loontjens
parameters <- fit_any_curve(x = 1:10,
y = 1:10 +5 + rnorm(10),
formula = as.formula(banaan ~ k * x + p),
list_of_start_parameters = list(k = 2, p = 3))
or
x <- 1:10
y <- 0.5 * x^2 + rnorm(10) + 10
parameters <- fit_any_curve(x = x,
y = y,
formula = as.formula(stuff ~ a1 * t^2 + b1),
variable_name = "t",
list_of_start_parameters = list(a1 = 2, b1 = 3),
title = "quadratic fit",
subtitle = "from no file",
save_plot = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.