extract: Extractor function for MixtureMissing

View source: R/extract.R

extractR Documentation

Extractor function for MixtureMissing

Description

Extract values from MixtureMissing objects or from outputs of select_mixture.

Usage

extract(
  object,
  what = c("model", "parameters", "cluster", "posterior", "outlier", "missing",
    "imputed", "complete", "information"),
  criterion = c("AIC", "BIC", "KIC", "KICc", "AIC3", "CAIC", "AICc", "ICL", "AWE", "CLC"),
  m_code = NULL
)

Arguments

object

A MixtureMissing object or an output of select_mixture.

what

The specific value to be extracted. See the return section for possible values.

criterion

If what = "information", criterion is a vector of desired information criteria. All criteria will be extracted by default. Duplicate values in the vector will not be shown again. See the details section for a list of available information criteria.

m_code

Only used in the case when object is an output of select_mixture. If m_code = NULL, extracting will be based on the best model. If m_code is one of 'CN', 'GH', 'NIG', 'SNIG', 'SC', 'C', 'St', 't', 'N', 'SGH', 'HUM', 'H', and 'SH', the function will look for this specific model and extract accordingly.

Details

Available information criteria include

  • AIC - Akaike information criterion

  • BIC - Bayesian information criterion

  • KIC - Kullback information criterion

  • KICc - Corrected Kullback information criterion

  • AIC3 - Modified AIC

  • CAIC - Bozdogan's consistent AIC

  • AICc - Small-sample version of AIC

  • ICL - Integrated Completed Likelihood criterion

  • AWE - Approximate weight of evidence

  • CLC - Classification likelihood criterion

Value

One of the following depending on what

  • If what = "model" - A data frame showing the component distribution and its abbreviation, number of clusters, and whether the data set is complete or incomplete.

  • If what = "parameters" - A list containing the relevant parameters.

  • If what = "cluster" - A numeric vector of length n indicating cluster memberships determined by the model.

  • If what = "posterior" - An n by G matrix where each row indicates the expected probabilities that the corresponding observation belongs to each cluster.

  • If what = "outlier" - A logical vector of length n indicating observations that are outliers. Only available if model is CN or t; NULL otherwise with a warning.

  • If what = "missing" - A data frame showing how many observations (cases) have missing values and the number of missing values per variables.

  • If what = "imputed" - The original data set if it is complete; otherwise, this is the data set with missing values imputed by appropriate expectations.

  • If what = "complete" - An n by d logical matrix indicating which cells have no missing values.

  • If what = "information" - A data frame showing the number of clusters, final observed log-likelihood value, number of parameters, and desired information criteria.

Examples


#++++ With no missing values ++++#

X <- iris[, 1:4]
mod <- MGHM(X, G = 2, model = 'GH', max_iter = 10)
extract(mod, what = "model")
extract(mod, what = "parameters")
extract(mod, what = "cluster")

#++++ With missing values ++++#

set.seed(123)
X <- hide_values(iris[, 1:4], n_cases = 20)
mod <- MGHM(X, G = 2, model = 'GH', max_iter = 10)
extract(mod, what = "outlier")
extract(mod, what = "missing")
extract(mod, what = "imputed")


MixtureMissing documentation built on Oct. 16, 2024, 1:09 a.m.