Gscale: Difference between revisions

From Eigenvector Research Documentation Wiki
Jump to navigation Jump to search
imported>Jeremy
(Importing text file)
 
imported>Jeremy
(Importing text file)
Line 1: Line 1:
===Purpose===
===Purpose===
Group/block scaling for a single or multiple blocks.  
Group/block scaling for a single or multiple blocks.  
===Synopsis===
===Synopsis===
:[gxs,mxs,stdxs] = gscale(xin,numblocks)
:[gxs,mxs,stdxs] = gscale(xin,numblocks)
===Description===
===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.
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.
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 (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.
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);
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).
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.
Outputs are the scaled matrix (gxs), a rowvector of means (mxs), and a row vector of "block standard deviations" stdxs.
===Examples===
===Examples===
Scale a matrix a that has two blocks augmented together:
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; 4 5 6; 7 8 9] [11 12 13; 14 15 16; 17 18 19]]
a =
a =
     1    2    3    11    12    13
     1    2    3    11    12    13
     4    5    6    14    15    16
     4    5    6    14    15    16
     7    8    9    17    18    19
     7    8    9    17    18    19
>> [gxs,mxs,stdxs] = gscale(a,2);
>> [gxs,mxs,stdxs] = gscale(a,2);
>> gxs
>> gxs
gxs =
gxs =
   -0.5774  -0.5774  -0.5774  -0.5774  -0.5774  -0.5774
   -0.5774  -0.5774  -0.5774  -0.5774  -0.5774  -0.5774
         0        0        0        0        0        0
         0        0        0        0        0        0
     0.5774    0.5774    0.5774    0.5774    0.5774    0.5774
     0.5774    0.5774    0.5774    0.5774    0.5774    0.5774
>> mxs
>> mxs
mxs =
mxs =
     4    5    6    14    15    16
     4    5    6    14    15    16
>> stdxs
>> stdxs
stdxs =
stdxs =
     3    3    3    3    3    3
     3    3    3    3    3    3
===See Also===
===See Also===
[[auto]], [[gscaler]], [[mncn]], [[mpca]], [[scale]], [[unfoldm]]
[[auto]], [[gscaler]], [[mncn]], [[mpca]], [[scale]], [[unfoldm]]

Revision as of 14:25, 3 September 2008

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