An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-sig-mixed-models/attachments/20120112/79a03cc8/attachment-0001.pl>
glmmADMB: Error in UseMethod("droplevels")
6 messages · Isa Blasco, Lorenzo Quaglietta, Ben Bolker
Isa Blasco <isa.blasco.costa at ...> writes:
Hi,
I am using glmmADMB to fit a negative binomial model to my data. My
explanatory variable is an ordered factor with 10 levels and I also
included a random factor (numeric) and Zero inflation.
This is the code I used: m7 <- glmmadmb (abun~odist + (1|sl), data=apa,
zeroInflation=TRUE, family="nbinom")
When I run it I got this error:
Error in UseMethod("droplevels") :
no applicable method for 'droplevels' applied to an object of class
"c('double', 'numeric')"
I do not know what the 'double' means but I checked the glmmADMB manual and
they use the same kind of variables in their example. Any guess on what it
is happening? How can I solve it?
I hope somebody knows!
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. Ben Bolker
1 day later
Ben Bolker <bbolker at ...> writes:
Isa Blasco <isa.blasco.costa at ...> writes:
Hi,
I am using glmmADMB to fit a negative binomial model to my data. My
explanatory variable is an ordered factor with 10 levels and I also
included a random factor (numeric) and Zero inflation.
This is the code I used: m7 <- glmmadmb (abun~odist + (1|sl), data=apa,
zeroInflation=TRUE, family="nbinom")
When I run it I got this error:
Error in UseMethod("droplevels") :
no applicable method for 'droplevels' applied to an object of class
"c('double', 'numeric')"
I do not know what the 'double' means but I checked the glmmADMB manual and
they use the same kind of variables in their example. Any guess on what it
is happening? How can I solve it?
I hope somebody knows!
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. Ben Bolker
Hi,
I'm having a similar problem.
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. Which could be the
problem?
Many thanks in advance, best regards,
Lorenzo Quaglietta
2 days later
Ben Bolker <bbolker at ...> writes:
Isa Blasco <isa.blasco.costa at ...> writes:
Hi,
I am using glmmADMB to fit a negative binomial model to my data. My
explanatory variable is an ordered factor with 10 levels and I also
included a random factor (numeric) and Zero inflation.
This is the code I used: m7 <- glmmadmb (abun~odist + (1|sl), data=apa,
zeroInflation=TRUE, family="nbinom")
When I run it I got this error:
Error in UseMethod("droplevels") :
no applicable method for 'droplevels' applied to an object of class
"c('double', 'numeric')"
I do not know what the 'double' means but I checked the glmmADMB manual and
they use the same kind of variables in their example. Any guess on what it
is happening? How can I solve it?
I hope somebody knows!
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. Ben Bolker
Hi,
I'm having a similar problem.
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.
Many thanks in advance, best regards,
Lorenzo Quaglietta
2 days later
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
2 days later
Ben Bolker <bbolker at ...> writes:
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
Thank you very much. I've defined the random terms as factors and that error did not appear anymore. However, I've encountered another message of error, which I copy here below (there's a very long series of codes of which I've copied only the last part and below the error): Newton raphson 1 f = 344.5193892398689 max g = 2.123148492572113e-07 Newton raphson 2 f = 344.5193892398687 max g = 4.356515148629114e-13 inner maxg = 0.0007671776212085923 Inner second time = 0.0007671776212085923 Inner f = 344.5055506201622 f = 344.5055506201622 max g = 0.0007671776212085923 Newton raphson 1 f = 344.505550121035 max g = 9.045343487557034e-07 Newton raphson 2 f = 344.5055501210349 max g = 7.366329768387914e-12 Warning -- Hessian does not appear to be positive definite Error in run_bin(platform, bin_loc, file_name, cmdoptions, run, rm_binary = ! use_tmp_dir, : object "sys.result" not found then: Warning messages: 1: running command 'C:\WINDOWS\system32\cmd.exe /c "C:/Programmi/R/R- 2.14.1/library/glmmADMB/bin/windows32/glmmadmb.exe" -maxfn 500 -maxph 4 - noinit -shess' had status 1 2: In shell(cmd, invisible = TRUE) : '"C:/Programmi/R/R-2.14.1/library/glmmADMB/bin/windows32/glmmadmb.exe" - maxfn 500 -maxph 4 -noinit -shess' execution failed with error code 1 I ignore what all this may means, so any help would be great. glmmADMB version is 0.7.2. Thanks in advance, best, Lorenzo