klaR (version 0.4-1)

partimat: Plotting the 2-d partitions of classification methods

Description

Provides a multiple figure array which shows the classification of observations based on classification methods (e.g. lda, qda) for every combination of two variables. Moreover, the classification borders are displayed and the apparent error rates are given in each title.

Usage

partimat(x,...)

## S3 method for class 'default':
partimat(x, grouping, method = "lda", prec = 100, 
    nplots.vert, nplots.hor, main = "Partition Plot", name, mar, 
    plot.matrix = FALSE, ...)
## S3 method for class 'data.frame':
partimat(x, ...)
## S3 method for class 'matrix':
partimat(x, grouping, ..., subset, na.action = na.fail)
## S3 method for class 'formula':
partimat(formula, data = NULL, ..., subset, na.action = na.fail)

Arguments

x
matrix or data frame containing the explanatory variables (required, if formula is not given).
grouping
factor specifying the class for each observation (required, if formula is not given).
formula
formula of the form groups ~ x1 + x2 + .... That is, the response is the grouping factor and the right hand side specifies the (non-factor) discriminators.
method
the method the classification is based on, currently supported are: lda, qda, rpart,
prec
precision used to draw the classification borders (the higher the more precise; default: 100).
data
Data frame from which variables specified in formula are preferentially to be taken.
nplots.vert
number of rows in the multiple figure array
nplots.hor
number of columns in the multiple figure array
subset
index vector specifying the cases to be used in the training sample. (Note: If given, this argument must be named.)
na.action
specify the action to be taken if NAs are found. The default action is for the procedure to fail. An alternative is na.omit, which leads to rejection of cases with missing values
main
title
name
Variable names to be printed at the axis / into the diagonal.
mar
numerical vector of the form c(bottom, left, top, right) which gives the lines of margin to be specified on the four sides of the plot. Defaults are rep(0, 4) if plot.matrix = TRUE, c(5, 4, 2, 1) + 0.
plot.matrix
logical; if TRUE, like a scatterplot matrix; if FALSE (default) uses less space and arranges the plots optimal (using a fuzzy algorithm) in an array by plotting each pair of variables once.
...
Further arguments passed to the classification method and underlying plot function drawparti.

concept

Vizualizing classification results

See Also

for much more fine tuning see drawparti

Examples

Run this code
library(MASS)
data(iris)
partimat(Species ~ ., data = iris, method = "lda")
partimat(Species ~ ., data = iris, method = "lda", 
    plot.matrix = TRUE, imageplot = FALSE) # takes some time ...

Run the code above in your browser using DataCamp Workspace