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