Regression

Share:

Description

Constructs a linear Regression model.

Usage

1
Regression(DV, family,predictors,predictorModels,N,mu,sigma,nu,tau,beta)

Arguments

DV

either a list or a RandomVariable

.

family

a gamlss.family object

predictors

either a data.frame or VariableList containing the predictors in the design.

predictorModels

(optional) a list with models to simulate random predictors.

N

a vector with the number of observations in each cell of the design.

mu

a vector with the values of mu in each cell of the design.

sigma

a vector with the values of sigma in each cell of the design.

nu

a vector with the values of nu in each cell of the design.

tau

a vector with the values of tau in each cell of the design.

beta

a vector or matrix with the slopes of the covariates in each cell of the design.

Details

The Regression function constructs a (multiple) regression model. The workhorse function is GLM_create, which should not be called directly.

Value

An object of class Regression (directly extending the GLM class).

Author(s)

Maarten Speekenbrink

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
mod <- Regression(predictors=VariableList(list(RandomIntervalVariable(numeric(10),digits=8,min=-Inf,max=Inf,name="X"))),predictorModels=ModelList(list(NormalModel(mean=0,sd=1))),N=10,mu=0,sigma=1,nu=NULL,tau=NULL,beta=1,DV=list(name="Y",min=-Inf,max=Inf,digits=8),family=NO())
mod <- simulate(mod)

# and a random interval covariate
x <- VariableList(list(
  RandomIntervalVariable(numeric(1),name="X1",min=-5,max=5,digits=2),
  RandomIntervalVariable(numeric(1),name="X2",min=-9,max=11,digits=4)
  ))
# and a random interval dependent variable
d <- RandomIntervalVariable(numeric(1),name="Y",min=-Inf,max=Inf,digits=2)
mod2 <- Regression(predictors=x,
  predictorModels=ModelList(list(UniformModel(),NormalModel(mean=1,sd=2))),
  N=10000,mu=2,sigma=3,beta=matrix(c(1,2),ncol=2),
  DV=d,family=NO())
mod2 <- simulate(mod2)
summary(lm(Y~X1+X2,data=getData(simulate(mod2))))