Learn R Programming

rase (version 0.2-22)

rase: Bayesian Range Ancestral State Estimation of Polygons

Description

Performs a bayesian two-dimensional ancestral state estimation with polygonal distributions as input (contrast with bm_ase) according to a Brownian Motion model of trait evolution (or dispersal for phylogeography). It uses Gibbs sampling to approximate the posterior distribution. See reference at the end for more detailed information.

Usage

rase(tree, polygons, niter = 1000, logevery = 10, sigma2_scale = 0.05, screenlog = TRUE, params0 = NA, nGQ = 20)

Arguments

tree
phylogenetic tree of class "phylo".
polygons
list of polygons in owin.object format.
niter
number of MCMC iterations. By default niter = 1000.
logevery
iteration cycle to print current iteration. By default logevery = 10.
sigma2_scale
optional. window proposal for sigma2x & sigma2y.
screenlog
if TRUE (default), prints current iteration every logevery to the screen.
params0
optional. A vector of initial parameter values in the following order: x ancestors, y ancestors, sigma2x and sigma2y. If params0 = NA (default), an initial Maximum Likelihood optimization with polygon centroids using ace provides the starting parameter values.
nGQ
degree of the one-dimensional Gauss-Legendre quadrature rule (default = 20) as given by polyCub.SV in package polyCub. Bigger numbers make the integration more precise, but takes longer.

Value

returns a matrix where every column represents one parameter. The first columns (i.e., nX_x; where X = node 1, ..., node i) give the ancestral locations for trait x in the order of nodes in the tree (see the phylo class for details), followed by the ancestral locations of trait y (i.e., nX_y), and the rate parameter in x (sigma2x) and y (sigma2y).

References

Quintero, I., Keil, P., Jetz, W., Crawford, F. W. 2015 Historical Biogeography Using Species Geographical Ranges. Systematic Biology. doi: 10.1093/sysbio/syv057

See Also

Contrast with the point ancestral state estimation bm_ase. For the maximum likelihood version of ranges see ranges.like.bm. For post-mcmc handling see post.mcmc.

Examples

Run this code
# Here the application in the paper of Quintero et al.,
# on the Psophia trumpeters 
# is shown using rase package.
	
#load data
data(rase_data, package = 'rase')  
	
## Not run: 
# # check the data we are going to use
# # the phylogenetic tree
# psophia_tree
# 	
# # the GPC polygons of Psophia distribution.
# psophia_poly
# 
# # Species names of polygons (in order)
# pnames <- c('dextralis', 'viridis', 'leucoptera', 'interjecta', 
#   'obscura', 'crepitans', 'ochroptera', 'napensis')
# 
# # name the polygons
# psophia_poly <- name.poly(psophia_poly, psophia_tree, 
#   poly.names = pnames)
# 
# # Run rase for 10 iterations
# rase_results <- rase(psophia_tree, psophia_poly, niter = 100)
# # Run with higher number of iterations
# # rase_results <- rase(psophia_tree, polygons)
# 
# # Check the results
# str(rase_results)
# 
# # post-MCMC handling
# rase_results_for_ggmcmc <- post.mcmc(rase_results, burnin=0, thin = 1)
# 	
# #plot the densities for dispersal rates using ggmcmc
# require(ggmcmc)
# ggs_traceplot(rase_results_for_ggmcmc, family = 'sigma')
# ## End(Not run)

Run the code above in your browser using DataLab