isolate.signal {AQEval} | R Documentation |
isolateContribution
Description
Environmental time-series signal processing: Contribution isolation based on background subtraction, deseasonalisation and/or deweathering.
Usage
isolateContribution(
data,
pollutant,
background = NULL,
deseason = TRUE,
deweather = TRUE,
method = 2,
add.term = NULL,
formula = NULL,
output = "mean",
...
)
Arguments
data |
Data source, typically |
pollutant |
The column name of the |
background |
(optional) if supplied, the background time-series to use as a background correction. See below. |
deseason |
logical or character vector, if
|
deweather |
logical or character vector, if
|
method |
numeric, contribution isolation method (default 2). See Note. |
add.term |
extra terms to add to the contribution isolation model; ignore for now (in development). |
formula |
(optional) Signal isolate model formula;
this allows user to set the signal isolation model formula
directly, but means function arguments |
output |
output options; currently, |
... |
other arguments; ignore for now (in development) |
Details
isolateContribution
estimates and
subtracts pollutant
variance associated with
factors that may hinder break-point/segment analysis:
-
Background Correction If applied, this fits the supplied
background
time-series as a spline term:s(background)
. -
Seasonality If applied, this fits regular frequency terms, e.g.
day.hour
,year.day
, as spline terms, default TRUE is equivalent tos(day.hour)
ands(year.day)
. All terms are calculated fromdate
column indata
. -
Weather If applied, this fits time-series of identified meteorological measurements, e.g. wind speed and direction (
ws
andwd
indata
). If bothws
andwd
are present these are fitted as a tensor termte(ws, wd)
. Otherdeweather
ing terms, if included, are fitted as spline terms(term)
. The defaultTRUE
is equivalent tote(ws, wd)
.
Using the supplied arguments, it builds a signal
(mgcv
) GAM model, calculates,
and returns the mean-centred residuals as an
estimate of the isolated local contribution.
Value
isolateContribution
returns a vector of
predictions of the pollutant
time-series after
the requested signal isolation.
Note
method
was included as part of method
development and testing work, and retained for now.
Please ignore for now.
Author(s)
Karl Ropkins
References
Regarding mgcv
GAM fitting methods, see
Wood (2017) for general introduction and package
documentation regarding coding (mgcv
):
Wood, S.N. (2017) Generalized Additive Models: an introduction with R (2nd edition), Chapman and Hall/CRC.
Regarding isolateContribution
, see:
Ropkins et al (In Prep).
See Also
Regarding seasonal terms and frequency
analysis, see also stl
and
spectralFrequency
.
Examples
#fitting a simple deseasonalisation, deweathering
#and background correction (dswb) model to no2:
aq.data$dswb.no2 <- isolateContribution(aq.data,
"no2", background="bg.no2")
#compare at 7 day resolution:
temp <- openair::timeAverage(aq.data, "7 day")
#without dswb
quantBreakPoints(temp, "no2", test=FALSE, h=0.1)
#with dswb
quantBreakPoints(temp, "dswb.no2", test=FALSE, h=0.1)