methods-eigen: Functionality for eigen-decompositions

methods-eigenR Documentation

Functionality for eigen-decompositions

Description

These methods extract data from, and attribute new data to, objects of class "eigen" returned by base::eigen() when the parameter only.values is set to FALSE or of class "eigen_ord" returned by eigen_ord().

Usage

## S3 method for class 'eigen'
as_tbl_ord(x)

## S3 method for class 'eigen'
recover_rows(x)

## S3 method for class 'eigen'
recover_cols(x)

## S3 method for class 'eigen'
recover_inertia(x)

## S3 method for class 'eigen'
recover_coord(x)

## S3 method for class 'eigen'
recover_conference(x)

## S3 method for class 'eigen_ord'
recover_aug_rows(x)

## S3 method for class 'eigen_ord'
recover_aug_cols(x)

## S3 method for class 'eigen'
recover_aug_coord(x)

## S3 method for class 'eigen_ord'
as_tbl_ord(x)

## S3 method for class 'eigen_ord'
recover_rows(x)

## S3 method for class 'eigen_ord'
recover_cols(x)

## S3 method for class 'eigen_ord'
recover_inertia(x)

## S3 method for class 'eigen_ord'
recover_coord(x)

## S3 method for class 'eigen_ord'
recover_conference(x)

## S3 method for class 'eigen_ord'
recover_aug_rows(x)

## S3 method for class 'eigen_ord'
recover_aug_cols(x)

## S3 method for class 'eigen_ord'
recover_aug_coord(x)

Arguments

x

An ordination object.

Details

base::eigen() usually returns an object of class "eigen", which contains the numerical eigendecomposition without annotations such as row and column names. To facilitate downstream analysis, eigen_ord() returns a modified 'eigen' object with row names taken (if available) from the original data and column names indicating the integer index of each eigenvector.

Value

The recovery generics ⁠recover_*()⁠ return core model components, distribution of inertia, supplementary elements, and intrinsic metadata; but they require methods for each model class to tell them what these components are.

The generic as_tbl_ord() returns its input wrapped in the 'tbl_ord' class. Its methods determine what model classes it is allowed to wrap. It then provides 'tbl_ord' methods with access to the recoverers and hence to the model components.

See Also

Other methods for eigen-decomposition-based techniques: methods-cmds, methods-factanal

Other models from the base package: methods-svd

Examples

# subset QS data to rank variables
qs_ranks <- subset(
  qswur_usa,
  complete.cases(qswur_usa),
  select = 8:13
)
head(qs_ranks)

# eigendecomposition of Kendall correlation matrix
qs_ranks %>%
  cor(method = "kendall") %>%
  eigen() %>%
  print() -> qs_eigen

# recover eigenvectors
get_rows(qs_eigen)
identical(get_cols(qs_eigen), get_rows(qs_eigen))

# wrap as a 'tbl_ord'
as_tbl_ord(qs_eigen)

# same eigendecomposition, preserving row names and adding column names
qs_ranks %>%
  cor(method = "kendall") %>%
  eigen_ord() %>%
  print() -> qs_eigen

# wrap as a 'tbl_ord' and augment with dimension names
augment_ord(as_tbl_ord(qs_eigen))

# decomposition returns pure eigenvectors
get_conference(qs_eigen)

corybrunson/ordr documentation built on Feb. 15, 2024, 9:28 p.m.