Learn R Programming

rase (version 0.2-21)

rase.slice: Ancestral State Estimation At Any Given Time Slice

Description

Estimates the geographical location of ancestors (at branches or, much less likely, at nodes) at any given point in time integrating over a rase. It first uses tree.slice to identify the branches that the slice intersects with and then uses MCMC sampling to approximate the posterior distribution of the ancestor locations.

Usage

rase.slice(tree, slice, res, polygons, 
	params0 = NA, niter = 1000, logevery = 10, nGQ = 20)

Arguments

tree
phylogenetic tree of class "phylo". The same used in the code{rase} run.
slice
the time at which to slice. It should be in the same units of the phylogenetic tree.
res
output from rase. Ideally, it should be the post-handled mcmc (i.e., already applied burnin and thinning, if applicable; see post.mcmc).
polygons
list of polygons in owin.object format used as input for rase.
params0
optional. A vector of initial parameter values in the following order: x ancestors for each branch in the order given by tree.slice, followed by y ancestors in the same order.
niter
number of MCMC iterations. By default niter = 1000.
logevery
iteration cycle to print current iteration. By default logevery = 10.
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., bX_x; where X = branch 1, ..., branch i) give the ancestral locations for trait x in the order given by tree.slice, followed by the ancestral locations of trait y (i.e., bX_y).

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

tree.slice, rase

Examples

Run this code
#load data
data(rase_data, package = 'rase')	
	
# check the data we are going to use
	
# examine the mcmc result from rase 
# after it has been applied a burnin 
# phase and a thinning
str(mcmc)
	
# the phylogenetic tree used in the rase run
psophia_tree

# the polygons used in the rase run
str(psophia_poly)
		
# define the slice of time;
# for now, let's say 1 Million
# years ago (Ma)
slice <- 1

# 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 slice for 100 iterations
slice_results <- rase.slice(psophia_tree, slice = slice, res = mcmc, 
      psophia_poly, niter = 100)
	
#check results
str(slice_results)

Run the code above in your browser using DataLab