R/autofit_gaussian_2D.R
autofit_gaussian_2D.Rd
Automatically determine the best-fitting 2D-Gaussian for a data set
autofit_gaussian_2D( data, comparison_method = "rmse", maxiter = 1000, simplify = TRUE )
data | A data.frame that contains the raw data (generally rectilinearly
gridded data, but this is not a strict requirement). Columns must be named
|
---|---|
comparison_method | One of "rmse", "rss", or "AIC"; what metric should be used to determine the "best-fitting" Gaussian? |
maxiter | Default 1000. A positive integer specifying the maximum number
of iterations allowed. See |
simplify | TRUE or FALSE. If TRUE, return only the coefficients, model,
model_error_stats, and fit_method for the best-fitting model. If FALSE, a
model comparison table is also included in the returned list as
|
If simplify = TRUE
, a list with the components:
"coefs" A data.frame of fitted model parameters.
"model" The model object, fitted by stats::nls()
.
"model_error_stats" A data.frame detailing the rss, rmse, deviance, and AIC of the fitted model.
"fit_method" A character vector that indicates which method and orientation strategy was used by this function.
If simplify = FALSE
, a model comparison table is also included
in the returned list as $model_comparison
. This table is obtained
via compare_gaussian_fits()
.
This function runs fit_gaussian_2D()
three times: once for
each of the "main" types of models: 1) elliptical, unconstrained; 2)
elliptical, log; 3) circular. In all three cases, amplitudes and
orientations are unconstrained. The function compare_gaussian_fits()
is then used to determine which of these three models is the best-fitting,
using the comparison_method
argument to make the decision.
Vikram B. Baliga