# Data from Coleman and James (1961)
cjdat = data.frame(y = 1:6, freq = c(1486, 694, 195, 37, 10, 1))
fit = vglm(y ~ 1, pospoisson, cjdat, weights = freq)
Coef(fit)
summary(fit)
fitted(fit)
pdat = data.frame(x2 = runif(nn <- 1000)) # Artificial data
pdat = transform(pdat, lambda = exp(1 - 2 * x2))
pdat = transform(pdat, y1 = rpospois(nn, lambda))
with(pdat, table(y1))
fit = vglm(y1 ~ x2, pospoisson, pdat, trace = TRUE, crit = "coef")
coef(fit, matrix=TRUE)
Run the code above in your browser using DataLab