Multivariate overview
Useful matrix operations for multivariate samples.
Added in v1.0.0
Table of contents
Model
MultivariateSample (type alias)
An observation is a (free) collection of data vectors, where N is the number of variables associated with the observation
Signature
export type MultivariateSample<N> = RNEA.ReadonlyNonEmptyArray<V.Vec<N, number>>
Example
// Given three subjects whose measurements are height, weight, shoe size, we can construct a correlation matrix as follows:
import * as V from '@jacob-alford/matrix-ts/Vector'
import * as MStat from '@jacob-alford/matrix-ts/Multivariate'
const obs1 = V.fromTuple([167, 63, 8])
const obs2 = V.fromTuple([200, 94, 12])
const obs3 = V.fromTuple([160, 65, 9])
const observations: MStat.MultivariateSample<3> = [obs1, obs2, obs3]
// This determines how mutually correlated the different variables are
MStat.correlation(observations)
Added in v1.0.0
Multivariate Statistics
correlation
The correlation matrix where each index: i, j represent the correlation between those two random variables
Signature
export declare const correlation: <N extends number>(
s: RNEA.ReadonlyNonEmptyArray<V.Vec<N, number>>
) => M.Mat<N, N, number>
Added in v1.0.0
covariance
The covariance matrix where each index: i, j represent the variance between each random variable of the Multivariatesample
Signature
export declare const covariance: <N extends number>(
s: RNEA.ReadonlyNonEmptyArray<V.Vec<N, number>>
) => M.Mat<N, N, number>
Added in v1.0.0
deviation
The difference in observation from a mean of MultivariateSample
Signature
export declare const deviation: <N extends number>(
s: RNEA.ReadonlyNonEmptyArray<V.Vec<N, number>>
) => RNEA.ReadonlyNonEmptyArray<V.Vec<N, number>>
Added in v1.0.0
mean
The average value over different variables
Signature
export declare const mean: <N extends number>(s: RNEA.ReadonlyNonEmptyArray<V.Vec<N, number>>) => V.Vec<N, number>
Added in v1.0.0