Learn R Programming

BartMixVs (version 1.0.0)

checkerboard: Generate data for an example of Zhu, Zeng and Kosorok (2015)

Description

Generate data including responses and predictors values according to an example of Zhu, R., Zeng, D. and Kosorok, M. R. (2015). "Reinforcement learning trees." J. Amer. Statist. Assoc. 110 1770--1784.

Usage

checkerboard(n, p, sigma, binary)

Arguments

n

The number of observations.

p

The number of predictors.

sigma

The error variance.

binary

A boolean argument: binary = TRUE indicates that binary responses are generated and binary = FALSE indicates that continuous responses are generated.

Value

Return a list with the following components.

X

An n by p data frame representing predictors values, with each row corresponding an observation.

Y

A vector of length n representing response values.

f0

A vector of length n representing the values of \(f0(x)\).

sigma

The error variance which is only returned when binary = FALSE.

prob

A vector of length n representing the values of \(\Phi(f0(x))\), which is only returned when binary = TRUE.

Details

Sample the predictors \(x_1, ..., x_p\) from Normal(\(0, \Sigma\)) with \(\Sigma_{jk} = 0.3^{|j-k|}\), \(j,k = 1, ..., p\). If binary = FALSE, sample the continuous response \(y\) from Normal(\(f0(x), \sigma^2\)), where $$f0(x) = 2x_1*x_4 + 2x_7*x_{10}.$$ If binary = TRUE, sample the binary response \(y\) from Bernoulli(\(\Phi(f0(x))\)) where \(f0\) is defined above and \(\Phi\) is the cumulative density function of the standard normal distribution.

References

Luo, C. and Daniels, M. J. (2021) "Variable Selection Using Bayesian Additive Regression Trees." arXiv preprint arXiv:2112.13998.

Zhu, R., Zeng, D. and Kosorok, M. R. (2015). "Reinforcement learning trees." J. Amer. Statist. Assoc. 110 1770--1784.

Examples

Run this code
# NOT RUN {
data = checkerboard(100, 10, 1, FALSE)
# }

Run the code above in your browser using DataLab