MannKendall(mydata,
pollutant = "nox",
deseason = FALSE,
type = "default",
period = "month",
statistic = "mean",
percentile = NA,
data.thresh = 0,
simulate = FALSE,
alpha = 0.05,
dec.place = 2,
ylab = pollutant,
xlab = "year",
main = "",
auto.text = TRUE,
autocor = FALSE,
slope.percent = FALSE,
date.breaks = 7, ...)
date
and at least
one other parameter for which a trend test is required; typically (but
not necessarily) a pollutant.TRUE
the function stl
is used (seasonal trend
decomposition using loess). Note that if TRUE
missing data are
first linearly interpolated because stl
type
determines how the data are split
i.e. conditioned, and then plotted. The default is will produce a
single plot using the entire data. Type can be one of the built-in
types as detailed in cutData
e.g. "season""mean"
, but can also be
"percentile"
. See time.average
for more details.statistic =
"percentile"
is chosen. Can be a vector of numbers
e.g. percentile = c(5, 50, 95)
will plot the 5th, 50th and 95th
percentile values together on the same plot.avg.time
. A value of zero means that
all available data will be used in a particular period regardless if
of the number of values available. Conversely, a value ofFALSE
. If
TRUE
, bootstrap simulations are undertaken, which also account
for autocorrelation.TRUE
(default) or FALSE
. If
TRUE
titles and axis labels will automatically try and format
pollutant names and units properly e.g. by subscripting the
FALSE
. Generally,
accounting for autocorrelation increases the uncertainty of the trend
estimate - sometimes by a large amount.FALSE
and the slope is expressed as an average units/year change
e.g. ppb. Percentage changes can often be confusing and shouldMannKendall
also returns an object of class
``openair''. The object includes three main components: call
, the command used to
generate the plot; data
, the data frame of summarised information used to make the
plot; and plot
, the plot itself. If retained, e.g. using
output <- MannKendall(mydata, "nox")
, this output can be used to recover the data, reproduce
or rework the original plot or undertake further analysis.
An openair output can be manipulated using a number of generic operations, including
print
, plot
and summarise
. See openair.generics
for further details.
The data
component of the MannKendall
output includes to subsets:
main.data
, the monthly data res2
the trend
statistics. For output <- MannKendall(mydata, "nox")
, these can be extracted as
object$data$main.data
and object$data$res2
, respectively.
Note: In the case of the intercept, it is assumed the
y-axis crosses the x-axis on 1/1/1970.deseason = TRUE
, missing data will be
linearly interpolated.Mann-Kendall
function provides a collection of
functions to analyse trends in air pollution data. The Mann-Kendall test
is a commonly used test in environmental sciences to detect the presence
of a trend. It is often used with the Sen-Theil (or just Sen) estimate
of slope. See references. The Mann-Kendall
function is flexible
in the sense that it can be applied to data in many ways e.g. by day of
the week, hour of day and wind direction. This flexibility makes it much
easier to draw inferences from data e.g. why is there a strong downward
trend in concentration from one wind sector and not another, or why
trends on one day of the week or a certain time of day are unexpected.
The Mann-Kendall test from trend is for data that are monotonic -
see deseason =
TRUE
.Similarly, for data that increase, then decrease, or show sharp
changes it may be better to use smoothTrend
.
Some of the code used in MannKendall
is based on that from Rand
Wilxox smoothTrend
for a flexible approach to
estimating trends using nonparametric regression. The
smoothTrend
function is suitable for cases where trends are not
monotonic and is probably better for exploring the shape of trends.# load example data from package
data(mydata)
# trend plot for nox
MannKendall(mydata, pollutant = "nox")
# trend plot for ozone with p=0.01 i.e. uncertainty in slope shown at
# 99 % confidence interval
MannKendall(mydata, pollutant = "o3", ylab = "o3 (ppb)", alpha = 0.01)
# trend plot by each of 8 wind sectors
MannKendall(mydata, pollutant = "o3", type = "wd", ylab = "o3 (ppb)")
# and for a subset of data (from year 2000 onwards)
MannKendall(select.by.date(mydata, year = 2000:2005), pollutant = "o3", ylab = "o3 (ppb)")
Run the code above in your browser using DataLab