This problem will consider the mtcars dataset in R studio. The dependent variabl
ID: 3313765 • Letter: T
Question
This problem will consider the mtcars dataset in R studio. The dependent variables is the fuel efficieny of a car in miles per gallon (mpg). There are several independent variables to consider, but for now we will only focus on the weight of the car recorded in 1000s of pounds (wt).
1. Remove the Chrysler Imperial from the dataset and refit the linear regression model.
2. Comment on how the regression coefficients have changed.
3. What about the Chrysler Imperial might have accounted for this change in model coefficients?
Explanation / Answer
1. The code is given as below :
y=mtcars
y
mpg=y$mpg
mpg
wt=y$wt
wt
l1=lm(mpg~wt)
l1
y1=y[-17,]
y1
mpg1=y1$mpg
mpg1
wt1=y1$wt
wt1
l2=lm(mpg1~wt1)
l2
Since the Chrysler Imperial is in the 17th row of the dataset,so we have removed the 17th row in the code.
If we run the code we will get the linear regression model(without removing Chrysler Imperial) as ,
mpg = 37.285 - 5.344*wt
and
the linear regression model(after removing Chrysler Imperial) is given as ,
mpg = 38.75- 5.87*wt
2. After removing the Chrysler Imperial the intercept has increased from 37.285 to 38.75 but the regression coefficient has decreased from -5.344 to -5.87
3. If we take the Chrysler Imperial into account then for one unit increase in wt,mpg decreases to 5.344 units( Since the regression coefficient has a minus sign,so we will say that mpg will decrease) and if we remove the Chrysler Imperial from the data set then for 1 unit increase in wt,mpg decreases to 5.87 units. So if we consider the Chrysler Imperial in the data set,the amount of decrease in y is less. Thus if we donot take the Chrysler Imperial into account,the relationship between x and y( i.e the amount of change in y for 1 unit change in x) will be misinterpreted.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.