| simData {mcemGLM} | R Documentation |
Data used for fitting examples
Description
Example data for logistic, Poisson and negative binomial models.
Usage
data("simData")
Format
A data frame with 200 observations on the following 8 variables.
obsa binary vector. Used as a response for a logistic model.
x1a numeric vector.
x2a numeric vector.
x3a categorical vector with levels
blue,red, andyellow.z1a categorical vector with levels
D1,D2,D3,D4, andD5.z2a categorical vector with levels
1,2,3,4, and5.z3a categorical vector with levels
A,B, andD.counta numeric vector. Used as a response for a Poisson model.
Details
The levels of z2 can be nested within $z1$. The observations were generated with the code shown in the examples section.
Examples
set.seed(47819)
x1 <- rnorm(200, 10, 1)
x2 <- rnorm(200, 5, 1)
x3 <- sample(c("red", "blue", "yellow"), size = 200, replace = TRUE)
z1 <- factor(rep(c("D1", "D2", "D3", "D4", "D5"), each = 40))
z2 <- factor(rep(rep(1:4, each = 5), 10))
z3 <- factor(c(rep("A", 100), rep("B", 60), rep("D", 40)))
kX <- model.matrix(~x1 + x2 + x3)
kZ <- cbind(model.matrix(~ 0+z1), model.matrix(~ 0+z1:z2), model.matrix(~ 0+z3))
kBeta <- c(5, -4, 5, 0, 8)
kU <- 3 * rt(28, 5)
linf0 <- kX
prob0 <- exp(linf0)/(1+exp(linf0))
obs <- as.numeric(runif(100) < prob0)
simData <- data.frame(obs, x1, x2, x3, z1, z2, z3)
[Package mcemGLM version 1.1.3 Index]