nn <- 10; mysize <- 20
set.seed(123)
bdata <- data.frame(x2 = rnorm(nn))
bdata <- transform(bdata,
y1 = rbinom(nn, size = mysize, p = logit(1+x2, inverse = TRUE)),
y2 = rbinom(nn, size = mysize, p = logit(1+x2, inverse = TRUE)),
f1 = factor(as.numeric(rbinom(nn, size = 1,
p = logit(1+x2, inverse = TRUE)))))
(fit1 <- vglm(cbind(y1, aaa = mysize - y1) ~ x2, # Matrix response (2-colns)
binomialff, data = bdata))
(fit2 <- vglm(f1 ~ x2, # Factor response
binomialff, model = TRUE, data = bdata))
set.seed(123)
simulate(fit1, nsim = 8)
set.seed(123)
c(simulate(fit2, nsim = 3)) # Use c() when model = TRUE
Run the code above in your browser using DataLab