gen.data: Generate Data With Contamination

View source: R/gen.data.q

gen.dataR Documentation

Generate Data With Contamination

Description

Generates a random dataset with some amount of contaimination.

Usage

gen.data(coeff, n = 100, eps = 0.1, sig = 3, snr = 1/20, seed = 837)

Arguments

coeff

a numeric vector of length 3 containing the true coefficients.

n

a positive integer giving the number of observations in the data set.

eps

a numeric value between 0 and 0.5 specifying the fraction of contamination.

sig

a positive numeric value giving the standard deviation of the uncontaminated data.

snr

a positive numeic value giving the signal to noise ratio, well not really.

seed

an integer value giving the seed for the random number generator.

Value

a data frame with n rows and 4 columns. The regressors are generated as: rnorm(n,1), rnorm(n,1)^3, exp(rnorm(n,1)). It also generates an unused vector x4.


robust documentation built on Sept. 11, 2024, 5:16 p.m.