plot(hubble\(x,hubble\)y,xlab=“Distance (Mpc)”, ylab=expression(“Velocity (km”s^{-1}“)”))
HubbleLM = lm(hubble\(y~hubble\)x) summary(HubbleLM) coef(HubbleLM)
hist(hubble\(x, breaks = 30,probability = T ,main = "Histogram of Galaxy Distance", xlab = "Distance") lines(density(hubble\)x), col=“red”, lwd=2)
hist(hubble\(y, breaks = 30,probability = T ,main = "Histogram of Galaxy Velocity", xlab = "Velocity") lines(density(hubble\)y), col=“blue”, lwd=2)
df.challenger <- read.csv(“https://www.dropbox.com/s/ezxj8d48uh7lzhr/challenger.csv?dl=1”) plot(df.challenger\(Temp,df.challenger\)O.ring,xlab=“Temperature”,ylab=“Number of incidents”)
ChallengerML = lm(df.challenger\(O.ring ~ df.challenger\)Temp) summary(ChallengerML) coef(ChallengerML)
abline(ChallengerML)