theta.cl: A function to perform the quantile classifier for a given...

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/theta.cl.R

Description

Given a certain quantile probability, the function compute the quantile classifier on the training set and gives the predicted class labels in the training and test set.It also computes the training misclassification rate and the test misclassification rate, when the truth labels of the test set are available. When the quantile probability is 0.5 the function compute the median classifier.

Usage

1
theta.cl(train, test, cl, theta, cl.test = NULL)

Arguments

train

A matrix of data (the training set) with observations in rows and variables in columns. It can be a matrix or a dataframe.

test

A matrix of data (the test set) with observations in rows and variables in columns. It can be a matrix or a dataframe.

cl

A vector of class labels for each sample of the training set. It can be factor or numerical.

theta

The quantile probability. If 0.5 the median classifier is applied

cl.test

If available, a vector of class labels for each sample of the test set (optional)

Details

theta.cl carries out quantile classifier for a given quantile probability.

Value

A list with components

cl.train

Predicted classification in the training set

cl.test

Predicted classification in the test set

me.train

Misclassification error in the training set

me.test

Misclassification error in the test set (only if cl.test is available)

Author(s)

Christian Hennig, Cinzia Viroli

See Also

See Also centroidcl

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
data(ais)
x=ais[,3:13]
cl=as.double(ais[,1])
set.seed(22)
index=sample(1:202,152,replace=FALSE)
train=x[index,]
test=x[-index,]
cl.train=cl[index]
cl.test=cl[-index]
out.m=theta.cl(train,test,cl.train,0.5,cl.test)
out.m$me.test
misc(out.m$cl.test,cl.test)

quantileDA documentation built on May 2, 2019, 5:54 a.m.