predict.factorial: Projection of new observations into a factorial space

predict.factorialR Documentation

Projection of new observations into a factorial space

Description

Projects new observations into the factorial space computed by CA, MCA or PCA – the same operation that is applied to the observations the analysis was fitted on: centering (and, for PCA with scale.unit = TRUE, scaling) with the parameters of the training data, then projection on the axes already computed. The axes are not recomputed and the new observations have no influence on them: they are supplementary individuals.

Usage

## S3 method for class 'factorial'
predict(object, test, ...)

Arguments

object

The factorial analysis (object of class factorial-class).

test

The new observations, a data.frame or matrix with the same (active) variables as the data the analysis was fitted on.

...

Other parameters.

Details

The projection is obtained by handing the new rows back to FactoMineR as supplementary individuals of the original analysis, so the coordinates are exactly the ones PCA (rbind (train, test), ind.sup = ...) would give. The active analysis is refitted in the process, which is unnoticeable on the sizes this package is meant for.

Supplementary variables (quanti.sup, quali.sup) play no part in the axes, so test does not have to carry them: any column of the training data that is missing from test is filled in (with the training mean, or the first level) purely so that the two can be stacked.

Value

The coordinates of the new observations on the factorial axes (a matrix, one row per observation and one column per axis).

See Also

PCA, CA, MCA, factorial-class, predict.cda

Examples

require (datasets)
data (iris)
d = splitdata (iris, 5)
pca = PCA (d$train.x)
# The coordinates of unseen observations on the axes of the training analysis
head (predict (pca, d$test.x))
# An observation of the training set projects onto the coordinates the analysis gave it
pca$ind$coord [1, ]
predict (pca, d$train.x [1, ])

fdm2id documentation built on Aug. 28, 2026, 9:07 a.m.