gcap.extractComponents: Decompose distribution into components

View source: R/components.R

gcap.extractComponentsR Documentation

Decompose distribution into components

Description

Decompose distribution into components

Usage

gcap.extractComponents(
  dat,
  dist = "norm",
  seed = 2021L,
  model_selection = "BIC",
  threshold = 0.4,
  min_prior = 0.001,
  niter = 1000,
  nrep = 5,
  min_comp = 1,
  max_comp = 10
)

Arguments

dat

a distribution represented as a numeric vector to decompose.

dist

'pois' or 'norm' (default).

seed

seed number.

model_selection

model selection strategy, default is 'BIC'. Details about custom setting please refer to flexmix package.

threshold

default is 0.5. Sometimes, the result components include adjacent distributions with similar mu (two and more distribution are very close), we use this threshold to obtain a more meaningful fit with less components.

min_prior

the minimum relative size of components, default is 0.001. Details about custom setting please refer to flexmix package.

niter

the maximum number of iterations.

nrep

number of run times for each value of component, keep only the solution with maximum likelihood.

min_comp

minimal number of components to fit, default is 1.

max_comp

maximal number of components to fit, default is 10.

Examples

set.seed(2021)
x = c(rnorm(10, 0), rnorm(50, 1), rnorm(20, 4), rnorm(5, 10))
y = gcap.extractComponents(x, max_comp = 5)
y

ShixiangWang/gcaputils documentation built on Feb. 14, 2023, 5:58 a.m.