plot_prox: Plot principle components of the proximity matrix

Description Usage Arguments Value References Examples

Description

Plot principle components of the proximity matrix

Usage

1
2
3
plot_prox(pca, dims = 1:2, labels = NULL, alpha = 1, alpha_label = NULL,
  color = "black", color_label = NULL, shape = "1", shape_label = NULL,
  size = 2, size_label = NULL, xlab = NULL, ylab = NULL, title = "")

Arguments

pca

a prcomp object, pca of an n x n matrix giving the proportion of times across all trees that observation i,j are in the same terminal node

dims

integer vector of length 2 giving indices for the dimensions of pca to be plotted

labels

length n character vector giving observation labels

alpha

optional continuous vector of length n make points/labels transparent or a numeric of length 1 giving the alpha of all points/labels

alpha_label

character legend title if alpha parameter used

color

optional discrete vector of length n which colors the points/labels or a character vector giving the color of all points/labels

color_label

character legend title if color parameter is used

shape

optional discrete vector of length n which shapes points (not applicable if labels used) or a character vector of length 1 which gives the shape of all points

shape_label

character legend title if shape parameter is used

size

optional continuous vector of length n which sizes points or labels or a numeric of length 1 which gives the sizes of all the points

size_label

character legend title if size parameter used

xlab

character x-axis label

ylab

character y-axis label

title

character plot title

Value

a ggplot object

References

https://github.com/vqv/ggbiplot

Gabriel, "The biplot graphic display of matrices with application to principal component analysis," Biometrika, 1971

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
library(randomForest)

fit = randomForest(hp ~ ., mtcars, proximity = TRUE)
prox = extract_proximity(fit)
pca = prcomp(prox, scale = TRUE)
plot_prox(pca, labels = row.names(mtcars))

fit = randomForest(Species ~ ., iris, proximity = TRUE)
prox = extract_proximity(fit)
pca = prcomp(prox, scale = TRUE)
plot_prox(pca, color = iris$Species, color_label = "Species", size = 2)

Example output

randomForest 4.6-14
Type rfNews() to see new features/changes/bug fixes.

edarf documentation built on May 2, 2019, 2:39 a.m.