trend.1D | R Documentation |
Atomic function for (linear) trend analysis
trend.1D(
ts,
dates,
method = c("pearson", "spearman", "kendall"),
return.pvalue = FALSE,
conf.level = 0.95
)
ts |
Numeric vector containing a time series |
dates |
Dates vector associated to the records in |
method |
Correlation method. Passed to |
return.pvalue |
Logical. Should p-values be returned instead of correlation coefficient estimates?.
Default to |
conf.level |
Numeric value indicating the confidence level for the significance test.
Passed to |
The function can be conveniently wrapped using climatology
. See examples.
J Bedia
climatology
, for computing climatological trend maps from grids
require(climate4R.datasets)
require(visualizeR)
# Simulate a positive trend
set.seed(1)
ts <- runif(min = 21, max = 23.5, n = 100) + seq(.1, .15, length.out = 100) * 10
dates <- paste0(1901:2000,"-01-01 00:00:00 GMT")
plot(1901:2000, ts, ty = 'l', ylab = "Simulated Mean Temp (degC)", xlab = "Year")
abline(reg = lm(ts ~ I(1901:2000)), col = "red", lty = 2)
trend.1D(ts, dates, return.pvalue = FALSE) # Default to Pearson's r
trend.1D(ts, dates, return.pvalue = TRUE)
# An example of how to compute a trend map using climatology as a wrapper for trend:
data("EOBS_Iberia_tas")
dates <- getRefDates(EOBS_Iberia_tas)
tau.estimate <- climatology(EOBS_Iberia_tas,
clim.fun = list(FUN = "trend.1D", dates = dates, method = "kendall"))
spatialPlot(tau.estimate, backdrop.theme = "coastline")
# Adding significant trend points is usually needed:
pval.estimate <- climatology(EOBS_Iberia_tas,
clim.fun = list(FUN = "trend.1D",
dates = dates,
method = "kendall",
return.pvalue = TRUE))
sig.points <- visualizeR::map.stippling(clim = pval.estimate, threshold = 0.05, condition = "LT",
pch = 19, cex = .25, col = "purple")
spatialPlot(tau.estimate, backdrop.theme = "coastline", sp.layout = list(sig.points))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.