svd

From STX Wiki
Jump to navigationJump to search

Compute the variance, covariance or covariance-matrix.


Usage 1
svd(0, A, trn)
A
the NxM matrix to be transformed
trn
transformation to be applied to A
trn transformed matrix T description trn(T)*T (MxM matrix)
0 T[i,j] = A[i,j] no transformation "Streumatrix"
1 T[i,j] = A[i,j]-avr(A) subtract matrix mean
2 T[i,j] = A[i,j]-avr(A[*,j]) subtract column mean (center columns) covariance matrix
3 T[i,j] = (A[i,j]-avr(A[*,j]))/dev(A[*,j]) subtract column mean, devide by column deviation (center and standardize columns) correlation matrix
4 T[i,j] = A[i,j]-(avr(A[i,*])+avr(A[*,j]))+avr(A) subtract row and column mean, add matrix mean (center rows and columns)
Result 1
The transformed matrix T.

Usage 2
svd(1, A, trn)
A
the NxM matrix to be transformed
trn
transformation to be applied to A (see Usage 1)
Result 2
Computes the transformed matrix T and returns the matrix C=trn(T)*T. C is a square matrix with M rows and columns (MxM).


trn transformation description 0 T[i,j] = A[i,j] no transformation
1 T[i,j] = A[i,j]-avr(A) subtract matrix mean
2 T[i,j] = A[i,j]-avr(A[*,j]) subtract column mean (center columns)
3 T[i,j] = (A[i,j]-avr(A[*,j]))/dev(A[*,j]) subtract column mean, devide by column deviation (center and standardize columns)
4 T[i,j] = A[i,j]-(avr(A[i,*])+avr(A[*,j]))+avr(A) subtract row and column mean, add matrix mean (center rows and columns)


Result 1
The variance v of vector x.
v = sum( (x-avr(x))?^2 ) / (nrow(x)-1)
v = (x-avr(x))^2 / (nrow(x)-1)

Usage 2
var(xvector, yvector)
Result 2
The covariance v of the vectors x and y.
v = sum( (x-avr(x) ?* (y-avr(y)) ) / (nrow(x)-1)
v = ((x-avr(x) * (y-avr(y))) / (nrow(x)-1)

Usage 3
var(xmatrix)
var(xmatrix, yscalar)
var(xmatrix, yvector)
Result 3
The covariance matrix v of the column vectors of x.
v[i,j] = sum( (x[*,i]-a[i]) ?* (x[*,j]-a[j]) ) / (nrow(x)-1) , with: i,j = 0..ncol(x)-1
The column averages a[i] are computed as follows:
y not supplied a[i] = avr(x[*,i])
yscalar a[i] = y
yvector a[i] = y[i]
See also
var, corr, dist, haclust, modclust

<function list>

Navigation menu

Personal tools