92_convert: Convert Matrices in Different Format

Description Usage Arguments Details Value Author(s) References See Also Examples

Description

These utility functions are to convert matrices in different formats.

Usage

1
2
3
4
5
6

Arguments

x

a matrix/array to be converted, the dimension could be K * p(p+1)/2 or p * p * K.

x1

a vector/matrix to be converted, the length and dimension could be p(p+1)/2 and p * p.

p

dimension of matrix.

class

id of clusters for each observation, length n.

Gamma

containing posterior probabilities if normalized, otherwise containing component densities weighted by mixing proportion, dimension n * K.

Details

LTSigma2variance converts LTSigma format to 3D array, and variance2LTSigma is the inversion function.

LTsigma2var converts LTsigma format to a matrix, and var2LTsigma is the inversion function. Note that LTsigma is one component of LTSigma.

class2Gamma converts id to a Gamma matrix where with probability 1 for the cluster where the observation belongs to, and Gamma2class converts posterior to cluster id where largest posterior is picked for each observation.

Value

A vector/matrix/array is returned.

Author(s)

Wei-Chen Chen [email protected] and Ranjan Maitra

References

http://maitra.public.iastate.edu/

See Also

init.EM, emcluster.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
## Not run: 
library(EMCluster, quietly = TRUE)
x <- da2$LTSigma
class <- da2$class

y <- LTSigma2variance(x)
str(y)
y <- variance2LTSigma(y)
str(y)
sum(x != y)

Gamma <- class2Gamma(class)
class.new <- Gamma2class(Gamma)
sum(class != class.new)

## End(Not run)

EMCluster documentation built on Aug. 26, 2017, 9:04 a.m.