Description Usage Arguments Details Value Author(s) Examples
View source: R/compare_gaussian_fits.R
Compare fitted 2D-Gaussians and determine the best-fitting model
1 | compare_gaussian_fits(fit_objects_list, comparison_method = "rmse")
|
fit_objects_list |
A list of outputs from |
comparison_method |
One of "rmse", "rss", or "AIC"; what metric should be used to determine the "best-fitting" Gaussian? |
For the argument fit_objects_list
, a list of fitted model
objects (output from fit_gaussian_2D()
) can simply be combined via
list()
. Naming the list is optional; should you supply names, the
output of compare_gaussian_fits()
will refer to specific models by
these names.
A list with the components:
"preferred_model" A character indicating the name of the preferred model (or if a named list was not provided, a model number is given in the order of the original supplied list).
"comparison_table" A data.frame detailing the rss, rmse, deviance, , AIC, R2, and adjusted R2 of the fitted models. The data.frame is sorted by the comparison_method that was selected.
Vikram B. Baliga
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | if (interactive()) {
library(gaussplotR)
## Load the sample data set
data(gaussplot_sample_data)
## The raw data we'd like to use are in columns 1:3
samp_dat <-
gaussplot_sample_data[,1:3]
## Fit a variety of different models
gauss_fit_ue <-
fit_gaussian_2D(samp_dat)
gauss_fit_uel <-
fit_gaussian_2D(samp_dat, method = "elliptical_log")
gauss_fit_cir <-
fit_gaussian_2D(samp_dat, method = "circular")
## Combine the outputs into a list
models_list <-
list(
unconstrained_elliptical = gauss_fit_ue,
unconstrained_elliptical_log = gauss_fit_uel,
circular = gauss_fit_cir
)
## Compare via rmse
models_compared <-
compare_gaussian_fits(
fit_objects_list = models_list,
comparison_method = "rmse" ## the default
)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.