Learn R Programming

composits (version 0.1.1)

plot_biplot: Plot "biplot" for different decomposition methods.

Description

The final graph shows the data points projected onto the first two components, together with the loadings as axes.

Usage

plot_biplot(obj, X = NULL, method = "pca", edges = NULL)

Arguments

obj

The output from comp_tsout_ens or mv_tsout_ens functions.

X

The data matrix used as input to mv_tsout_ens (not needed if obj is output from comp_tsout_ens).

method

The decomposition method, choose between "pca" (default), "dobin", "ics" or "ica".

edges

Set to "all" to connect points by time index, "outlying" to connect tagged outliers to previous and following points.

Value

A ggplot showing the biplot.

Examples

Run this code
# NOT RUN {
set.seed(100)
n <- 600
x <- sample(1:100, n, replace=TRUE)
x[25] <- 200
x[320] <- 300
x2 <- sample(1:100, n, replace=TRUE)
x3 <- sample(1:100, n, replace=TRUE)
x4 <- sample(1:100, n, replace=TRUE)
X <- cbind.data.frame(x, x2, x3, x4)

out1 <- mv_tsout_ens(X, compr=2, fast=FALSE)
plot_biplot(out1, X = X, method = "pca")

X <- X/rowSums(X)
out2 <- comp_tsout_ens(X, compr=2, fast=FALSE)
plot_biplot(out2)
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab