class: Matrix of Indicator Variables given Classification

Description

Converts a classification vector into a matrix of indicator variables.

Usage

class(groups, k)

Arguments

groups

A numeric vector of integers.
Typically the distinct entries of this vector would represent a classification of observations in a data set.

k

An integer indicating the number of groups.

Value

An $n$ (number of observations) by $k$ (number of groups) matrix of (0,1) indicator variables.
The [i,j]th entry is 1 if groups[i] is j and 0 otherwise.

References

Punzo, A., and McNicholas, P. D. (2013). Outlier Detection via Parsimonious Mixtures of Contaminated Gaussian Distributions. arXiv.org e-print 1305.4669, available at: http://arxiv.org/abs/1305.4669.