pcplot {bapred} | 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. Currently has to have levels: '1', '2', '3' and so on. |
y |
optional factor. Binary target variable. Currently has to have levels '1' and '2'. |
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))