circle_data {JOUSBoost} | R Documentation |
Simulate data from the circle model.
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) \le inner_r
, then p(y=1|x) = 1
, if r(x) \ge 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
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 |
X |
An |
p |
The true conditional probability |
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
# 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)