Skip to content

Multivariate Poisson GLM??

2 messages · Corey Sparks, Kjetil Halvorsen

#
Dear R Users,
I'm working on a problem where I have a multivariate response vector of
counts and a continuous predictor.
 I've thought about doing this the same way you would do a Multvariate
regression model with normally distributed data, but since these data are
counts, they are probably better modeled with a Poisson distribution.

For example
y1<-rpois(100,3.5)
y2<-rpois(100,1.5)
y3<-rpois(100,.09)
x<-rnorm(100, mean=25, sd=10)
dat<-data.frame(y1, y2, y3, x)

#Get the Multivariate linear model assuming normality
fit<-lm(cbind(y1,y2,y3)~x, data=dat)
fit.0<-update(fit, ~1)
#Calculate Pillai's trace for global model test
anova(fit, fit.0)

But, if I try this approach with glm() instead of lm(), I get the error
indicating that a multivariate response vector isn't allowed in glm

fit.pois<-glm(cbind(y1,y2,y3)~x, data=dat, family=poisson)
Error: (subscript) logical subscript too long

If anyone has experience with a multivariate Poisson response vector I would
gladly appreciate any suggestions.
Corey Sparks
#
You could have a look at the VGAM (vector glm /gam models) at CRAN.

Kjetil
On Tue, Jan 5, 2010 at 5:59 PM, Corey Sparks <corey.sparks at utsa.edu> wrote: