I'm trying to fit a mixed-effects model to a problem that includes: a continuous response variable (mean jumped distance by 17 species of frogs) in 3 different arenas and under 2 types of stimuli.
A glimpse of the data:
Species type_arena type_of_stimuli microhabitat mean_distance se_distance SVL
<fctr> <fctr> <fctr> <fctr> <dbl> <dbl> <dbl>
1 Aplastodiscus_leucopygius arbustos aprox arboreal 94.00000 94.00000 40.34400
2 Aplastodiscus_leucopygius arbustos toque arboreal 326.00000 52.78257 40.34400
3 Aplastodiscus_leucopygius folhico aprox arboreal 104.00000 64.00000 40.34400
4 Aplastodiscus_leucopygius folhico toque arboreal 378.00000 46.41121 40.34400
5 Aplastodiscus_leucopygius vazia aprox arboreal 204.00000 84.41564 40.34400
6 Aplastodiscus_leucopygius vazia toque arboreal 400.00000 41.83300 40.34400
7 Cycloramphus_boraceiensis arbustos aprox torrent 43.33333 43.33333 44.29167
8 Cycloramphus_boraceiensis arbustos toque torrent 448.33333 47.98727 44.29167
9 Cycloramphus_boraceiensis folhico aprox torrent 0.00000 0.00000 44.29167
10 Cycloramphus_boraceiensis folhico toque torrent 231.66667 78.84232 44.29167
# ... with 92 more rows
So, it's a kind of two-way ANOVA design. I have the species phylogeny and prepared its inverse:
treeAinv<-inverseA(phylo,nodes="TIPS",scale=TRUE)$Ainv
I included the following priors:
prior = list(R = list(V = 1, fix = 1), G=list(G1=list(V=1, nu=0.02)))
and the model:
model1<-MCMCglmm(mean_distance~type_arena*type_of_stimulus,
random=~Specie, data=df_spe, family="gaussian",
ginverse = list(Specie=treeAinv), nodes="ALL", prior=prior, nitt=300000, burnin=25000, thin = 100, verbose=FALSE)
which seems to converge well (heidel.diag p-value = 0.428), ESS greater than 1000 for both random and fixed effects.
My question is: how can I incorporate intraspecific variation in the jumped distance? I have the standard error of the distance and tried to make the model as:
random=~Species+ us(1+se_distance):Species
but I keep getting an error about prior specification:
Error in MCMCglmm(mean_distance ~ type_arena * type_of_stimulus, random = ~Species + :
prior$G has the wrong number of structures
Thank you in advance