Conversion | R Documentation |
These utility functions are to convert matrices in different formats.
LTSigma2variance(x)
variance2LTSigma(x)
LTsigma2var(x1, p = NULL)
var2LTsigma(x1)
class2Gamma(class)
Gamma2class(Gamma)
x |
a matrix/array to be converted, the dimension could be
|
x1 |
a vector/matrix to be converted, the length and dimension could be
|
p |
dimension of matrix. |
class |
id of clusters for each observation, length |
Gamma |
containing posterior probabilities if normalized,
otherwise containing component densities weighted by
mixing proportion, dimension |
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.
A vector/matrix/array is returned.
Wei-Chen Chen wccsnow@gmail.com and Ranjan Maitra
https://www.stat.iastate.edu/people/ranjan-maitra
init.EM
, emcluster
.
## 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.