# NOT RUN {
avec <- c(0, 5) # Alter these values
Size <- 10
gdata <- data.frame(x2 = runif(nn <- 1000))
gdata <- transform(gdata, x3 = runif(nn))
gdata <- transform(gdata,
prob1 = logitlink(1 + 2 * x2 + .5 * x3, inverse = TRUE),
prob2 = logitlink(1 - 1 * x2 + .5 * x3, inverse = TRUE),
prob3 = logitlink(1, inverse = TRUE))
gdata <- transform(gdata,
y1 = rgaitbinom.mlm(nn, prob = prob1, Size, pobs.a = c(0.2, 0.3),
byrow = TRUE, alter = avec),
y2 = rgaitbinom.mlm(nn, prob = prob2, Size, pobs.a = c(0.2, 0.3),
byrow = TRUE, alter = avec),
y3 = rgaitbinom.mlm(nn, prob = prob3, Size, pobs.a = c(0.2, 0.3),
byrow = TRUE, alter = avec))
gabinomial.mlm(alter = avec)
with(gdata, table(y1))
with(gdata, table(y2))
with(gdata, table(y3))
fit1 <- vglm(cbind(y1, Size-y1) ~ x2 + x3, gabinomial.mlm(alter = avec),
crit = "coef", trace = TRUE, data = gdata)
head(fitted(fit1))
head(predict(fit1))
coef(fit1, matrix = TRUE)
summary(fit1)
# Another example ------------------------------
fit3 <- vglm(cbind(y3, Size-y3) ~ 1, gabinomial.mlm(alter = avec),
gdata, trace = TRUE)
coef(fit3, matrix = TRUE)
# }
Run the code above in your browser using DataLab