rank_trace {rrr}R Documentation

Rank Trace Plot

Description

rank_trace is a plot used to determine the effective dimensionality, i.e., t = \mathrm{rank}\left(\mathbf{C}\right), of the reduced-rank regression equation.

Usage

rank_trace(x, y, type = "identity", k = 0, plot = TRUE,
  interactive = FALSE)

Arguments

x

data frame or matrix of predictor variables

y

data frame or matrix of response variables

type

type of reduced-rank regression model to fit. type = "identity", the default, uses \mathbf{\Gamma} = \mathbf{I} to fit a reduced-rank regression. type = "pca" fits a principal component analysis model as a special case of reduced-rank regression. type = "cva" fits a canonical variate analysis model as a special case of reduced-rank regression. type = "lda" fits a linear discriminant analysis model as a special case of reduced-rank regression.

k

small constant added to diagonal of covariance matrices to make inversion easier.

plot

if FALSE, returns data frame of rank trace coordinates.

interactive

if TRUE, creates an interactive plotly graphic.

Value

plot of rank trace coordinates if plot = TRUE, the default, or data frame of rank trace coordinates if plot = FALSE.

References

Izenman, A.J. (2008) Modern Multivariate Statistical Techniques. Springer.

Examples

data(tobacco)
tobacco_x <- tobacco[,4:9]
tobacco_y <- tobacco[,1:3]
gamma <- diag(1, dim(tobacco_y)[2])
rank_trace(tobacco_x, tobacco_y)
rank_trace(tobacco_x, tobacco_y, plot = FALSE)
rank_trace(tobacco_x, tobacco_y, type = "cva")

data(pendigits)
digits_features <- pendigits[, -35:-36]
rank_trace(digits_features, digits_features, type = "pca")

library(dplyr)
data(COMBO17)
galaxy <- as_data_frame(COMBO17)
galaxy <- select(galaxy, -starts_with("e."), -Nr, -UFS:-IFD)
galaxy <- na.omit(galaxy)
galaxy_x <- select(galaxy, -Rmag:-chi2red)
galaxy_y <- select(galaxy, Rmag:chi2red)
rank_trace(galaxy_x, galaxy_y, type = "cva")


[Package rrr version 1.0.0 Index]