Description Usage Arguments Value References Examples
View source: R/elasticNetSim.R
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).
1 2 3 4 5 6 7 8 | elasticNetSim(
n,
p = 40,
p0 = 15,
signal = 3,
sigma = sqrt(0.01),
beta.true = NULL
)
|
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) |
list of
x simulated design matrix
y simulated response vector
beta.true true beta parameters used to create the simulation
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
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | #--------------------------------------------------------------------------
# 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,])
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.