[R] Multivariate Poisson GLM??

Corey Sparks corey.sparks at utsa.edu
Tue Jan 5 21:59:07 CET 2010


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

-- 
Corey Sparks
Assistant Professor
Department of Demography and Organization Studies
University of Texas at San Antonio
501 West Durango Blvd
Monterey Building 2.270C
San Antonio, TX 78207
210-458-3166
corey.sparks 'at' utsa.edu
https://rowdyspace.utsa.edu/users/ozd504/www/index.htm



More information about the R-help mailing list