Mixed normals {essHist} | R Documentation

## The mixture of normal distributions

### Description

Density, distribution function and random generation for the mixture of normals with each component specified by `mean` and `sd`, and mixture weights by `prob`. `paramExample` gives detailed parameters for some examples specified by `type`.

### Usage

    dmixnorm(x, mean = c(0), sd = rep(1,length(mean)),
              prob = rep(1,length(mean)), type = NULL, ...)
    pmixnorm(x, mean = c(0), sd = rep(1,length(mean)),
              prob = rep(1,length(mean)), type = NULL, ...)
    rmixnorm(n, mean = c(0), sd = rep(1,length(mean)),
              prob = rep(1,length(mean)), type = NULL)
    paramExample(type)

### Arguments

`x` | vector of locations.
`n` | integer; number of observations.
`mean` | vector of means for each mixture component.
`sd` | vector of standard deviations for each mixture component. Default is of unit variance for each component.
`prob` | vector of prior probability for each mixture component (i.e. mixture weights). All nonnegative values are allowed, and automatically recaled to ensure their sum equal to 1. Default is of equal probability for each component.

`type`

a (case insensitive) character string of example name; It includes examples from Marron & Wand (1992): "MW1", ..., "MW15", or equivalently "gauss", "skewed_unimodal", "strong_skewed", "kurtotic_unimodal", "outlier", "bimodal", "separated_bimodal", "skewed_bimodal", "trimodal", "claw", "double_claw", "asymmetric_claw", "asymmetric_double_claw", "smooth_comb", "discrete_comb"; It also includes "harp" example from Li et al. (2016).

`...` | further arguments passed to `dnorm` and `pnorm`.

### Details

Users either provide, optionally, `mean`, `sd` and `prob`; or `type`. In case of providing `type`, the values of `mean`, `sd` and `prob` are ignored.

The default case is standard normal, the same as `dnorm`, `pnorm` and `rnorm`.

### Value

`dmixnorm` gives the density, `pmixnorm` gives the distribution function, and `rmixnorm` generates random deviates.

The length of the result is determined by `n` for `rmixnorm`, and is the length of `x` for `dmixnorm` and `pmixnorm`.

`paramExample` gives a data frame with components `mean`, `sd` and `prob`.

### References

Li, H., Munk, A., Sieling, H., and Walther, G. (2016). The essential histogram. arXiv:1612.07216.

Marron, J. S., & Wand, M. P. (1992). Exact mean integrated squred error. Ann. Statist., 20(2), 712–736.

### See Also

Normal for standard normal distributions; Distributions for other standard distributions.

### Examples

    ## Example harp
    type = "harp"
    #     generate random numbers
    n = 500
    Y = rmixnorm(n, type = type)
    #     compute the density
    x = seq(min(Y), max(Y), length.out = n)
    f = dmixnorm(x, type = type)
    #     compute the distribution
    F = pmixnorm(x, type = type)
    #     plots
    op = par(mfrow = c(1,2))
    plot(x, f, type = "l", main = "Harp Density")
    rug(Y, col = 'red')
    plot(x, F, type = "l", main = "Harp Distribution")
    rug(Y, col = 'red')
    par(op)

[Package essHist version 1.2.2 Index]