0% found this document useful (0 votes)
18 views1 page

Speed Vs Stopping Distance

Uploaded by

jonathan_2906
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views1 page

Speed Vs Stopping Distance

Uploaded by

jonathan_2906
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

library(ggplot2)

library(corrplot)
library(plotly)

?cars
View(cars)
plot(cars)
EVSU<-cars
plot(EVSU$speed, EVSU$dist,
xlab = "Speed (mph)",
ylab = "Stoppping Distance (ft)",
main = "Speed and Stopping Distances of Cars")

model <- lm(dist ~ speed, data = EVSU)


abline(model, col = "maroon")

One<-cor(EVSU)
View(One)

corrplot(One,method = "circle")
corrplot(One, method = "number")
corrplot(One,method = "pie")

corrplot.mixed(One,
upper = "number",
lower = "circle",
addgrid.col = "maroon",
tl.col="maroon")

intercept <- coef(model)[1]


slope <- coef(model)[2]
equation <- paste0("y = ", round(slope, 2), "x + ", round(intercept, 2))

ggplot(data=EVSU, aes(x=dist, y=speed))+


geom_point(shape=1)+
geom_smooth(method = lm)+
labs(
"Speed and Stopping Distances of Cars",
x="Stopping Distance",
y="Speed",
title = "Stopping Speed vs.Distance")+
annotate("text", x = max(EVSU$dist) * 0.7,
y = max(EVSU$speed) * 0.9,
label = equation,
color = "blue", size = 5)

You might also like