predict.pda: Classify based on a pda object

View source: R/pda.R

predict.pdaR Documentation

Classify based on a pda object

Description

Classify new data based on a trained pda model.

Usage

## S3 method for class 'pda'
predict(object, newdata = NULL, ...)

Arguments

object

A fitted pda model.

newdata

Matrix of predictor values.

...

Additional arguments to lda.

Details

Based on the trained pda model, new data objects (rows of newdata) are classified. Remember that pda does not scale the predictor matrix, make certain your newdata are treated identically to the predictor matrix used to train the pda model.

Value

A list with one element for each dimension. In each element is another list with the integer Dimension, the vector Classifications, the posterior probabilities Posteriors and the PLS-scores Scores used to make the classifications.

Author(s)

Lars Snipen.

See Also

pda.

Examples

data(microbiome)
y <- microbiome[1:40,1]
X <- as.matrix(microbiome[1:40, -1])
p.trn <- pda(y[-1], X[-1,], prior = c(0.5,0.5), max.dim = 8)    # leaving out sample 1 before training
lst <- predict(p.trn, newdata = X[1, , drop = FALSE])           # predicting sample 1



larssnip/mpda documentation built on March 28, 2022, 3:37 p.m.