threewise_plot {rrr}R Documentation

3-D Reduced Rank Regression Plots

Description

Create three-dimensional, interactive plotly graphics for exploration and diagnostics.

Usage

threewise_plot(x, y, type = "pca", pair_x = 1, pair_y = 2, pair_z = 3,
  rank = "full", k = 0, point_size = 2.5)

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.

pair_x

variable to be plotted on the X-axis

pair_y

variable to be plotted on the Y-axis

pair_z

variable to be plotted on the Z-axis

rank

rank of coefficient matrix.

k

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

point_size

size of points in scatter plot.

Value

three-dimensional plot. If type = "pca" returns three principal components scores - defaulted to the first three - against each other. If type = "cva" returns three-dimensional plot of residuals. If type = "lda" returns three-dimensional plot of three linear discriminant scores plotted against each other.

Examples

## Not run: 
data(pendigits)
digits_features <- pendigits[, -35:-36]
threewise_plot(digits_features, digits_class, type = "pca", k = 0.0001)

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)
threewise_plot(galaxy_x, galaxy_y, type = "cva")

data(iris)
iris_x <- iris[,1:4]
iris_y <- iris[5]
threewise_plot(iris_x, iris_y, type = "lda")

## End(Not run)


[Package rrr version 1.0.0 Index]