Abstract Phylogenetic comparative methods are widely used to study trait coevolution across biological and cultural domains. The most common methods are phylogenetic generalized linear (mixed) models, phylogenetic path analysis, Pagel's ‘discrete’ method and Ornstein–Uhlenbeck models. While some frameworks like generalized linear mixed models are quite flexible in terms of the data structure, they are ill‐suited for inferring causal effects; others, like Pagel's ‘discrete’ can more explicitly infer causal sequences, but are limited in the number and types of traits that can be modelled. Here, we develop a novel class of generalized dynamic phylogenetic models (GDPMs) that overcomes these limitations and synthesizes the strengths of existing methods into a flexible framework for dynamic inference. Treating the phylogeny as an implicit time series, GDPMs model trait coevolution for any number of traits undergoing both deterministic adaptation and stochastic drift, capable of inferring directed evolution ( vs. ), feedback (), and contingencies (e.g. first , then ). We introduce the coevolve R package, a user‐friendly interface for fitting GDPMs in a Bayesian framework using Stan. To demonstrate the GDPM framework, we first work through a biologically motivated synthetic example of predation and mating system among cichlid fish. We also perform simulation‐based calibration as a computational validation of our models. Additionally, we present some empirical applications of GDPMs, including analyses of brain size in non‐human primates and societal complexity across human populations. These examples highlight the flexibility and potential of the GDPM framework, which allows researchers to model latent variables, multilevel structures and repeated measures, measurement error, missing data and other complexities inherent in comparative data.
Ringen et al. (Mon,) studied this question.