Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

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

a numeric matrix to transform (optionally a data frame that can be coerced to a numerical matrix).

targetnorm

desired sum of squares for a block of variables (default = 1)

Details

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

Value

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

Note

This is a R port of the ‘MBnorm.m’ function of the MB matlab toolbox by Fran van den Berg which can be found at: http://www.models.life.ku.dk/~courses/MBtoolbox/mbtmain.htm

Author(s)

Antoine Stevens

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

Examples

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

prospectr

Miscellaneous Functions for Processing and Sample Selection of Spectroscopic Data

v0.2.1
MIT + file LICENSE
Authors
Antoine Stevens [aut, cre] (<https://orcid.org/0000-0002-1588-7519>), Leonardo Ramirez-Lopez [aut, cre] (<https://orcid.org/0000-0002-5369-5120>), Guillaume Hans [ctb] (<https://orcid.org/0000-0002-6503-5760>)
Initial release
2020-10-23

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.