anova - Nesting success (binomial glmm) in r -
i running glmm using glmer()
in r:
glmer(survive ~ fyear + site + fyear * site.x + (1|fyear), family = binomial(link = logexp(shaffer.sub$exposure)), data = shaffer.sub)
where survive 0 or 1 depending if nest successful or not. here can see data looks like:
structure(list(id = structure(1:7, .label = c("1", "2", "3", "4", "5", "6", "7"), class = "factor"), year.x = structure(c(1l, 1l, 2l, 3l, 3l, 3l, 3l), .label = c("1994", "1995", "1999"), class = "factor"), survive = structure(c(1l, 2l, 2l, 2l, 2l, 2l, 1l), .label = c("0", "1"), class = "factor"), fyear = structure(c(1l, 1l, 2l, 3l, 3l, 3l, 3l), .label = c("1994", "1995", "1999"), class = "factor"), site.x = structure(c(1l, 2l, 1l, 1l, 1l, 2l, 1l), .label = c("n", "s"), class = "factor")), .names = c("id", "year.x", "survive", "fyear", "site.x"), row.names = c(na, -7l), class = "data.frame")
but warning message:
*warning messages: 1: in checkconv(attr(opt, "derivs"), opt$par, ctrl = control$checkconv, : model failed converge max|grad| = 0.0299425 (tol = 0.001, component 12) 2: in checkconv(attr(opt, "derivs"), opt$par, ctrl = control$checkconv, : model unidentifiable: large eigenvalue ratio - rescale variables?*
i told should not use same random factor fixed effect on same model.
at end, have output can see year, site , interaction year:site effects. in anova table (is possible? i've been trying use summary(aov(model))
doesn't work; anova(model)
not either.
i error aov()
command:
*error in summary`(aov(syearxsite))` : error in evaluating argument 'object' in selecting method function 'summary': error in if (fixed.only) { : argument not interpretable logical*
how can see effect of variables on survival?
whoever told not use categorical input variable (fyear
) both fixed , random effect correct. it's hard know recommend, depends on number of years , sites have in data set (is data linked all of data (i hope not), or first few rows? how many years , how many sites , how many total observations have?)
if want treat year random , site fixed (which sensible if have 2 sites (n
vs s
seen in data) , quite few years, e.g. more 5) fit:
g1 <- glmer(survive~site.x+(site.x|fyear), family=binomial(link=logexp(shaffer.sub$exposure)), data=shaffer.sub)
i don't know site
vs site.x
are: see site.x
in data snippet.
to information, try summary(g1)
. (that give variances random effects, not fixed effects; glmms don't operate in same "variance explained" mode anova does, in particular because variances explained different terms not add total variance.)