[R] Multivariate Poisson GLM??

Kjetil Halvorsen kjetilbrinchmannhalvorsen at gmail.com
Wed Jan 6 01:28:47 CET 2010


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:
> 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
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



More information about the R-help mailing list