In: Computer Science
In this discussion, you will apply the statistical concepts and techniques covered in this week's reading about correlation coefficient and simple linear regression. A car rental company wants to evaluate the premise that heavier cars are less fuel efficient than lighter cars. In other words, the company expects that fuel efficiency (miles per gallon) and weight of the car (often measured in thousands of pounds) are correlated. Performing this analysis will help the company optimize its business model and charge its customers appropriately.
In this discussion, you will work with a cars data set that includes two variables:
The random sample will be drawn from a CSV file. This data will be unique to you, and therefore your answers will be unique as well. Run Step 1 in the Python script to generate your unique sample data.
In your initial post, address the following items:
<Figure size 640x480 with 1 Axes>
mpg wt mpg 1.000000 -0.863527 wt -0.863527 1.000000
OLS Regression Results ============================================================================== Dep. Variable: mpg R-squared: 0.746 Model: OLS Adj. R-squared: 0.737 Method: Least Squares F-statistic: 82.10 Date: Fri, 02 Oct 2020 Prob (F-statistic): 8.10e-10 Time: 12:39:57 Log-Likelihood: -75.289 No. Observations: 30 AIC: 154.6 Df Residuals: 28 BIC: 157.4 Df Model: 1 Covariance Type: nonrobust ============================================================================== coef std err t P>|t| [0.025 0.975] ------------------------------------------------------------------------------ Intercept 37.1346 1.960 18.944 0.000 33.119 41.150 wt -5.2638 0.581 -9.061 0.000 -6.454 -4.074 ============================================================================== Omnibus: 2.644 Durbin-Watson: 2.405 Prob(Omnibus): 0.267 Jarque-Bera (JB): 2.104 Skew: 0.643 Prob(JB): 0.349 Kurtosis: 2.832 Cond. No. 12.7 ============================================================================== Warnings: [1] Standard Errors assume that the covariance matrix of the errors is correctly specified.
Does the graph show any trend? If yes, is the trend what you expected?
Ans:From the scatterplot we see that there is negative trend between mpg and weight of the car. this means that if weight of car increases then the milege of the car will decreses. Hence i would expect that if i choose a heavy car than it will give less milege.
What is the coefficient of correlation between miles per gallon and weight? What is the sign of the correlation coefficient? Does the coefficient of correlation indicate a strong correlation, weak correlation, or no correlation between the two variables?
Ans: The coefficient of correlation between miles per gallon and weight is -0.8592 . The sign of the correlation coefficient is negative. The coefficient of correlation indicate a strong correlation because correlation coefficient lies between -1 and 1 and if coefficient of correlation is close to -1 or 1 than there is a strong correlation between the variables. Here the correlation coefficient is -0.8592 which is close to -1, so we can say that there is strong correlation between the variables.
Write the simple linear regression equation for miles per gallon as the response variable and weight as the predictor variable. How might the car rental company use this model?
Ans:
The simple linear regression equation for miles per gallon as the response variable and weight as the predictor variable is written as
mpg = 37.2757 - 5.3542*wt
The car rental company uses this model to decide the miles per gallon of car according to the weight of the car. the company can make more profit by using lighter cars
What is the slope coefficient? Is this coefficient significant at a 5% level of significance (alpha=0.05)? (Hint: Check the P-value, , for weight in the Python output.)
Ans: From the regression output, we see that the slope coefficient is -5.3542 and the p-value is 0.000 which is less than 0.05, so the slope coefficient is significant at 5% level of significant.
Note: If you have any doubts or queries, feel free to ask by commenting down below.
And if my answer suffice to the requirements, then kindly upvote as an appreciation
Happy Learning :)