mixmodMap_V2M: Vector of Labels to Matrix of Class Assignments Conversion

Description Usage Arguments Value Author(s) References Examples

View source: R/mixmodMap_V2M.R

Description

Converts a vector of labels to a matrix of class assignments.

Usage

1
mixmodMap_V2M(z, n = length(z), K = max(z))

Arguments

z

vector of labels corresponding to the class assigned to each observation.

n

number of observations.

K

number of classes.

Value

matrix of class assignments. Rows correspond to observations and columns correspond to classes. Each row contains only zeros except for the column corresponding to the class to which the observation is assigned, which value is one.

Author(s)

J.-P. Baudry and G. Celeux

References

J.-P. Baudry, A. E. Raftery, G. Celeux, K. Lo and R. Gottardo (2010). Combining mixture components for clustering. Journal of Computational and Graphical Statistics, 19(2):332-353.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
set.seed(1)

data(Baudry_etal_2010_JCGS_examples)
res <- mixmodCombi(ex4.1, nbCluster = 1:8)

res@hierarchy[[3]]@partition[1:10] # Is the labels vector of the classes assigned to the 10 first 
# observations

mixmodMap_V2M(res@hierarchy[[3]]@partition[1:10]) #  Is the corresponding matrix of class 
# assignments for the 10 first observations 

RmixmodCombi documentation built on May 2, 2019, 1:27 p.m.