GLM: GLM

Description Usage Arguments Details Value Author(s) Examples

Description

Constructs a GLM model.

Usage

1
GLM(DV,family=NO(),factors,covariates,covariateModels,N,mu,sigma,nu,tau,beta)

Arguments

DV

either a list or a RandomVariable

.

family

a gamlss.family object

factors

either a data.frame or VariableList containing the factors of the design.

covariates

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

covariateModels

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

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 GLM function constructs a GLM model. The workhorse function is GLM_create, which should not be called directly.

Value

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

Author(s)

Maarten Speekenbrink

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
mod <- GLM(factors=data.frame(A=factor(c(1,1,2,2),labels=c("A1","A2")),B=factor(c(1,2,1,3),labels=c("B1","B2","B3"))),covariates=VariableList(list(RandomIntervalVariable(numeric(60),digits=8,min=-Inf,max=Inf,name="X"))),covariateModels=ModelList(list(NormalModel(mean=0,sd=1))),N=c(15,15,15,15),mu=c(0,1,2,3),sigma=c(2,2,2,2),nu=NULL,tau=NULL,beta=c(1,1,1,1),DV=list(name="Y",min=-Inf,max=Inf,digits=8),family=NO())
mod <- simulate(mod)

# create two factors and put them into a variablelist
f1 <- NominalVariable(factor(c(1,1,2,2),labels=c("A1","A2")),name="A")
f2 <- NominalVariable(factor(c(1,2,2,3),labels=c("B1","B2","B3")),name="B")
facs <- VariableList(list(f1,f2))
# and a random interval covariate
x <- VariableList(list(RandomIntervalVariable(numeric(1),name="X",min=-5,max=5,digits=2)))
# and a random interval dependent variable
d <- RandomIntervalVariable(numeric(1),name="Y",min=-10,max=Inf,digits=2)
mod2 <- GLM(factors=facs,covariates=x,
  covariateModels=ModelList(list(UniformModel())),
  N=c(20,20,20,20),mu=c(2,5,2,10),sigma=c(2,2,2,2),beta=c(1,2,1,2),
  DV=d,family=NO())
mod2 <- simulate(mod2)

simdat.base documentation built on May 2, 2019, 5:53 p.m.

Related to GLM in simdat.base...