Learn R Programming

SSLfmm (version 0.1.0)

error_beta_classification: Compute Theoretical Bayes' Error for a Binary Gaussian Mixture

Description

Computes the Bayes'classification error rate for a two-component Gaussian mixture given mu_hat, Sigma_hat, and pi_hat. If mu_hat is supplied as a list of length 2, it is converted to a \(p \times 2\) matrix internally.

Usage

error_beta_classification(mu_hat, Sigma_hat, pi_hat)

Value

A numeric scalar giving the theoretical Bayes' classification error rate.

Arguments

mu_hat

Either a numeric matrix of size \(p \times 2\) whose columns are component means, or a list of two numeric vectors.

Sigma_hat

Numeric \(p \times p\) covariance matrix shared across components.

pi_hat

Numeric vector of length 2 with mixing proportions \((\pi_1, \pi_2)\) that are non-negative and sum to 1.

Details

The linear discriminant is $$ \beta_1 = \Sigma^{-1}(\mu_1 - \mu_2), \qquad \beta_0 = -\frac{1}{2}(\mu_1 + \mu_2)^\top \Sigma^{-1}(\mu_1 - \mu_2) + \log(\pi_1 / \pi_2) $$ and the Bayes' error is $$ \mathrm{Err} = \sum_{k = 1}^2 \pi_k \, \Phi\left( \frac{(-1)^k \{\beta_0 + \beta_1^\top \mu_k\}} {\|\beta_1\|} \right), $$ where \(\Phi\) is the standard normal cdf.

Examples

Run this code
mu_hat <- matrix(c(1, 0, -1, 0), nrow = 2)  # columns are mu1, mu2
Sigma_hat <- diag(2)
pi_hat <- c(0.5, 0.5)
error_beta_classification(mu_hat, Sigma_hat, pi_hat)

Run the code above in your browser using DataLab