Classifies new observations using parameters determined by
the rda
-function.
# S3 method for rda
predict(object, newdata, posterior = TRUE,
aslist = TRUE, ...)
Object of class rda
.
Data frame (or matrix) of cases to be classified.
Logical; indicates whether a matrix of posterior probabilites over all classes for each observation shall be returned in addition to classifications.
Logical; if TRUE
, a list
containing classifications and posterior probabilities is returned,
otherwise a vector with an attribute ‘posterior
’.
currently unused
Depends on the value of argument ‘aslist
’:
Either a vector (of class factor
) of classifications
that (optionally) has an attribute ‘posterior
’
containing the posterior probability matrix, or
A list with elements ‘class
’ and ‘posterior
’.
# NOT RUN {
data(iris)
x <- rda(Species ~ ., data = iris, gamma = 0.05, lambda = 0.2)
predict(x, iris[, 1:4])
# }
Run the code above in your browser using DataLab