rage: Random clade age generator

View source: R/rage.R

rageR Documentation

Random clade age generator

Description

This function uses the qage() function above to generate random clade ages from the corresponding models.

Usage

rage(ages, n = 1000, ...)

Arguments

ages

Either a vector of fossil ages or a matrix with two columns: the first with the minimum age bounds (upper stratigraphic bounds) and the second with the maximum age bounds (lower stratigraphic bounds) of each fossil (in rows). A minimum of 2 are required.

n

Number of samples to be drawn. Default n = 1000.

...

Other options passed to qage().

Details

If ages are known exactly, only minimum ages are used. If some or all ages have uncertainty, typically upper and lower bounds defined by bracketing geological strata, age maximums and minimums are set for each fossil.

Value

A numeric vector of length n representing simulated clade ages.

See Also

qage()

Examples

## Not run: 
  # Example using the default method of Strauss & Sadler (1989)
  hist(rage(n=10000, ages=c(50, 30, 25, 14, 3.5)), breaks=500, freq=FALSE,
    xlim=c(50,120), xlab="Clade Age",
    main="Strauss & Sadler Example\nn=1000, ages=c(50, 30, 25, 14, 3.5)")
  graphics::curve(dexp(x-50, rate=0.07), col='blue', lwd=2, add=TRUE)
  graphics::legend("right", legend="dexp", col="blue", lty=1, lwd=2,
    box.lty=0)
  
  # Example using the method of Solow (2003)
  hist(rage(n=10000, ages=c(50, 30, 25, 14, 3.5), method="Solow"),
    breaks=500, freq=FALSE, xlim=c(50,120), xlab="Clade Age",
    main="Solow Example\nn=1000, min.ages=c(50, 30, 25, 14, 3.5)")
    # heavy on intermediate values
  graphics::curve(dexp(x-50, rate=0.04), col='blue', lwd=2, add=TRUE)
  graphics::curve(dlnorm(x-50, meanlog=log(50-30), sdlog=pi/sqrt(3)),
    col='orange', lwd=2, add=TRUE)
  graphics::legend("right", legend=c("dexp", "dlnorm"), col=c("blue",
    "orange"), lty=1, lwd=2, box.lty=0)
  
  # Strauss & Sadler (1989) method incorporating fossil age uncertainty
  hist(rage(n=10000, ages=cbind(c(50, 30, 25, 14, 3.5),
    c(56, 35, 25, 14, 6))), breaks=500, freq=FALSE, xlim=c(50,120), xlab="Age",
    main="Solow Example (with fossil age uncertainty); n=1000,
      ages=cbind(c(50, 30, 25, 14, 3.5), c(56, 35, 25, 14, 6))")
  graphics::curve(dlnorm(x-50, meanlog=2.6, sdlog=0.9), col='blue', lwd=2, add=TRUE)
  graphics::legend("right", legend="dlnorm", col="blue", lty=1, lwd=2, box.lty=0)
  
## End(Not run)

josephwb/chronos documentation built on Jan. 27, 2023, 2:35 a.m.