| predict.specproc_rsimca | R Documentation |
Predicts the classes of new observations with a model fitted by
rsimca(), or their distances to the classes.
## S3 method for class 'specproc_rsimca'
predict(object, newdata, type = c("class", "distances"), ...)
object |
An object returned by |
newdata |
A numeric matrix or data frame with the same variables as the training data. |
type |
|
... |
Not used. |
With type = "class", a factor of the predicted classes. With
type = "distances", a tibble with the combined distance of each
observation to each class (one column per class), and outlying,
TRUE for the observations outlying for every class.
Christian L. Goueguel
rsimca()
# iris: train on 100 flowers, predict the 50 others
set.seed(1)
train <- sample(nrow(iris), 100)
fit <- rsimca(iris[train, 1:4], iris$Species[train], ncomp = 2)
head(predict(fit, iris[-train, 1:4]))
head(predict(fit, iris[-train, 1:4], type = "distances"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.