| ethanol {lattice} | R Documentation |
Ethanol fuel was burned in a single-cylinder engine. For various settings of the engine compression and equivalence ratio, the emissions of nitrogen oxides were recorded.
ethanol
A data frame with 88 observations on the following 3 variables.
Documentation contributed by Kevin Wright.
Brinkman, N.D. (1981) Ethanol Fuel—A Single-Cylinder Engine Study of Efficiency and Exhaust Emissions. SAE transactions, 90, 1410–1424.
Cleveland, William S. (1993). Visualizing Data. Hobart Press, Summit, New Jersey.
ethanol
datasets
## Constructing panel functions on the fly
EE <- equal.count(ethanol$E, number=9, overlap=1/4)
xyplot(NOx ~ C | EE, data = ethanol,
prepanel = function(x, y) prepanel.loess(x, y, span = 1),
xlab = "Compression ratio", ylab = "NOx (micrograms/J)",
panel = function(x, y) {
panel.grid(h=-1, v= 2)
panel.xyplot(x, y)
panel.loess(x,y, span=1)
},
aspect = "xy")
# Wireframe loess surface fit. See Figure 4.61 from Cleveland.
require(stats)
with(ethanol, {
eth.lo <- loess(NOx ~ C * E, span = 1/3, parametric = "C",
drop.square = "C", family="symmetric")
eth.marginal <- list(C = seq(min(C), max(C), length.out = 25),
E = seq(min(E), max(E), length.out = 25))
eth.grid <- expand.grid(eth.marginal)
eth.fit <- predict(eth.lo, eth.grid)
wireframe(eth.fit ~ eth.grid$C * eth.grid$E,
shade=TRUE,
screen = list(z = 40, x = -60, y=0),
distance = .1,
xlab = "C", ylab = "E", zlab = "NOx")
})
R version 2.9.0 (2009-04-17)
Copyright (C) 2009 The R Foundation for Statistical Computing
ISBN 3-900051-07-0
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> library(lattice)
> png(filename="images/ethanol_%03d.png" ,width=480, height=480)
> ### Name: ethanol
> ### Title: Engine exhaust fumes from burning ethanol
> ### Aliases: ethanol
> ### Keywords: datasets
>
> ### ** Examples
>
> ## Constructing panel functions on the fly
> EE <- equal.count(ethanol$E, number=9, overlap=1/4)
> xyplot(NOx ~ C | EE, data = ethanol,
+ prepanel = function(x, y) prepanel.loess(x, y, span = 1),
+ xlab = "Compression ratio", ylab = "NOx (micrograms/J)",
+ panel = function(x, y) {
+ panel.grid(h=-1, v= 2)
+ panel.xyplot(x, y)
+ panel.loess(x,y, span=1)
+ },
+ aspect = "xy")
>
> # Wireframe loess surface fit. See Figure 4.61 from Cleveland.
> require(stats)
> with(ethanol, {
+ eth.lo <- loess(NOx ~ C * E, span = 1/3, parametric = "C",
+ drop.square = "C", family="symmetric")
+ eth.marginal <- list(C = seq(min(C), max(C), length.out = 25),
+ E = seq(min(E), max(E), length.out = 25))
+ eth.grid <- expand.grid(eth.marginal)
+ eth.fit <- predict(eth.lo, eth.grid)
+ wireframe(eth.fit ~ eth.grid$C * eth.grid$E,
+ shade=TRUE,
+ screen = list(z = 40, x = -60, y=0),
+ distance = .1,
+ xlab = "C", ylab = "E", zlab = "NOx")
+ })
>
>
>
> dev.off()
null device
1
>