My assignment is:
Use the regsubsets function in the leaps package to perform an exhaustive search
For best subsets regression models. Then compare the adjusted r^2 selected for each
Subset size. Which model is best according to this criterion? You will have to
Look at components of summary.regsubsets. There you can find the relevant.
Values of different optimality criteria for the best model selected at each size.
I have a data set cigs on which I call
q=regsubsets(Sales~Age+HS+Income+Black+Female+Price, data=cigs, method="exhaustive")
All of those are correct variables
summary(q)
returns
Subset selection object
Call: regsubsets.formula(Sales ~ Age + HS + Income + Black + Female +
Price, data = cigs, method = "exhaustive")
6 Variables (and intercept)
Forced in Forced out
Age FALSE FALSE
HS FALSE FALSE
Income FALSE FALSE
Black FALSE FALSE
Female FALSE FALSE
Price FALSE FALSE
1 subsets of each size up to 6
Selection Algorithm: exhaustive
Age HS Income Black Female Price
1 ( 1 ) " " " " "*" " " " " " "
2 ( 1 ) " " " " "*" " " " " "*"
3 ( 1 ) "*" " " "*" " " " " "*"
4 ( 1 ) "*" " " "*" "*" " " "*"
5 ( 1 ) "*" " " "*" "*" "*" "*"
6 ( 1 ) "*" "*" "*" "*" "*" "*"
Any idea why this does not give me any information about r^2?