Learn R Programming

gamair (version 1.0-2)

mpg: Data on automobile efficiency on town streets and highway.

Description

Fuel efficiency in miles per gallon for a variety of cars in the USA.

Usage

data(mpg)

Arguments

Format

A data frame listing fuel efficiency and other car characteristics including

symbol

Insurers measure of relative riskiness of car from -3 (safe) to 3 (risky)

loss

average insurance loss payment per insured vehicle per year.

hw.mpg

Fuel consumption on highway as miles per US gallon.

city.mpg

Fuel consumption in town as miles per US gallon.

make

Name of car maker.

fuel

2 level factor. gas or diesel.

aspir

2 level factor. std or turbo.

doors

2 level factor. two or four.

style

Factor indicating style of car.

drive

3 level factor indicating front, rear or all wheel drive: fwd, rwd or 4wd.

eng.loc

Engine location

wb

wheel base in inches

length

in inches

width

in inches

height

in inches

weight

in pounds

eng.type

Factor giving engine type

cylinders

Factor for number of cylinders

eng.cc

cubic capicity of engine in cubic inches.

fuel.sys

fuel system

bore

in inches

stroke

in inches

comp.ratio

compression ratio

hp

horse power

rpm

maximum RPM

price

in US dollars

Details

Data were collected by Jeffrey C. Schlimmer from 1) 1985 Model Import Car and Truck Specifications, 1985 Ward's Automotive Yearbook. 2) Personal Auto Manuals, Insurance Services Office, 160 Water Street, New York, NY 10038 3) Insurance Collision Report, Insurance Institute for Highway Safety, Watergate 600, Washington, DC 20037

References

Wood, S.N. (2006) Generalized Additive Models: An Introduction with R

Examples

Run this code
# NOT RUN {
require(gamair);require(mgcv)
data(mpg)
b <- gam(list(city.mpg~fuel+style+drive+s(weight)+s(hp)+s(make,bs="re"),
          hw.mpg~fuel+style+drive++s(weight)+s(hp)+s(make,bs="re")),
          family=mvn(d=2),data=mpg)
plot(b,pages=1,scheme=1)
# }

Run the code above in your browser using DataLab