Gscale

From Eigenvector Research Documentation Wiki
Revision as of 15:25, 3 September 2008 by imported>Jeremy (Importing text file)
Jump to navigation Jump to search

Purpose

Group/block scaling for a single or multiple blocks.

Synopsis

[gxs,mxs,stdxs] = gscale(xin,numblocks)

Description

GSCALE scales an input matrix xin such that the columns have mean zero, and variance in each block/sub-matrix relative to the total variance in xin equal to one. The purpose is to provide equal sum-of-squares weighting to each block in xin.

Inputs are a matrix xin (class "double") and the number of sub-matrices or blocks numblocks. Note that size(xin,2)/numblocks must be an integer. If numblocks is not included, it is assumed to 1 i.e. the matrix xin is treated as a single block.

If (numblocks) is 0 (zero) then automatic mode is used based on the dimensions of the (xin) matrix:

If (xin) is a three-way array, it is unfolded (combining the first two modes as variables) and the size of the original second mode (size(xin,2)) is used as (numblocks). The output is re-folded back into the original three-way array.

Note that the unfold operation is: xin = unfoldmw(xin,3);

If (xin) is a two-way array, each variable is treated on its own and GSCALE is equivalent to autoscale (see the AUTO function).

Outputs are the scaled matrix (gxs), a rowvector of means (mxs), and a row vector of "block standard deviations" stdxs.

Examples

Scale a matrix a that has two blocks augmented together:

>> a = [[1 2 3; 4 5 6; 7 8 9] [11 12 13; 14 15 16; 17 18 19]]

a =

    1     2     3    11    12    13
    4     5     6    14    15    16
    7     8     9    17    18    19

>> [gxs,mxs,stdxs] = gscale(a,2);

>> gxs

gxs =

  -0.5774   -0.5774   -0.5774   -0.5774   -0.5774   -0.5774
        0         0         0         0         0         0
   0.5774    0.5774    0.5774    0.5774    0.5774    0.5774

>> mxs

mxs =

    4     5     6    14    15    16

>> stdxs

stdxs =

    3     3     3     3     3     3

See Also

auto, gscaler, mncn, mpca, scale, unfoldm