phyr
phyr copied to clipboard
structuring covariance matrices in communityPGLMM
Just some thoughts:
-
I've been working on a bipartite problem, and the simple format of communityPGLMM with repulsion=T sets both site and sp to the repulsion matrix. To look at repulsion for just one of these, I had to use the extended version of re=list(full V). It would be simpler to allow the formula structure (1 | sp__, V.sp), (1 | sp__@site, V.sp) and (1 | sp__@site__, V.sp, V.site); i.e., allowing the specification of the V matrix along with the r.e. term.
-
In using the full format re=list(full V), the cpp=T option didn't work, so I had to use cpp = F.
-
This isn't an issue, but it was interesting. For the particular dataset (with only nspp=7), using cpp=F and re=list(full V) was as fast as using the standard formatting (e.g. (1 | sp__)) for the same problem. I thought this was surprising.
-
method="nelder-mead-nlopt" worked best; it was best-able to bring the random effects variances closer to zero and gave higher logLiks.
@arives Tony,
For 1, would it be okay to split repulsion
into two arguments: repulsion.sp
and repulsion.site
? Instead of the formula you proposed, this may make the formula easier to read. The downside is that the repulsion argument will apply to all random terms, i.e. if repulsion.sp = TRUE
then all Vsp will be inverted (but not Vsite).
-
The cpp should work for this case, if you can send some code to me, I can have a look at it.
-
For nspp = 7, we probably won't be able to see the differences.
-
I don't think it is worth giving two arguments for repulsion, because this is only going part way. An advantage of specifying a V is that then it could be anything, like a spatial matrix. Presumably you could leave the code as it is, and then have it so that if a V is specified, it is used. It just might be a little fussy to check for things like the formula containing a space before a comma, like (1 | sp__ , V.sp).
-
I'll do this separately. I did reload phyr first.
-
Yep.
@arives Tony,
- The specific V can be set to
tree_site
? We can allowtree_site
(andtree
) to be either a phylogeny or a matrix. Will this work? I don't really want to mess with the formula given the fussy things you mentioned ...
Yeah, I just took a look at prep_dat_pglmm, and it will be a pain to incorporate V into the formula, since you can't use lme4::findbars(), etc.
I like your idea of letting V be a phylogeny or matrix. And then will the "full" version of specifying re, that covers all bases.
Daijiang,
Also, I'm finding that "nelder-mead-nlopt" almost always works better than "bobyqa". It might be worth using it as the default.
Cheers, Tony
Have you tried subplex
? It suppose to work faster than nelder-mead-nlopt
and get similar results.
Argument repulsion
now can be a vector of length 1 or >1. If length = 1, then all nested terms will have the same "repulsion" setting. If length > 1, it will specify each nested term by order. See the documentation for more details.