1
$\begingroup$

I have a dataset with 6 variables such as price, country (this is a categorical variable with 7 levels), Rating_A, Rating_B, Rating_C, and Rating_D.

However, if I fit the GLM like

glm(price~factor(country)*Rating_A*Rating_B*Rating_C*Rating_D, 
    family="gaussian", datafile)

Then the lowest AIC of the model will have so many interactions.

My question is how to find the best model? Can I use:

glm(price~factor(country)+Rating_A+Rating_B+Rating_C+Rating_D, 
    family="gaussian", datafile) 

to eliminate some variables and then fit the new glm function with interaction?

To find the best variables in GLM model, I use library(MASS), and use the function stepAIC() to find the AIC.

$\endgroup$
  • 4
    $\begingroup$ Statistical methods are like cars: the best one depends on where and when you want to drive. My Italian sports car may be useless in your alpine blizzard conditions. Please define what you mean by "best" here and what you plan to do with the model. $\endgroup$ – Dimitriy V. Masterov Nov 24 '20 at 18:40
  • $\begingroup$ @DimitriyV.Masterov: by "best model" OP most likely means the model with smallest prediction error, i.e. minimal test MSE, while being as parsimonious as possible. Here are a few keywords for methods that can generally be used to choose a model: best subset selection, forward selection, backward selection coupled with information criteria, R^2 or even better, cross-validated test MSE. $\endgroup$ – PaulG Nov 25 '20 at 22:50
  • $\begingroup$ @PaulG Prediction is not the only game in town. Quite a few folks focus on descriptive work or causal inference. Hence I asked Ivan to fill in what he has in mind. $\endgroup$ – Dimitriy V. Masterov Nov 25 '20 at 23:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.