-----Original Message-----
From: R-sig-mixed-models [mailto:r-sig-mixed-models-bounces at r-
project.org] On Behalf Of Aoibheann Gaughran
Sent: Friday, November 9, 2018 10:23 AM
To: Ben Bolker <bbolker at gmail.com>
Cc: r-sig-mixed-models at r-project.org
Subject: Re: [R-sig-ME] post hoc tests for glmmTMB
Great, thank you - I will keep plugging on. I will reconsider my use of
the Anova function in car as well!
On Fri, 9 Nov 2018 at 15:19, Ben Bolker <bbolker at gmail.com> wrote:
The point about Wald tests is correct, although their reliability
depends very much on context (they should be pretty good for tests of
fixed effects when the data set is reasonably large and predicted
probabilities/counts are not too extreme, i.e. not too close to zero
(counts) or 0/1 (probabilities)).
There are a lot of improvements in the development version with
respect to post hoc tests etc. on glmmTMB fits, as documented here:
<
https://github.com/glmmTMB/glmmTMB/blob/master/glmmTMB/vignettes/model
_evaluation.rmd
If you can install the development version (see
https://github.com/glmmTMB/glmmTMB/blob/master/README.md), that should
help a lot.
If you can't, most of these improvements will probably get to CRAN in
the next week or two; we're planning a new release soon.
In any case, I think that running the following code should make
multcomp work with glmmTMB objects (not quite sure what that first
function is doing ... ???)
glht_glmmTMB <- function (model, ..., component="cond") {
glht(model, ...,
coef. = function(x) fixef(x)[[component]],
vcov. = function(x) vcov(x)[[component]],
df = NULL)
}
modelparm.glmmTMB <- function (model, coef. = function(x)
fixef(x)[[component]],
vcov. = function(x)
df = NULL, component="cond", ...) {
multcomp:::modelparm.default(model, coef. = coef., vcov. = vcov.,
df = df, ...)
}
## example
g1 <- glht(cbpp_b1, linfct = mcp(period = "Tukey"))
On 2018-11-09 9:42 a.m., Guillaume Adeux wrote:
Hi Aoibheann,
I think that anova on glmmTMB objects only produce Wald tests, which
seem to be very reliable.
You might want to look at the monet package (or its little brother
afex) that can produce LRT tests or parametric bootstrap.
Moreover, emmeans should work fine with glmmTMB but I remember
having a similar problem.
Maybe this thread and the following discussion can help you out:
GA2
Le ven. 9 nov. 2018 ? 15:24, Aoibheann Gaughran <gaughra at tcd.ie> a
Update: lsmeans works if I use an older version of lsmeans
(2.27-62) -
I rely on the results?
Many thanks, Aoibheann
On Fri, 9 Nov 2018 at 12:24, Aoibheann Gaughran <gaughra at tcd.ie>
Dear list,
I am trying to perform post hoc tests on a glmmTMB model. I would
use car::Anova and mulgcomp::glht on my glmms (lmers). However,
these functions do not appear to be working for glmmTMB (when I
run the model
an lmer they work fine). I have also tried lsmeans and emmeans but
they
not appear to support glmmTMB either (although it appears they
used
have found various treads online suggesting that these functions
should work with TMB but they date back a few months.
I am using the most up to date versions of R (3.5.1) and have
updated
of my packages e.g. glmmTMB 0.2.2.0, lsmeans 2.30-0
The following are the error messages that I receive:
Anova(topmodTRFETE, type = 2)Error in I.p[c(subs.relatives,
subs.term), , drop = FALSE] :
summary(glht(topmodTRFETE, linfct = mcp(roadworks = "Tukey")),
test =
adjusted("holm"))Error in modelparm.default(model, ...) :
dimensions of coefficients and covariance matrix don't match
source(system.file("other_methods","lsmeans_methods.R",package="glmmTM
B"))>
lsmeans(topmodTRFETE, pairwise ~ roadworks, adjustSigma = TRUE,
adjust = "holm")Error in ref_grid(object, ...) :
Can't handle an object of class ?glmmTMB?
Use help("models", package = "emmeans") for information on
supported
models.> rw.emm.s <- emmeans(topmodTRFETE, "roadworks")Error in
ref_grid(object, ...) :
Can't handle an object of class ?glmmTMB?
Use help("models", package = "emmeans") for information on
supported
Can any point me in the direction of a workaround for performing
on my glmmTMB model?
Many thanks,
--
Aoibheann Gaughran
Behavioural and Evolutionary Ecology Research Group Zoology
Building School of Natural Sciences Trinity College Dublin Dublin
2 Ireland
Phone: +353 (86) 3812615
--
Aoibheann Gaughran
Behavioural and Evolutionary Ecology Research Group Zoology
Building School of Natural Sciences Trinity College Dublin Dublin 2
Ireland
Phone: +353 (86) 3812615
[[alternative HTML version deleted]]