TheilSen(mydata, pollutant = "nox", deseason = FALSE, type = "default",
  avg.time = "month", statistic = "mean", percentile = NA,
  data.thresh = 0, alpha = 0.05, dec.place = 2, xlab = "year",
  lab.frac = 0.99, lab.cex = 0.8, x.relation = "same",
  y.relation = "same", data.col = "cornflowerblue", line.col = "red",
  text.col = "darkgreen", cols = NULL, shade = "grey95",
  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 cannottype 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. timeAverage for more details.statistic =
"percentile" is chosen.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 of 100 will mean"year"."greyscale".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
should be cutData and
lattice:xyplot. For example, TheilSen passes the option
hemisphere = "southern" on to cutData to provide southern
(rather than default nTheilSen 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 <- TheilSen(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 summary.
The data component of the TheilSen output includes two
  subsets: main.data, the monthly data res2 the trend
  statistics. For output <- TheilSen(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.TheilSen function provides a collection of functions to
analyse trends in air pollution data. The TheilSen 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.
For data that are strongly seasonal, perhaps from a background
site, or a pollutant such as ozone, it will be important to
deseasonalise the data (using the option deseason =
TRUE.Similarly, for data that increase, then decrease, or show
sharp changes it may be better to use smoothTrend.
A minimum of 6 points are required for trend estimates to be made.
Note! that since version 0.5-11 openair uses Theil-Sen to derive
the p values also for the slope. This is to ensure there is
consistency between the calculated p value and other trend
parameters i.e. slope estimates and uncertainties. The p value and
all uncertainties are calculated through bootstrap simulations.
Note that the symbols shown next to each trend estimate relate to
how statistically significant the trend estimate is: p $<$ 0.001="***," p="" $<$="" 0.01="**," 0.05="*" and="" 0.1="$+$." some="" of="" the="" code="" used="" in="" TheilSen is based on that from
Rand Wilcox http://www-rcf.usc.edu/~rwilcox/ . This mostly
relates to the Theil-Sen slope estimates and uncertainties.
Further modifications have been made to take account of correlated
data based on Kunsch (1989). The basic function has been adapted
to take account of auto-correlated data using block bootstrap
simulations if autocor = TRUE (Kunsch, 1989). We follow the
suggestion of Kunsch (1989) of setting the block length to n(1/3)
where n is the length of the time series.
The slope estimate and confidence intervals in the slope are plotted and
numerical information presented.$>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
TheilSen(mydata, pollutant = "nox")
# trend plot for ozone with p=0.01 i.e. uncertainty in slope shown at
# 99 \% confidence interval
TheilSen(mydata, pollutant = "o3", ylab = "o3 (ppb)", alpha = 0.01)
# trend plot by each of 8 wind sectors
TheilSen(mydata, pollutant = "o3", type = "wd", ylab = "o3 (ppb)")
# and for a subset of data (from year 2000 onwards)
TheilSen(select.by.date(mydata, year = 2000:2005), pollutant = "o3", ylab = "o3 (ppb)")Run the code above in your browser using DataLab