chron.ci: Build Mean Value Chronology with Confidence Intervals

chron.ciR Documentation

Build Mean Value Chronology with Confidence Intervals

Description

This function builds a mean value chronology with bootstrapped confidence intervals, typically from a data.frame of detrended ring widths as produced by detrend.

Usage

chron.ci(x, biweight=TRUE, conf=0.95, R=100)

Arguments

x

a data.frame of (usually detrended) ring widths with rownames(x) containing years and colnames(x) containing each series ID such as produced by read.rwl

biweight

logical flag. If TRUE then a robust mean is calculated using tbrm.

conf

numeric. A scalar for the confidence level.

R

integer. The number of bootstrap replicates.

Details

This either averages the rows of the data.frame using a mean or a robust mean (the so-called standard chronology) and calculates boostrapped confidence intervals using the normal approximation. The function will fail if there are any rows in x that contain only one sample and in practice there should be several samples in a row. One of the guiding principles of bootstrapping is that the population is to the sample as the sample is to the bootstrap samples.

Value

An object of of class data.frame with the standard chronology, the upper and lower confidence interval, and the sample depth. The years are stored as row numbers.

Author(s)

Andy Bunn.

See Also

read.rwl, detrend, boot, boot.ci

Examples

library(graphics)
library(utils)
data(wa082)
# truncate to a sample depth of five
wa082Trunc <- wa082[rowSums(!is.na(wa082))>4,]
# detrend
wa082RWI <- detrend(wa082Trunc, method="AgeDepSpline")
# bootstrap the chronology and
wa082Crn <- chron.ci(wa082RWI, biweight = TRUE, R = 100, conf = 0.99)
head(wa082Crn)
# plot (this is so much easier in ggplot!)
wa082Crn$yrs <- time(wa082Crn)
xx <- c(wa082Crn$yrs,rev(wa082Crn$yrs))
yy <- c(wa082Crn$lowerCI,rev(wa082Crn$upperCI))
plot(wa082Crn$yrs,wa082Crn$std,type="n",ylim=range(yy),
     ylab="RWI",xlab="Year",main="Chronology with CI")
polygon(x=xx,y=yy,col = "grey",border = NA)
lines(wa082Crn$yrs,wa082Crn$std)

AndyBunn/dplR documentation built on April 20, 2024, 10:33 p.m.