By default, regsubsets()
only reports results
up to the best eight-variable model. But the nvmax
option can be used
in order to return as many variables as are desired. Here we fit up to a
19-variable model.
regfit.full <- regsubsets(Salary ~ ., data = Hitters, nvmax = 19)
reg.summary <- summary(regfit.full)
Try using the regsubsets()
function in the same fashion with the Boston dataset with the nvmax
option set to 13 and store the output in regfit.full
:
Assume that:
MASS
and leaps
libraries have been loadedBoston
dataset has been loaded and attached