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