Simulating a Tree-Ring Collection

knitr::opts_chunk$set(
  message = FALSE, warning = FALSE,
  fig.width = 7, fig.height = 4.5, fig.align = "center",
  dev = "png", dpi = 96
)
# spell out zero through nine in the prose
words <- function(n, cap = FALSE) {
  out <- as.character(n)
  small <- n %in% 0:9
  out[small] <- c("zero", "one", "two", "three", "four", "five", "six",
                  "seven", "eight", "nine")[n[small] + 1]
  if (cap) substr(out, 1, 1) <- toupper(substr(out, 1, 1))
  out
}
f2 <- function(x) sprintf("%.2f", x)
f3 <- function(x) sprintf("%.3f", x)

Introduction

sim.collection() simulates ring widths for a collection of trees. It uses Cook's linear aggregate model [@Cook1990model]. Each series is the sum of an age trend, climate, disturbance and noise. The function can also add dating errors.

The function returns the ring widths as an rwl object. It also returns each simulated component. With measured data, the true age trend and climate are unknown. With simulated data they are known, which makes it possible to check how well a method recovers them [e.g., @Bunn2004].

This vignette shows how a ring is built, what is in the example collection, and how to set agreement among trees. It then covers options that make the trees more realistic, and it compares a simulated collection with a measured one. Using the collection to test detrending, chronology building or other analyses is left to the reader. The last section suggests a few starting points.

library(dplR)
exampleRelease <- list(tree = 10, year = 1950, size = log(1.8),
                       decay = 25)
exampleEvent <- list(year = 1880, frac = 0.5, size = log(0.6), decay = 8)
sim <- sim.collection(seed = 1, release = exampleRelease,
                      event = exampleEvent)
sim

The release and event sizes here are set for this vignette. The release multiplies growth by 1.8, printed on the log scale as log(1.8) = 0.588. The event multiplies growth by 0.6, a 40% cut, printed as log(0.6) = -0.511. The function's defaults are a doubling and a halving. The seed fixes the random draws. Throughout the vignette, "the example collection" refers to this collection.

Constructing a Ring Width

Cook's linear aggregate model writes a ring width as a sum of parts [@Cook1990model, p. 98]:

$$R_t = A_t + C_t + \delta D1_t + \delta D2_t + E_t.$$

$R_t$ is the ring width in year $t$. $A_t$ is the age trend. $C_t$ is the climate. $D1_t$ is a disturbance in one tree, and $D2_t$ is a disturbance across the site. $\delta$ is 1 when a disturbance is present and 0 when it is not. $E_t$ is everything else.

The simulator changes this form in four ways.

  1. Ring widths are multiplicative. Cook notes that taking logs makes the model linear [@Cook1990model, p. 98]. The parts are therefore added on the log scale, and the sum is exponentiated to give a width.
  2. Because a collection contains many trees and cores, each term carries subscripts for the tree $i$ and the core $j$ that share it.
  3. $E_t$ is split in two. $T_{it}$ is noise shared by the cores of a tree, and $E_{ijt}$ is noise in one core.
  4. Climate and noise pass through the tree's memory, an AR(1) filter with coefficient $\phi$. Their filtered sum is $M_{ijt}$.

The disturbances are pulses that are zero outside the years they act, so $\delta$ is not needed. One ring in core $j$ of tree $i$ in year $t$ is then

$$\log R_{ijt} = \log A_{it} + M_{ijt} + D1_{it} + D2_{it}, \qquad M_{ijt} = \phi M_{ij,t-1} + C_t + T_{it} + E_{ijt}.$$

The subscripts indicate which series share a term. A term with only $t$ is the same in every tree. A term with $i$ belongs to one tree and both of its cores. A term with $j$ belongs to one core.

Widths are in mm and are rounded to digits = 3, or 0.001 mm. Dating errors are added last, and only to the measured series.

The Components of Two Cores

The figure below shows the components of two cores and the ring widths they produce. SIM06A is from an open-grown tree. SIM10A is from a crowded tree, so its age trend includes a competition history. The 1880 event hits both trees, and tree 10 also has the release in 1950.

$M$ holds the climate and the noise together, after the tree's memory. To show them apart, the figure runs the climate through the same AR(1) filter on its own. The noise row is what is left of $M$. Climate is the same in every tree, so it is drawn once. Each row uses one y scale for both cores. The climate, noise and disturbance rows share one scale, so their sizes can be compared directly. The code that draws the figure is hidden here and can be found in the vignette's R code, through browseVignettes("dplR").

cores <- c("SIM06A", "SIM10A")
truthYears <- as.numeric(rownames(sim$truth$rwl))
phi <- sim$truth$params$phi

# the climate as the trees record it: through the tree's memory filter
climateFiltered <- as.numeric(stats::filter(sim$truth$climate$climate, phi,
                                            method = "recursive"))

coreParts <- lapply(cores, function(coreName) {
  width <- sim$truth$rwl[[coreName]]
  measured <- !is.na(width)
  list(name = coreName,
       measured = measured,
       age = sim$truth$age[[coreName]],
       noise = sim$truth$memory.noise[[coreName]] - climateFiltered,
       disturbance = sim$truth$disturbance[[coreName]],
       width = width)
})

# one y range per row, over the years each core was measured
rowRange <- function(part) {
  range(unlist(lapply(coreParts, function(cp) cp[[part]][cp$measured])))
}
ageRange <- rowRange("age")
widthRange <- rowRange("width")
logRange <- range(climateFiltered, rowRange("noise"), rowRange("disturbance"))

drawPanel <- function(cp, part, title, ylim, ylab, left) {
  plot(truthYears[cp$measured], cp[[part]][cp$measured], type = "l",
       xlim = range(truthYears), ylim = ylim, xlab = "", ylab = "",
       las = 1, yaxt = if (left) "s" else "n")
  if (part != "width" && part != "age") abline(h = 0, col = "grey75")
  mtext(title, side = 3, adj = 0, line = 0.2, cex = 0.75, font = 2)
  if (left) mtext(ylab, side = 2, line = 2.8, cex = 0.75)
}

oldPar <- par(mar = c(2, 1.5, 1.5, 0.5), oma = c(1, 3, 1.5, 0),
              mgp = c(2.5, 0.6, 0), cex.axis = 0.8)
# rows: age trend, climate (one panel), noise, disturbance, ring width
layout(matrix(c(1, 2,
                3, 3,
                4, 5,
                6, 7,
                8, 9), ncol = 2, byrow = TRUE))
for (k in 1:2) {
  drawPanel(coreParts[[k]], "age", "A, age trend", ageRange, "mm", k == 1)
  mtext(cores[k], side = 3, line = 1.3, font = 2)
}
plot(truthYears, climateFiltered, type = "l", ylim = logRange, xlab = "",
     ylab = "", las = 1)
abline(h = 0, col = "grey75")
mtext("C, climate through the tree's memory (both cores)", side = 3,
      adj = 0, line = 0.2, cex = 0.75, font = 2)
mtext("log", side = 2, line = 2.8, cex = 0.75)
for (k in 1:2) {
  drawPanel(coreParts[[k]], "noise", "T + E, noise through the memory",
            logRange, "log", k == 1)
}
for (k in 1:2) {
  drawPanel(coreParts[[k]], "disturbance", "D1 + D2, disturbance",
            logRange, "log", k == 1)
}
for (k in 1:2) {
  cp <- coreParts[[k]]
  drawPanel(cp, "width", "R, ring width", widthRange, "mm", k == 1)
  lines(truthYears[cp$measured], cp$age[cp$measured], lty = 2)
}
par(oldPar)

The dashed line in the bottom row is the age trend. SIM06A has a smooth age trend. In SIM10A, the competition history makes the age trend wander. The 1880 event is a dip in both cores. The release in 1950 is only in SIM10A. It is clear in the disturbance row, but it is hard to pick out in the ring widths, because climate and noise swing by about as much. Without the components, it would be difficult to say how much of each ring is due to the release.

The components multiply back to the true ring widths. The age trend is multiplied by the exponential of the sum of two log-scale terms, memory.noise ($M$) and disturbance ($D1 + D2$), and the product is rounded as the widths are.

rebuilt <- round(sim$truth$age * exp(sim$truth$memory.noise +
                                     sim$truth$disturbance), 3)
all.equal(as.matrix(rebuilt), as.matrix(sim$truth$rwl),
          check.attributes = FALSE)

The Example Collection

params <- sim$truth$params
truthYrs <- as.numeric(rownames(sim$truth$rwl))
rwlYrs <- as.numeric(rownames(sim$rwl))

The example collection has r params$n.tree trees with r words(params$n.core) cores each. All are cored in r params$end.year. @CookKairiukstis1990 [p. 27] recommend two cores from each of twenty trees for a ring-width chronology. Tree 1 is the oldest, with its pith in r min(sim$truth$pith$pith). Tree r params$n.tree is the youngest, with its pith in r max(sim$truth$pith$pith). Tree ages are spaced quadratically between the two ends of age.range (120 and 380 years by default). Most trees are young and few are old, so sample depth drops going back in time. Each core misses the pith by a few rings (pith.miss), so the two cores of a tree start in different years.

seg.plot(sim$rwl)

Series names are the site, a two-digit tree number and a core letter. SIM03A is the first core of tree 3. sim$ids gives the tree and core of each series. It is in the form that rwi.stats() and treeMean() use. autoread.ids() reads the names the same way.

Competition, Disturbance and Dating Errors

The example collection includes crowded trees, an event, a release and a dating error. The table lists them by tree.

simTruth <- sim$truth
nTree <- nrow(simTruth$pith)
planted <- data.frame(tree = simTruth$pith$tree,
                      pith = simTruth$pith$pith,
                      crowded = simTruth$pith$tree %in% simTruth$competition,
                      event = seq_len(nTree) %in% simTruth$event$trees,
                      release = seq_len(nTree) == simTruth$release$tree)
planted$error <- ""
errTree <- sim$ids[simTruth$errors$series, "tree"]
planted$error[errTree] <- paste(simTruth$errors$series, simTruth$errors$type,
                                simTruth$errors$year)
planted
nStanding <- sum(simTruth$pith$pith < simTruth$event$year)

Of the r nTree trees, r words(length(simTruth$competition)) are crowded. The r simTruth$event$year event cuts growth by r round(100 * (1 - exp(simTruth$event$size)))% in r words(length(simTruth$event$trees)) of the r nStanding trees alive that year. Their growth recovers over about a decade. Cook defines $D2$ as hitting all trees [@Cook1990model, p. 102]. Here it hits about half, so it can be told apart from a climate year. Setting frac = 1 in event applies it to every tree. Tree r simTruth$release$tree grows r round(exp(simTruth$release$size), 1) times faster from r simTruth$release$year, and this fades over decades. The r simTruth$errors$year ring is missing from r simTruth$errors$series. Every ring before it is dated one year too late.

Each of these features can be omitted by setting release, event or errors to NULL.

Measured and True Widths

sim$rwl is the collection as measured. It has the missing ring. sim$truth$rwl has the widths as the trees grew them. The tables in sim$truth start in r min(truthYrs), the year of the oldest pith. sim$rwl starts in r min(rwlYrs), the first measured ring. The two are therefore matched by year, using the row names.

trueAge <- sim$truth$age[rownames(sim$rwl), ]
dim(trueAge)
dim(sim$rwl)

sim$truth holds the following components. The help page, ?sim.collection, describes each one.

names(sim$truth)

Setting Agreement Among Trees and Cores

The variances of the components are not specified directly. They follow from three targets that describe how closely trees and cores agree, and the function derives the variance of each component from these targets.

Core noise accounts for the remaining variance. An AR(1) filter raises the variance of white noise by $1/(1-\phi^2)$. The function scales the shocks so that $M$ retains the specified standard deviation for any value of $\phi$ [@Bunn2013, Appendix A]. By default the climate is red, meaning autocorrelated (climate.phi). A red series gains more variance from the memory filter than white noise does, and the scaling allows for this as well.

Because the shares are set on the shocks, the targets describe the year-to-year part with the memory removed. That is what prewhitened indices would show if detrending were perfect. Without prewhitening, the correlation between trees is higher, because the red climate carries more of its variance through the memory than the noise does. The table in Low-Frequency Climate shows both. This can be checked against the known components. exp(sim$truth$memory.noise) is each core with its age trend and disturbance removed exactly.

perfect <- as.rwi(exp(sim$truth$memory.noise[rownames(sim$rwl), ]))
rbind(pearson = rwi.stats(perfect, sim$ids, prewhiten = TRUE,
                          method = "pearson")[, c("rbar.wt", "rbar.bt")],
      spearman = rwi.stats(perfect, sim$ids,
                           prewhiten = TRUE)[, c("rbar.wt", "rbar.bt")])

These values come from a single collection. The same check, repeated over twenty collections, follows.

agree <- sapply(1:20, function(seed) {
  coll <- sim.collection(seed = seed, release = NULL, event = NULL,
                       errors = NULL)
  indices <- as.rwi(exp(coll$truth$memory.noise[rownames(coll$rwl), ]))
  pearsonStats <- rwi.stats(indices, coll$ids, prewhiten = TRUE,
                            method = "pearson")
  spearmanStats <- rwi.stats(indices, coll$ids, prewhiten = TRUE)
  c(pearson.wt = pearsonStats$rbar.wt, pearson.bt = pearsonStats$rbar.bt,
    spearman.wt = spearmanStats$rbar.wt, spearman.bt = spearmanStats$rbar.bt)
})
round(rowMeans(agree), 3)
spearmanOf <- function(r) 6 / pi * asin(r / 2)

With Pearson's correlation, the twenty collections average r f3(rowMeans(agree)["pearson.wt"]) within trees and r f3(rowMeans(agree)["pearson.bt"]) between trees. The targets are 0.6 and 0.4. The values are a little low because rwi.stats() fits its own AR model to each core and works on indices, while the parts were built on the log scale. rwi.stats() also uses Spearman's correlation by default. On normal data, a Pearson correlation $r$ corresponds to a Spearman correlation of about $(6/\pi)\arcsin(r/2)$, which is slightly smaller [@Moran1948]. As Spearman's, targets of 0.6 and 0.4 are about r f3(spearmanOf(0.6)) and r f3(spearmanOf(0.4)). These differences should be considered when a statistic is compared with its target.

Options for More Realistic Collections

The example collection is simpler than a measured one. The options below make it more realistic, one feature at a time. Most are off by default. Those options draw their random numbers last, and only when turned on. Turning one on therefore leaves the rest of the collection unchanged for a given seed. Seeds lists the exceptions.

Climate

By default the climate is random, with climate.phi = 0.3. Each year keeps 0.3 of the year before. A series supplied by the user can be passed with climate. It must be named by year and cover every year from the oldest pith. The function rescales it to the size set by rbar.bt and sd.hf and keeps its shape.

The rescaling matters when a supplied series has variance at multidecadal or centennial periods. Low-Frequency Climate below shows what happens and how climate.slow avoids it.

sens.sdlog gives each tree its own sensitivity to climate. It is a multiplier drawn on the log scale, with a mean square of 1, so the average climate variance across trees is unchanged. Because trees that differ in sensitivity agree less, the correlation between trees falls below rbar.bt.

sensBt <- sapply(c(0, 0.3, 0.6), function(sensSdlog) {
  mean(sapply(1:20, function(seed) {
    coll <- sim.collection(seed = seed, sens.sdlog = sensSdlog, release = NULL,
                         event = NULL, errors = NULL)
    indices <- as.rwi(exp(coll$truth$memory.noise[rownames(coll$rwl), ]))
    rwi.stats(indices, coll$ids, prewhiten = TRUE, method = "pearson")$rbar.bt
  }))
})
setNames(round(sensBt, 3), c("sens.sdlog = 0", "0.3", "0.6"))

Low-Frequency Climate {#slow-climate}

climate.slow adds climate at multidecadal and longer periods. It takes a series named by year, on the log scale, such as a trend or a wave. The series is added after the rescaling and after the tree's memory, at the amplitude supplied. It makes no random draws, so the rest of the collection is the same as without it. Each tree feels it through its sensitivity, as it does the rest of the climate. sim$truth$climate$slow holds it.

The example below uses a wave with a period of 150 years and an amplitude of 0.15 on the log scale. The wave covers every year from the oldest pith, as a series passed to the function must. It is added two ways. With climate.slow, it sits on top of the year-to-year climate. With climate, it is added to the year-to-year climate first, and the sum is rescaled.

waveYears <- 1500:2025
wave <- setNames(0.15 * sin(2 * pi * (waveYears - 1500) / 150), waveYears)
baseline <- sim.collection(seed = 1, release = NULL, event = NULL,
                           errors = NULL)
withSlow <- sim.collection(seed = 1, release = NULL, event = NULL,
                           errors = NULL, climate.slow = wave)
fastClimate <- setNames(baseline$truth$climate$climate,
                        baseline$truth$climate$year)
waveInside <- sim.collection(seed = 1, release = NULL, event = NULL,
                             errors = NULL,
                             climate = fastClimate +
                               wave[names(fastClimate)])
waveHere <- wave[names(fastClimate)]
shrink <- sd(waveInside$truth$climate$climate) / sd(fastClimate + waveHere)

With climate.slow, the year-to-year climate keeps its size and the wave keeps its amplitude of 0.15. With climate, the sum is rescaled, so both parts are multiplied by r f2(shrink). The wave's amplitude drops to r f3(0.15 * shrink), and the year-to-year climate shrinks by the same factor.

rbar.bt sets the share of the year-to-year variance from climate. The slow part is shared by every tree too, so it adds to the correlation between trees, but only at long periods. The table gives the correlation between trees for the three collections, averaged over ten seeds. It is computed three ways. The column perfect uses perfect indices, exp(sim$truth$memory.noise), without prewhitening. The column prewhitened uses the same indices prewhitened. The column spline30 uses ring widths detrended with a 30-year spline and prewhitened.

rbarThreeWays <- function(coll) {
  perfect <- as.rwi(exp(coll$truth$memory.noise[rownames(coll$rwl), ]))
  detrended <- detrend(coll$rwl, method = "Spline", nyrs = 30,
                       make.plot = FALSE)
  c(perfect = rwi.stats(perfect, coll$ids, prewhiten = FALSE,
                    method = "pearson")$rbar.bt,
    prewhitened = rwi.stats(perfect, coll$ids, prewhiten = TRUE,
                            method = "pearson")$rbar.bt,
    spline30 = rwi.stats(detrended, coll$ids, prewhiten = TRUE,
                         method = "pearson")$rbar.bt)
}
slowRbar <- sapply(1:10, function(seed) {
  base <- sim.collection(seed = seed, release = NULL, event = NULL,
                         errors = NULL)
  fast <- setNames(base$truth$climate$climate, base$truth$climate$year)
  slow <- sim.collection(seed = seed, release = NULL, event = NULL,
                         errors = NULL, climate.slow = wave)
  inside <- sim.collection(seed = seed, release = NULL, event = NULL,
                           errors = NULL,
                           climate = fast + wave[names(fast)])
  c(rbarThreeWays(base), rbarThreeWays(slow), rbarThreeWays(inside))
})
slowRbarTable <- matrix(rowMeans(slowRbar), nrow = 3, byrow = TRUE,
                        dimnames = list(c("no wave", "climate.slow",
                                          "wave in climate"),
                                        c("perfect", "prewhitened",
                                          "spline30")))
round(slowRbarTable, 3)

With climate.slow, the correlation of the perfect indices goes up, from r f3(slowRbarTable["no wave", "perfect"]) to r f3(slowRbarTable["climate.slow", "perfect"]), because the wave is shared by every tree. Prewhitening or a 30-year spline removes most of the wave, and the correlation is back near the collection without it (r f3(slowRbarTable["climate.slow", "prewhitened"]) and r f3(slowRbarTable["climate.slow", "spline30"])). rbar.bt therefore still describes the year-to-year part. With the wave inside climate, the correlation of the perfect indices goes up as well. However, because the year-to-year climate is now smaller, the prewhitened and spline values fall, to r f3(slowRbarTable["wave in climate", "prewhitened"]) and r f3(slowRbarTable["wave in climate", "spline30"]). climate.slow is suited to collections in which the year-to-year agreement should remain at the level set by rbar.bt. climate is suited to an observed climate series with its own mix of periods.

The 30-year spline gives lower values than the prewhitened perfect indices even without the wave (r f3(slowRbarTable["no wave", "spline30"]) against r f3(slowRbarTable["no wave", "prewhitened"])). The spline is an imperfect estimate of the age trend, and that loss of agreement is similar with and without climate.slow. A similar gap appears with the competition history turned off.

Noise

Core noise is Gaussian by default, so rings that depart strongly from their neighbors are rare. Real cores have more of them, from reaction wood, cracks and misread rings. noise.df draws core noise from a t distribution with that many degrees of freedom, at the same standard deviation. This gives heavier tails. The effect appears in the excess kurtosis, which is 0 for a Gaussian distribution and positive for heavier tails. It is computed here on the year-to-year differences between the two cores of a tree. Climate, tree noise, the age trend and disturbance are the same in both cores, so the difference holds only core noise.

coreKurtosis <- function(collection) {
  logWidth <- log(as.matrix(collection$truth$rwl))
  coreA <- logWidth[, collection$ids$core == 1]
  coreB <- logWidth[, collection$ids$core == 2]
  coreDiff <- diff(coreA - coreB)
  excessKurtosis <- apply(coreDiff, 2, function(x) {
    x <- x[!is.na(x)]
    mean((x - mean(x))^4) / var(x)^2 - 3
  })
  median(excessKurtosis)
}
round(c(gaussian = coreKurtosis(sim.collection(seed = 1)),
        t6 = coreKurtosis(sim.collection(seed = 1, noise.df = 6)),
        t4 = coreKurtosis(sim.collection(seed = 1, noise.df = 4))), 2)

The Gaussian value is slightly below 0. Sample kurtosis is biased low in series of about 200 values, and pure Gaussian series of that length give a similar median.

Age Trend

By default, every tree without competition has the same shape of age trend, scaled by its growth rate. This arrangement favors regional curve standardization (RCS). bai.trend lets each tree's basal area increment change with age. It is multiplied by $e^{\beta_i \cdot \mathrm{age}/100}$, with $\beta_i$ drawn from a normal distribution with standard deviation bai.trend. If the increment falls with age, rings narrow faster than geometry alone predicts. If it rises, rings level off or widen. bai.age ties a tree's growth rate to its age. It is the correlation between log growth rate and age. A negative value makes old trees slow growers. @BriffaMelvin2011 [p. 122--123] expect this in collections of living trees, and it biases a regional curve. The figure shows the true age trend of every core, with and without bai.trend = 0.3. Competition is off, so the left panel shows the geometry alone and the right panel adds the change in basal area increment.

openGrown <- sim.collection(seed = 1, compete = 0)
varied <- sim.collection(seed = 1, compete = 0, bai.trend = 0.3)
# each core's true age trend for its first 300 rings, by cambial age
byCambialAge <- function(collection) {
  ageTrend <- as.matrix(collection$truth$age)
  apply(ageTrend, 2, function(x) x[!is.na(x)][1:300])
}
oldPar <- par(mfrow = c(1, 2), mar = c(4, 4, 2, 1), mgp = c(2.5, 0.7, 0))
matplot(byCambialAge(openGrown), type = "l", lty = 1, col = "grey30", log = "y",
        xlab = "Cambial age", ylab = "A (mm)", main = "bai.trend = 0")
matplot(byCambialAge(varied), type = "l", lty = 1, col = "grey30", log = "y",
        xlab = "Cambial age", ylab = "A (mm)", main = "bai.trend = 0.3")
par(oldPar)

Each tree's basal area increment is in sim$truth$growth$bai. The correlation between its log and the tree's age, averaged over twenty collections, shows the effect of bai.age.

ageGrowthCor <- function(baiAge) {
  mean(sapply(1:20, function(seed) {
    coll <- sim.collection(seed = seed, bai.age = baiAge)
    treeAge <- coll$truth$params$end.year - coll$truth$pith$pith
    cor(log(coll$truth$growth$bai), treeAge)
  }))
}
round(c("bai.age = 0" = ageGrowthCor(0), "-0.5" = ageGrowthCor(-0.5)), 2)

Dead Trees

By default every tree is cored in end.year. dead = list(frac, span) makes a share of the trees dead. Each dies in a year drawn uniformly from the span years before end.year. A dead tree keeps its age, so the collection goes further back and the series end in different years. The release tree and any tree with a planted error stay alive.

withDead <- sim.collection(seed = 1, release = exampleRelease,
                     event = exampleEvent,
                     dead = list(frac = 0.3, span = 300))
withDead
range(as.numeric(rownames(withDead$rwl)))

The event now hits r words(length(withDead$truth$event$trees)) trees instead of six. Dead trees reach further back in time, which changes the set of trees alive in 1880, and the event draws its trees from that set.

Spread and Level

With spread.b = 1, the parts add on the log scale. The spread of the widths around the age trend is then proportional to the trend. @CookPeters1997 describe spread rising as a power $b$ of the level, and in many series $b$ is below 1. With spread.b below 1, the parts add on a power scale, $p = 1 - b$, in Box-Cox form. The spread then grows as $A^b$. Narrow rings swing more on the log scale than wide ones. A ring that falls below zero on the power scale becomes an absent ring. spread.b.sd gives each tree its own $b$. sim$truth$params$spread.zero counts the absent rings.

The figure shows the oldest core with spread.b = 1 and spread.b = 0.5, as the log of the ring width divided by its age trend. The draws are the same in both panels. Early rings are wide, and late rings are narrow.

spreadOne <- sim.collection(seed = 1, release = NULL, event = NULL,
                            errors = NULL)
spreadHalf <- sim.collection(seed = 1, release = NULL, event = NULL,
                             errors = NULL, spread.b = 0.5)
logRatio <- function(collection, seriesName) {
  log(collection$truth$rwl[[seriesName]] /
        collection$truth$age[[seriesName]])
}
spreadYears <- as.numeric(rownames(spreadOne$truth$rwl))
ratioRange <- range(logRatio(spreadOne, "SIM01A"),
                    logRatio(spreadHalf, "SIM01A"), na.rm = TRUE)
oldPar <- par(mfrow = c(2, 1), mar = c(2, 4, 1.5, 1), mgp = c(2.5, 0.7, 0))
plot(spreadYears, logRatio(spreadOne, "SIM01A"), type = "l", las = 1,
     ylim = ratioRange, xlab = "", ylab = "log(R / A)",
     main = "SIM01A, spread.b = 1")
abline(h = 0, col = "grey75")
plot(spreadYears, logRatio(spreadHalf, "SIM01A"), type = "l", las = 1,
     ylim = ratioRange, xlab = "", ylab = "log(R / A)",
     main = "SIM01A, spread.b = 0.5")
abline(h = 0, col = "grey75")
par(oldPar)

With spread.b = 1, the swings are about the same size throughout the core. With spread.b = 0.5, they are smaller in the wide early rings and larger in the narrow late rings. No ring falls below zero in this collection (r spreadHalf$truth$params$spread.zero absent rings).

Disturbance That Builds Gradually

A pulse that jumps in one year fits a sudden event, like a fire or a drought. A release after a thinning builds more slowly as the trees grow into the space. event has an optional ramp, the number of years the pulse takes to build. release does not take a ramp, so a thinning that releases every tree is set up as an event with frac = 1 and a size above 0, as below. The pulse is scaled so its peak is still size. The peak comes ramp * log(1 + decay / ramp) years after year, about eight years for the event below.

ramped <- sim.collection(seed = 1, release = NULL, errors = NULL,
                         event = list(year = 1960, frac = 1,
                                      size = log(1.5), decay = 25,
                                      ramp = 4))
rampPulse <- ramped$truth$disturbance[["SIM10A"]]
rampYears <- as.numeric(rownames(ramped$truth$disturbance))
plot(rampYears, exp(rampPulse), type = "l", xlim = c(1940, 2025),
     xlab = "Year",
     ylab = "Growth multiplier", main = "An event that builds, SIM10A")

Comparison with a Measured Collection

It is worth comparing a simulated collection with a measured one. wa082, from Hurricane Ridge in Washington, comes with dplR. The table below gives the same summaries for both. For the agreement statistics, each series is detrended with the default spline in detrend(), whose stiffness is two-thirds of the series length.

data(wa082)
describe <- function(rwl, ids) {
  st <- summary(rwl)
  rs <- rwi.stats(detrend(rwl, method = "Spline", make.plot = FALSE), ids,
                  prewhiten = TRUE)
  c(series = ncol(rwl), trees = length(unique(ids$tree)),
    length = median(st$year), mean.mm = median(st$mean),
    sd.mm = median(st$stdev), ar1 = median(st$ar1),
    rbar.wt = rs$rbar.wt, rbar.bt = rs$rbar.bt, eps = rs$eps)
}
round(rbind(simulated = describe(sim$rwl, sim$ids),
            wa082 = describe(wa082, autoread.ids(wa082))), 3)

The lengths, sizes and agreement are similar. The simulated series have higher first-order autocorrelation in their raw widths. The arguments can be used to make a simulated collection resemble a measured one. The collection below is based on wa082. It has the same number of trees and is cored in the last year of wa082. Its range of ages comes from the lengths of the wa082 series, plus five years, the average number of rings by which a core misses the pith (pith.miss). Its agreement targets come from the table above.

waStats <- describe(wa082, autoread.ids(wa082))
waLen <- summary(wa082)$year
lookAlike <- sim.collection(n.tree = 12, end.year = max(time(wa082)),
                       age.range = range(waLen) + 5,
                       rbar.bt = waStats[["rbar.bt"]],
                       rbar.wt = waStats[["rbar.wt"]],
                       release = NULL, event = NULL, errors = NULL,
                       site = "LIKE", seed = 1)
round(rbind(lookAlike = describe(lookAlike$rwl, lookAlike$ids),
            wa082 = waStats), 3)
likeStats <- describe(lookAlike$rwl, lookAlike$ids)

The look-alike has rbar.bt of r f3(likeStats[["rbar.bt"]]). It was built with r f3(waStats[["rbar.bt"]]). The targets are for perfect indices, and here a spline did the detrending. The example collection also came back lower after the spline, r f3(describe(sim$rwl, sim$ids)[["rbar.bt"]]) against r f3(rwi.stats(perfect, sim$ids, prewhiten = TRUE)$rbar.bt) with perfect indices. How much lower depends on the collection. To match a statistic measured after detrending, the target can be set higher and the result checked. Here the target for rbar.bt is raised to 0.43.

lookAlikeHigher <- sim.collection(n.tree = 12, end.year = max(time(wa082)),
                                  age.range = range(waLen) + 5,
                                  rbar.bt = 0.43,
                                  rbar.wt = waStats[["rbar.wt"]],
                                  release = NULL, event = NULL,
                                  errors = NULL, site = "LIKE", seed = 1)
round(rbind(lookAlikeHigher = describe(lookAlikeHigher$rwl,
                                       lookAlikeHigher$ids),
            wa082 = waStats), 3)

This setting suits this seed. Another seed would give a somewhat different value after detrending. The median series is also shorter than in wa082, because ages are spaced quadratically and there are few old trees.

Agreement in summary statistics is a limited test. Two collections can have the same means, lengths and correlations and still differ in ways that matter to a method, such as the shape of the age trends or the size of climate at long periods. The components of a simulated collection are known, and those of a measured collection are not. The two are therefore most informative when used together.

Seeds and Reproducibility {#seeds}

The seed fixes the random draws. Setting seed calls set.seed(), which resets the random-number stream for the session.

Some arguments, such as rbar.bt, sd.hf, compete and climate.phi, set only a size and scale the same draws. For example, sim.collection(seed = 1, rbar.bt = 0.2, rbar.wt = 0.4) gives the default collection with lower agreement. The trees an event hits are drawn from a separate stream, so the event and its frac do not change any other draw. sens.sdlog, bai.trend and spread.b.sd draw last, and only when turned on. Three arguments change the draws that follow them. A finite noise.df uses random numbers differently from Gaussian draws. dead changes the years the collection covers. A user-supplied climate replaces the drawn series.

baseline <- sim.collection(seed = 1)
withSens <- sim.collection(seed = 1, sens.sdlog = 0.3)
identical(baseline$truth$climate, withSens$truth$climate)
withTNoise <- sim.collection(seed = 1, noise.df = 6)
identical(baseline$truth$climate, withTNoise$truth$climate)
identical(baseline$truth$competition, withTNoise$truth$competition)

Using the Known Components

Every component in sim$truth can be used to score an analysis. A few starting points:

Limitations

Some simplifications favor certain methods. They are worth considering when a method performs better here than expected.

The book Learning to Love dplR uses the default collection throughout. It has a chapter on how it is built.

References



Try the dplR package in your browser

Any scripts or data that you put into this service are public.

dplR documentation built on Dec. 6, 2026, 1:07 a.m.