knitr::opts_chunk$set( collapse = TRUE, comment = "#>", eval = FALSE )
{fibre}
, which uses {INLA}
$$\text{trait}{i,j} = \text{root}_j + \sum_k\beta{j, k}\mu_{i, k}$$ $$\mu_{i, k} \sim \text{Pflow}\left(\phi_k^2\right)$$ where $j$ is refers to the $j$th trait dimension, and $k$ refers to the $k$th latent trait dimension.
Essentially this is dimension reduction, but where the latent space is constrained to be consistent with a model of evolutionary change on a phylogeny. The code for that model would look like this:
mod_mult <- fibre(Beak.Length_Culmen_tr + Beak.Length_Nares_tr + Beak.Width_tr + Beak.Depth_tr ~ bre_brownian(phlo, latent = 2), data = avonet_beaks, engine_options = list(verbose = TRUE))
ls()
This model is not fully implemented, but should be available as a new feature in the package shortly.
The model is:
$$\text{trait}{i,j} = \mu_i + \mu_j + \mu{i}^\text{int} \mu_{j}^\text{int}$$ $$\mu_i \sim \text{Pflow}i\left(\phi_i^2\right); \mu_j \sim \text{Pflow}_j\left(\phi_j^2\right)$$ $$\mu_i^\text{int} \sim \text{Pflow}_i\left(\phi\text{int}^2\right); \mu_j^\text{int} \sim \text{Pflow}j\left(\phi\text{int}^2\right)$$
$$\mu_i^\text{int} \sim \text{Pflow}i\left(\phi\text{int}^2\right); \mu_j^\text{int} \sim \text{Pflow}j\left(\phi\text{int}^2\right)$$
then:
$$\mu_\text{int} = \mu_{i}^\text{int} \mu_{j}^\text{int} \sim \text{Pflow}\text{i}\otimes\text{Pflow}\text{j}\left(\phi_\text{int}^2\right)$$ - which means that the interaction can be modeled with a single parameter that is distributed according to a phylogenetic flow model that is the Kronecker product of the two interacting phylogenetic flows.
{fibre}
model estimates 'rates' for the interaction, which in this case gives a measure of what combinations of nodes in the two phylogenies contribute the most to an interaction.mod_int <- fibre(EFFECTSIZE1 ~ bre_brownian(plant_phlo) + bre_brownian(fungus_phlo) + bre_brownian(plant_phlo * fungus_phlo) + re(PlantSpecies2018) + re(FungalGenus2018) + bre_brownian(fungus_phlo * pf_as_pfc(PlantSpecies2018)) + bre_brownian(plant_phlo * pf_as_pfc(FungalGenus2018)), data = plant_fungus %>% filter(plant_is_tip & fungus_is_tip), engine_options = list(verbose = TRUE)) mod_int
ls()
mod_int <- readr::read_rds("extdata/mod_int.rds") mod_int
ls()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.