cpop_data_binary: A simulated binary data

cpop_data_binaryR Documentation

A simulated binary data

Description

A simulated binary data

Usage

cpop_data_binary

Format

A list with columns:

x1

A matrix of size 100*20, each column has mean 1 and sd 1

x2

A matrix of size 100*20, each column has mean 2 and sd 1

x3

A matrix of size 100*20, each column has mean 3 and sd 1

y1

A factor vector of 0's and 1's, created by beta and x1

y2

A factor vector of 0's and 1's, created by beta and x2

y3

A factor vector of 0's and 1's, created by beta and x3

beta

A random vector with first 10 entries drawn from random unif(-1, 1), otherwise 0's.

Examples

data(cpop_data_binary)
## Loading simulated matrices and vectors
x1 = cpop_data_binary$x1
x2 = cpop_data_binary$x2
x3 = cpop_data_binary$x3
y1 = cpop_data_binary$y1
y2 = cpop_data_binary$y2
y3 = cpop_data_binary$y3
## Not run: 
set.seed(13)
n = 100
p = 20
x1 = matrix(rnorm(n * p, mean = 1, sd = 1), nrow = n, ncol = p)
x2 = matrix(rnorm(n * p, mean = 2, sd = 1), nrow = n, ncol = p)
x3 = matrix(rnorm(n * p, mean = 3, sd = 1), nrow = n, ncol = p)
colnames(x1) = colnames(x2) = colnames(x3) = sprintf("X%02d", 1:p)
z1 = pairwise_col_diff(x1)
z2 = pairwise_col_diff(x2)
z3 = pairwise_col_diff(x3)
k = 10
q = choose(p, 2)
beta = c(runif(k, -1, 1), rep(0, q - k))
names(beta) = colnames(z1)
y1 = factor(rbinom(n, 1, prob = CPOP::expit(z1 %*% beta)), levels = c("0", "1"))
y2 = factor(rbinom(n, 1, prob = CPOP::expit(z2 %*% beta)), levels = c("0", "1"))
y3 = factor(rbinom(n, 1, prob = CPOP::expit(z3 %*% beta)), levels = c("0", "1"))
cpop_data_binary = tibble::lst(x1, x2, x3, y1, y2, y3, beta)
usethis::use_data(cpop_data_binary)

## End(Not run)

kevinwang09/top documentation built on April 20, 2022, 3:01 a.m.