# NOT RUN {
avec <- c(5, 10) # Alter these values parametrically
ivec <- c(3, 15) # Inflate these values
tvec <- c(6, 7) # Truncate these values
set.seed(1); pobs.a <- pstr.i <- 0.1
gdata <- data.frame(x2 = runif(nn <- 1000))
gdata <- transform(gdata, shape.p = logitlink(2, inverse = TRUE))
gdata <- transform(gdata,
y1 = rgaitdzeta(nn, shape.p, a.mix = avec, pobs.mix = pobs.a,
i.mix = ivec, pstr.mix = pstr.i, truncate = tvec))
gaitdzeta(a.mix = avec, i.mix = ivec)
with(gdata, table(y1))
spikeplot(with(gdata, y1), las = 1)
fit7 <- vglm(y1 ~ 1, trace = TRUE, data = gdata, crit = "coef",
gaitdzeta(i.mix = ivec, truncate = tvec,
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)
spikeplot(with(gdata, y1), lwd = 2, ylim = c(0, 0.6), xlim = c(0, 20))
plotdgaitd(fit7, new.plot = FALSE, offset.x = 0.2, all.lwd = 2)
# }
Run the code above in your browser using DataLab