simulation: Simulates data with categorial covariates

Description Usage Arguments Details Value See Also Examples

Description

Simulates data with categorial covariates/categorial effect modifiers

Usage

1
2
simulation(n, covariates, correlation = NULL, formula, coefficients, 
family, sd = 1, seed = rpois(1, 2348) * rnorm(1))

Arguments

n

number of observations; must be large enough, so that all categories of all factor variables exist and therefore vector coefficients fits

covariates

description of the covariates and effect modifiers included in the model; format: list( name of variable 1 = list("distribution", c(parameters), "level of measurement"), name of variable 2 = ...)

correlation

optional matrix, specifies the correlation of Gaussian covariates

formula

formula like in gvcm.cat (all variables contained in formula must be defined in covariates)

coefficients

true parameter vector

family

a family object; currently only gaussian, binomial, poisson, Gamma

sd

if family = gaussian, standard deviation of response; if family = Gamma the rate parameter like in rgamma

seed

specifies the to be used seed

Details

Remarks on covariates:

Value

A data frame containing all specified covariates (even if they are not included in formula) and the response (named y)

See Also

Function gvcm.cat

Examples

1
2
3
4
5
6
7
8
9
## example function simulation
covariates <- list(x1=list("unif", c(0,2)),
                  x2=list("unif", c(0,2)),
                  x3=list("unif", c(0,2)),
                  u=list("multinom",c(0.3,0.4,0.3), "nominal")
                  )
true.f <- y ~ 1 + v(x1,u) + x2
true.coefs <- c(0.2,  0.3,.7,.7, -.5)
data <- simulation(400, covariates, NULL, true.f, true.coefs , binomial(), seed=456)

gvcm.cat documentation built on May 1, 2019, 10:13 p.m.