Predicting the Weight of Cars Using Multiple Linear Regression

What data are we going to use?

"Cars93" is a list of cars on sale in the US in 1993. It's real world data made available to the public via the MASS package in R. 
Photo: www.caranddriver.com


The data frame contains 93 rows and 27 columns.

More about the data:
Cars were selected at random from among 1993 passenger car models that were listed in both the Consumer Reports issue and the PACE Buying Guide. Pickup trucks and Sport/Utility vehicles were eliminated due to incomplete information in the Consumer Reports source. Duplicate models (e.g., Dodge Shadow and Plymouth Sundance) were listed at most once.
Manufacturer
Manufacturer.

Model
Model.

Type
Type: a factor with levels "Small", "Sporty", "Compact", "Midsize", "Large" and "Van".

Min.Price
Minimum Price (in \$1,000): price for a basic version.

Price
Midrange Price (in \$1,000): average of Min.Price and Max.Price.

Max.Price
Maximum Price (in \$1,000): price for “a premium version”.

MPG.city
City MPG (miles per US gallon by EPA rating).

MPG.highway
Highway MPG.

AirBags
Air Bags standard. Factor: none, driver only, or driver & passenger.

DriveTrain
Drive train type: rear wheel, front wheel or 4WD; (factor).

Cylinders
Number of cylinders (missing for Mazda RX-7, which has a rotary engine).

EngineSize
Engine size (litres).

Horsepower
Horsepower (maximum).

RPM
RPM (revs per minute at maximum horsepower).

Rev.per.mile
Engine revolutions per mile (in highest gear).

Man.trans.avail
Is a manual transmission version available? (yes or no, Factor).

Fuel.tank.capacity
Fuel tank capacity (US gallons).

Passengers
Passenger capacity (persons)

Length
Length (inches).

Wheelbase
Wheelbase (inches).

Width
Width (inches).

Turn.circle
U-turn space (feet).

Rear.seat.room
Rear seat room (inches) (missing for 2-seater vehicles).

Luggage.room
Luggage capacity (cubic feet) (missing for vans).

Weight
Weight (pounds).

Origin
Of non-USA or USA company origins? (factor).

Make
Combination of Manufacturer and Model (character).


Goal:

Get the predicted weight of each car based on weight, miles per gallon, engine size, horsepower, and passenger capacity.
Short Answer:

R Code:


Comments