library(utils)
data(gp.rwl)
data(gp.po)
## Basic use: caps smoother (default), return indices only
gp.rwi <- rcs(rwl = gp.rwl, po = gp.po, biweight = TRUE,
make.plot = FALSE)
str(gp.rwi)
## Return the regional curve alongside the indices
gp.out <- rcs(rwl = gp.rwl, po = gp.po, biweight = TRUE,
rc.out = TRUE, make.plot = FALSE)
str(gp.out)
## Plot the regional curve with a title
rcs(rwl = gp.rwl, po = gp.po, biweight = TRUE,
rc.out = FALSE, make.plot = TRUE, main = "Regional Curve")
## Use the age-dependent spline smoother instead of caps
gp.rwi.ads <- rcs(rwl = gp.rwl, po = gp.po, biweight = TRUE,
method = "ads", rc.out = FALSE, make.plot = FALSE)
## Truncate the regional curve where fewer than 5 series contribute.
## Indices for rings beyond the truncated curve are returned as NA.
gp.out.trunc <- rcs(rwl = gp.rwl, po = gp.po, biweight = TRUE,
method = "ads", min.n = 5,
rc.out = TRUE, make.plot = FALSE)
## Compare the two smoothers visually
op <- par(no.readonly = TRUE)
par(mfrow = c(1, 2))
rcs(rwl = gp.rwl, po = gp.po, biweight = TRUE,
method = "caps", make.plot = TRUE, main = "caps")
rcs(rwl = gp.rwl, po = gp.po, biweight = TRUE,
method = "ads", make.plot = TRUE, main = "ads")
par(op)
## Compare caps and ads indices for one series
gp.caps <- rcs(rwl = gp.rwl, po = gp.po, biweight = TRUE,
method = "caps", rc.out = FALSE, make.plot = FALSE)
gp.ads <- rcs(rwl = gp.rwl, po = gp.po, biweight = TRUE,
method = "ads", rc.out = FALSE, make.plot = FALSE)
cor(gp.caps[[1]], gp.ads[[1]], use = "complete.obs")
## Use subtraction rather than division (e.g. after variance stabilization)
gp.rwi.sub <- rcs(rwl = gp.rwl, po = gp.po, biweight = TRUE,
ratios = FALSE, make.plot = FALSE)
Run the code above in your browser using DataLab