Learn R Programming

prospectr (version 0.1.3)

blockScale: Hard or soft block scaling

Description

Hard or soft block scaling of a spectral matrix to constant group variance. In multivariate calibration, block scaling is used to down-weight variables, when one block of variables dominates other blocks. With hard block scaling, the variables in a block are scaled so that the sum of their variances equals 1. Wen soft block scaling is used, the variables are scaled such that the sum of variable variances is equal to the square root of the number of variables in a particular block.

Usage

blockScale(X,type='hard',sigma2=1)

Arguments

X
data.frame or matrix to transform
type
type of block scaling: 'hard' or 'soft'
sigma2
desired total variance of a block (ie sum of the variances of all variables, default = 1), applicable when type = 'hard'

Value

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

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

blockNorm, standardNormalVariate, detrend

Examples

Run this code
X <- matrix(rnorm(100),ncol=10)
# Hard block scaling
res <- blockScale(X)
apply(res$Xscaled,2,var) # sum of column variances == 1

Run the code above in your browser using DataLab