gdata = data.frame(x2 = runif(nn <- 1000) - 0.5)
gdata = transform(gdata, x3 = runif(nn) - 0.5,
x4 = runif(nn) - 0.5)
gdata = transform(gdata, eta = 1.0 - 1.0 * x2 + 2.0 * x3)
gdata = transform(gdata, prob = logit(eta, inverse = TRUE))
gdata = transform(gdata, y = rgeom(nn, prob))
with(gdata, table(y))
fit = vglm(y ~ x2 + x3 + x4, geometric, gdata, trace = TRUE)
coef(fit, matrix = TRUE)
summary(fit)
Run the code above in your browser using DataLab