# NOT RUN {
avec <- c(0, 3) # Alter 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 = rgenapois(nn, lambda = lambda1, pobs.a = c(0.2, 0.3), byrow = TRUE,
alter = avec),
y2 = rgenapois(nn, lambda = lambda2, pobs.a = c(0.2, 0.3), byrow = TRUE,
alter = avec),
y3 = rgenapois(nn, lambda = lambda3, pobs.a = c(0.2, 0.3), byrow = TRUE,
alter = avec))
genapoisson(alter = avec)
with(gdata, table(y1))
with(gdata, table(y2))
with(gdata, table(y3))
fit1 <- vglm(y1 ~ x2 + x3, genapoisson(alter = avec),
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, genapoisson(alter = avec), gdata, trace = TRUE)
coef(fit3, matrix = TRUE)
# }
Run the code above in your browser using DataLab