simdata {ImpShrinkage} | R Documentation |
This function generates a toy example. The error term, \varepsilon
,
and the design matrix, X
, are simulated from standard normal
distributions, \mathcal{N}(0,1)
, using the rnorm
function. Given the true parameter vector, \beta
, the response vector,
y
, is calculated as
y = X \beta + \varepsilon.
simdata(n, p, beta, seed = NULL)
n |
Number of observations. |
p |
Number of variables. |
beta |
Regression parameter. |
seed |
(Optional) The random seed for reproducibility. Default is |
A list containing the following components:
a matrix of dimensions n x p
.
a numeric vector of length n
.
Saleh, A. K. Md. Ehsanes. (2006). Theory of Preliminary Test and Stein‐Type Estimation With Applications, Wiley.
simulated_data <- simdata(n = 100, p = 5, beta = c(2, 1, 3, 0, 5))
X <- simulated_data$X
y <- simulated_data$y
X
y