Description Usage Arguments Details Value References See Also Examples

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`

.

1 2 3 4 5 6 7 | ```
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)
``` |

`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 |

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`

.

`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`

.

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.

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | ```
## 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)
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.