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.$$
Usage
simdata(n, p, beta, seed = NULL)
Value
A list containing the following components:
X
a matrix of dimensions n x p.
y
a numeric vector of length n.
Arguments
n
Number of observations.
p
Number of variables.
beta
Regression parameter.
seed
(Optional) The random seed for reproducibility. Default is NULL.
References
Saleh, A. K. Md. Ehsanes. (2006). Theory of Preliminary Test and
Stein‐Type Estimation With Applications, Wiley.