dt.tools {bpca}R Documentation

Data Tools for Multivariate

Description

Calculates vector variable lengths, angles between vector variables and variable correlations from ‘data.frame’ or ‘matrix’ objects

Usage

  dt.tools(x,
           center=2,
           scale=TRUE)

Arguments

x

A data.frame or matrix object.

center

Numeric. The type of centering to be performed:
⁠0⁠’ - no centering;
⁠1⁠’ - global-centered = sweep(x, 1, mean(x));
⁠2⁠’ - column-centered = sweep(x, 2, apply(x, 2, mean));
⁠3⁠’ - double-centered = sweep(sweep(x, 1, apply(x, 1, mean)), 2, apply(x, 2, mean)) + mean(x).
The default is 2.

scale

Logical. A value indicating whether the variables should be scaled to have unit variance before the analysis takes place:
FALSE - no scale;
TRUE - scale.

Details

This function computes: vector variable lengths, angles between vector variables and variable correlations from data.frame or matrix objects.

If the data are centered (center=2), the correlations are the same as those obtained by the cor function.

Value

An list with the components:

length

A vector of the lengths.

angle

A matrix of the angles.

r

A matrix of the observed correlations.

Author(s)

Faria, J. C.
Allaman, I. B.
Demétrio C. G. B.

References

Johnson, R. A. and Wichern, D. W. (1988) Applied multivariate statistical analysis. Prentice-Hall, Inc., Upper Saddle River, NJ, USA, 6 ed.

See Also

bpca

Examples

##
## Computes: vector variable lengths, angles between vector variables and
## variable correlations from data.frame or matrix objects (n x p)
## n = rows (objects)
## p = columns (variables)
##

dt <- dt.tools(iris,
               2)  # No numeric columns are removed in dt.tools 

# Exploring the object 'bp' created by the function 'var.tools'
class(dt)
names(dt)
str(dt)

dt$length
dt$angle
dt$r
dt

# Checking the determinations
(iris.tools <- round(dt.tools(iris,
                              center=2)$r,
                     5))

(iris.obsv  <- round(cor(iris[-5]),
                     5))

all(iris.tools == iris.obsv)

[Package bpca version 1.3-6 Index]