simdata {ImpShrinkage}R Documentation

Simulation data

Description

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)

Arguments

n

Number of observations.

p

Number of variables.

beta

Regression parameter.

seed

(Optional) The random seed for reproducibility. Default is NULL.

Value

A list containing the following components:

X

a matrix of dimensions n x p.

y

a numeric vector of length n.

References

Saleh, A. K. Md. Ehsanes. (2006). Theory of Preliminary Test and Stein‐Type Estimation With Applications, Wiley.

Examples

simulated_data <- simdata(n = 100, p = 5, beta = c(2, 1, 3, 0, 5))
X <- simulated_data$X
y <- simulated_data$y
X
y


[Package ImpShrinkage version 1.0.0 Index]