Skip to contents

Thin extender over dirichletprocess::DirichletProcessGaussian + dirichletprocess::Fit for a Bayesian nonparametric Dirichlet-process Gaussian mixture model (Ross & Markwick, 2018; MacEachern, 1994). Constructs the DP object on y and then runs the Gibbs sampler for iterations sweeps.

Usage

morie_dp_gaussian_mixture(y, iterations = 1000, ...)

Arguments

y

Numeric vector of observations to model with the DP Gaussian mixture.

iterations

Integer; number of Gibbs-sampler iterations to run via dirichletprocess::Fit (default 1000).

...

Further arguments forwarded to dirichletprocess::DirichletProcessGaussian (e.g. g0Priors, alphaPriors, mhDraws, verbose).

Value

A list with $method = "dirichletprocess::DirichletProcessGaussian + Fit" and $raw (the fitted dirichletprocess object after the Gibbs run, containing the cluster assignments, cluster parameters, and concentration-parameter trace).

Examples

if (FALSE) { # \dontrun{
  if (requireNamespace("dirichletprocess", quietly = TRUE)) {
    set.seed(1)
    y <- c(stats::rnorm(50, -2), stats::rnorm(50, 2))
    morie_dp_gaussian_mixture(y, iterations = 200)
  }
} # }