rmultreg {ADVICE} | R Documentation |
Multiple Regression Data Generator
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
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
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