A classifier based on Bayes rule, that is maximum a posterior probabilities of class membership
Classifier_Bayes(dat, n, p, g, pi, mu, sigma, ncov =2)
Arguments
dat: An n×p matrix where each row represents an individual observation
n: Number of observations.
p: Dimension of observation vecor.
g: Number of classes.
pi: A g-dimensional vector for the initial values of the mixing proportions.
mu: A p×g matrix for the initial values of the location parameters.
sigma: A p×p covariance matrix if ncov=1, or a list of g covariance matrices with dimension p×p×g if ncov=2.
ncov: Options of structure of sigma matrix; the default value is 2; ncov = 1 for a common covariance matrix; ncov = 2 for the unequal covariance/scale matrices.
where ϕ is a normal probability function with mean μi and covariance matrix Σi, and zij is is a zero-one indicator variable denoting the class of origin. The Bayes' Classifier of allocation assigns an entity with feature vector yj to Class Ck if