Description Usage Arguments Value Author(s) See Also Examples
Given a design matrix (data) including sufficient samplings from different multivariate normal distribution, export the parameters of Bayesian posterior multivariate normal mixture distribution. Parameters contains mixture probability, mean vector and covariance matrix, for each cluster.
1 2 3 4 5 | # paramtric columns-only as input data:
# data <- dataset2[,1:4]
# Specify species to get parameters of mixture MVN:
MixMVN_BayesianPosterior(data, species, idx)
|
data |
Design matrix: data.frame or matrix-like data sampling from different multivariate normal distribution, |
species |
Number of clusters: number of clusters for import data. It will be only called once by the next argument |
idx |
port for clustering result: an vector which should have the identical dimension as the number of samplings of data. Default value is generated by kmeans algrithm. |
return a matrix-like result with contains all parameters of Bayesian posterior multivariate normal mixture distribution: All clusters are arrayed in rows and mixture probability, posterior mean and posterior covariance for each cluster are arrayed in columns.
ZHANG Chen
kmeans, MVN_BayesianPosterior
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | library(plyr)
# Design matrix should only contain columns of variables
# Export will be a matrix-like data
# Using kmeans (default) clustering algrithm
data_dim <- dataset2[,1:4]
result <- MixMVN_BayesianPosterior(data=data_dim, species=3)
result
# class(result)
# Get the parameters of the 1st cluster:
result[1,]
# class(result[1,])
# Get the mixture probability of cluster2:
result[2,1][[1]]
# class(result[2,1][[1]])
# class(result[2,]$probability)
# class(result[2,1])
# Get the mean vector of cluster1:
result[1,2][[1]]
# class(result[1,2][[1]])
# class(result[1,]$mean)
# class(result[1,2])
# Get the covariance matrix of cluster3:
result[3,3][[1]]
# class(result[3,3][[1]])
# class(result[3,]$var)
# class(result[3,3])
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.