[R] glm.nb error

Sarah Goslee sarah.goslee at gmail.com
Fri Jun 7 17:13:40 CEST 2013


Hi,

On Fri, Jun 7, 2013 at 10:44 AM, Daofeng Li <lidaof at 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

I'd assume there is a missing value somewhere.

But we really need a reproducible example to be certain. You could use
dput(head(yourdata, 20)) to give us something to work with (as long as
that much of your data throws the error).

At the very least, we probably also need
str(y)
str(group)

Are you certain there are no missing values in your data? The problem
may not be that obvious, but that's an easy place to start.

Sarah

>
> 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
>

-- 
Sarah Goslee
http://www.functionaldiversity.org



More information about the R-help mailing list