$30.00
Description
Instructions:

Copy your answer to each question AND the R code by which you reached your answer to a document. The answers should be correctly ordered.
Problem 1 (4 pts): Consider data set cars, which is available in R. It is a data frame consists of two variables speed and dist. Complete the following questions:

(1 pt) Plot a scatterplot to view the relationship between speed and dist.

(1 pt) Calculate both Pearson’s correlation and Spearman’s correlation and interpret the relation between speed and dist.

(2 pts) Update the scatter plot such that the new scatter plot satis es followings: If an observation’s speed 15(mph), then this observation will be plotted in red color, otherwise, it will be plotted in blue color. Add a vertical line at speed = 15(mph).
Problem 2 (6 pts): The data set whiteside is available after loading the MASS package by calling library(MASS). Complete the following questions:

(1 pt) From whiteside, create a subset called whitesideBefore which only contains observations whose Insul = Before and has two columns Temp and Gas.

(1 pt) Use the plot function to produce a scatterplot of whitesideBefore. Put Temp on xaxis and Gas on yaxis. From the plot, which correlation type is between Temp and Gas? Does a linear model look suitable for this data set?

(1 pt) Calculate both Pearson’s correlation and Spearman’s correlation and interpret the relation between Temp and Gas of whitesideBefore.

(1 pt) Use lm() function to t a simple linear regression for whitesideBefore. Set Gas as response variable and Temp as predictor. Assign the tting result to some name, say whiteside.lm, for later usage.

(2 pts) Report the estimates of the intercept and slope coe cients. Interpret the both coe cients.
1