On Jun 7, 2013, at 9:44 AM, Daofeng Li <lid...@gmail.com> wrote: > Dear R Community, > > I have encountered a problem while using the R function glm.nb. > The code that produce the error was following two lines: > > group=c(1,1,1,1,0,0,0,0) > fit=glm.nb(y~group) > > While the y contains 8 sets of number like: > gene275 0 1 0 0 1 5 1 0 > > Error message: > > Error in while ((it <- it + 1) < limit && abs(del) > eps) { : > missing value where TRUE/FALSE needed > Calls: glm.nb -> as.vector -> theta.ml > In addition: There were 50 or more warnings (use warnings() to see the > first 50) > Execution halted > > > Information of my system: >> sessionInfo() > R version 3.0.1 (2013-05-16) > Platform: x86_64-unknown-linux-gnu (64-bit) > > locale: > [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C > [3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8 > [5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 > [7] LC_PAPER=C LC_NAME=C > [9] LC_ADDRESS=C LC_TELEPHONE=C > [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C > > attached base packages: > [1] stats graphics grDevices utils datasets methods base > > Does anyone happen to have some hit on how to solve this? > Appreciate for any response. > > Thanks in advance, > > Daofeng
There is something wrong with your actual 'y' or 'group' that is not evident from the above info: group <- c(1, 1, 1, 1, 0, 0, 0, 0) y <- c(0, 1, 0, 0, 1, 5, 1, 0) > require(MASS) Loading required package: MASS > glm.nb(y ~ group) Call: glm.nb(formula = y ~ group, init.theta = 1.711564307, link = log) Coefficients: (Intercept) group 0.5596 -1.9459 Degrees of Freedom: 7 Total (i.e. Null); 6 Residual Null Deviance: 10.23 Residual Deviance: 6.848 AIC: 25.25 Check str(y) and str(group) You should also be sure to note in your posts when you are using a function from a non-base package, in this case MASS, which is not indicated in your sessionInfo() above, so something is amiss there as well. Regards, Marc Schwartz ______________________________________________ R-help@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.