[R-sig-ME] glmmADMB: Error in UseMethod("droplevels")
Ben Bolker
bbolker at gmail.com
Thu Jan 19 14:07:22 CET 2012
Lorenzo Quaglietta <giaguarenzo at ...> writes:
>
> Ben Bolker <bbolker at ...> writes:
>
> > It means that it doesn't make sense to use a numeric variable as
> > a grouping variable for a random factor (which is what you've done):
> > if sl is a discrete numeric code that identifies groups of observations,
> > then you should convert it to a factor. If it's a continuous variable,
> > then you need to go back and read/think some more about the meanings
> > of random factors ...
> >
> > It also means that I made some changes to glmmADMB recently that
> > got in the way of an informative error message (you should have
> > received an error message that told you this). I will try to
> > catch that error in a more informative way.
> >
> My model formula is:
>
> glmmADMB1 <- glmmadmb(Fix ~ log_BIO_F * log_BIO_P + log_drs + fperp + log_pr +
> log_la + (1 | ANIMALE) + (1 | ID) + (1 | Time),
> data=otters, zeroInflation=TRUE,
> family="poisson").
>
> and I got the following error message:
>
> "Error in UseMethod("droplevels") :
> no applicable method for 'droplevels' applied to an object of class
> "c('integer', 'numeric')".
>
> My random terms are not categorical nor fitted as factors. Covariates are
> continous (the log_ ones) and a factor (fperp). Any clue about what can be the
> problem would be very appreciated.
Can you be clearer about what you mean by "my random terms are not
categorical nor fitted as factors"? Grouping terms in glmmADMB
*must* be defined as factors (i.e. you must convert ANIMALE, ID,
Time to factors).
I could have made glmmADMB make this conversion internally,
but I thought it was better to make this the user's responsibility,
so that if someone were doing something strange (like trying to
use a continuous variable as a grouping factor, on the right side
of the bar in (1|g)) it would be more immediately obvious.
In general, it would be very helpful if you can include the
version of glmmADMB in any query, as the package is evolving very
quickly. If you install the latest version (0.7.2.5) you should
still get an error, but the error will be (slightly) more
informative -- it will tell you that all grouping variables
must be factors.
Ben Bolker
More information about the R-sig-mixed-models
mailing list