# NOT RUN {
avec <- c(5, 10) # Alter these values
ivec <- c(3, 15) # Inflate these values
tvec <- c(6, 7) # Truncate these values
pobs.a <- logitlink(-1, inverse = TRUE) # About 0.27
pstr.i <- logitlink(-1, inverse = TRUE) # About 0.27
max.support <- 20; set.seed(1)
gdata <- data.frame(x2 = runif(nn <- 1000))
gdata <- transform(gdata, lambda.p = exp(2 + 0.5 * x2))
gdata <- transform(gdata,
y1 = rgaitpois(nn, lambda.p, alter.mix = avec, pobs.mix.a = pobs.a,
inflate.mix = ivec, pstr.mix.i = pstr.i,
truncate = tvec, max.support = max.support))
gaitpoisson.mix(alter = avec, inflate = ivec)
with(gdata, table(y1))
gaitpxfit <- vglm(y1 ~ x2, crit = "coef", trace = TRUE, data = gdata,
gaitpoisson.mix(alter = avec, inflate = ivec,
truncate = tvec, eq.ap = TRUE,
eq.ip = TRUE, max.support = max.support))
head(fitted(gaitpxfit, type.fitted = "Pstr.i"))
head(predict(gaitpxfit))
coef(gaitpxfit, matrix = TRUE)
summary(gaitpxfit)
# }
Run the code above in your browser using DataLab