# NOT RUN {
avec <- seq(5, 25, by = 5) # Alter these values
tvec <- c(4, 7, 22) # Truncate these values
pobs.a <- logitlink(-0.5, inverse = TRUE) # About 0.5
gdata <- data.frame(x2 = runif(nn <- 1000))
gdata <- transform(gdata, munb.p = exp(2 + 0 * x2), size.p = exp(1))
gdata <- transform(gdata,
y1 = rgaitnbinom.mix(nn, size.p = size.p, munb.p = munb.p,
pobs.a = pobs.a, truncate = tvec, alter = avec))
gatnbinomial.mix(alter = avec)
(ty1 <- with(gdata, table(y1)))
# }
# NOT RUN {
plot(as.numeric(names(ty1)), c(ty1) / sum(ty1), xlab = "y",
ylab = "Proportion", las = 1, type = "h", col = "blue")
fit1 <- vglm(y1 ~ 1, trace = TRUE, data = gdata,
gatnbinomial.mix(alter = avec, truncate = tvec,
parallel = TRUE))
head(fitted(fit1, type.fitted = "Pobs.a"))
head(predict(fit1))
coef(fit1, matrix = TRUE)
summary(fit1)
# }
Run the code above in your browser using DataLab