This report looks at the speed and stopping distance of cars in the R built-in ‘cars’ data set. For more information on this data set please visit the R Documentation.

Data

There are observations from 50 cars in the data set. The variables in this data set are speed, dist.

Analysis

I will use the following formulas to calculate the summary statistics for speed and distance below:

mean_speed <- mean(cars$speed, na.rm = TRUE)
median_speed <- median(cars$speed, na.rm = TRUE)
min_speed <- min(cars$speed, na.rm = TRUE)
max_speed <- max(cars$speed, na.rm = TRUE)
mean_distance <- mean(cars$dist, na.rm = TRUE)
median_distance <- median(cars$dist, na.rm = TRUE)
min_distance <- min(cars$dist, na.rm = TRUE)
max_distance <- max(cars$dist, na.rm = TRUE)

Summary statistics of the speed variable:

Summary statistics of the stopping distance variable:

Relationship between speed and stopping distance

A scatter plot of the relationship between speed and stopping distance

The data was plotted with the code below:

plot(
  cars$speed,
  cars$dist,
  main="Relationship between speed and stopping distance",
  xlab="Speed (mph)",
  ylab="Stopping distance (ft)"
  )

Conclusion

The correlation of speed and stopping distance is 0.8068949

This large positive correlation means that the conclusion can be made that the greater the speed that a car travels at, the greater the expected stopping distance will be. This is clear when looking at the scatter plot.