|
|
| Line 31: |
Line 31: |
| ---- | | ---- |
| ;Usage 2: '''<code>svd('''1''', <var>A</var>, <var>trn</var>)</code>''' | | ;Usage 2: '''<code>svd('''1''', <var>A</var>, <var>trn</var>)</code>''' |
| :;<var>A</var>:the NxM matrix to be transformed
| | :;Result 2: Returns the matrix ''C''=<code>trn(''T'')*''T''</code>. ''C'' is a square matrix with M rows and columns (MxM). |
| :;<var>trn</var>:transformation to be applied to A (see '''Usage 1''')
| |
| :;Result 2: Computes the transformed matrix ''T'' and returns the matrix ''C''=<code>trn(''T'')*''T''</code>. ''C'' is a square matrix with M rows and columns (MxM). | |
|
| |
|
|
| |
|
| |
| ::{|class="einrahmen"
| |
| !''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''.
| |
| :<code>''v'' = sum( (''x''-avr(''x''))?^2 ) / (nrow(''x'')-1)</code>
| |
| :<code>''v'' = (''x''-avr(''x''))^2 / (nrow(''x'')-1)</code>
| |
| ----
| |
| ;Usage 2: '''<code>var(''x''<sub>vector</sub>, ''y''<sub>vector</sub>)</code>'''
| |
| ;Result 2: The covariance ''v'' of the vectors ''x'' and ''y''.
| |
| :<code>''v'' = sum( (''x''-avr(''x'') ?* (''y''-avr(''y'')) ) / (nrow(''x'')-1)</code>
| |
| :<code>''v'' = ((''x''-avr(''x'') * (''y''-avr(''y''))) / (nrow(''x'')-1)</code>
| |
| ----
| |
| ;Usage 3: '''<code>var(''x''<sub>matrix</sub>)</code>'''
| |
| :'''<code>var(''x''<sub>matrix</sub>, ''y''<sub>scalar</sub>)</code>'''
| |
| :'''<code>var(''x''<sub>matrix</sub>, ''y''<sub>vector</sub>)</code>'''
| |
| ;Result 3: The covariance matrix ''v'' of the column vectors of ''x''.
| |
| :<code>''v''[i,j] = sum( (''x''[*,i]-a[i]) ?* (''x''[*,j]-a[j]) ) / (nrow(''x'')-1) , with: i,j = 0..ncol(''x'')-1</code>
| |
| :The column averages a[i] are computed as follows:
| |
| ::{|class="einrahmen"
| |
| |''y'' not supplied || a[i] = avr(''x''[*,i])
| |
| |-
| |
| |''y''<sub>scalar</sub> || a[i] = ''y''
| |
| |-
| |
| |''y''<sub>vector</sub> || a[i] = ''y''[i]
| |
| |-
| |
| |}
| |
|
| |
|
| ;See also: [[../var|var]], [[../corr|corr]], [[../dist|dist]], [[../haclust|haclust]], [[../modclust|modclust]] | | ;See also: [[../var|var]], [[../corr|corr]], [[../dist|dist]], [[../haclust|haclust]], [[../modclust|modclust]] |
|
| |
|
| [[../#Functions|<function list>]] | | [[../#Functions|<function list>]] |
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 (NxM) |
description |
trn(T)*T (MxM)
|
| 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)
- Result 2
- Returns the matrix C=
trn(T)*T. C is a square matrix with M rows and columns (MxM).
- See also
- var, corr, dist, haclust, modclust
<function list>