Generate sparse linear model and random samples
Generate design matrix and response following linear models , where , and .
make_sparse_model(n, p, alpha, rho, snr, nsim)
n
: the sample sizep
: the number of featuresalpha
: sparsity, i.e., nonzeros in the true regression coefficient.rho
: pairwise correlation among featuressnr
: signal to noise ratio, defined as nsim
: the number of simulationsA list object containing:
x
:: The n
by p
design matrixy
:: The n
by nsim
matrix of response vector, each column representing one replication of the simulationbeta
:: The true regression coefficient vectorsigma
:: The true error standard deviation