optMVtrans: Optimal Transformations to linearize Multivariate Data

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/optMVtrans.R

Description

optMVtrans creates a new dataset where the columns of that dataset have been subjected to a non-linear transformation that maximizes the sum of squared lower-triangle correlations in the correlation matrix among the variables.

Usage

1
optMVtrans(dat, maxit = 25, rescale=TRUE, diff=.01)

Arguments

dat

A data frame containing only numeric variables.

maxit

The maximum number of transformations to compute before stopping.

rescale

Logical indicating whether the data should be rescaled such that all variables have minimum value=1.

diff

The difference between the sum of squared lower-triangle correlations of the current and previous iterations, below which the algorithm will stop trying to find better transformations

Details

The function starts by estimating the Box-Cox transformation on each variable and returns a new matrix where each variable was optimally, non-linearly transformed against all of the other original variables in the provided data matrix. Then, if that set of transformations resulted in a greater sum of squared lower-triangle correlations among the transformed variables (with respect to the original data), the algorithm estimates another set of Box-Cox transformations on the data transformed in the previous step. The algorithm continues until it reaches the maximum number of iteration or the sum of squared lower-triangle correlations converges.

Value

out

A matrix of transformed variables of the same dimension as the original input data

Author(s)

Dave Armstrong

References

Box, G. E. P. and Cox, D. R. (1964) An analysis of transformations. JRSS B 26: 211–246.

See Also

boxCoxVariable

Examples

1
2
3
4
5
6
data(banks76)
num.dat <- banks76[,-(1:3)]
R_old <- cor(num.dat)
banks.trans <- optMVtrans(num.dat)
R_new <- cor(banks.trans)
R_new-R_old

icpsrmsda documentation built on May 31, 2017, 1:53 a.m.