1\name{ambientNOxCH} 2\alias{ambientNOxCH} 3\docType{data} 4\encoding{utf8} 5\title{ Daily Means of NOx (mono-nitrogen oxides) in air} 6\description{ 7 This dataset contains daily means (from midnight to midnight) of NOx, 8 i.e., mono-nitrogen oxides, in [ppb] at 13 sites in central 9 Switzerland and Aarau for the year 2004. 10} 11\usage{data(ambientNOxCH, package="robustbase")} 12\format{ 13 A data frame with 366 observations on the following 14 variables. 14 \describe{ 15 \item{\code{date}}{date of day, of class \code{"Date"}.} 16 \item{\code{ad}}{Site is located north of Altdorf 100 meters east of 17 motorway A2, on an open field at the beginning of a more than 18 2000m deep valley (690.175, 193.55; 438; inLuft)} 19 \item{\code{ba}}{Site is located in the centre of the little town of 20 Baden in a residential area. Baden has 34'000 21 inhabitants and is situated on the swiss plateau (666.075, 22 257.972; 377; inLuft).} 23 \item{\code{ef}}{Site is located 6 km south of altdorf and 800 m 24 north of the village of Erstfeld. The motorway A2 passes 5 m west 25 of the measuring site. Over 8 million vehicles have passed 26 Erstfeld in 2004 where 13\% of the counts were 27 attributed to trucks (691.43, 187.69; 457; MFM-U).} 28 \item{\code{la}}{Site is located on a wooded hill in a rural area 29 called Laegern, about 190 m above Baden, which is about 5 km away 30 (669.8, 259; 690; NABEL).} 31 \item{\code{lu}}{Site is located in the center of town of Lucerne, 32 which has 57'000 inhabitants (666.19, 211.975; 460; inLuft).} 33 \item{\code{re}}{Site is located 1 km west of Reiden on the Swiss 34 plateau. The motorway A2 passes 5 m west of the measuring site 35 (639.56, 232.11; 462; MFM-U).} 36 \item{\code{ri}}{Site is located at Rigi Seebodenalp, 649 m above 37 the lake of Lucerne on an alp with half a dozen small houses 38 (677.9, 213.5; 1030; NABEL).} 39 \item{\code{se}}{Site is located in Sedel next to town of Lucerne 40 35m above and 250m south of motorway A14 from Zug to Lucerne on a 41 low hill with free 360° panorama (665.5, 213.41; 484; inLuft).} 42 \item{\code{si}}{Site is located at the border of a small industrial 43 area in Sisseln, 300 m east of a main road (640.725, 266.25; 305; 44 inLuft).} 45 \item{\code{st}}{Site is located at the south east border of Stans 46 with 7'000 inhabitants (670.85, 201.025; 438; inLuft).} 47 \item{\code{su}}{Site is located in the center of Suhr (8700 48 inhabitants), 10 m from the main road (648.49, 246.985; 403; inLuft).} 49 \item{\code{sz}}{Site is located in Schwyz (14'200 inhabitants) near 50 a shopping center (691.92, 208.03; 470; inLuft).} 51 \item{\code{zg}}{Site is located in the centre of Zug with 22'000 52 inhabitants, 24 m from the main road (681.625, 224.625; 420; 53 inLuft).} 54 } 55} 56\details{ 57 The 13 sites are part of one of the three air quality monitoring networks: 58 inLuft (regional authorities of central Switzerland and canton Aargau) 59 \cr 60 NABEL (Swiss federal network) 61 \cr 62 MFM-U (Monitoring flankierende Massnahmen Umwelt), special Swiss 63 federal network along transit motorways A2 and A13 from Germany to 64 Italy through Switzerland 65 \cr 66 The information within the brackets means: Swiss 67 coordinates km east, km north; m above sea level; network 68 69 When the measuring sites are exposed to the same atmospheric condition 70 and when there is no singular emission event at any site, 71 \code{log(mean(NOx) of a specific day at each site)} is a linear 72 function of \code{log(yearly.mean(NOx) at the corresponding site)}. The 73 offset and the slope of the straight 74 line reflects the atmospheric conditions at this specific day. During 75 winter time, often an inversion prevents the emissions from being 76 diluted vertically, so that there evolve two separate atmospheric 77 compartements: One below the inversion boundary with polluted air and one 78 above with relatively clean air. In our example below, Rigi Seebodenalp 79 is above the inversion boundary between December 10th and 12th. 80} 81 82\source{ 83 http://www.in-luft.ch/ \cr 84 http://www.empa.ch/plugin/template/empa/*/6794 \cr 85 http://www.bafu.admin.ch/umweltbeobachtung/02272/02280 86} 87\seealso{another NOx dataset, \code{\link{NOxEmissions}}. 88} 89\examples{ 90data(ambientNOxCH) 91str (ambientNOxCH) 92 93yearly <- log(colMeans(ambientNOxCH[,-1], na.rm=TRUE)) 94xlim <- range(yearly) 95lNOx <- log(ambientNOxCH[, -1]) 96days <- ambientNOxCH[, "date"] 97 98## Subset of 9 days starting at April 4: 99idays <- seq(which(ambientNOxCH$date=="2004-12-04"), length=9) 100ylim <- range(lNOx[idays,],na.rm=TRUE) 101op <- par(mfrow=c(3,3),mar=rep(1,4), oma = c(0,0,2,0)) 102 103for (id in idays) { 104 daily <- unlist(lNOx[id,]) 105 plot(NA, xlim=xlim,ylim=ylim, ann=FALSE, type = "n") 106 abline(0:1, col="light gray") 107 abline(lmrob(daily~yearly, na.action=na.exclude), 108 col="red", lwd=2) 109 text(yearly, daily, names(yearly), col="blue") 110 mtext(days[id], side=1, line=-1.2, cex=.75, adj=.98) 111} 112mtext("Daily ~ Yearly log( NOx mean values ) at 13 Swiss locations", 113 outer=TRUE) 114par(op) 115 116## do all 366 regressions: Least Squares and Robust: 117LS <- lapply(1:nrow(ambientNOxCH), function(id) 118 lm(unlist(lNOx[id,]) ~ yearly, 119 na.action = na.exclude)) 120R <- lapply(1:nrow(ambientNOxCH), 121 function(id) lmrob(unlist(lNOx[id,]) ~ yearly, 122 na.action = na.exclude)) 123## currently 4 warnings about non-convergence; 124## which ones? 125days[notOk <- ! sapply(R, `[[`, "converged") ] 126## "2004-01-10" "2004-05-12" "2004-05-16" "2004-11-16" 127 128## first problematic case: 129daily <- unlist(lNOx[which(notOk)[1],]) 130plot(daily ~ yearly, 131 main = paste("lmrob() non-convergent:",days[notOk[1]])) 132rr <- lmrob(daily ~ yearly, na.action = na.exclude, 133 control = lmrob.control(trace=3, max.it = 100)) 134##-> 53 iter. 135 136## Look at all coefficients: 137R.cf <- t(sapply(R, coef)) 138C.cf <- t(sapply(LS, coef)) 139plot(C.cf, xlim=range(C.cf[,1],R.cf[,1]), 140 ylim=range(C.cf[,2],R.cf[,2])) 141mD1 <- rowMeans(abs(C.cf - R.cf)) 142lrg <- mD1 > quantile(mD1, 0.80) 143arrows(C.cf[lrg,1], C.cf[lrg,2], 144 R.cf[lrg,1], R.cf[lrg,2], length=.1, col="light gray") 145points(R.cf, col=2) 146 147## All robustness weights 148aW <- t(sapply(R, weights, type="robustness")) 149colnames(aW) <- names(yearly) 150summary(aW) 151sort(colSums(aW < 0.05, na.rm = TRUE)) # how often "clear outlier": 152# lu st zg ba se sz su si re la ef ad ri 153# 0 0 0 1 1 1 2 3 4 10 14 17 48 154 155lattice::levelplot(aW, asp=1/2, main="Robustness weights", 156 xlab= "day", ylab= "site") 157} 158\keyword{datasets} 159