poissonff()
pdat = data.frame(x = rnorm(nn <- 100))
pdat = transform(pdat, y = rpois(nn, exp(1+x)))
(fit = vglm(y ~ x, family=poissonff, pdat))
coef(fit, matrix=TRUE)
nn = 200
cdat = data.frame(x2 = rnorm(nn), x3 = rnorm(nn), x4 = rnorm(nn))
cdat = transform(cdat, lv1 = 0 + x3 - 2*x4)
cdat = transform(cdat, lambda1 = exp(3 - 0.5 * (lv1-0)^2),
lambda2 = exp(2 - 0.5 * (lv1-1)^2),
lambda3 = exp(2 - 0.5 * ((lv1+4)/2)^2))
cdat = transform(cdat, y1 = rpois(nn, lambda1),
y2 = rpois(nn, lambda2),
y3 = rpois(nn, lambda3))
# vvv p1 = cqo(cbind(y1,y2,y3) ~ x2 + x3 + x4, poissonff, cdat,
# vvv EqualTol=FALSE, ITol=FALSE)
# vvv summary(p1) # # Three dispersion parameters are all unity
lvplot(p1, y=TRUE, lcol=2:4, pch=2:4, pcol=2:4, rug=FALSE)
Run the code above in your browser using DataLab