daijiang / phyr

Functions for phylogenetic analyses
https://daijiang.github.io/phyr/
GNU General Public License v3.0
30 stars 10 forks source link

bayes = T, random terms within random terms #84

Open arives opened 1 year ago

arives commented 1 year ago

This might or might not be a technical issue, but it is puzzling. Using bayes = T in a poisson model with (1|site) and (1|plot) where plots are contained within sites, INLA seems "reluctant" to assign variance to the (1|plot) term in comparison to bayes = F. At least this is the case I'm currently analyzing. For example,

bayes = T Random effects: Variance Std.Dev lower.CI upper.CI 1|Site 1.348e-01 0.367168 6.959e-02 0.3159326 1|Species 4.095e-01 0.639946 2.720e-01 0.6345215 1|Species__ 4.312e-05 0.006566 1.718e-05 0.0001574 1|plotID 3.618e-05 0.006015 1.383e-05 0.0001154 1|obs 2.827e-01 0.531723 2.085e-01 0.3824574

bayes = F Random effects: Variance Std.Dev 1|Site 1.678e-01 0.4096591 1|Species 4.365e-01 0.6606860 1|Species__ 4.361e-07 0.0006603 1|plotID 3.055e-03 0.0552749 1|obs 2.703e-01 0.5199349

The same pattern occurs with nested random effects. I've tried using the fits from bayes = T as starting values for bayes = F, and vice versa, but the results stay the same.

I don't see any statsitical reason why this should be the case, but I also don't see how it could be a coding mistake. The only thing I can think of is that INLA does not constrain estimates much in the fitting chains, so that a local optimum found by bayes = F is averaged out. Maybe it is just something to be aware of.