Miki Bálint
2012-Dec-04 22:48 UTC
[R] bigglm (but not glm) error with poisson distribution
Dear All, I am trying to fit a generalized linear model with bigglm() (v. 0.8) on a large dataset containing many zeros under a poisson distribution (in R 2.15.0, 64 bit Ubuntu 12.04). The bigglm() call gives an error message (NA/NaN/Inf in foreign function call (arg 3)). If I understand correctly, this may result from a log(0). However, the corresponding glm() call works without problems. I would be very grateful for suggestions solving this problem - the original datafile is too big for fitting a model with glm(). This should reproduce the error with a small dataset: library(biglm) library(RCurl) expand.abund=read.csv(textConnection(getURL("http://dl.dropbox.com/u/48351148/expand_abund.csv")),row.names=1) dim(expand.abund) ## [1] 924 3 head(expand.abund) ## Var1 Var2 Reads ## 1 f00boy01a OTU_25174 944 ## 2 f00boy05b OTU_25174 1105 otu.bigglm <- bigglm(Reads ~ Var2, data=expand.abund, family=poisson()) ## Error in coef.bigqr(object$qr) : ## NA/NaN/Inf in foreign function call (arg 3) traceback() ## 11: .Fortran("regcf", as.integer(p), as.integer(p * p/2), bigQR$D, ## bigQR$rbar, bigQR$thetab, bigQR$tol, beta = numeric(p), nreq = as.integer(nvar), ## ier = integer(1), DUP = FALSE) ## 10: coef.bigqr(object$qr) ## 9: coef(object$qr) ## 8: coef.biglm(iwlm) ## 7: coef(iwlm) ## 6: bigglm.function(formula = formula, data = datafun, ...) ## 5: bigglm(formula = formula, data = datafun, ...) ## 4: bigglm(formula = formula, data = datafun, ...) ## 3: bigglm.data.frame(Reads ~ Var2, data = expand.abund, family poisson()) ## 2: bigglm(Reads ~ Var2, data = expand.abund, family = poisson()) ## 1: bigglm(Reads ~ Var2, data = expand.abund, family = poisson()) otu.glm <- glm(Reads ~ Var2, data=expand.abund, family=poisson()) summary(otu.glm, dispersion=c(otu.glm$deviance/otu.glm$df.residual)) Thank you, Miklos Balint
Miki Bálint
2012-Dec-06 15:53 UTC
[R] bigglm (but not glm) error with poisson distribution
Dear All, I am trying to fit a generalized linear model with bigglm() (v. 0.8) on a large dataset containing many zeros under a poisson distribution (in R 2.15.0, 64 bit Ubuntu 12.04). The bigglm() call gives an error message (NA/NaN/Inf in foreign function call (arg 3)). If I understand correctly, this may result from a log(0). However, the corresponding glm() call works without problems. I would be very grateful for suggestions solving this problem - the original datafile is too big for fitting a model with glm(). This should reproduce the error with a small dataset: library(biglm) library(RCurl) expand.abund=read.csv(textConnection(getURL("http://dl.dropbox.com/u/48351148/expand_abund.csv")),row.names=1) dim(expand.abund) ## [1] 924 3 head(expand.abund) ## Var1 Var2 Reads ## 1 f00boy01a OTU_25174 944 ## 2 f00boy05b OTU_25174 1105 otu.bigglm <- bigglm(Reads ~ Var2, data=expand.abund, family=poisson()) ## Error in coef.bigqr(object$qr) : ## NA/NaN/Inf in foreign function call (arg 3) traceback() ## 11: .Fortran("regcf", as.integer(p), as.integer(p * p/2), bigQR$D, ## bigQR$rbar, bigQR$thetab, bigQR$tol, beta = numeric(p), nreq = as.integer(nvar), ## ier = integer(1), DUP = FALSE) ## 10: coef.bigqr(object$qr) ## 9: coef(object$qr) ## 8: coef.biglm(iwlm) ## 7: coef(iwlm) ## 6: bigglm.function(formula = formula, data = datafun, ...) ## 5: bigglm(formula = formula, data = datafun, ...) ## 4: bigglm(formula = formula, data = datafun, ...) ## 3: bigglm.data.frame(Reads ~ Var2, data = expand.abund, family poisson()) ## 2: bigglm(Reads ~ Var2, data = expand.abund, family = poisson()) ## 1: bigglm(Reads ~ Var2, data = expand.abund, family = poisson()) otu.glm <- glm(Reads ~ Var2, data=expand.abund, family=poisson()) summary(otu.glm, dispersion=c(otu.glm$deviance/otu.glm$df.residual)) Thank you, Miklos Balint