Description Usage Arguments Value Author(s) See Also Examples
This function fills gaps in a time series by using na.spline
and smoothes the time series by using smooth.spline
1 2 | TSGFspline(Yt, interpolate = FALSE,
...)
|
Yt |
univariate time series of class |
interpolate |
Should the smoothed and gap filled time series be interpolated to daily values by using |
... |
further arguments (currently not used) |
The function returns a gap-filled and smoothed version of the time series.
Matthias Forkel <matthias.forkel@tu-dresden.de> [aut, cre]
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | # introduce random gaps
gaps <- ndvi
gaps[runif(100, 1, length(ndvi))] <- NA
plot(gaps)
# do smoothing and gap filling
tsgf <- TSGFspline(gaps)
plot(gaps)
lines(tsgf, col="red")
# compare original data with gap-filled data
plot(ndvi[is.na(gaps)], tsgf[is.na(gaps)], xlab="original", ylab="gap filled")
abline(0,1)
r <- cor(ndvi[is.na(gaps)], tsgf[is.na(gaps)])
legend("topleft", paste("Cor =", round(r, 3)))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.