The http://fueleconomy.gov website, run by the U.S. Department of Energy's Office of Energy Efficiency and Renewable Energy and the U.S. Environmental Protection Agency, lists different estimates of fuel economy for passenger cars and trucks. For each vehicle, various characteristics are recorded such as the engine displacement or number of cylinders. Along with these values, laboratory measurements are made for the city and highway miles per gallon (MPG) of the car.
Predictors extracted from the website include:
outcome used in the book is in column
FE and is the unadjusted
data in cars from model year 2010.
cars introduced in 2011 that were not in the model year 2010 data.
cars introduced in 2012 that were not in the model year 2010 or 2011 data
data(FuelEconomy) library(lattice) ### Plot shown in the text: cars2010 <- cars2010[order(cars2010$EngDispl),] cars2011 <- cars2011[order(cars2011$EngDispl),] cars2010a <- cars2010 cars2010a$Year <- "2010 Model Year" cars2011a <- cars2011 cars2011a$Year <- "2011 Model Year" plotData <- rbind(cars2010a, cars2011a) plotTheme <- bookTheme(FALSE) plotTheme$plot.symbol$col <- rgb(.2, .2, .2, .5) plotTheme$plot.symbol$cex <- 0.7 trellis.par.set(plotTheme) xyplot(FE ~ EngDispl|Year, plotData, xlab = "Engine Displacement", ylab = "Fuel Efficiency (MPG)", between = list(x = 1.2))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.