Learn R Programming

nor1mix (version 1.1-3)

norMix: Mixtures of Univariate Normal Distributions

Description

Objects of class norMix represent finite mixtures of (univariate) normal (aka Gaussian) distributions. Methods for construction, printing, plotting, and basic computations are provided.

Usage

norMix(mu, sig2 = rep(1,m), w = NULL, name = NULL, long.name = FALSE)

is.norMix(obj) m.norMix(obj) var.norMix(x, ...) ## S3 method for class 'norMix': mean(x, \dots) ## S3 method for class 'norMix': print(x, \dots)

Arguments

mu
numeric vector of length $K$, say, specifying the means $\mu$ of the $K$ normal components.
sig2
numeric vector of length $K$, specifying the variances $\sigma^2$ of the $K$ normal components.
w
numeric vector of length $K$, specifying the mixture proportions $\pi_j$ of the normal components, $j = 1,\dots,K$. Defaults to equal proportions
name
optional name tag of the result (used for printing).
long.name
logical indicating if the name attribute should use punctuation and hence be slightly larger than by default.
obj,x
an object of class norMix.
...
further arguments passed to methods.

Value

  • norMix returns objects of class "norMix" which are currently implemented as 3-column matrix with column names mu, sig2, and w, and further attributes. The user should rarely need to access the underlying structure directly.

Details

The (one dimensional) normal mixtures, Robjects of class "norMix", are constructed by norMix and tested for by is.norMix. m.norMix() returns the number of mixture components; the mean() method (for class "norMix" returns the mu vector of means and var.norMix() (not a method, call the function explicitly!) the sig2 vector of variances.

For further methods see below.

See Also

dnorMix for the density, pnorMix for the cumulative distribution and the quantile function (qnorMix), and rnorMix for random numbers and plot.norMix, the plot method.

MarronWand has the Marron-Wand densities as normal mixtures.

Examples

Run this code
ex <- norMix(mu = c(1,2,5))# s^2 = 1, equal proportions
ex
plot(ex)# looks like a mixture of only 2

plot(ex, log = "y")# maybe "revealing"

Run the code above in your browser using DataLab