View source: R/runRegression.R
runRegression | R Documentation |
This function calculates rolling regressions for input data with a set window width. The principal use of teh function is to identify "dilution lines" where the ratio between two pollutant concentrations is invariant. The original idea is based on the work of Bentley (2004).
runRegression(mydata, x = "nox", y = "pm10", run.len = 3, date.pad = TRUE)
mydata |
A data frame with colums for |
x |
The column name of the |
y |
The column name of the |
run.len |
The window width to be used for a rolling regression. A value of 3 for example for hourly data will consider 3 one-hour time sequences. |
date.pad |
Should gaps in time series be filled before calculations are made? |
The intended use is to apply the approach to air pollution data to extract
consecutive points in time where the ratio between two pollutant
concentrations changes by very little. By filtering the output for high R2
values (typically more than 0.90 to 0.95), conditions where local source
dilution is dominant can be isolated for post processing. The function is
more fully descfibed and used in the openair
online manual, together
with examples.
A tibble with date
and calculated regression coefficients and
other information to plot dilution lines.
For original inspiration:
Bentley, S. T. (2004). Graphical techniques for constraining estimates of aerosol emissions from motor vehicles using air monitoring network data. Atmospheric Environment,(10), 1491–1500. https://doi.org/10.1016/j.atmosenv.2003.11.033
Example for vehicle emissions high time resolution data:
Farren, N. J., Schmidt, C., Juchem, H., Pöhler, D., Wilde, S. E., Wagner, R. L., Wilson, S., Shaw, M. D., & Carslaw, D. C. (2023). Emission ratio determination from road vehicles using a range of remote emission sensing techniques. Science of The Total Environment, 875. https://doi.org/10.1016/j.scitotenv.2023.162621.
Other time series and trend functions:
TheilSen()
,
calendarPlot()
,
smoothTrend()
,
timePlot()
,
timeProp()
,
timeVariation()
,
trendLevel()
# Just use part of a year of data
output <- runRegression(selectByDate(mydata, year = 2004, month = 1:3),
x = "nox", y = "pm10", run.len = 3)
output
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.