Skip to main content
added tags; loaded figure; fixed code to show in window; formatted; light editing
Source Link
gung - Reinstate Monica
  • 147.5k
  • 89
  • 406
  • 716

I want to select models using regsubsetsregsubsets(). I have a dataframe called olympiadaten (data uploaded: http://www.sendspace.com/file/8e27d0). I first attach this dataframe and then start to analyze, my code is:

attach(olympiadaten)

library(leaps)
a<-regsubsets(Gesamt ~ CommunistSocialist + CountrySize + GNI + Lifeexp + 
              Schoolyears + ExpMilitary + Mortality +
PopPoverty + PopTotal + ExpEdu + ExpHealth, data=olympiadaten, nbest=2)
summary(a)
plot(a,scale="adjr2")


summary(lm(Gesamt~ExpHealth))

screenshot of the plot: http://tinypic.com/r/2pq8agy/6
http://tinypic.com/r/2pq8agy/6

The graphic says, it should have an adjusted R squared of about 0.14, but when I look at the output, I get a value of 0.06435.

Here is the output of summary(lm(Gesamt~ExpHealth)): summary(lm(Gesamt~ExpHealth))

I don't know what I might have done wrong, any help would be appreciated, thanks. (I could not attach both files correctly, maybe a moderator can attach them correctly, thanks).

And last but not least, some more questions: What is the difference between selecting models by AIC and by the adj. R squared? Both measure the fit and recognize the number of variables, so isn't the best model choosen by AIC also the model with the highest adj. r squared?

When I have 12 variables, this means, there are 2^12 possibilites of models, right? So does the regsubsets command calculate each model and shows the two best (nbest=2) of each size? If so do I really get the 'best' model? And when I do AIC using backwards selection (starting with the model which contains all variables), does this also end up with the same model that regsubsets says is the best?

  • What is the difference between selecting models by AIC and by the adj. R squared?
  • Both measure the fit and recognize the number of variables, so isn't the best model chosen by AIC also the model with the highest adj. r squared?
  • When I have 12 variables, this means, there are $2^12$ possibilities of models, right?
  • So does the regsubsets() command calculate each model and show the two best (nbest=2) of each size?
  • If so, do I really get the 'best' model?
  • And when I do AIC using backwards selection (starting with the model which contains all variables), does this also end up with the same model that regsubsets() says is the best?

I want to select models using regsubsets. I have a dataframe called olympiadaten (data uploaded: http://www.sendspace.com/file/8e27d0). I first attach this dataframe and then start to analyze, my code is:

attach(olympiadaten)

library(leaps)
a<-regsubsets(Gesamt ~ CommunistSocialist + CountrySize + GNI + Lifeexp + Schoolyears + ExpMilitary + Mortality +
PopPoverty + PopTotal + ExpEdu + ExpHealth, data=olympiadaten, nbest=2)
summary(a)
plot(a,scale="adjr2")


summary(lm(Gesamt~ExpHealth))

screenshot of the plot: http://tinypic.com/r/2pq8agy/6

The graphic says, it should have an adjusted R squared of about 0.14, but when I look at the output, I get a value of 0.06435

output of : summary(lm(Gesamt~ExpHealth))

I don't know what I might have done wrong, any help would be appreciated, thanks. (I could not attach both files correctly, maybe a moderator can attach them correctly, thanks).

And last but not least, some more questions: What is the difference between selecting models by AIC and by the adj. R squared? Both measure the fit and recognize the number of variables, so isn't the best model choosen by AIC also the model with the highest adj. r squared?

When I have 12 variables, this means, there are 2^12 possibilites of models, right? So does the regsubsets command calculate each model and shows the two best (nbest=2) of each size? If so do I really get the 'best' model? And when I do AIC using backwards selection (starting with the model which contains all variables), does this also end up with the same model that regsubsets says is the best?

I want to select models using regsubsets(). I have a dataframe called olympiadaten (data uploaded: http://www.sendspace.com/file/8e27d0). I first attach this dataframe and then start to analyze, my code is:

attach(olympiadaten)

library(leaps)
a<-regsubsets(Gesamt ~ CommunistSocialist + CountrySize + GNI + Lifeexp + 
              Schoolyears + ExpMilitary + Mortality +
PopPoverty + PopTotal + ExpEdu + ExpHealth, data=olympiadaten, nbest=2)
summary(a)
plot(a,scale="adjr2")


summary(lm(Gesamt~ExpHealth))

screenshot of the plot:
http://tinypic.com/r/2pq8agy/6

The graphic says, it should have an adjusted R squared of about 0.14, but when I look at the output, I get a value of 0.06435.

Here is the output of summary(lm(Gesamt~ExpHealth)):

I don't know what I might have done wrong, any help would be appreciated.

And last but not least, some more questions:

  • What is the difference between selecting models by AIC and by the adj. R squared?
  • Both measure the fit and recognize the number of variables, so isn't the best model chosen by AIC also the model with the highest adj. r squared?
  • When I have 12 variables, this means, there are $2^12$ possibilities of models, right?
  • So does the regsubsets() command calculate each model and show the two best (nbest=2) of each size?
  • If so, do I really get the 'best' model?
  • And when I do AIC using backwards selection (starting with the model which contains all variables), does this also end up with the same model that regsubsets() says is the best?
added 29 characters in body
Source Link
Michael R. Chernick
  • 43.2k
  • 28
  • 85
  • 159

I want to select models withusing regsubsets. I have a dataframe called olympiadaten (data uploaded: http://www.sendspace.com/file/8e27d0). I first attach this dataframe and then start to analyze, my code is:

I don't know which mistakewhat I didmight have done wrong, any help would be niceappreciated, thanks. (I could not attach both files correctly, maybe a modemoderator can attach them correctly, thanks).

And last but not least, some more questions: What is the difference between selecting models by AIC and by the adj. R squared? Both measure the fit and recognize the number of variables, so isisn't the best model choosen by AIC also the model with the highest adj. r squared?

When I have 12 variables, this means, there are 2^12 possibilites of models, right? So does the regsubsets command calculate each model and shows the two best (nbest=2) of each size? SoIf so do I really get the 'best' model? And when I do stepwise AIC using backwards selection (starting with the model which contains all variables), does this also endsend up with the same model asthat regsubsets says it is the best?

I want to select models with regsubsets. I have a dataframe called olympiadaten (data uploaded: http://www.sendspace.com/file/8e27d0). I first attach this dataframe and then start to analyze, my code:

I don't know which mistake I did, any help would be nice, thanks. (I could not attach both files correctly, maybe a mode can attach them correctly, thanks).

And last but not least, some more questions: What is the difference between selecting models by AIC and by the adj. R squared? Both measure the fit and recognize the number of variables, so is the best model choosen by AIC also the model with the highest adj. r squared?

When I have 12 variables, this means, there are 2^12 possibilites of models, right? So does the regsubsets command calculate each model and shows the two best (nbest=2) of each size? So do I really get the 'best' model? And when I do stepwise AIC backwards selection (starting with the model which contains all variables), does this also ends with the same model as regsubsets says it is the best?

I want to select models using regsubsets. I have a dataframe called olympiadaten (data uploaded: http://www.sendspace.com/file/8e27d0). I first attach this dataframe and then start to analyze, my code is:

I don't know what I might have done wrong, any help would be appreciated, thanks. (I could not attach both files correctly, maybe a moderator can attach them correctly, thanks).

And last but not least, some more questions: What is the difference between selecting models by AIC and by the adj. R squared? Both measure the fit and recognize the number of variables, so isn't the best model choosen by AIC also the model with the highest adj. r squared?

When I have 12 variables, this means, there are 2^12 possibilites of models, right? So does the regsubsets command calculate each model and shows the two best (nbest=2) of each size? If so do I really get the 'best' model? And when I do AIC using backwards selection (starting with the model which contains all variables), does this also end up with the same model that regsubsets says is the best?

fixed spelling
Source Link
Peter Flom
  • 128.1k
  • 36
  • 184
  • 424

Problem calculatincalculating, interpreting regsubsets and general questions about model selection procedure

I want to make model selectionselect models with regsubsets. I have a dataframe called olympiadaten (data uploaded: http://www.sendspace.com/file/8e27d0). I first attach this dataframe and then start to analyze, my code:

Problem calculatin, interpreting regsubsets and general questions about model selection procedure

I want to make model selection with regsubsets. I have a dataframe called olympiadaten (data uploaded: http://www.sendspace.com/file/8e27d0). I first attach this dataframe and then start to analyze, my code:

Problem calculating, interpreting regsubsets and general questions about model selection procedure

I want to select models with regsubsets. I have a dataframe called olympiadaten (data uploaded: http://www.sendspace.com/file/8e27d0). I first attach this dataframe and then start to analyze, my code:

Source Link
user1690846
  • 236
  • 1
  • 3
  • 6
Loading