Learn R Programming

l2boost (version 1.0.3)

elasticNetSim: A blocked correlated data simulation.

Description

Creates a data simulation of n observations with signal groups of (p0/signal) signal variables and (p-p0) noise variables. Random noise is added to all columns. The default values, with n=100 create the simulation of Zou and Hastie (2005).

Usage

elasticNetSim(
  n,
  p = 40,
  p0 = 15,
  signal = 3,
  sigma = sqrt(0.01),
  beta.true = NULL
)

Arguments

n

number of observations

p

number of coordinate directions in the design matrix (default 40)

p0

number of signal coordinate directions in the design matrix (default 15)

signal

number of signal groups (default 3)

sigma

within group correlation coefficient (default sqrt(0.01))

beta.true

specify the true simulation parameters. (default NULL = generated from other arguments)

Value

list of

  • x simulated design matrix

  • y simulated response vector

  • beta.true true beta parameters used to create the simulation

References

Zou, H. and Hastie, T. (2005) Regularization and variable selection via the elastic net J. R. Statist. Soc. B, 67, Part 2, pp. 301-320

Examples

Run this code
# NOT RUN {
#--------------------------------------------------------------------------
# Example: Elastic net simulation
#  
# For elastic net simulation data, see Zou, H. and Hastie, T. (2005) 
# Regularization and variable selection via the elastic net J. R. Statist. Soc. B
# , 67, Part 2, pp. 301-320
  # Set the RNG seed to create a reproducible simulation
  set.seed(432) # Takes an integer argument
  
  # Creata simulation with 100 observations.
  dta <- elasticNetSim(n=100)
  
  # The simulation contains a design matrix x, and response vector y
  dim(dta$x)
  length(dta$y)
  print(dta$x[1:5,])

# }

Run the code above in your browser using DataLab