lines.fit_t_thresh: Add to a plot line segments joining the evolutionary rate...

lines.threshMLR Documentation

Add to a plot line segments joining the evolutionary rate through time estimated by the "ClimExp" model in the fit_t_thresh function.

Description

Plot the estimated evolutionary rate of the latent variable in the "environmental" threshold model as a function of the environmental data and time.

Usage


## S3 method for class 'threshML'
lines(x, steps = 100, ...)

Arguments

x

an object of class 'threshML' obtained from a fit_t_thresh fit.

steps

the number of steps from the root to the present used to compute the relative rate \sigma(t) through time.

...

further arguments to be passed to lines. See ?lines.

Value

lines.threshML returns invisibly a list with the following components used to add the line segments to the current plot:

time_steps

the times steps where the climatic function was evaluated to compute the rate. The number of steps is controlled through the argument steps.

values

the estimated (relative) rate values through time estimated at each time_steps

Note

All the graphical parameters (see par) can be passed through (e.g. line type: lty, line width: lwd, color: col ...)

Author(s)

J. Clavel

References

Clavel, J. & Morlon, H., 2017. Accelerated body size evolution during cold climatic periods in the Cenozoic. Proceedings of the National Academy of Sciences, 114(16): 4183-4188.

Melendez-Vazquez, F., Lucaci, A. G., Selberg A., Clavel, J., Rincon-Sandoval, M., Santaquiteria, A., White, W. T., Drabeck, D., Carnevale, G., Duarte-Ribeiro, E., Miya, M., Westneat, M. W., Baldwin, C. C., Hughes, L. C., Ortí, G., Kosakovsky Pond, S. L., Betancur-R, R., Arcila, D., 2025. Ecological interactions and genomic innovation fueled the evolution of ray-finned fish endothermy. Sci. Adv., 11 (eads8488):1-16.

See Also

lines.threshML, fit_t_thresh

Examples


if(test){
data(InfTemp)



## Comparison between models
## require(phytools)
data(InfTemp)
set.seed(1)
tree <- pbtree(n=150, scale=67)
tree <- reorder(tree, "postorder")

beta = -0.2 # strengh and direction of the climatic effect
# The (latent) trait is simulated using the function "sim_t_env" (see also ?fit_t_env)
x <- sim_t_env(tree, param=c(0.1, beta), env_data=InfTemp, model="EnvExp", root.value=0,
               step=0.001, plot=TRUE)

# Use the "threshState" function to simulate the discrete traits from the continuous one 'x'.
th <- sapply(x, threshState, thresholds = setNames(c(0,Inf), letters[1:2]))


# Fit the climatic model
clim_fit1 <- fit_t_thresh(tree, th, model="Clim", env_data=InfTemp, df=50)
plot(clim_fit1, lty=2)

clim_fit2 <- fit_t_thresh(tree, th, model="Clim", env_data=InfTemp, df=10)
lines(clim_fit2, col="red")



}


RPANDA documentation built on Nov. 6, 2025, 1:17 a.m.