compare_gaussian_fits: Compare fitted 2D-Gaussians and determine the best-fitting...

Description Usage Arguments Details Value Author(s) Examples

View source: R/compare_gaussian_fits.R

Description

Compare fitted 2D-Gaussians and determine the best-fitting model

Usage

1
compare_gaussian_fits(fit_objects_list, comparison_method = "rmse")

Arguments

fit_objects_list

A list of outputs from fit_gaussian_2D(). See Details for more

comparison_method

One of "rmse", "rss", or "AIC"; what metric should be used to determine the "best-fitting" Gaussian?

Details

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.

Value

A list with the components:

Author(s)

Vikram B. Baliga

Examples

 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
    )
}

gaussplotR documentation built on May 3, 2021, 1:07 a.m.