Learn R Programming

aspect (version 1.0-6)

corAspect: Scaling by Maximizing Correlational Aspects

Description

This function performs optimal scaling by maximizing a certain aspect of the correlation matrix.

Usage

corAspect(data, aspect = "aspectSum", level = "nominal", itmax = 100, eps = 1e-06, ...)

Arguments

data

Data frame or matrix

aspect

Function on the correlation matrix (see details)

level

Vector with scale level of the variables ("nominal" or "ordinal"). If all variables have the same scale level, only one value can be provided

itmax

Maximum number of iterations

eps

Convergence criterion

...

Additional parameters for aspect

Value

loss

Final value of the loss function

catscores

Resulting category scores (after optimal scaling)

cormat

Correlation matrix based on the scores

eigencor

Eigenvalues of the correlation matrix

indmat

Indicator matrix (dummy coded)

scoremat

Transformed data matrix (i.e with category scores resulting from optimal scaling)

burtmat

Burt matrix

niter

Number of iterations

Details

We provide various pre-specified aspects:

"aspectAbs" takes the sum of the absolute values of the correlations to the power pow. The optional argument pow = 1.

"aspectSum" the sum of the correlations to the power of pow. Again, as default pow = 1.

"aspectDeterminant" computes the determinant of the correlation matrix; no additional arguments needed.

"aspectEigen" the sum of the first p eigenvalues (principal component analysis). By default the argument p = 1.

"aspectSMC" the squared multiple correlations (multiple regression) with respect to a target variable. By default targvar = 1 which implies that the first variable of the dataset is taken as response.

"aspectSumSMC" uses the sum of all squared multiple correlations (path analysis).

Alternatively, the user can write his own aspect, e.g. the function myAspect(r, ...) with r as the correlation matrix. This function must return a list with the function value as first list element and the first derivative with respect to r as the second. Then aspect = myAspect and additional arguments go into ... in maxAspect().

References

Mair, P., & De Leeuw, J. (2010). Scaling variables by optimizing correlational and non-correlational aspects in R. Journal of Statistical Software, 32(9), 1-23. 10.18637/jss.v032.i09

de Leeuw, J. (1988). Multivariate analysis with optimal scaling. In S. Das Gupta and J.K. Ghosh, Proceedings of the International Conference on Advances in Multivariate Statistical Analysis, pp. 127-160. Calcutta: Indian Statistical Institute.

See Also

lineals

Examples

Run this code
# NOT RUN {
## maximizes the first eigenvalue
data(galo)
res.eig1 <- corAspect(galo[,1:4], aspect = "aspectEigen")
res.eig1
summary(res.eig1)

## maximizes the first 2 eigenvalues
res.eig2 <- corAspect(galo[,1:4], aspect = "aspectEigen", p = 2)
res.eig2

## maximizes the absolute value of cubic correlations
res.abs3 <- corAspect(galo[,1:4], aspect = "aspectAbs", pow = 3)
res.abs3

## maximizes the sum of squared correlations
res.cor2 <- corAspect(galo[,1:4], aspect = "aspectSum", pow = 2)
res.cor2

## maximizes the determinant
res.det <- corAspect(galo[,1:4], aspect = "aspectDeterminant")
res.det

## maximizes SMC, IQ as target variable
res.smc <- corAspect(galo[,1:4], aspect = "aspectSMC", targvar = 2)
res.smc

## maximizes the sum of SMC
res.sumsmc <- corAspect(galo[,1:4], aspect = "aspectSumSMC")
res.sumsmc


# }

Run the code above in your browser using DataLab