# NOT RUN {
ivec <- c(0, 3) # Inflate these values
gdata <- data.frame(x2 = runif(nn <- 1000))
gdata <- transform(gdata, x3 = runif(nn))
gdata <- transform(gdata, lambda1 = exp(1 + 2 * x2 + 0.5 * x3),
lambda2 = exp(1 - 1 * x2 + 0.5 * x3),
lambda3 = exp(1))
gdata <- transform(gdata,
y1 = rgenipois(nn, lambda1, pstr.i = c(0.2, 0.3), byrow = TRUE,
inflate = ivec),
y2 = rgenipois(nn, lambda2, pstr.i = c(0.2, 0.3), byrow = TRUE,
inflate = ivec),
y3 = rgenipois(nn, lambda3, pstr.i = c(0.2, 0.3), byrow = TRUE,
inflate = ivec))
genipoisson(inflate = ivec)
with(gdata, table(y1))
with(gdata, table(y2))
with(gdata, table(y3))
fit1 <- vglm(y1 ~ x2 + x3, genipoisson(inflate = ivec),
crit = "coef", trace = TRUE, data = gdata)
head(fitted(fit1))
head(predict(fit1))
coef(fit1, matrix = TRUE)
# summary(fit1) # Currently does not work!!
# Another example ------------------------------
fit3 <- vglm(y3 ~ 1, genipoisson(inflate = ivec), gdata, trace = TRUE)
coef(fit3, matrix = TRUE)
# }
Run the code above in your browser using DataLab