plot_MIpca {doMIsaul}R Documentation

Plot a PCA from a multiply imputed dataset.

Description

plot_MIpca() plots only mean value while plot_MIpca_all() plots all values for the selected observations.

Usage

plot_MIpca(
  data.list,
  obs.sel,
  color.var = NULL,
  pca.varsel = NULL,
  pc.sel = c(1, 2)
)

plot_MIpca_all(
  data.list,
  obs.sel,
  pca.varsel = NULL,
  color.var = NULL,
  pc.sel = c(1, 2),
  alpha = 0.4
)

Arguments

data.list

The list of the imputed datasets.

obs.sel

The selection of observations to highlight. If NULL, no observations are selected; if numeric, the vector corresponds to the observations' row number to highlight, if character, the string should be of type a condition (TRUE/FALSE) on the dataset to select the observations, where the dataset is referred to as "DATA" (ex: obs.sel = "DATA$X1>3").

color.var

Either NULL to color according to obs.sel, "none" to use no color, or a vector of size nrow(data.list[[1]]) (a factor).

pca.varsel

optional. A vector of strings containing the names of the variables to use for the PCA. If NULL all variables in the dataset will be used.

pc.sel

Numeric vector of size 2 containing the indexes of the principal components to plot. Default is PC1 and PC2.

alpha

Transparency level for plotting the point of the selected observations.

Value

A ggplot object.

Examples

data(cancer, package = "survival")
cancer.imp <- MImpute(cancer[, -c(1:3)], 4)
plot_MIpca(cancer.imp, 1:10,
    pca.varsel = c("age", "sex", "ph.ecog", "meal.cal",  "wt.loss"))

plot_MIpca(cancer.imp, obs.sel = NULL, color.var = factor(cancer$status),
           pca.varsel = c("age", "sex", "ph.ecog", "meal.cal",  "wt.loss"))
data(cancer, package = "survival")
cancer.imp <- MImpute(cancer[, -c(1:3)], 6)
plot_MIpca_all(cancer.imp, 1:10,
    pca.varsel = c("age", "sex", "ph.ecog", "meal.cal",  "wt.loss"))

[Package doMIsaul version 1.0.1 Index]