pcplot | R Documentation |
This function performs principal component analysis on the covariate matrix and plots the first two principal components against each other. Different batches are distinguished by different colors and (optionally) the two classes of the target variable by different plot symbols.
pcplot(x, batch, y, alpha = 0.35, ...)
x |
matrix. The covariate matrix. Observations in rows, variables in columns. |
batch |
factor. Batch variable. Each factor level (or 'category') corresponds to one of the batches. For example, if there are four batches, this variable would have four factor levels and observations with the same factor level would belong to the same batch. |
y |
optional factor. Binary target variable. Has to have two factor levels, where each of them correponds to one of the two classes of the target variable. |
alpha |
optional numeric between 0 and 1. Alpha transparency of the contour lines of the batch-specific two-dimensional density estimates. Only applicable when default color scheme ( |
... |
additional arguments to be passed to |
For the data corresponding to each batch a two-dimensional kernel density estimate is obtained using the function kde2d()
from the MASS-package. These estimates are depicted through contour lines (using contour
).
NULL
Roman Hornung
data(autism) par(mfrow=c(1,3)) pcplot(x=X, batch=batch, y=y, alpha=0.25, main="alpha = 0.25") pcplot(x=X, batch=batch, y=y, alpha=0.75, main="alpha = 0.75") pcplot(x=X, batch=batch, y=y, col=1:length(unique(batch)), main="col = 1:length(unique(batch))") par(mfrow=c(1,1))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.