Learn R Programming

prospectr (version 0.1.3)

blockNorm: Sum of squares block weighting

Description

Sum of squares block weighting: allows to scale blocks of variables, but keeping the relative weights of the variables inside a block.

Usage

blockNorm(X,targetnorm=1)

Arguments

X
data.frame or matrix to transform
targetnorm
desired sum of squares for a block of variables (default = 1)

Value

a list with components Xscaled, the scaled matrix and f, the scaling factor

Details

The function computes a scaling factor, which, multiplied by the input matrix, produces a matrix with a pre--determined sum of squares.

References

Eriksson, L., Johansson, E., Kettaneh, N., Trygg, J., Wikstrom, C., and Wold, S., 2006. Multi- and Megavariate Data Analysis. MKS Umetrics AB.

See Also

blockScale, standardNormalVariate, detrend

Examples

Run this code
X <- matrix(rnorm(100),ncol=10)
# Block normalize to sum of square = 1
res <- blockNorm(X,1)
sum(res$Xscaled^2) # check

Run the code above in your browser using DataLab