# Generate a random tree
Ntips = 50
tree = generate_random_tree(list(birth_rate_intercept=1),max_tips=Ntips)$tree
# simulate spherical Brownian motion (a dispersal model) on the tree
simul = simulate_sbm(tree, radius=6371, diffusivity=50)
# Analyze correlations between geodistances & phylodistances
coranal = correlate_phylo_geodistances(tree = tree,
tip_latitudes = simul$tip_latitudes,
tip_longitudes = simul$tip_longitudes,
correlation_method = "spearman",
Npermutations = 100,
max_phylodistance = 100,
radius = 6371)
print(coranal$correlation)
print(coranal$Pvalue)
plot(coranal$phylodistances, coranal$geodistances,
xlab="phylodistance", ylab="geodistance", type="p")
Run the code above in your browser using DataLab