make_sparse_model function

Generate sparse linear model and random samples

Generate sparse linear model and random samples

Generate design matrix and response following linear models y=Xβ+ϵy = X \beta + \epsilon, where ϵ N(0,σ2)\epsilon ~ N(0, \sigma^2), and X N(0,Σ)X ~ N(0, \Sigma).

make_sparse_model(n, p, alpha, rho, snr, nsim)

Arguments

  • n: the sample size
  • p: the number of features
  • alpha: sparsity, i.e., nαn^\alpha nonzeros in the true regression coefficient.
  • rho: pairwise correlation among features
  • snr: signal to noise ratio, defined as βTΣβ/σ2\beta^T \Sigma \beta / \sigma^2
  • nsim: the number of simulations

Returns

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
  • Maintainer: Guo Yu
  • License: GPL-3
  • Last published: 2018-01-16