classify: Classify observations

Description Usage Arguments Value See Also Examples

View source: R/classify.R

Description

Classify observations according to the maximum a posterior probabilites.

Usage

1
classify(x, theta)

Arguments

x

Either a matrix of A) observations where rows corresponds to obsercations and columns to dimensions or B) class probabilities where rows correspond to obsevations and columns to components.

theta

A list of parameters for the full model as described in rtheta. If theta is supplied, x are assumed to be observations (A). If theta is missing, x are assumed to be probabilites (B).

Value

A integer vector of class numbers with length equal to the number of rows in x.

See Also

get.prob

Examples

1
2
3
4
5
6
7
8
# Classify using probabilites (usually returned from get.prob)
probs <- matrix(runif(75), 25, 3)
classify(probs)

# Classify using a matrix of observations and theta
theta <- rtheta(d = 4, m = 3)
u <- SimulateGMCMData(n = 20, theta = theta)$u
classify(x = u, theta = theta)

GMCM documentation built on Nov. 6, 2019, 1:08 a.m.