Learn R Programming

GLMaSPU (version 1.0)

generate_data: Generate data for generalized linear models in simulation.

Description

generate_data returns simulated data, including response Y, covariates Z, and variable of interest X.

Usage

generate_data(seed, n, p, beta, alpha)

Arguments

seed
Random seed.
n
Number of samples
p
Dimension of variable of interest
beta
Coefficients for covariates Z
alpha
Coefficients for variable of interest X

Value

A list object

References

Chong Wu, Gongjun Xu and Wei Pan, "An Adaptive test on high dimensional parameters in generalized linear models" (Submitted)

Examples

Run this code

p = 200
n = 100
beta = c(1,3,3)
s = 0.15
signal.r = 0.08
non.zero = floor(p * s)
seed = 2
alpha = c(rep(signal.r,non.zero),rep(0,p-non.zero))
dat = generate_data(seed, n = n, p = p, beta = beta,alpha = alpha)
#X, Y, cov
#dat$X; dat$Y; dat$cov

Run the code above in your browser using DataLab