# [R-sig-ME] Estimates for groups within fixed effects & also: enough info for estimating variance? MCMCglmm

Drager, Andrea Pilar andrea.p.drager at rice.edu
Mon Mar 5 18:08:38 CET 2018

```Hi all,

I've fitted a model with a binary response at the individual level,
two continuous fixed effects (measured at the individual level but
containing info on 23 species), and a single random effect of
"species". My model is mixing well and the results fit the data, but
what I am really interested in is getting estimates for the fixed
effect by species, rather than globally.

It is my understanding (per a 2016 reply to a post to this list:
parameter estimates for all factor levels MCMCglmm) that by
suppressing the intercept here, I am estimating the first "level" (one
species?) for each effect, and that the remaining effects are
deviations from these levels.  How do I code random slopes and
intercepts for species within each of the fixed effects, rather than
deviations from a common distribution?

priorS = list(R = list(V = 1, nu = 0, fix = 1),  G = list(G1 = list(V
= 1, nu = 0.002)))

smodel <-MCMCglmm(fl~  -1 + Zdbh + Znnd,
random = ~ species,
family = "categorical", verbose=F, pr = TRUE,
start=list(QUASI=FALSE),
data=IHF,prior=priorS,
nitt=500000,burnin=5000,thin=100)

A second part of the question is that I would like to include a random
effect to measure the influence of phylogenetic autocorrelation. I
know how to code this using a distance matrix (see below), however, I
am concerned that statistically, "species" and "phylo" may not have
enough information to partition the variance in a meaningful way.
Perhaps running three models (random=species, random=phylo,
random=species + phylo) and comparing goodness-of-fit could be useful?
I would greatly appreciate any insight. Many thanks!

prior = list(R = list(V = 1, nu = 0, fix = 1), G = list(G1 = list(V =
1,nu = 0.002),

G2=list(V=1,nu=0.002)))

model <-MCMCglmm(fl ~ Zdbh_mm + Znnd,
random = ~species + phylo,
family = "categorical", verbose=F, pr = TRUE,
start=list(QUASI=FALSE),
ginverse=list(phylo=inv.phylo\$Ainv),data=IHF,prior=prior,
nitt=500000,burnin=5000,thin=100)
Andrea Pilar Drager
PhD. student
Ecology and Evolutionary Biology, Rice University

```