Calculate the density of multivariate mixture models at data points for each component
Usage
ddmix( dat, n, p, g, distr, mu, sigma, dof=NULL, delta=NULL)
Arguments
dat
The dataset
n
The total number of points
p
Dimension of data
g
The number of clusters
distr
A three letter string indicating the distribution; "mvn" for normal, "mvt" for t distribution, "msn" for skew normal, and "mst" for skew t distribution.
mu
A numeric mean matrix with each column corresponding to the mean
sigma
An array of dimension (p,p,g) with first two dimensions corresponding covariance matrix of each component
dof
A vector of degrees of freedom for each component
delta
A matrix with each column as skew parameter vector
Value
ddmix gives an n by g matrix of logorithm of density at each data point for each component.
References
McLachlan G.J. and Krishnan T. (2008). The EM Algorithm and Extensions (2nd). New Jersay: Wiley.
McLachlan G.J. and Peel D. (2000). Finite Mixture Models. New York: Wiley.
See Also
ddmvn,ddmvt,ddmsn,ddmst.
Examples
p=2
g=3
#mixing propotion of each component
pro <- c(0.3,0.3,0.4)
#specify mean and covariance matrix for each component
sigma<-array(0,c(2,2,3))
for(h in 2:3) sigma[,,h]<-diag(2)
sigma[,,1]<-cbind( c(1,0),c(0,.1))
mu <- cbind(c(4,-4),c(3.5,4),c( 0, 0))
#specify other parameters for "mvt","msn","mst"
delta <- cbind(c(3,3),c(1,5),c(-3,1))
dof <- c(3,5,5)
#specify the distribution
distr <- "mst"
y <- c(1,2)
n=1
#then the density value at y for the mixture model is
ddmix(y, n, p, g, distr, mu, sigma, dof, delta)
Results
R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> library(EMMIXskew)
Loading required package: lattice
Loading required package: mvtnorm
Loading required package: KernSmooth
KernSmooth 2.23 loaded
Copyright M. P. Wand 1997-2009
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/EMMIXskew/ddmix.Rd_%03d_medium.png", width=480, height=480)
> ### Name: ddmix
> ### Title: Density Functions of Mixture Models
> ### Aliases: ddmix
> ### Keywords: cluster
>
> ### ** Examples
>
>
> p=2
> g=3
>
> #mixing propotion of each component
> pro <- c(0.3,0.3,0.4)
>
> #specify mean and covariance matrix for each component
>
> sigma<-array(0,c(2,2,3))
> for(h in 2:3) sigma[,,h]<-diag(2)
> sigma[,,1]<-cbind( c(1,0),c(0,.1))
>
> mu <- cbind(c(4,-4),c(3.5,4),c( 0, 0))
>
> #specify other parameters for "mvt","msn","mst"
>
> delta <- cbind(c(3,3),c(1,5),c(-3,1))
> dof <- c(3,5,5)
>
> #specify the distribution
> distr <- "mst"
>
> y <- c(1,2)
>
> n=1
>
> #then the density value at y for the mixture model is
>
> ddmix(y, n, p, g, distr, mu, sigma, dof, delta)
[,1] [,2] [,3]
[1,] -10.49563 -8.278297 -5.645026
>
>
>
>
>
>
> dev.off()
null device
1
>