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, var.position=2, var.center=TRUE, var.scale=FALSE)

Arguments

x A data.frame or matrix object.
var.position A vector of length 1 giving the position of the elements to be considered as variables on the given object. They will be represented as vectors in the graphical representation. 1 indicates rows and 2 indicates columns.
var.center A logical value indicating whether the variables should be shifted to be zero centered. Alternatively, a vector of length equal to the number of columns of x can be supplied. The value is passed to scale.
var.scale A logical value indicating whether the variables should be scaled to have unit variance before the analysis takes place. Alternatively, a vector of length equal the number of columns of x can be supplied. The value is passed to 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 (var.center=TRUE), 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)

Jose Claudio Faria (joseclaudio.faria@gmail.com)
and
Clarice Garcia Borges Demetrio (clarice@esalq.usp.br)

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 dataframe or matrix objects (n x p)
  ## n = rows (objects)
  ## p = columns (variables)
  ##

  library(bpca)
  dt <- dt.tools(iris[-5], 2)

  # 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[-5], var.center=TRUE)$r, 5); iris.tools
  iris.obsv  <- round(cor(iris[-5]), 5); iris.obsv
  all(iris.tools == iris.obsv)

[Package bpca version 1.0.2 Index]