Learn R Programming

ggpmisc (version 0.6.3)

distrmix_helper_fun: Helper function for fitting Normal mixture model

Description

Factored out code used in both stat_distrmix_line() and stat_distrmix_eq().

Usage

distrmix_helper_fun(
  data,
  aes.name = "x",
  method,
  method.name,
  se,
  method.args = list(),
  k = 2,
  free.mean = TRUE,
  free.sd = TRUE,
  n.min = 10L * k,
  fit.seed = NA,
  fm.values = TRUE,
  verbose = getOption("verbose", default = FALSE)
)

Arguments

data

A layer specific dataset, only needed if you want to override the plot defaults.

method

function or character If character, "normalmixEM" or the name of a model fit function are accepted, possibly followed by the fit function's method argument separated by a colon. The function must return a model fit object of class mixEM.

se

Currently ignored.

method.args

named list with additional arguments.

k

integer Number of mixture components to fit.

free.mean, free.sd

logical If TRUE, allow the fitted mean and/or fitted sd to vary among the component Normal distributions.

n.min

integer Minimum number of distinct values in the mapped variable for fitting to the attempted.

fit.seed

RNG seed argument passed to set.seed(). Defaults to NA, which means that set.seed() will not be called.

fm.values

logical Add parameter estimates and their standard errors to the returned values (`FALSE` by default.)

verbose

If FALSE, capture screen output from method and display it as a message() only in case of conversion failure.

Details

This function does the model fitting and returns a data frame with the estimates for the parameters. It is a wrapper on functions from package 'mixtools'.