
Last chance! 50% off unlimited learning
Sale ends in
linearRelation(mydata,
x = "nox",
y = "no2",
period = "monthly",
condition = FALSE,
n = 20,
rsq.thresh = 0,
ylim = c(0, 20),
ylab = paste("slope from ", y, " = m.", x, " + c", sep = ""),
xlab = NULL,
auto.text = TRUE,
main = "",
span = 0.3,...)
date
and two
pollutants.x = "nox"
.y = "pm10"
.x
and
y
. "hour" will show the diurnal relationship between
period = "hour"
, period = "day"
and
period = "day.hour"
, setting condition = TRUE
will plot
the relationships split by year. This is useful for seeing how the
relationships may be changing on
can be set to ensure
that at least n
points are sent to tx
and y
is not very good for a
particular period, setting rsq.thresh
can help to remove those
periods where the relationship is nTRUE
(default) or FALSE
. If TRUE
titles and axis labels will automatically try and format pollutant
names and units properly e.g. by subscripting the loess
fit. Controls the fit line: lower
values produce a more "wiggly" fit.strip = FALSE
.linearRelation
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 <- linearRelation(mydata, "nox", "no2")
, 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.linearRelation
function does just that - it fits a
linearRelationship between two pollutants over a wide range of time
periods determined by period
.
linearRelation
function is particularly useful if background
concentrations are first removed from roadside concentrations, as the
increment will relate more directly with changes in emissions. In this
respect, using linearRelation
can provide valuable information
on how emissions may have changed over time, by hour of the day
etc. Using the function in this way will require users to do some basic
manipulation with their data first.
If a data frame is supplied that contains nox
, no2
and
o3
, the y
can be chosen as y = "ox"
. In function
will therefore consider total oxidant slope (sum of NO2 + O3), which can
provide valuable information on likely vehicle primary NO
emissions. Note, however, that most roadside sites do not have ozone
measurements and calcFno2
is the alternative.
A smooth line is added to all plots except period = "weekday"
using smooth.spline
. smooth.spline
uses Generalized Cross
Validation (GCV) to find a line that is (in laymans terms!) neither too
wiggly nor too smooth. The line tends to highlight both the overall
tendency of a relationship as well as some of the more interesting
features.calcFno2
# monthly relationship between NOx and SO2 - note rapid fall in ratio at the beginning of the series
linearRelation(mydata, x = "nox", y = "so2")
# monthly oxidant slope - approximately corresponding to f-NO2
# note data frame needs date, nox, no2 and o3
# clear increase in slope at the end of 2002/beginning of 2003
linearRelation(mydata, x = "nox", y = "ox")
# diurnal oxidant slope by year
# clear change in magnitude starting 2003, but the diurnal profile has also changed:
# the morning and evening peak hours are more important, presumably due to change in certain vehicle types
linearRelation(mydata, x = "nox", y = "ox", period = "hour", condition = TRUE)
# PM2.5/PM10 ratio, but only plot where monthly R2 >= 0.8
linearRelation(mydata, x = "pm10", y = "pm25", rsq.thresh = 0.8)
Run the code above in your browser using DataLab