predict.kda: Classify Multivariate Observations Based on Kernel Rules

Description Usage Arguments Details Value References See Also Examples

View source: R/kda.R

Description

Classify multivariate observations in conjunction with kda.

Usage

1
predict.kda(object, newdata, ...)

Arguments

object

Object of class "kda".

newdata

A data.frame of cases to be classified or, if object has a formula, a data.frame with columns of the same names as the variables used. A vector will be interpreted as a row vector. If newdata is missing, an attempt will be made to retrieve the data used to fit the kda object.

...

Further arguments.

Details

This function is a method for the generic function predict() for class "kda". It can be invoked by calling predict(x) for an object x of the appropriate class, or directly by calling predict.kda(x) regardless of the class of the object.

Value

A list with components:

class

The predicted class labels (a factor).

posteriors

Matrix of class posterior probabilities.

References

Hastie, T., Tibshirani, R. and Friedman, J. (2009), The Elements of Statistical Learning: Data Mining, Inference and Prediction. Second edition, Springer, New York.

See Also

kda.

Other observation_specific majority: kda

Examples

1
2
3
4
  fit <- kda(Species ~ Sepal.Length + Sepal.Width, data = iris,
             wf = "gaussian", bw = 0.5)
  pred <- predict(fit)
  mean(pred$class != iris$Species)

schiffner/locClass documentation built on May 29, 2019, 3:39 p.m.