Learn R Programming

aspect (version 1.0-2)

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

  • lossFinal value of the loss function
  • catscoresResulting category scores (after optimal scaling)
  • cormatCorrelation matrix based on the scores
  • eigencorEigenvalues of the correlation matrix
  • indmatIndicator matrix (dummy coded)
  • scorematTransformed data matrix (i.e with category scores resulting from optimal scaling)
  • burtmatBurt matrix
  • niterNumber 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, Volume 32, Issue 9.

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
## 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

## some user-defined non-sense aspect
## first list element corresponds to function value, second to first derivative
myAspect <- function(r, a = 1, b = 1) list(a*b*r, matrix(a*b, nrow = nrow(r), ncol = ncol(r)))
res.my <- corAspect(galo[,1:4], aspect = myAspect, a = 2, b = 4)
res.my

Run the code above in your browser using DataLab