pooled_scatter: Calculate Pooled Scatter (Within-Class Scatter) Matrix

View source: R/scatter.R

pooled_scatterR Documentation

Calculate Pooled Scatter (Within-Class Scatter) Matrix

Description

Computes the within-class scatter matrix for a dataset with given class labels. This uses a trick involving the class means and their counts to produce:

S_w = \sum_i x_i x_i^T - \sum_k n_k M_k M_k^T

Usage

pooled_scatter(X, Y)

Arguments

X

A numeric matrix (n x d). Rows are samples, columns are features.

Y

A factor or numeric vector of length n representing class labels.

Value

A numeric (d x d) matrix representing the within-class scatter matrix.


bbuchsbaum/discursive documentation built on April 14, 2025, 4:57 p.m.