MacroPCApredict {cellWise} | R Documentation |
MacroPCApredict
Description
Based on a MacroPCA
fit of an initial (training) data set X
, this function analyzes a
new (test) data set Xnew
.
Usage
MacroPCApredict(Xnew, InitialMacroPCA, MacroPCApars = NULL)
Arguments
Xnew |
The new data (test data), which must be a matrix or a data frame.
It must always be provided. Its columns (variables) should correspond to those of |
InitialMacroPCA |
The output of the MacroPCA function on the initial (training) dataset. Must be provided. |
MacroPCApars |
The input options to be used for the prediction.
By default the options of InitialMacroPCA are used. For the complete list of
options see the function |
Value
A list with components:
MacroPCApars |
the options used in the call. |
DDC |
result of DDCpredict which is the first step of MacroPCApredict.
See the function |
scaleX |
the scales of the columns of |
k |
the number of principal components. |
loadings |
the columns are the |
eigenvalues |
the |
center |
vector with the fitted center. |
It |
number of iteration steps. |
diff |
convergence criterion. |
Xnew.NAimp |
|
scores |
scores of |
OD |
orthogonal distances of the rows of |
cutoffOD |
cutoff value for the OD. |
SD |
score distances of the rows of |
cutoffSD |
cutoff value for the SD. |
highOD |
row numbers of cases in |
highSD |
row numbers of cases in |
residScale |
scale of the residuals. |
stdResid |
standardized residuals. Note that these are |
indcells |
indices of cellwise outliers. |
NAimp |
various results for the NA-imputed Xnew. |
Cellimp |
various results for the cell-imputed Xnew. |
Fullimp |
various result for the fully imputed Xnew. |
Author(s)
Rousseeuw P.J., Van den Bossche W.
References
Hubert, M., Rousseeuw, P.J., Van den Bossche W. (2019). MacroPCA: An all-in-one PCA method allowing for missing values as well as cellwise and rowwise outliers. Technometrics, 61(4), 459-473. (link to open access pdf)
See Also
checkDataSet
, cellMap
,
DDC
, DDCpredict
,
MacroPCA
Examples
library(MASS)
set.seed(12345)
n <- 50; d <- 10
A <- matrix(0.9, d, d); diag(A) = 1
x <- mvrnorm(n, rep(0,d), A)
x[sample(1:(n * d), 50, FALSE)] <- NA
x[sample(1:(n * d), 50, FALSE)] <- 10
MacroPCA.out <- MacroPCA(x, 2)
xnew <- mvrnorm(25, rep(0,d), A)
xnew[sample(1:(25 * d), 12, FALSE)] <- 10
predict.out <- MacroPCApredict(xnew, MacroPCA.out)
cellMap(predict.out$stdResid)
# For more examples, we refer to the vignette:
## Not run:
vignette("MacroPCA_examples")
## End(Not run)