Gscale

From Eigenvector Research Documentation Wiki
Revision as of 09:28, 5 February 2009 by imported>Jeremy
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. numblocks defines how the data should be split into blocks. Three different uses exist:

  • >0 if (numblocks) is > 0, the number of sub-matrices/blocks in the data. Note that size(xin,2)/numblocks must be a whole number. If (numblocks) is not included it is assumed to be 1 (one) and the entire (xin) matrix is treated as a single block.
  • =0 If (numblocks) is 0 (zero) then automatic blocking is done 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).
  • <0 If (numblocks) is a negative integer, then class information in the indicated set on mode 2 (the variable mode) is used to divide the blocks. E.g. if numblocks is -3, then the third class set is used to define blocks. This feature is only defined for two-way arrays.

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