rmultreg: Multiple Regression Data Generator

Description Usage Arguments Value Author(s) Examples

View source: R/rmultreg.R

Description

Values of any number of predictor variables and a single response variable are simulated according to a model with randomly generated coefficients. Values of each predictor are simulated independently from standard normal distributions. The regression coefficients are generated independently from a uniform distribution on the interval (minimum, maximum), and each coefficient is multiplied by a Bernoulli (p) variate, independent of the other coefficients. This results in some of the coefficients being zeroed out. Noise is added to the regression response according to independent t variates with degrees of freedom equal to dfnoise.

Usage

1
rmultreg(n, k = 1, minimum = 0, maximum = 1, p = 0.5, dfnoise = 100, sdnoise = 1) 

Arguments

n

number of observations.

k

number of predictor variables in addition to the intercept.

minimum

minimum possible value for the regression coefficients, apart, possibly, from some zeroes.

maximum

maximum possible value for the regression coefficients, apart, possibly, from some zeroes.

p

probability that a given regression coefficient remains nonzero.

dfnoise

degrees of freedom for t-distributed additive noise.

sdnoise

standard deviation of the noise term.

Value

a list containing

data

a dataframe containing n observations on k predictor variables and a response y.

coefficients

a numeric vector containing the true regression coefficients.

Author(s)

W.J. Braun

Examples

1
2
3
4
5
    myRegressionData <- rmultreg(50, k=3, p=.5, sdnoise = .25)
    pairs(myRegressionData$data)
    out <- ices(y ~ ., data = myRegressionData$data) # fit model to simulated data
    confint(out) # calculate 95% confidence intervals for all coefficients
    myRegressionData$coefficients # compare with true coefficients

ADVICE documentation built on April 16, 2021, 9:07 a.m.

Related to rmultreg in ADVICE...