MixMVN_BayesianPosteriori: Calculate Bayesian posteriori MVN mixture distribution

Description Usage Arguments Value See Also Examples

Description

The function to export the mixture probabilities, the mean vectors and covariance matrices of Bayesian posteriori MVN mixture distribution in the basis of given priori information (priori MVN mixture) and observation data (a design matrix containing all variables).

Usage

1
2
3
4
5
# paramtric columns-only as input data:
# data <- dataset2[,1:4]

# Specify species to get parameters of MVN mixture model:
MixMVN_BayesianPosteriori(data, species, idx)

Arguments

data

A data.frame or matrix-like data: obervations should be arrayed in rows while variables should be arrayed in columns.

species

A positive integer. The 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 is 1, which means no clustering algrithm is used.

idx

A vector-like data to import for accepting clustering result. Default value is generated by kmeans clustering. Notice the length of idx should be the same as observation numbers of data (rows).

Value

return a matrix-like result containing all parameters of Bayesian posteriori MVN mixture distribution: Clusters are arrayed in rows, while the mixture probabilities, posteriori mean vectors and posteriori covariance matrices are arrayed in columns.

See Also

kmeans, MVN_BayesianPosteriori

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
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_BayesianPosteriori(data=data_dim, species=3)
result

# Get the parameters of the cluster1:
result[1,]

# Get the mixture probability of cluster2:
# (Attention to the difference between
# result[2,1][[1]] and result[2,1])
result[2,1][[1]]

# Get the mean vector of cluster1:
result[1,2][[1]]

# Get the covariance matrix of cluster3:
result[3,3][[1]]

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