d: Deviation from the Mean

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/linearAlgebra-d.R

Description

Calculates the deviation from the mean.

Usage

1
d(x)

Arguments

x

Numeric matrix, data frame, or vector. Data matrix.

Details

The n \times 1 vector of deviations from the mean is given by

\mathbf{d} = \mathbf{x} - \bar{x}

where \mathbf{x} is an n \times 1 column vector and \bar{x} is the mean of \mathbf{x}.

The n \times k matrix of deviations from the mean is given by

\mathbf{D} = \mathbf{X} - \mathbf{1}_{n} \bar{\mathbf{x}}

where \mathbf{X} is an n \times 1 matrix, \mathbf{1}_{n} is an n \times 1 column vector of ones, and \bar{\mathbf{x}} is the k \times 1 mean vector of \mathbf{X}.

Value

A matrix.

Author(s)

Ivan Jacob Agaloos Pesigan

See Also

Other Scaling Functions: deltacapsq(), z()

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
x <- matrix(
  rnorm(n = 5 * 5, mean = 100, sd = 15),
  ncol = 5
)

d(x)

x <- rnorm(5)

d(x)

jeksterslab/linearAlgebra documentation built on Dec. 20, 2021, 10:10 p.m.