This function can be used to test for phylogenetic signal in patterns of niche overlap (Warren et al., 2008) based on the age-range correlation (ARC) as implemented by Turelli & Fitzpatrick (2006).

1 | ```
age.range.correlation(phy, overlap, tri = "upper", n = 10000)
``` |

`phy` |
an object of class |

`overlap` |
a matrix of class |

`tri` |
either |

`n` |
an integer giving the number of iterations for the Monte Carlo resampling procedure. |

In age-range correlation (ARC; *sensu* Fitzpatrick & Turelli 2006), phylogentic relationships are taken into account when computing average range (or niche) overlap between two clades at node i by

*
o(i) = sum( over j) sum(over k) 0.5^(n(ik) - 1) * o(jk)
*

where the double sum is over all species in the two clades, o(jk) denotes the overlap between species j and k, and n(jk) is the number of nodes separating the two species on the phylogeny. Plotting *o(i)* against node ages depicts the ARC for a given clade. Slopes and intercept derived from a linear model can be used to characterize speciation mode (allopatric versus sympatric) or niche evolution (conservatism versus flexibility) in the clade (see Fitzpatrick & Turelli [2006] and Warren et al. [2008], respectively).

The significance of the ARC is assessed via Monte Carlo simulation by random permutation of the overlap matrix to estimate the distribution of slope and intercept unter the null hypothesis of no phylogenetic signal.

A list of four elements:

`age.range.correlation` |
A matrix with age and average overlap for each node. |

`linear.regression` |
A linear model of mean niche (or range)overlap versus node age. |

`sig` |
Significance of intercept and slope derived by randomization. |

`MonteCarlo.replicates` |
A matrix containing intercepts and slopes of randomized datasets. |

Christoph Heibl

Fitzpatrick, B.M & Turelli, M. 2006. The geography of mammalian speciation: mixed signals from phylogenies and range maps. *Evolution* **60**: 601-615.

Warren, D., R.E. Glor, & M. Turelli. 2008. Environmental niche equivalency versus conservatism: quantitative approaches to niche evolution. *Evolution* **62**: 2868-2883.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | ```
# load PNOs for Oxalis sect. Palmatifoliae ...
data(PNO)
# ... and calculate niche overlap between species
no <- niche.overlap(PNO$AnnualMeanTemperature)
# load phylogeny and PNOs of Oxalis sect. Palmatifoliae
data(tree)
# age-range correlation
x <- age.range.correlation(phy = tree, overlap = no, n = 100)
# plot average niche overlap versus node age
plot(x$age.range.correlation)
# add a regression line
abline(x$linear.regression$coefficients)
# add regression lines from Monte Carlo randomization
apply(x$MonteCarlo.replicates, 1, abline, lwd = 0.2, col = "grey50")
``` |

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.