scatter: Compute the scatter matrix

Description Usage Arguments Value Author(s) Examples

Description

This functions is a fast computation of the scatter matrix and cross-scatter matrix given by

XX^T

and XY^T respectively.

Usage

1
2
3
scatter(X, center = TRUE)

xscatter(X, Y, center = TRUE)

Arguments

X

An n by p1 numeric matrix with observations in the rows and variables in the columns.

center

logical. If TRUE, the data-matrices are centered first.

Y

An n by p2 as X.

Value

The p1 times p1 scatter matrix or p1 times p2 cross-scatter matrix.

Author(s)

Anders Ellern Bilgrau <anders.ellern.bilgrau (at) gmail.com>

Examples

1
2
3
4
5
6
7
8
n <- 11
X <- createData(n, 4)
Y <- createData(n, 2)
scatter(X)
(n-1)*cov(X)

xscatter(X, Y)
n*xcov(X, Y, method = "ML")  # == (n - 1)*xcov(X, Y)

AEBilgrau/correlateR documentation built on June 1, 2019, 9:11 p.m.