rase: Bayesian Range Ancestral State Estimation of Polygons

Description Usage Arguments Value Author(s) References See Also Examples

View source: R/rase_source.r

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

1
2
  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). We recommend the using the coda package for plotting and summarizing the resulting mcmc, as in the example below.

Author(s)

Forrest Crawford, Ignacio Quintero

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.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
  # 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)

    # Use the amazing 'coda' package to explore the MCMC
    require(coda)

    # post-MCMC handling
    rasemcmc <- coda::mcmc(rase_results)
    	
    #plot the traces for all the parameters 
    plot(rasemcmc)
  
## End(Not run)

rase documentation built on May 29, 2017, 11:38 a.m.

Search within the rase package
Search all R packages, documentation and source code