Library: | distribs |
See also: | normalmixselect normalmix normal |
Quantlet: | normalmixdens | |
Description: | evaluating a normal mixture density function |
Usage: | fx = normalmixdens(x,w,mu,sigma) | |
Input: | ||
x | p x 1 vector, evaluation point(s) | |
w | p x 1 vector, weights of the mixture components | |
mu | p x 1 vector, means of the mixture components | |
sigma | p x 1 vector, standard deviations of the mixture components | |
Output: | ||
fx | p x 2 matrix, represents the points x and the values of the density at x |
- components with w <= 0 are ignored;
- negative standard deviations are not accepted
library("distribs") library("plot") w=#(1,1,1) mu=#(0,5,10) sig=#(1,1,1) x=grid(-5,0.1,200) fx=normalmixdens(x,w,mu, sig) px=setmask(fx, "line") plot(px)
Plots a trimodal normal mixture density function