Learn R Programming

cate (version 1.1.1)

gen.sim.data: Generate simulation data set

Description

gen.sim.data generates data from the following model Y = X_0 Beta_0^T + X_1 Beta_1^T + Z Gamma^T + E Sigma^1/2, Z|X_0, X_1 = X_0 Alpha_0^T + X_1 Alpha_1^T + D, cov(X_0, X_1) ~ Sigma_X

Usage

gen.sim.data(
  n,
  p,
  r,
  d0 = 0,
  d1 = 1,
  X.dist = c("binary", "normal"),
  alpha = matrix(0.5, r, d0 + d1),
  beta = NULL,
  beta.strength = 1,
  beta.nonzero.frac = 0.05,
  Gamma = NULL,
  Gamma.strength = sqrt(p),
  Gamma.beta.cor = 0,
  Sigma = 1,
  seed = NULL
)

Arguments

n

number of observations

p

number of observed variables

r

number of confounders

d0

number of nuisance regression covariates

d1

number of primary regression covariates

X.dist

the distribution of X, either "binary" or "normal"

alpha

association of X and Z, a r*d vector (d = d0 + d1)

beta

treatment effects, a p*d vector

beta.strength

strength of beta

beta.nonzero.frac

if beta is not specified, fraction of nonzeros in beta

Gamma

confounding effects, a p*r matrix

Gamma.strength

strength of Gamma, more precisely the mean of square entries of Gamma * alpha

Gamma.beta.cor

the "correlation" (proportion of variance explained) of beta and Gamma

Sigma

noise variance, a p*p matrix or p*1 vector or a single real number

seed

random seed

Value

a list of objects

X0

matrix of nuisance covariates

X1

matrix of primary covariates

Y

matrix Y

Z

matrix of confounders

alpha

regression coefficients between X and Z

beta

regression coefficients between X and Y

Gamma

coefficients between Z and Y

Sigma

noise variance

beta.nonzero.pos

the nonzero positions in beta

r

number of confounders