Generate design matrix and response following linear models \(y = X \beta + \epsilon\), where \(\epsilon ~ N(0, \sigma^2)\), and \(X ~ N(0, \Sigma)\).
make_sparse_model(n, p, alpha, rho, snr, nsim)
the sample size
the number of features
sparsity, i.e., \(n^\alpha\) nonzeros in the true regression coefficient.
pairwise correlation among features
signal to noise ratio, defined as \(\beta^T \Sigma \beta / \sigma^2\)
the number of simulations
A list object containing:
x
: The n
by p
design matrix
y
: The n
by nsim
matrix of response vector, each column representing one replication of the simulation
beta
: The true regression coefficient vector
sigma
: The true error standard deviation