margin: Classification Margin Between Two Sample Classes

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

View source: R/wilma-utils.R

Description

For a set of n observations grouped into two classes (for example n expression values of a gene), the margin function measures the size of the gap between the classes. This is the distance between the observation of response class zero having the lowest value, and the individual of with response one having the highest value.

Usage

1
margin(x, resp)

Arguments

x

Numeric vector of length n, for example containing gene or cluster expression values of n different cases.

resp

Numeric vector of length n containing the “binary” class labels of the cases. Must be coded by 0 and 1.

Value

A numeric value, the margin. Positive margin indicates perfect separation of the response classes, whereas negative margin means imperfect separation.

Author(s)

Marcel Dettling

References

see those in wilma.

See Also

wilma, score is the second statistic that is used there.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
data(leukemia, package="supclust")
op <- par(mfrow=c(1,3))
plot(leukemia.x[,69],leukemia.y)
title(paste("Margin = ", round(margin(leukemia.x[,69], leukemia.y),2)))

## Sign-flipping is very important
plot(leukemia.x[,161],leukemia.y)
title(paste("Margin = ", round(margin(leukemia.x[,161], leukemia.y),2)))
x <- sign.flip(leukemia.x, leukemia.y)$flipped.matrix
plot(x[,161],leukemia.y)
title(paste("Margin = ", round(margin(x[,161], leukemia.y),2)))
par(op)

supclust documentation built on Sept. 27, 2021, 5:11 p.m.