4
$\begingroup$

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

$\endgroup$

1 Answer 1

2
$\begingroup$

I know this question was posted 2 months ago but it might still help the OP or someone else.

First, I am not sure to understand which question you are trying to answer with your second model. But if I understood correctly, you have the mean and standard error estimates of the jumping distances and are trying to get the effect of the other parameters: arena, stimuli,...

If this is correct, the intra-specific variation (or standard deviation) of the jump is not a fixed or random effect, it should rather be the error variance (units) of your model with every other factor accounted for. In other terms it is the variance that is neither accounted for by your fixed effects nor by your random effects. So if you add microhabitat to your first model and fix the residual variance to $se^2$ in the priors using fix=1, you should have the correct model.

prior <- list(R = list(V = diag(df_spe$se_distance^2), fix = 1),
              G=list(G1=list(V=1, nu=0.02)))

For reference a similar model is treated at p130 of the "Course Notes" vignette for the MCMCglmm package.

Second, irrespective of the correctness of your model on a statistical point of view, if you add random effects, you need to specify priors for them; either by adding a G2 list with a proper V matrix, if it is a new random intercept, or making G1$V a 2x2 matrix, if you are adding a random slope to a preexisting random intercept. That is what the error message is telling you.

$\endgroup$
1
  • $\begingroup$ Thank you @prolix! Indeed I haven't specified the priors for the random effect. I'm new to MCMCglmm. $\endgroup$ Commented Sep 29, 2017 at 18:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.