Learn R Programming

bda (version 18.3.2)

fnm: Distribution of Two Finite Gaussian Mixtures

Description

To compute the values of the density and distribution functions of two finite Gaussian mixture models.

Usage

fnm(p1,p2,mu1,mu2,sig1,sig2,from,to)

Value

Return the densities ('y') and probabilities ('Fx') over a grid of 'x'.

Arguments

p1,p2

mixing coefficients.

mu1,mu2

vectors of the mean values of the Gaussian components.

sig1,sig2

vectors of the SD values of the Gaussian components.

from,to

to specify the range of data.

Examples

Run this code
data(Pain)

group <- pain$treat
x <- pain$recall0
y <- pain$recall1
#out <- tkde(x,y,group)
out <- tkde(x,y,group,type='percent')
plot(out$risk,type='l')
abline(h=1,col='gray')

plot(out$responder,type='l',ylim=c(-.28,.1))
lines(out$resp$ll~out$resp$x,lty=2,col=1+(out$resp$p<0.05))
lines(out$resp$ul~out$resp$x,lty=2,col=1+(out$resp$p<0.05))
abline(h=0,col='gray')

plot(out$g2,type='l')
lines(out$g1,col=2)

Run the code above in your browser using DataLab