Keywords - Function groups - @ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

Library: distribs
See also: normalmixselect normalmixdens normal

Quantlet: normalmix
Description: generates normal mixture pseudo-variates

Reference(s):

Usage: x = normalmix(n,w,mu,sigma)
Input:
n scalar, length of vector x, number of variates generated
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:
x n x 1 vector, normal mixture variates

Note:

Example:
library("distribs")
library("plot")
library("smoother")
n=1000
w=#(1,2,3)
mu=#(0,5,10)
sig=#(1,1.2,1.4)
x=normalmix(n,w,mu, sig)
fhx=denxest(x)
p1=setmask(fhx,"line")
plot(p1)

Result:
1000 pseudo-variates are created. then the density is estimated
using a kernel estimate, and the result (a mixture of three
normal distributions) is plotted.



Author: J.-U. Scheer, 20020406 license MD*Tech
(C) MD*TECH Method and Data Technologies, 05.02.2006