MixMVN_BayesianPosterior: MixMVN_BayesianPosterior

Description Usage Arguments Value Author(s) See Also Examples

Description

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.

Usage

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)

Arguments

data

Design matrix: data.frame or matrix-like data sampling from different multivariate normal distribution, dim(data)[1] should be the number of observations and dim(data)[2] should be the number of variables or parameters.

species

Number of clusters: number of clusters for import data. It will be only called once by the next argument idx through kmeans clustering algrithm in this function. Default value 1 means no clustering is used if the idx is also the default. In that case, this function will execute identical process as MVN_BayesianPosterior().

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.

Value

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.

Author(s)

ZHANG Chen

See Also

kmeans, MVN_BayesianPosterior

Examples

 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])

CubicZebra/MVNBayesian documentation built on May 17, 2019, 2:14 a.m.