@dpascall, @jonnations
I am attempting to implement use brm_multiple to sample from the distribution of the estimated variance-covariance matrices, perform the models and join the posterior distribution. However, I am struggling to translate my original brm model into a brm_multiple to do this.
Previously my code (as following vignette(‘brms_phylogenetics’)):
A <-ape::vcv.phylo(my_tree)
mod1 <- brm(
phen ~ cofactor + (1 | random) + (1 | gr(species_name, cov = A)) ,
data = data,
family = bernoulli(),
data2 = list(A = A),
…
)
where data contains phen, cofactor, random and species_name, and A is a variance-covariance matrix from a phylo tree stored in data2.
To run multiple imputations of trees now I have:
mod_multiple<- brm_multiple(
phen ~ cofactor + (1 | random) + (1 | gr(species_name, cov = my_tree_list)) ,
data = dataset_list,
family = bernoulli(),
data2 = my_tree_list,
…
)
Where my_tree_list is a list of named lists of variance-covariance matrices created from different trees i.e. a list of list(A=A) from mod1 and dataset_lists is a list of the same dataset, length same as data2.
However, this gives an Error: my_tree_list cannot be found in data2
I have also attempted data2 = list(A = list_of_vcvs) where list_of_vcvs is a list of the variance-covariance matrices rather than pre-converted into lists as above. This gives: error “data2” must be a list of named lists.
However, this provides an error that my_tree_list cannot be found in data2 does anyone have any pointers as to what alterations I need to make to data2 or the gr(cov = A) part.
Thanks,
Tom