rdmix: Mixture of Normal Distributions In hafen/ed: ed: a regression approach to density estimation

Description

Density and random generation of a mixture of normal distributions

Usage

 ```1 2 3``` ```rmix(n, mu = 0, sigma = 1, delta = 1) dmix(x, mu, sigma, delta) ```

Arguments

 `n` number of observations `mu` vector of means `sigma` vector of standard deviations `delta` vector `x` vector of quantiles

Details

If a scalar is specified for any of the parameters, it will be replicated to meet the length of the other parameters. If the `delta` values do not sum to 1, they will be normalized with a warning.

Value

`dmix` gives the density and `rnorm` generates random deviates

Ryan Hafen

Examples

 ```1 2 3 4 5 6 7 8 9``` ```mu <- c(0, 2, 3.5, 5, 8) sigma <- c(0.5, 0.7, 0.3, 0.6, 1.4) delta <- 0.2 x <- rmix(2000, mu, sigma, delta) hist(x, breaks = 100, freq = FALSE) ss <- seq(-2, 12, length = 200) lines(ss, dmix(ss, mu, sigma, delta), col = "red") ```

hafen/ed documentation built on May 17, 2019, 1:32 p.m.