the dplr package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/r/cran/doc/packages/dplr.pdf ·...

23
The dplR Package September 2, 2007 Type Package Title Dendrochronology Program Library in R Version 1.0 Date 2007-07-27 Author Andy Bunn Maintainer Andy Bunn <[email protected]> Description This package contains functions for performing some standard tree-ring analyses. License GPL R topics documented: ca533 ............................................ 2 cana157 ........................................... 2 chron ............................................ 3 co021 ............................................ 4 crn.plot ........................................... 5 detrend ........................................... 6 detrend.series ........................................ 7 Undocumented ....................................... 8 dplR-package ........................................ 9 i.detrend ........................................... 9 i.detrend.series ....................................... 10 read.crn ........................................... 11 read.ids ........................................... 12 read.rwl ........................................... 13 rwi.stats ........................................... 14 rwl.stats ........................................... 15 seg.plot ........................................... 16 skel.plot ........................................... 17 tbrm ............................................. 18 wavelet.plot ......................................... 19 write.crn ........................................... 21 1

Upload: others

Post on 15-Feb-2020

8 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: The dplR Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/dplR.pdf · The dplR Package September 2, 2007 Type Package Title Dendrochronology Program Library

The dplR PackageSeptember 2, 2007

Type Package

Title Dendrochronology Program Library in R

Version 1.0

Date 2007-07-27

Author Andy Bunn

Maintainer Andy Bunn <[email protected]>

Description This package contains functions for performing some standard tree-ring analyses.

License GPL

R topics documented:ca533 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2cana157 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2chron . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3co021 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4crn.plot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5detrend . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6detrend.series . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7Undocumented . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8dplR-package . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9i.detrend . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9i.detrend.series . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10read.crn . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11read.ids . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12read.rwl . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13rwi.stats . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14rwl.stats . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15seg.plot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16skel.plot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17tbrm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18wavelet.plot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19write.crn . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21

1

Page 2: The dplR Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/dplR.pdf · The dplR Package September 2, 2007 Type Package Title Dendrochronology Program Library

2 cana157

Index 23

ca533 Campito Mountain Tree Ring Widths

Description

This dataset gives the raw ring widths for bristlecone pine Pinus longaeva at Campito Mountain inCalifornia, USA. There are 34 series. Dataset was created using read.rwl and saved to an .rdafile using save.

Usage

ca533

Format

A data.frame containing 34 tree-ring series in columns and 1358 years in rows.

Source

International tree-ring data bank, Accessed on 27-August-2007 at ftp://ftp.ncdc.noaa.gov/pub/data/paleo/treering/measurements/northamerica/usa/ca533.rwl

References

Graybill, D. (1983) Campito Mountain Data Set. IGBP PAGES/World Data Center for Paleocli-matology Data Contribution Series 1983-CA533.RWL. NOAA/NCDC Paleoclimatology Program,Boulder, Colorado, USA.

cana157 Twisted Tree Heartrot Hill Standard Chronology

Description

This dataset gives the standard chronology for white spruce Picea glauca at Twisted Tree HeartrotHill in Yukon, Canada. Dataset was created using read.crn and saved to an .rda file using save.

Usage

cana157

Format

A data.frame containing the standard chronology in column one and the sample depth in columntwo. There are 463 years (1530–1992) in the rows.

Page 3: The dplR Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/dplR.pdf · The dplR Package September 2, 2007 Type Package Title Dendrochronology Program Library

chron 3

Source

International tree-ring data bank, Accessed on 27-August-2007 at ftp://ftp.ncdc.noaa.gov/pub/data/paleo/treering/chronologies/northamerica/canada/cana157.crn

References

Jacoby, G., R. D’Arrigo, and B. Buckley (1992) Twisted Tree Heartrot Hill Data Set. IGBPPAGES/World Data Center for Paleoclimatology Data Contribution Series 1992-CANA157.CRN.NOAA/NCDC Paleoclimatology Program, Boulder, Colorado, USA.

chron Build Mean Value Chronology

Description

This function builds a mean value chronology, typically from a data.frame of detrended ring widthsas produced by detrend.

Usage

chron(x, prefix = NULL, biweight = TRUE, prewhiten = FALSE)

Arguments

x a data.frame of ring widths with rownames(x) containing years and col-names(x) containing each series id such as produced by read.rwl

prefix a character vector with a length of < 4. Defaults to xxx

biweight Logical flag. If TRUE then a robust is calculated using tbrm.

prewhiten Logical flag. If TRUE each series is whitened using ar prior to averaging.

Details

This either averages the rows of the data.frame using a mean or a robust mean (the so-calledstandard chronology) or can do so from the residuals of an ar process (the residual chronology).

Value

A data.frame with the standard chronology, redisual chronology (if prewhitening was per-formed), and the sample depth.

Author(s)

Andy Bunn

Page 4: The dplR Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/dplR.pdf · The dplR Package September 2, 2007 Type Package Title Dendrochronology Program Library

4 co021

References

Cook, E. R. and Kairiukstis, L.A. (1990) Methods of Dendrochronology: Applications in the Envi-ronmental Sciences. Springer. ISBN-13: 978-0792305866.

Fritts, H.C. (2001) Tree Rings and Climate. Blackburn. ISBN-13: 978-1930665392.

See Also

read.rwl, detrend, ar

Examples

data(ca533)ca533.rwi <- detrend(rwl = ca533, method = "ModNegExp")ca533.crn <- chron(ca533.rwi, prefix = "CAM")# With residual chronca533.crn <- chron(ca533.rwi, prefix = "CAM", prewhiten = TRUE)

co021 Schulman Old Tree No. 1, Mesa Verde

Description

This dataset gives the raw ring widths for Douglas fir Pseudotsuga menziesii at Mesa Verde inColorado, USA. There are 35 series. Dataset was created using read.rwl and saved to an .rdafile using save.

Usage

co021

Format

A data.frame containing 35 tree-ring series in columns and 788 years in rows.

Source

International tree-ring data bank, Accessed on 27-August-2007 at ftp://ftp.ncdc.noaa.gov/pub/data/paleo/treering/chronologies/northamerica/usa/co021.crn

References

Schulman, E. (1963) Schulman Old Tree No. 1 Data Set. IGBP PAGES/World Data Center forPaleoclimatology Data Contribution Series 1983-CO021.RWL. NOAA/NCDC PaleoclimatologyProgram, Boulder, Colorado, USA.

Page 5: The dplR Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/dplR.pdf · The dplR Package September 2, 2007 Type Package Title Dendrochronology Program Library

crn.plot 5

crn.plot Plots a Tree-Ring Chronology

Description

This function makes a default plot of a tree-ring chronology from a data.frame of the typeproduced by chron.

Usage

crn.plot(crn)

Arguments

crn a data.frame as produced by chron. The data.frame should have the yearsin rownames(crn), the chronologies in the columns. Optionally, the last columncan contain the sample depth named “samp.depth”.

Details

This makes a simple plot of one or more tree-ring chronologies.

Value

None. Invoked for side effect (plot).

Author(s)

Andy Bunn

See Also

chron

Examples

data(cana157)crn.plot(cana157)

# Without sample depthcana157.mod <- data.frame(TTRSTD=cana157[,1])rownames(cana157.mod) <- rownames(cana157)crn.plot(cana157.mod)

# With multiple chronologiesdata(ca533)ca533.rwi <- detrend(rwl = ca533, method = "ModNegExp")ca533.crn <- chron(ca533.rwi, prefix = "CAM", prewhiten = TRUE)crn.plot(ca533.crn)

Page 6: The dplR Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/dplR.pdf · The dplR Package September 2, 2007 Type Package Title Dendrochronology Program Library

6 detrend

detrend Detrend Multiple Ring-Width Series Simultaneously

Description

This is a wrapper for detrend.series to detrend many ring-width series at once.

Usage

detrend(rwl, y.name = colnames(rwl), make.plot = FALSE,method = c("Spline", "ModNegExp","Mean"))

Arguments

rwl a data.frame with series as columns and years as rows such as that producedby read.rwl

y.name a character vector of length(ncol(rwl)) that gives the id of each series. Defaultsto the column names of rwl.

make.plot logical flag. Makes plots of the raw data and detrended data if TRUE. See detailsbelow.

method a character vector to determine the detrending method. See details below. Possi-ble values are “Spline”, “ModNegExp”, “Mean”, or subset of c(“Spline”, “Mod-NegExp”, “Mean”).

Details

See detrend.series for details on detrending methods. Setting make.plot = TRUE will causeplots of each series to be produced. These could be saved using Devices if desired.

Value

If one detrending method is used, a data.frame containing the dimensionless detrended ringwidths with column names, row names and dimensions of rwl. If more methods are used, a list withncol(rwl) elements each containing a data.frame with the detrended ring widths in each column.

Author(s)

Andy Bunn

See Also

detrend.series

Page 7: The dplR Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/dplR.pdf · The dplR Package September 2, 2007 Type Package Title Dendrochronology Program Library

detrend.series 7

Examples

data(ca533)# Detrend using modified expontential decay. Returns a data.frameca533.rwi <- detrend(rwl = ca533, method = "ModNegExp")# Detrend using both methods. Returns a listca533.rwi <- detrend(rwl = ca533)

## Not run:# Save a pdf of all seriespdf("foo.pdf")ca533.rwi <- detrend(rwl = ca533, method = c("Spline", "ModNegExp"))

dev.off()## End(Not run)

detrend.series Detrend a Ring-Width Series

Description

Detrend a tree-ring series by one of two methods, a smoothing spline or a statistical model. Theseries and fits are plotted by default.

Usage

detrend.series(y, y.name = NULL, make.plot = TRUE,method = c("Spline", "ModNegExp", "Mean"))

Arguments

y a numeric vector. Usually a tree-ring series.

y.name an optional character vector to name the series for plotting purposes.

make.plot logical flag. Makes plots of the raw data and detrended data if TRUE.

method a character vector to determine the detrending method. See details below. Possi-ble values are “Spline”, “ModNegExp”, “Mean”, or subset of c(“Spline”, “Mod-NegExp”, “Mean”).

Details

This detrends and standardises a tree-ring series. The detrending is the estimation and removal ofthe tree’s natural biological growth trend. The standardisation is done by dividing each series bythe growth trend to produce units in the dimensionless ring-width index (RWI). There are currentlythree methods available for detrending although more are certainly possible. The two methodsimplemented are a smoothing spline via smooth.spline (method = “Spline”) or a modifiednegative exponential curve (method = “ModNegExp”).

Page 8: The dplR Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/dplR.pdf · The dplR Package September 2, 2007 Type Package Title Dendrochronology Program Library

8 Undocumented

The “Spline” approach uses an n-year spline where the frequency response is 0.50 at a wavelengthof 0.67*n years. This attempts to remove the low frequency variability that is due to biological orstand effects.

The “ModNegExp”approach attempts to fit a classic nonlinear model of biological growth of theform Y a * exp(b*1:length(Y)) + k using nls. See Fritts (2001) for details about the parameters.If a nonlinear model cannot be fit then a linear model is fit.

The “Mean”approach fits a horizontal line using the mean of the series.

These methods are chosen because they are commonly used in dendrochronology. It is, of course,up to the user to determine the best detrending method for their data. See the references below forfurther details on detrending.

Value

A data.frame containing the detrended series (y) according to the method(s) used.

Author(s)

Andy Bunn

References

Cook, E.R. and Kairiukstis, L.A. (1990) Methods of Dendrochronology: Applications in the Envi-ronmental Sciences. Springer. ISBN-13: 978-0792305866.

Fritts, H.C. (2001) Tree Rings and Climate. Blackburn. ISBN-13: 978-1930665392.

See Also

detrend

Examples

# Using a plausible representation of a tree-ring seriesgt <- 0.5 * exp (-0.05 * 1:200) + 0.2noise <- c(arima.sim(model = list(ar = 0.7), n = 200, mean = 1, sd = 0.5))series <- gt * noiseseries.rwi <- detrend.series(y=series,y.name="Foo")# Use series CAM011 from the Campito datasetdata(ca533)series <- ca533[,"CAM011"]names(series) <- rownames(ca533)series.rwi <- detrend.series(y = series, y.name = "CAM011")

Undocumented Undocumented Functions in dplR

Description

Not for user use. Called internally.

Page 9: The dplR Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/dplR.pdf · The dplR Package September 2, 2007 Type Package Title Dendrochronology Program Library

i.detrend 9

dplR-package Dendrochronology Program Library in R

Description

This package contains functions for performing some standard tree-ring analyses.

Details

Package: dplRType: PackageVersion: 1.0Date: 2007-07-27License: GPL

Main Functions

read.rwl reads rwl files

detrend detrends raw ring widths

chron builds chronologies

Author(s)

Andy Bunn <[email protected]>

References

Cook, E. R. and Kairiukstis, L.A. (1990) Methods of Dendrochronology: Applications in the Envi-ronmental Sciences. Springer. ISBN-13: 978-0792305866.

Fritts, H.C. (2001) Tree Rings and Climate. Blackburn. ISBN-13: 978-1930665392.

i.detrend Interactively Detrend Multiple Ring-Width Series

Description

Interactively detrend multiple tree-ring series by one of two methods, a smoothing spline or a sta-tistical model. This is a wrapper for detrend.series.

Usage

i.detrend(rwl, y.name = colnames(rwl))

Page 10: The dplR Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/dplR.pdf · The dplR Package September 2, 2007 Type Package Title Dendrochronology Program Library

10 i.detrend.series

Arguments

rwl a data.frame with series as columns and years as rows such as that producedby read.rwl or ca533

y.name a character vector of length(ncol(rwl)) that gives the id of each series. Defaultsto the column names of rwl.

Details

This function allows a user to choose detrending curves based on plots that are produced by detrend.seriesfor which it is essentially a wrapper. The user enters their choice of detrended method via keyboardat a prompt for each ring width series in rwl. See detrend.series for examples and details onthe detrending methods.

Value

A data.frame containing each detrended series according to the method used as columns andrownames set to colnames(y). These are typically years. Plots are also produced as the user choosesthe detrending methods through keyboard input.

Author(s)

Andy Bunn

See Also

detrend.series

i.detrend.series Interactively Detrend a Ring-Width Series

Description

Interactively detrend a tree-ring series by one of three methods, a smoothing spline, a linear model,or the mean. This is a wrapper for detrend.series.

Usage

i.detrend.series(y, y.name = NULL)

Arguments

y a numeric vector. Usually a tree-ring series.

y.name an optional character vector to name the series for plotting purposes.

Page 11: The dplR Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/dplR.pdf · The dplR Package September 2, 2007 Type Package Title Dendrochronology Program Library

read.crn 11

Details

This function allows a user to choose a detrending method based on a plot that is produced bydetrend.series for which it is essentially a wrapper. The user enters their choice of detrendedmethod via keyboard at a prompt. See detrend.series for examples and details on the de-trending methods.

Value

A vector containing the detrended series (y) according to the method used with names set to col-names(y). These are typically years. A plot is also produced and the user chooses a method throughkeyboard input.

Author(s)

Andy Bunn

See Also

detrend.series

read.crn Read Tucson Format Chronology File

Description

This function reads in a Tucson (decadal) format file of tree-ring chronologies (.crn).

Usage

read.crn(fname, header=NULL)

Arguments

fname a character vector giving the file name of the crn file.

header logical flag indicating whether the file has a header. If NULL then the functionwill attempt to determine if a header exists

Details

This reads in a standard crn file as defined according to the standards of the ITRDB at http://www.ncdc.noaa.gov/paleo/treeinfo.html. Despite the standards at the ITRDB,this occasionally fails due to formatting problems.

Value

A data.frame with each chronology in columns and the years as rows. The chronology ids arethe column names and the years are the row names. If the file includes sample depth that is includedas the last column (samp.depth).

Page 12: The dplR Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/dplR.pdf · The dplR Package September 2, 2007 Type Package Title Dendrochronology Program Library

12 read.ids

Author(s)

Andy Bunn

read.ids Read Site-Tree-Core Ids

Description

This function tried to read site, tree and core ids from a rwl data.frame.

Usage

read.ids(rwl, stc = c(3, 2, 3))

Arguments

rwl a data.frame with series as columns and years as rows such as that producedby read.rwl or ca533

stc a vector of three integers summing to eight. These indicate the number of chrac-ters of to split the site code (stc[1]), the tree ids (stc[2]), and the core ids (stc[3]).Defaults to c(3, 2, 3). See details for further information.

Details

Because dendrochronologists often take more than one core per tree, it is occasionally useful tocalculate within vs. between tree variance. The International Tree Ring Data Bank (ITRDB) allowsthe first eight characters in an rwl file for series ids but these are often shorter. Typically the creatorsof rwl files use a logical labeling method that can allow the user to determine the tree and core idfrom the label.

Argument stc tells how each series separate into site, tree, and core ids. For instance a series codemight be “ABC011” indicating site “ABC”, tree 1, core 1. If this format is consistent then the stcmask would be c(3,2,3) allowing up to three characters for the core id (i.e., pad to the right). If it isnot possible to divine the scheme (and often it is not possible to machine read ids), then the outputdata.frame can be built manually. See below for format.

Value

A data.frame with column one named “tree” giving a numeric id for each tree and column twonamed “core” giving a numeric id for each core. The original series ids are copied from rwl asrownames.

Author(s)

Andy Bunn

See Also

rwi.stats, read.rwl

Page 13: The dplR Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/dplR.pdf · The dplR Package September 2, 2007 Type Package Title Dendrochronology Program Library

read.rwl 13

Examples

data(ca533)read.ids(ca533,stc=c(3,2,3))

read.rwl Read Tucson Format Ring Width File

Description

This function reads in a Tucson (decadal) format file of ring widths (.rwl).

Usage

read.rwl(fname, header=NULL)

Arguments

fname a character vector giving the file name of the rwl file.

header logical flag indicating whether the file has a header. If NULL then the functionwill attempt to determine if a header exists

Details

This reads in a standard rwl file as defined according to the standards of the ITRDB at http://www.ncdc.noaa.gov/paleo/treeinfo.html. Despite the standards at the ITRDB,this occasionally fails due to formatting problems.

Value

A data.frame with the series in columns and the years as rows. The series ids are the columnnames and the years are the row names.

Author(s)

Andy Bunn

Page 14: The dplR Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/dplR.pdf · The dplR Package September 2, 2007 Type Package Title Dendrochronology Program Library

14 rwi.stats

rwi.stats Calculates Summary Statistics on Detrended Ring Width Series

Description

This function calculates descriptive statistics on a data.frame of (usually) ring-width indices.

Usage

rwi.stats(rwi, ids = NULL, period = "max")

Arguments

rwi a data.framewith detreneded and standardised ring width indices as columnsand years as rows such as that produced by detrend.

ids a optional data.frame with column one named “tree” giving a numeric id foreach tree and column two named “core” giving a numeric id for each core. De-faults to one core per tree as data.frame(tree=1:ncol(rwi),core=rep(1,ncol(rwi))).

period a character string, either “common” or “max” indicating whether correlationsshould be limited to complete observations over the period common to all coresor the maximum pairwise overlap. See Details of cor. Defaults to “max”.

Details

This calculates a variety of descriptive statistics commonly used in dendrochronology.

For correctly calculating the statistics on within and between series variability, an appropriate maskmust be provided that identifies each series with a tree as it is common for dendrochronologists totake more than one core per tree. The function read.ids is be helpful for creating a mask basedon the series id.

Note that period=“common” can produce NaN for many of the stats if there is no common overlapperiod among the cores. This happens especially in chronologies with floating subfossil samples(e.g., ca533).

Some of the statistics are specific to dendrochronology (e.g., the effective number of cores or theexpressed population signal). Users unfamiliar with these should see Cook and Kairiukstis (1990)and Fritts (2001) for further details.

Value

A data.frame containing the following: n.tot total number of unique combinations of theinput series (i.e., n*n-1/2), n.wt total number of unique combinations of the within-tree series,n.bt total number of unique combinations of the between-tree series, rbar.tot the mean of allcorrelation between different cores, rbar.wt the mean of the correlations between series fromthe same tree over all trees, rbar.bt the mean interseries correlation between all series fromdifferent trees, c.eff the effective number of cores, rbar.eff the effective signal calculatedas rbar.bt / (rbar.wt + (1-rbar.wt) / c.eff) , eps the expressed populationsignal.

Page 15: The dplR Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/dplR.pdf · The dplR Package September 2, 2007 Type Package Title Dendrochronology Program Library

rwl.stats 15

Author(s)

Andy Bunn

References

Cook, E.R. and Kairiukstis, L.A. (1990) Methods of Dendrochronology: Applications in the Envi-ronmental Sciences. Springer. ISBN-13: 978-0792305866.

Fritts, H.C. (2001) Tree Rings and Climate. Blackburn. ISBN-13: 978-1930665392.

See Also

detrend, cor, read.ids, rwi.stats

Examples

data(ca533)ca533.rwi <- detrend(rwl = ca533, method = "ModNegExp")ca533.ids <- read.ids(ca533, stc=c(3,2,3))rwi.stats(ca533.rwi, ca533.ids)

rwl.stats Calculates Descriptive Statistics on Raw Ring Width Series

Description

This function calculates descriptive statistics on a data.frame of (usually) raw ring-width series.

Usage

rwl.stats(rwl)

Arguments

rwl a data.frame with usually raw ring-width series as columns and years asrows such as that produced by read.rwl. Although it is sometimes desireableto run this on detrended (e.g., rwi) data.

Details

This calculates a variety of descriptive statistics commonly used in dendrochronology (see below).Users unfamiliar with these should see Cook and Kairiukstis (1990) and Fritts (2001) for furtherdetails.

Page 16: The dplR Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/dplR.pdf · The dplR Package September 2, 2007 Type Package Title Dendrochronology Program Library

16 seg.plot

Value

A data.frame containing descriptive stats on each series (series). These are the first and lastyear of the series as well as the length of the series (first,last,year). The mean, median,standard deviation are given (mean,median, stdev) as are the skewness, sensitivity, and firstorder autocorrelation (skew,sens,ar1).

Author(s)

Andy Bunn

References

Cook, E.R. and Kairiukstis, L.A. (1990) Methods of Dendrochronology: Applications in the Envi-ronmental Sciences. Springer. ISBN-13: 978-0792305866.

Fritts, H.C. (2001) Tree Rings and Climate. Blackburn. ISBN-13: 978-1930665392.

See Also

rwi.stats,read.rwl

Examples

data(ca533)rwl.stats(ca533)

seg.plot Segment Plot

Description

Makes a segment plot of tree-ring data.

Usage

seg.plot(rwl,...)

Arguments

rwl a data.frame with series as columns and years as rows such as that producedby read.rwl.

... arguments to be passed to plot.

Details

This makes a simple plot of the length of each series in a tree-ring chronology.

Page 17: The dplR Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/dplR.pdf · The dplR Package September 2, 2007 Type Package Title Dendrochronology Program Library

skel.plot 17

Value

None. This function is invoked for its side effect, which is to produce a plot.

Author(s)

Andy Bunn

Examples

data(ca533)seg.plot(ca533,main="Campito Mountain")

skel.plot Skeleton Plot

Description

Automatically generates a skeleton plot of tree-ring data.

Usage

skel.plot(y)

Arguments

y a tree-ring chronology or series

Details

This makes a skeleton plot - a plot that gives the relative growth for a year relative to the surroundingyears. This is done on high frequency growth. Low frequency variation is removed using a Hanningfilter with weight set to nine. Relative growth is scaled from one to ten but only values greater thanthree are plotted.

Value

None. This function is invoked for its side effect, which is to produce a plot.

Author(s)

Andy Bunn

References

Stokes, M.A. and Smiley, T.L. (1968) An Introduction to Tree-Ring Dating. The University ofArizona Press. ISBN-13: 978-0816516803.

Page 18: The dplR Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/dplR.pdf · The dplR Package September 2, 2007 Type Package Title Dendrochronology Program Library

18 tbrm

See Also

read.rwl, detrend, chron

Examples

# On a raw ring width seriesdata(ca533)skel.plot(ca533[,1])

# On a chronologydata(cana157)skel.plot(cana157[,1])

tbrm Calculates Tukey’s Biweight Robust Mean

Description

This calculates a robust average that is unaffected by outliers.

Usage

tbrm(x, C = 9)

Arguments

x a numeric vector

C a constant. C is preassigned a value of 9 according to the Cook reference below.

Details

This is a one step computation that follows the Affy whitepaper below see page 22. This functionis called by chron to calculate a robust mean. Cook and Kairiukstis (1990) have further details.

Value

A numeric mean.

Author(s)

Andy Bunn

References

Statistical Algorithms Description Document, 2002, Affymetrix. p22. Cook, E. R. and Kairiukstis,L.A. (1990) Methods of Dendrochronology: Applications in the Environmental Sciences. Springer.ISBN-13: 978-0792305866.

Page 19: The dplR Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/dplR.pdf · The dplR Package September 2, 2007 Type Package Title Dendrochronology Program Library

wavelet.plot 19

See Also

chron

Examples

tbrm(rnorm(100))

# Comparedata(co021)co021.rwi <- detrend(co021,method = "Spline")crn1 <- apply(co021.rwi,1,tbrm)crn2 <- chron(co021.rwi)cor(crn1,crn2[,1])

wavelet.plot Plot a Continuous Wavelet Transform

Description

This function creates a filled.contour plot of a continuous wavelet transform using the Morletwavelet.

Usage

wavelet.plot(crn.vec,yr.vec,p2,dj=0.25,siglvl=0.99,...)

Arguments

crn.vec a vector of values for the wavelet transform.

yr.vec a vector of values giving the years for the plot. Must be the same length aslength(crn.vec).

p2 the numbers of power of two to be computed for the wavelet transform.

dj sub-octaves per octave calculated.

siglvl level for the significance test. Defaults to 0.99.

... other arguments to pass to filled.contour.

Details

This produces a plot of a continuous wavelet transform. Its implementation very closely followsTorrence and Compo (1998). The user provides a tree-ring chronology (although detrended seriesare conceivably useful as well), the years for the plot, the powers of two (for the scale parameter),and the confidence level for the significance test. The function assumes that the data are yearlyand defaults to calculating four sub-octaves per octave (four voices per power of two). The input

Page 20: The dplR Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/dplR.pdf · The dplR Package September 2, 2007 Type Package Title Dendrochronology Program Library

20 wavelet.plot

crn.vec is padded up to the next power of two before the transform and the padding is removedbefore plotting.

Currently the Morlet wavelet is the only wavelet implemented; the wavenumber (k0) is fixed atsix. In future releases, other wavelets will be available (Dog, Paul, etc.). Similarly, a chi-squaredistribution is used to assess significance at the level indicated. In future versions, significance willbe calculated against the global wavelet spectrum, or a red-noise background.

The filled.contour levels are determined using quantile(Power,probs=seq(0,1,0.1)).A contour for significance is displayed as is the cone of influence. Anything within the cone ofinfluence should not be interpreted.

Refer to Torrence and Compo (1998) for details on the transform, significance, etc.

Value

None. This function is invoked for its side effect, which is to produce a plot.

Note

The functions wavelet and morlet are ports of Torrence’s IDL code available at http://atoc.colorado.edu/research/wavelets/software.html

Author(s)

Andy Bunn

References

Torrence, C. and Compo, G.P. (1998) A practical guide to wavelet analysis. Bulletin of the AmericanMeteorological Society, 79: 61–78.

See Also

chron

Examples

data(ca533)ca533.rwi <- detrend(rwl = ca533, method = "ModNegExp")ca533.crn <- chron(ca533.rwi, prefix = "CAM", prewhiten = FALSE)Years <- as.numeric(rownames(ca533.crn))CAMstd <- ca533.crn[,1]wavelet.plot(CAMstd,Years,p2=9,siglvl=0.99,main="CAMstd")

Page 21: The dplR Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/dplR.pdf · The dplR Package September 2, 2007 Type Package Title Dendrochronology Program Library

write.crn 21

write.crn Write Tucson Format Chronology File

Description

This function writes a chronology to a Tucson (decadal) format file.

Usage

write.crn(crn, fname, header=NULL, append=FALSE)

Arguments

crn a data.frame containing a tree-ring chronology with two columns of the typeproduced by chron. The first column contains the mean value chronology, thesecond column gives the sample depth. Years for the chronology are determinedfrom the row names. The chronology ID is determined from the first columnname.

fname a character vector giving the file name of the crn file.

header a list giving information for the header of the file. If NULL then no headerinformation will be written.

append logical flag indicating whether to append this chronology to an existing file.

Details

This writes a standard crn file as defined according to the standards of the ITRDB at http://www.ncdc.noaa.gov/paleo/treeinfo.html. This is the decadal or Tucson format.It is an ASCII file and machine readable by the standard dendrochronology programs. Header in-formation for the chronology can be written according to the International Tree Ring Data Bank(ITRDB) standard. The header information is given as a list and must be formatted with thefollowing:

Description Name Class Max WidthSite ID site.id character 5Site Name site.name character 52Species Code spp.code character 4State or Country state.country character 13Species spp character 18Elevation elev character or numeric 5Latitude lat character or numeric 5Longitude long character or numeric 5First Year first.yr character or numeric 4Last Year last.yr character or numeric 4Lead Investigator lead.invs character 63Completion Date comp.date character 8

Page 22: The dplR Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/dplR.pdf · The dplR Package September 2, 2007 Type Package Title Dendrochronology Program Library

22 write.crn

See examples for a correctly formatted header list. If the width of the fields is less than the maxwidth, then the fields will be padded to the right length when written. Not that lat and long are reallylat*100 or long*100 and given as integers. E.g., 37 degrees 30 minutes would be given as 3750.

This function takes a single chronology with sample depth as input. This means that is will failif given output from chron where prewhiten = TRUE. However, more than one chronologycan be appended to the bottom of an existing file (e.g., standard and residual) with a second call towrite.crn. However, the ITRDB recommends saving and publishing only one chronology perfile. The examples section shows how to circumvent this. The output from this file is suitable forpublication on the ITRDB.

Value

None. Invoked for side effect (file is written).

Author(s)

Andy Bunn

See Also

chron, read.crn

Examples

data(ca533)ca533.rwi <- detrend(rwl = ca533, method = "ModNegExp")ca533.crn <- chron(ca533.rwi, prefix = "CAM")write.crn(ca533.crn,"tmp.crn")# Put the standard and residual chronologies in a single file# with ITRDB header info on top. Not reccomended.ca533.crn <- chron(ca533.rwi, prefix = "CAM", prewhiten = TRUE)hdr.list <- list(site.id = "CAM", site.name = "Campito Mountain",spp.code = "PILO", state.country = "California", spp = "Bristlecone Pine",elev = 3400, lat = 3730, long = -11813, first.yr = 626, last.yr = 1983,lead.invs = "Donald A. Graybill, V.C. LaMarche, Jr.",comp.date = "Nov1983")

write.crn(ca533.crn[,-2],"tmp.crn", header = hdr.list)write.crn(ca533.crn[,-1],"tmp.crn", append = TRUE)

Page 23: The dplR Package - uni-bayreuth.deftp.uni-bayreuth.de/math/statlib/R/CRAN/doc/packages/dplR.pdf · The dplR Package September 2, 2007 Type Package Title Dendrochronology Program Library

Index

∗Topic IOread.crn, 11read.rwl, 13write.crn, 21

∗Topic datasetsca533, 1cana157, 2co021, 4

∗Topic hplotcrn.plot, 5seg.plot, 16skel.plot, 17wavelet.plot, 19

∗Topic iploti.detrend, 9i.detrend.series, 10

∗Topic manipchron, 3detrend.series, 7

∗Topic miscdetrend, 6read.ids, 12rwi.stats, 14rwl.stats, 15tbrm, 18Undocumented, 8

∗Topic packagedplR-package, 9

ar, 3

ca533, 1, 10, 12, 14cana157, 2chron, 3, 5, 9, 18–22co021, 4cor, 14, 15crn.plot, 5cwt.filled.contour

(Undocumented), 8

detrend, 3, 6, 8, 9, 14, 15, 18detrend.series, 6, 7, 9–11Devices, 6dplR (dplR-package), 9dplR-package, 9

i.detrend, 9i.detrend.series, 10

morlet (wavelet.plot), 19

nls, 8

read.crn, 2, 11, 22read.ids, 12, 14, 15read.rwl, 1, 3, 4, 6, 9, 10, 12, 13, 15, 16, 18rwi.stats, 12, 14, 15, 16rwl.stats, 15

save, 1, 2, 4seg.plot, 16skel.plot, 17smooth.spline, 7

tbrm, 3, 18

Undocumented, 8

wavelet (wavelet.plot), 19wavelet.plot, 19write.crn, 21

23