Learn R Programming

dimensio (version 0.10.1)

predict: Predict New Coordinates

Description

Predict the projection of new individuals/rows or variables/columns.

Usage

# S4 method for CA
predict(object, newdata, margin = 1)

# S4 method for MCA predict(object, newdata, margin = 1)

# S4 method for PCA predict(object, newdata, margin = 1)

Value

A data.frame of coordinates.

Arguments

object

A CA or PCA object.

newdata

An object of supplementary points coercible to a matrix for which to compute principal coordinates.

margin

A length-one numeric vector giving the subscript which the data will be predicted: 1 indicates individuals/rows (the default), 2 indicates variables/columns.

Author

N. Frerebeau

See Also

Other multivariate analysis: ca(), mca(), pca(), pcoa()

Examples

Run this code
## Create a matrix
A <- matrix(data = sample(1:10, 100, TRUE), nrow = 10, ncol = 10)

## Compute correspondence analysis
X <- ca(A, sup_row = 8:10, sup_col = 7:10)

## Predict new row coordinates
Y <- matrix(data = sample(1:10, 120, TRUE), nrow = 20, ncol = 6)
predict(X, Y, margin = 1)

## Predict new column coordinates
Z <- matrix(data = sample(1:10, 140, TRUE), nrow = 7, ncol = 20)
predict(X, Z, margin = 2)

Run the code above in your browser using DataLab