normMix: Gaussian binary mixture distribution

Description Usage Arguments Value Author(s) References Examples

Description

Density, distribution, function, quantile function, and random generation for the mixture of two Gaussian distributions with mixture proportion p and 1-p.

Usage

1
2
3
4
dnormMix(x, mean=c(0,1), sd=c(1,1), p=1)
pnormMix(x, mean=c(0,1), sd=c(1,1), p=1)
qnormMix(x, mean=c(0,1), sd=c(1,1), p=1)
rnormMix(n, mean=c(0,1), sd=c(1,1), p=1)

Arguments

x

vector of quantiles or probabilities.

n

number of observations.

mean

vector of two means.

sd

vector of standard deviations.

p

mixture proportion of the first distribution (the second has proportion 1-p).

Value

dnormMix gives the density, pnormMix gives the distribution function, qnormMix gives the quantile function, and rnormMix generates random deviates.

Author(s)

Leendert van Maanen (l.vanmaanen@uva.nl)

References

Van Maanen, L. & Van Rijn, H (submitted). The fixed-point property in concurrent processing. Manuscript submitted for publication

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
## the default value for p reduces this function to a normal distribution
dnormMix(1) == dnorm(1)

## plot that illustrates the fixed-point property
p <- c(.8,.5,.2)
m <- c(0,1); s <- c(1,2)
plot(function(X) {dnormMix(X, m, s, p[1])}, -5,10, ylab="Density",xlab="x", bty='L')
for (i in 2:3) {
  plot(function(X) {dnormMix(X, m, s, p[i])},-5,10, add=TRUE, lty=i, lwd=2)
}
legend("topright", legend=paste("p=",p,sep=''), lty=1:3, lwd=2, bty='n')

JimGrange/Van-Maanen-fp documentation built on May 7, 2019, 10:51 a.m.