predict_qda {msos} | R Documentation |
Quadratic discrimination prediction
Description
The function uses the output from the function qda
(Section A.3.2) and a P
-vector X
, and calculates the predicted
group for this X
.
Usage
predict_qda(qd, newx)
Arguments
qd |
The output from |
newx |
A |
Value
A K
-vector of the discriminant values d_k^Q(X)
in
(11.48) for the given X
.
See Also
Examples
# Load Iris Data
data(iris)
# Build data
x.iris <- as.matrix(iris[, 1:4])
n <- nrow(x.iris)
# Gets group vector (1, ... , 1, 2, ..., 2, 3, ... , 3)
y.iris <- rep(1:3, c(50, 50, 50))
# Perform QDA
qd.iris <- qda(x.iris, y.iris)
yhat.qd <- NULL
for (i in seq_len(n)) {
yhat.qd <- c(yhat.qd, imax(predict_qda(qd.iris, x.iris[i, ])))
}
table(yhat.qd, y.iris)
[Package msos version 1.2.0 Index]