sim_data: Generate Simulated Data

Description Usage Arguments Value Author(s) References Examples

View source: R/sim_data.R

Description

It returns simulated data. This is corresponding to high dimensional linear model simulation settings in the manuscript.

Usage

1
sim_data(seed, n, p, beta)

Arguments

seed

Random seed.

n

Number of subjects.

p

Number of variables.

beta

Coefficients.

Value

A list object containing the simulated data.

Author(s)

Chong Wu and Wei Pan

References

Wu, C., Xu, G., Shen, X., & Pan, W. (2018+). An adaptive test for high-dimensional generalized linear models with application to detect gene-environment interactions, Submitted.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
# Generate the data (codes for the simulations in the manuscript)
n = 30
signal.r = 0
nInformative = 3
p = 40
seed = 1
s = 0.01
non.zero = floor((p/2) * s)
alpha = c(rep(0,p/2 - non.zero), runif(non.zero,-signal.r,signal.r))
beta = c(rep(2,nInformative), rep(0,(p/2- 3)), alpha)
dat = sim_data(seed, n = n, p = p, beta = beta)

X = dat$X
Y = dat$Y

ChongWu-Biostat/aispu documentation built on Jan. 4, 2020, 1:23 a.m.