circle_data: Simulate data from the circle model.

Description Usage Arguments Value References Examples

View source: R/simulation.R

Description

Simulate draws from a bernoulli distribution over c(-1,1). First, the predictors x are drawn i.i.d. uniformly over the square in the two dimensional plane centered at the origin with side length 2*outer_r, and then the response is drawn according to p(y=1|x), which depends on r(x), the euclidean norm of x. If r(x) ≤ inner_r, then p(y=1|x) = 1, if r(x) ≥ outer_r then p(y=1|x) = 1, and p(y=1|x) = (outer_r - r(x))/(outer_r - inner_r) when inner_r <= r(x) <= outer_r. See Mease (2008).

Usage

1
circle_data(n = 500, inner_r = 8, outer_r = 28)

Arguments

n

Number of points to simulate.

inner_r

Inner radius of annulus.

outer_r

Outer radius of annulus.

Value

Returns a list with the following components:

y

Vector of simulated response in c(-1,1).

X

An nx2 matrix of simulated predictors.

p

The true conditional probability p(y=1|x).

References

Mease, D., Wyner, A. and Buha, A. (2007). Costweighted boosting with jittering and over/under-sampling: JOUS-boost. J. Machine Learning Research 8 409-439.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
# Generate data from the circle model
set.seed(111)
dat = circle_data(n = 500, inner_r = 1, outer_r = 5)

## Not run: 
# Visualization of conditional probability p(y=1|x)
inner_r = 0.5
outer_r = 1.5
x = seq(-outer_r, outer_r, by=0.02)
radius = sqrt(outer(x^2, x^2, "+"))
prob = ifelse(radius >= outer_r, 0, ifelse(radius <= inner_r, 1,
             (outer_r-radius)/(outer_r-inner_r)))
image(x, x, prob, main='Probability Density: Circle Example')

## End(Not run)

JOUSBoost documentation built on May 2, 2019, 6:03 a.m.