predict.pvs {klaR} | R Documentation |
Prediction of class membership and posterior probabilities using pairwise variable selection.
## S3 method for class 'pvs': predict(object, newdata, quick = FALSE, detail = FALSE, ...)
object |
an object of class ‘pvs ’, as that created by the function “pvs ” |
newdata |
a data frame or matrix containing new data. If not given the same datas as used for training the ‘pvs ’-model are used. |
quick |
indicator (logical), whether a quick, but less accurate computation of posterior probabalities should be used or not. |
detail |
indicator (logical), whether the returned object includes additional information about the posterior probabilities for each date in each submodel. |
... |
Further arguments are passed to underlying predict calls. |
If “quick=FALSE
” the posterior probabilites for each case are computed using the pairwise coupling algorithm presented by Hastie, Tibshirani (1998).
If “quick=FALSE
” a much quicker solution is used, which leads to less accurate posterior probabalities.
In almost all cases it doesn't has a negative effect on the classification result.
a list with components:
class |
the predicted classes |
posterior |
posterior probabilities for the classes |
details |
(only if “details=TRUE ”. A list containing matrices of posterior probabalities computated by the classification method for each case and classpair. |
Gero Szepannek, szepannek@statistik.tu-dortmund.de, Christian Neumann
Szepannek, G. and Weihs, C. (2006) Variable Selection for Classification of More than Two Classes Where the Data are Sparse. In From Data and Information Analysis to Kwnowledge Engineering., eds Spiliopolou, M., Kruse, R., Borgelt, C., Nuernberger, A. and Gaul, W. pp. 700-708. Springer, Heidelberg.
## learn a pvs-model with half of the Satellite dataset, ## using "ks.test" as selection and "qda" as classification method: library("mlbench") data("Satellite") model <- pvs(classes ~ ., Satellite[1:3218,], method = "qda", vs.method = "ks.test") model # short summary, showing the class-pairs of the submodels and the selected variables ## now predict on the rest of the data set: ## pred <- predict(model,Satellite[3219:6435,]) # takes some time pred <- predict(model,Satellite[3219:6435,], quick=TRUE) # that's much quicker ## now you can look at the predicted classes: pred$class ## or the posterior probabilities: pred$posterior