Generates species trait data under models that deviate from Brownian Motion. Supports OU (stabilising selection), regime shifts (clade-specific optima), and non-linear inter-trait correlations.
Usage
simulate_non_bm(
tree,
n_traits = 4,
scenario = c("OU", "regime_shift", "nonlinear"),
alpha = 2,
theta = 0,
sigma = 1,
shift_magnitude = 2,
seed = NULL
)Arguments
- tree
Object of class
"phylo".- n_traits
Integer. Number of traits to simulate (default 4). Use at least 2 for
scenario = "nonlinear": the current generator always returnstrait1andtrait2, even if a smaller number is requested.- scenario
Character. One of
"OU","regime_shift","nonlinear".- alpha
Numeric. OU pull strength (only for
"OU").- theta
Numeric. Base OU optimum (only for
"OU"). Trait j usestheta + 0.5 * (j - 1)for both its optimum and root value.- sigma
Numeric. BM diffusion rate.
- shift_magnitude
Numeric. Raw additive regime offset (only for
"regime_shift"). Trait j usesshift_magnitude * (1 + 0.2 * (j - 1)), added to one clade and subtracted from the other. It is not multiplied by a trait SD;sigmaseparately controls the underlying BM diffusion.- seed
Integer seed or
NULL.
