poissonff()
pdata <- data.frame(x = rnorm(nn <- 100))
pdata <- transform(pdata, y = rpois(nn, exp(1+x)))
(fit <- vglm(y ~ x, family = poissonff, pdata))
coef(fit, matrix = TRUE)
nn <- 200
cdata <- data.frame(x2 = rnorm(nn), x3 = rnorm(nn), x4 = rnorm(nn))
cdata <- transform(cdata, lv1 = 0 + x3 - 2*x4)
cdata <- transform(cdata, 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))
cdata <- transform(cdata, y1 = rpois(nn, lambda1),
y2 = rpois(nn, lambda2),
y3 = rpois(nn, lambda3))
lvplot(p1, y = TRUE, lcol = 2:4, pch = 2:4, pcol = 2:4, rug = FALSE)
Run the code above in your browser using DataLab