Learn R Programming

PoSIAdjRSquared (version 0.1.0)

datagen.norm: Data generation normal

Description

Function to generate data according to the linear model of the form Y = X*beta + epsilon where the noise epsilon follows a standard normal distribution.

Usage

datagen.norm(seed, n, p, rho, beta_vec)

Value

X

Design matrix of type "matrix" and dimension nxp

y

Response vector of type "matrix" and dimension nx1

true_y

True response vector, i.e. without the noise, of type "matrix" and dimension nx1

Arguments

seed

Integer for seed

n

Integer for sample size

p

Integer for number of variables in the design matrix

rho

Integer for correlation between variables in the design matrix

beta_vec

True regression coefficient vector of length p

Examples

Run this code
  datagen.norm(seed = 7, n = 100, p = 10, rho = 0, beta_vec = c(1,0.5,0,0.5,0,0,0,0,0,0))

Run the code above in your browser using DataLab