Description Usage Arguments Value See Also Examples
View source: R/MixMVN_BayesianPosteriori.R
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).
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)
|
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 |
A vector-like data to import for accepting clustering result. Default value is generated by |
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.
kmeans
, MVN_BayesianPosteriori
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]]
|
probability mean var
cluster1 0.40625 Numeric,4 Numeric,16
cluster2 0.3020833 Numeric,4 Numeric,16
cluster3 0.2916667 Numeric,4 Numeric,16
$probability
[1] 0.40625
$mean
[,1]
dimen1 0.9801142
dimen2 0.9406973
dimen3 1.0123423
dimen4 0.9965562
$var
dimen1 dimen2 dimen3 dimen4
dimen1 0.0029772772 0.0002209323 -0.0001688302 -0.0009481328
dimen2 0.0002209323 0.0027897337 0.0003187421 -0.0009681992
dimen3 -0.0001688302 0.0003187421 0.0027238369 -0.0003243733
dimen4 -0.0009481328 -0.0009681992 -0.0003243733 0.0032880276
[1] 0.3020833
[,1]
dimen1 0.9801142
dimen2 0.9406973
dimen3 1.0123423
dimen4 0.9965562
dimen1 dimen2 dimen3 dimen4
dimen1 0.0031284484 3.498480e-04 7.472368e-04 -0.0008624259
dimen2 0.0003498480 8.742726e-04 -6.015018e-05 0.0001817702
dimen3 0.0007472368 -6.015018e-05 1.192155e-02 -0.0073731140
dimen4 -0.0008624259 1.817702e-04 -7.373114e-03 0.0131048366
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.