gen_mease: Generate data from the Mease model

View source: R/gen_mease.R

gen_measeR Documentation

Generate data from the Mease model

Description

Generate binary classification data from the Mease model Mease et al. (2007).

Usage

gen_mease(n = 1000, nsim = 1)

Arguments

n

Integer specifying the number of observations. Default is 1000.

nsim

Integer specifying the number of binary repsonses to generate. Default is 1.

Value

A data frame with 3 + nsim columns. The first two columns give the values of the numeric features x1 and x2. The third column (yprob) gives the true probabilities (i.e., PrY = 1 | X = x). The remaining nsim columns (yclass<i>, i = 1, 2, ..., nsim) give the simulated binary outcomes corresponding to yprob.

References

Mease D, Wyner AJ, Buja A. Boosted classification trees and class probability quantile estimation. Journal of Machine Learning Research. 2007; 8:409–439.

Examples

# Generate N = 1000 observations from the Mease model
set.seed(2254)  # for reproducibility 
mease <- gen_mease(1000, nsim = 1)

# Plot predictor values colored by binary outcome
cols <- palette.colors(2, palette = "Okabe-Ito", alpha = 0.3)
plot(x2 ~ x1, data = mease, col = cols[mease$yclass1 + 1], pch = 19)

bgreenwell/treemisc documentation built on Oct. 26, 2022, 12:56 a.m.