rand: Random Regressors

View source: R/rand.R

randR Documentation

Random Regressors

Description

A utility function for producing random regressors with a specified number of degrees of freedom.

Usage

rand(df = 1, rdist = rnorm, args = list(), nrow, seed = NULL)

Arguments

df

degrees of freedom, i.e., number of random regressors

rdist

random distribution function for sampling

args

arguments for rdist

nrow

number of rows in resulting matrix. This can often be omitted in the context of functions like lm where it is inferred from the data frame, if one is provided.

seed

seed for random number generation

Value

A matrix of random variates with df columns. In its intended use, the number of rows will be selected to match the size of the data frame supplied to lm

Examples

rand(2,nrow=4)
rand(2,rdist=rpois, args=list(lambda=3), nrow=4)
summary(lm( waiting ~ eruptions + rand(1), faithful))

mosaic documentation built on May 29, 2024, 5:27 a.m.