ffcsaps {dplR} | R Documentation |
Applies a smoothing spline to y
with rigidity determined
by two parameters: frequency response f
at a wavelength
of nyrs
years.
ffcsaps(y, x = seq_along(y), nyrs = length(y)/2, f = 0.5)
y |
a |
x |
a |
nyrs |
a number greater than 1, affecting the rigidity of the
spline. When |
f |
a number between 0 and 1 giving the frequency response at a
wavelength of |
This applies a smoothing spline similar to the spline applied in most dendrochronological software. See references for more information.
In dplR
in version 1.7.3 the function caps
was introduced. This essentially replaces ffcsaps
for most uses. Where ffcsaps
is written entirely in R, caps
is a wrapper for a Fortran subroutine from ARSTAN that is thousands of times faster.
A filtered vector.
DendroLab website: https://dendrolaborg.wordpress.com/
Code provided by DendroLab based on programming by F. Qeadan and F. Biondi, University of Nevada Reno, USA and adapted for dplR by Andy Bunn. Patched and improved by Mikko Korpela.
Cook, E. R. and Kairiukstis, L. A., editors (1990) Methods of Dendrochronology: Applications in the Environmental Sciences. Springer. ISBN-13: 978-0-7923-0586-6.
Cook, E. R. and Peters, K. (1981) The Smoothing Spline: A New Approach to Standardizing Forest Interior Tree-Ring Width Series for Dendroclimatic Studies. Tree-Ring Bulletin, 41, 45-53.
library(graphics)
## Use first series from the Mesa Verde data set
data(co021)
series <- co021[, 1]
series <- series[!is.na(series)]
plot(series, type = "l", ylab = "Ring Width (mm)", col = "grey")
lines(ffcsaps(series, nyrs = 10), col = "red", lwd = 2)
lines(ffcsaps(series, nyrs = 100), col = "green", lwd = 2)
## nyrs defaults to 0.5*length(series) = 347
lines(ffcsaps(series), col = "blue", lwd = 2)
legend("topright",
c("Series", "nyrs=10", "nyrs=100",
paste("Default nyrs (", length(series) / 2, ")", sep="")),
fill=c("grey", "red", "green", "blue"))
## Compare to caps
all.equal(caps(series),ffcsaps(series))
## Note behavior when NA is encountered and
## take appropriate measures as demonstrated above
y <- c(NA,NA,rnorm(100))
ffcsaps(y)