rmix: Random Mixture Classification Example

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

View source: R/rmix.R

Description

Generates a random mixture for binary class prediction with output variable green and red factors and with two inputs x1 and x2. Similar to the mixture dataset in ESL.

Usage

1
rmix(n = 100)

Arguments

n

Sample size, should be even number, n/2 green and n/2 red.

Details

The optimal Bayes error rate is 20.76

Value

dataframe with columns x1, x2, y

Author(s)

A. I. McLeod

References

ESL. Hastie, Tibshirani and Friedman (2009). The Elements of Statistical Learning. 2nd Ed. Springer.

See Also

rxor, rdigitsBFOS, ShaoReg

Examples

1
2
3
4
5
6
7
mdf <- rmix(200)
gr <- mdf[mdf$y=="green",]
rd <- mdf[mdf$y=="red",]
with(mdf, {plot(x1, x2, type="n")
  points(gr, col="green")
  points(rd, col="red")
  })

gencve documentation built on May 29, 2017, 7:12 p.m.