rnormmix: Generate a mixture with normal components

Description Usage Arguments Value Author(s) Examples

View source: R/normmix.R

Description

Generates a mixture on a 2d window where the means, covariances and component probabilities are chosen randomly. The number of components can be either fixed or random.

For examples see

http://faculty.missouri.edu/~micheasa/sppmix/sppmix_all_examples.html#rnormmix

Usage

1
2
rnormmix(m, sig0, df = 10, rand_m = FALSE, xlim = c(0, 1), ylim = c(0,
  1), dvec, mu0, Sigma0)

Arguments

m

Number of components of the mixture.

sig0

Tuning parameter for generating a random matrix from an Inverse Wishart distribution. If this argument is missing it is set to .1 of the minimum width/height of the window.

df

Degrees of freedom for generating a random matrix from an Inverse Wishart distribution. Default is 10.

rand_m

Request a random number of components. When rand_m = TRUE, the function will randomly choose a number of components from 1:m.

xlim, ylim

Vectors defining the observation window. The component means are sampled uniformly over this window.

dvec

A vector of weights used in the Dirichlet distribution used to sample the mixture probabilities. If the dimension of dvec is not the same as the number of components, then dvec is either truncated to the same dimension or repeated to have dimension m. If missing, a vector of ones is used.

mu0, Sigma0

Mean and covariance matrix for a multivariate normal distribution, used to generate all component means. If mu0 is missing the center of the window is used. If Sigma0 is missing it is set to the identity matrix. If both mu0 and Sigma0 are missing, the component means are generated uniformly over the window of observation.

Value

Object of class normmix.

Author(s)

Sakis Micheas, Yuchen Wang

Examples

1
2
3
4
mix1 <- rnormmix(m = 3, sig0 = .1, df = 5)
summary(mix1)
mix2 <- rnormmix(m = 5, sig0 = .1, df = 5, rand_m = TRUE, ylim = c(0, 5))
summary(mix2)

sppmix documentation built on Jan. 13, 2021, 10:04 p.m.