set.seed(1)
if (FALSE) {
nn <- 1000 # Example 1
ymat <- rbinom3.or(nn, mu1 = logitlink(0.5, inv = TRUE),
oratio12 = exp(1), exch = TRUE)
fit1 <- vglm(ymat ~ 1, binom3.or(exc = TRUE), tra = TRUE)
coef(fit1, matrix = TRUE)
constraints(fit1)
bdata <- data.frame(x2 = sort(runif(nn))) # Example 2
bdata <- transform(bdata,
mu1 = logitlink(-1 + 1 * x2, inv = TRUE),
mu2 = logitlink(-1 + 2 * x2, inv = TRUE),
mu3 = logitlink( 2 - 1 * x2, inv = TRUE))
ymat2 <- with(bdata,
rbinom3.or(nn, mu1, mu2, mu3, exp(0.25),
oratio13 = exp(0.25), exp(0.25)))
fit2 <- vglm(ymat2 ~ x2, binom3.or(eq.or = TRUE),
bdata, trace = TRUE)
coef(fit2, matrix = TRUE)
}
Run the code above in your browser using DataLab