simDataGLMMdesign: Simulated data to use in GLMM

Description Usage Arguments Details Value Examples

Description

Here, a design matrix is specified for a univariate model, whereas in the function simDataGLMM, a fixed mean is used, and a multivariate model can be specified.

Usage

1
2
simDataGLMMdesign(fixedMat, fixedCoef, randomMat, covM, disFam,
  detailed.output = F, seed = NULL)

Arguments

fixedMat

The model matrix (numeric matrix or data.frame of factors and numeric variables) of the fixed effects to enter the linear predictor. Make sure that the contrasts fit together with the specification of the coefficients in fixedCoef.

fixedCoef

The coefficients to use with the fixed effects.

randomMat

The model matrix (data.frame of factors) of the random effects.

covM

Covariance matrix of the random effects. Currently, only the diagonal is used.

disFam

The distribution family. The canonical link function is chosen.

detailed.output

Output all the steps. Default: F. (This option is only for testing and can be removed.)

seed

integer. Seed used for the simulation. Default: NULL, so the seed provided by the system is used.

Details

For the Gaussian family, the variance parameter is 1. For the Gamma distribution, the rate parameter is 1.

Value

A data frame consisting of the fixed effects and random effects as given in the input and the simulated response variable 'res'.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
# one numeric explanatory variable and 1 factor with 2 levels
fixedMat = as.matrix(runif(10))
randomMat = data.frame(group = as.factor(rep(c("A", "B"), each=5)))
simDataGLMMdesign(fixedMat, fixedCoef=0.5, randomMat, covM = 1, disFam = poisson(), seed = 1234)

fixedMat = as.matrix(runif(20), ncol=2)
randomMat = as.factor(rep(c("A", "B"), each=5))
simDataGLMMdesign(fixedMat, fixedCoef=0.5, randomMat, covM = 1, disFam = poisson())

fixedMat = data.frame(quant=runif(10), fac=as.factor(rep(c("D1", "D2"), each=5)))
randomMat = data.frame(group = as.factor(rep(c("A", "B"), each=5)), group2 = as.factor(rep(c("a", "b", "c", "d", "e"), 2)))
simDataGLMMdesign(fixedMat, fixedCoef=c(1, 5, 10), randomMat, covM = diag(c(1,2)), disFam = inverse.gaussian(), detailed.output=T)

JeanettPetersen/simGLMM documentation built on May 21, 2019, 4:03 a.m.