# 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 = rgaitlog(nn, shape.p, alt.mix = avec, pobs.mix = pobs.a,
inf.mix = ivec, pstr.mix = pstr.i, truncate = tvec,
max.support = max.support))
gaitlog(alt.mix = avec, inf.mix = ivec, max.support = max.support)
with(gdata, table(y1))
# }
# NOT RUN {
spikeplot(with(gdata, y1), las = 1)
# }
# NOT RUN {
gaitlxfit <- vglm(y1 ~ x2, trace = TRUE, data = gdata,
gaitlog(inf.mix = ivec, truncate = tvec,
max.support = max.support,alt.mix = avec,
eq.ap = TRUE, eq.ip = TRUE))
head(fitted(gaitlxfit, type.fitted = "Pstr.mix"))
head(predict(gaitlxfit))
t(coef(gaitlxfit, matrix = TRUE)) # Easier to see with t()
summary(gaitlxfit, HDEtest = FALSE) # summary(gaitlxfit) is better
# }
Run the code above in your browser using DataLab