Assignment 6 Age of car ears 1.00 1.00 2.00 2.00 3.00 3.00 4.00 5.00 6.00 10.00
ID: 3053291 • Letter: A
Question
Assignment 6 Age of car ears 1.00 1.00 2.00 2.00 3.00 3.00 4.00 5.00 6.00 10.00 Mileage 40.00 25.00 37.00 35.00 36.00 35.00 32.00 30.00 25.00 20.00 -3.7, s,-2.75; ?-31.5, s,-6.38; cov,--12.83 1. Given the previous values, calculate the regression equation and draw the regression line. 2. What does the value for b (the slope) tell us about the relationship between X and Y? 3. What is the difference between the predicted and observed value for Mileage when a car is 4 years old? 4. Calculate and interpret B. Is the effect significant? Why or why not? 5. Calculate and interpret r2.Explanation / Answer
Using R
> Age_of_Car=c(1,1,2,2,3,3,4,5,6,10)
> Mileage=c(40,25,37,35,36,35,32,30,25,20)
> model=lm(Mileage~Age_of_Car)
> model
Call:
lm(formula = Mileage ~ Age_of_Car)
Coefficients:
(Intercept) Age_of_Car
37.775 -1.696
Mileage =37.775 - 1.696 *Age of Car
is a regression model
2) If Age of car is increases one year then mileage of car is decreases 1.696 unit .
3)
> newdata=data.frame(Age_of_Car=4)
> predict(model,newdata = newdata)
1
30.99119
Actual value = 32
Predicted Value = 30.9911
difference =Actual value - Predicted value
= 32 - 30.9911
= 1.0089
5) R-square
> R_Square=summary(model)$r.squared
> R_Square
[1] 0.5344941