dMixNormal | R Documentation |
Density function, cumulative distribution function and random generation for the mixture of normal distributions
dMixNormal(x, mean, sd, probs) pMixNormal(q, mean, sd, probs, lower.tail = TRUE) rMixNormal(n, mean, sd, probs)
x |
the quantile for which density will be determined |
mean |
the vector of means of mixed normal distributions |
sd |
the vector of standard deviations of mixed normal distributions |
probs |
the vector of normalized probability weight of mixed normal distributions |
q |
the quantile for which cumulative distribution will be determined |
lower.tail |
logical, if TRUE (default), probability of X being smaller than or equal to q is returned. If false, the probability of being greater is returned. |
n |
the number of random values to return |
dMixNormal
returns the probability density
pMixNormal
returns the cumulative distribution
rMixNormal
returns a vector of random numbers following the specified distribution
# generate some random numbers from the mixture of two normal distributions # with equal variance and weight but different means norm.mix = rMixNorm(n=1e3,mean=c(-1,1),sd=c(1,1),probs=c(0.5,0.5)) # test the empirical distribution against the theoretical one ks.test(norm.mix,pMixNormal,mean=c(-1,1),sd=c(1,1),probs=c(0.5,0.5))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.