I am working on a phylogenetic regression model in brms with multiple measurements per species. I have read over the excellent
brms_phylogenetics vignette several times, but still have a question about repeated measurements. I will use the sample data variables and scripts from the vignette to ask my question.
Here is the head of the dataset:
phen cofactor species phylo spec_mean_cf 1 107.41919 11.223724 sp_1 sp_1 10.309588 2 109.16403 9.805934 sp_1 sp_1 10.309588 3 91.88672 10.308423 sp_1 sp_1 10.309588 4 121.54341 8.355349 sp_1 sp_1 10.309588 5 105.31638 11.854510 sp_1 sp_1 10.309588 6 64.99859 4.314015 sp_2 sp_2 3.673914
spec_mean_cf is the mean value of the cofactor for the species.
There are several examples in the vignette of modeling
phen ~ spec_mean_cf, including a way to incorporate the variability of the
cofactor for each species by using the distance from the mean of each individual (a separate variable called
within_spec_cf in the vignette).
phen ~ spec_mean_cf + (1 | phylo) + (1 | species) + within_spec_cf
However, the mean of the species is always used as a predictor variable.
In brms, is there a way to use the individual values, and not the mean, as the predictor while still accounting for species measurement variability? In
MCMCglmm it would be written as:
MCMCglmm( fixed = phen ~ cofactor, random = ~ species + phylo)
I have tried a few variations with my own data, such as:
phen ~ cofactor + (1 | phylo) + within_spec_cf
phen ~ cofactor + (1 | phylo) + (1 | within_spec_cf )
but I don’t think this is correct, as I get an estimate of zero for
cofactor for each model (not possible in this case)
I apologize if this is very naive. I am trying to learn-by-doing.
Please also provide the following information in addition to your question:
- Operating System: OSX 10.11.6
- brms Version: 2.3.0