A function to apply the quantile classifier that uses a different optimal quantile probability for each variable

Description

A function to apply the quantile classifier that uses a different optimal quantile probability for each variable

Usage

1
quantilecldiff(train, test, cl, theta = NULL, 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

A vector of quantile probabilities (optional)

cl.test

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

Details

quantilecldiff carries out the quantile classifier by using a different optimal quantile probability for each variable selected in the training set.

Value

A list with components

thetas

The vector of quantile probabilities

theta.choice

The mean of optimal quantile probabilities

me.train

Misclassification error for the best quantile probability in the training set

me.test

Misclassification error for the best quantile probability in the test set (only if cl.test is available)

cl.train

Predicted classification in the training set

cl.test

Predicted classification in the test set

Author(s)

Christian Hennig, Cinzia Viroli

See Also

See Also quantilecl

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.q=quantilecldiff(train,test,cl.train,cl.test=cl.test)
out.q$me.test
out.q$theta.choice