pairwise_plot {rrr}R Documentation

Pairwise Plots

Description

Pairwise Plots

Usage

pairwise_plot(x, y, type = "pca", pair_x = 1, pair_y = 2, rank = "full",
  k = 0, interactive = FALSE, 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

rank

rank of coefficient matrix.

k

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

interactive

logical. If interactive = FALSE, the default, plots a static pairwise plot. If interactive = FALSE plots an interactive pairwise plot.

point_size

size of points in scatter plot.

Value

ggplot2 object if interactive = FALSE; plotly object if interactive = TRUE.

References

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

Examples

data(pendigits)
digits_features <- pendigits[,1:34]
digits_class <- pendigits[,35]
pairwise_plot(digits_features, digits_class, type = "pca", pair_x = 1, pair_y = 3)

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

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


[Package rrr version 1.0.0 Index]