# NOT RUN {
avec <- c(5, 10)  # Alter these values parametrically
ivec <- c(3, 15)  # Inflate these values
tvec <- c(6, 7)   # Truncate these values
max.support <- 20; set.seed(1)
pobs.a <- pstr.i <- 0.1
gdata <- data.frame(x2 = runif(nn <- 1000))
gdata <- transform(gdata, shape.p = logitlink(2+0.5*x2, inverse = TRUE))
gdata <- transform(gdata,
  y1 = rgaitdlog(nn, shape.p, a.mix = avec, pobs.mix = pobs.a,
                i.mix = ivec, pstr.mix = pstr.i, truncate = tvec,
                max.support = max.support))
gaitdlog(a.mix = avec, i.mix = ivec, max.support = max.support)
with(gdata, table(y1))
# }
# NOT RUN {
 spikeplot(with(gdata, y1), las = 1) 
# }
# NOT RUN {
fit7 <- vglm(y1 ~ x2, trace = TRUE, data = gdata,
             gaitdlog(i.mix = ivec, truncate = tvec,
                      max.support = max.support, a.mix = avec,
                      eq.ap = TRUE, eq.ip = TRUE))
head(fitted(fit7, type.fitted = "Pstr.mix"))
head(predict(fit7))
t(coef(fit7, matrix = TRUE))  # Easier to see with t()
summary(fit7)
# }
# NOT RUN {
 spikeplot(with(gdata, y1), lwd = 2, ylim = c(0, 0.4))
plotdgaitd(fit7, new.plot = FALSE, offset.x = 0.2, all.lwd = 2)  
# }
Run the code above in your browser using DataLab