Treat make as a categorical predictor, converting it to a factor explicitly if necessary:
fit3 <- lm(log(price) ~ mpg + psngr + length + width + weight + factor(make), data = cars)
The models are nested. The first nested-model F-test compares fit2 with the intercept-only fit1. Adding the five quantitative predictors reduces the residual sum of squares from to , with
There is overwhelming evidence that these quantitative car properties jointly improve the model.
The second test compares fit3 with fit2. Adding make reduces the residual sum of squares further to , with
Thus manufacturer has a highly significant effect even after adjusting for the five quantitative properties, and fit3 is preferred among these nested models.
There are observations because the intercept-only model has residual degrees of freedom. The make term uses additional degrees of freedom. By the degrees of freedom of a factor predictor, a factor with represented levels contributes degrees of freedom when an intercept is present. Hence
unique manufacturers occur in the dataset.

Articles by others on the same topic (0)

There are currently no matching articles.