Solved – get different BIC values when I use regsubsets and lm in R

I used regsubsets to find a model with lowest BIC; height is our D.V. , the code I typed is below:

male = read.table(file.choose(), header=TRUE) mreg = regsubsets(height ~ biacromial + pelvic.breadth + bitrochanteric + chest.depth           + chest.diam + elbow.diam + wrist.diam + knee.diam + ankle.diam           + shoulder.girth + chest.girth + waist.girth + navel.girth + hip.girth           + thigh.girth + bicep.girth + forearm.girth + knee.girth + calf.girth           + ankle.girth + wrist.girth + age + weight         , data=male) plot(mreg) 

enter image description here

so the best subset for male is: bitrochanteric,waist.girth+hip.girth+thigh.girth+bicep.girth, calf.girth+weight

I regress the model using lm

 mreg2 = lm(height ~ bitrochanteric + waist.girth + hip.girth + thigh.girth               + bicep.girth + calf.girth + weight, data=male)  BIC(reg2) 

Then I got a value of 1461.665 ,which is totally different from my graph and so I don't understand at all why it is different.

Just an investigation, I have never used this command before.

The vertical axis probably means "Drop in BIC" compared to the intercept-only model, not the model BIC.

For instance, if your ideal model has a BIC of 1451.665, corresponding to a drop of 220.

Then the model with just waist.girth and weight should have a BIC of about 1551. Because that model only has a drop of 120, which is still 100 higher than your ideal model.

Here is the track of my investigation:

library(leaps) b<-regsubsets(Fertility~.,data=swiss,nbest=2) summary(b) plot(b) 

enter image description here

Now compare the best and the worst models:

attach(swiss) m01 <- glm(Fertility ~ Agriculture + Education + Catholic + Infant.Mortality) m02 <- glm(Fertility ~ Examination) m03 <- glm(Fertility ~ 1) BIC(m01) BIC(m02) BIC(m03) BIC(m02) - BIC(m03)  # Should be about -18 BIC(m01) - BIC(m03)  # Should be about -37 BIC(m02) - BIC(m01)  # Difference from the models (-18) - (-37)        # Difference taken from the axis 

Results:

>     BIC(m01) [1] 336.3417 >     BIC(m02) [1] 355.9029 >     BIC(m03) [1] 377.4258 >     BIC(m02) - BIC(m03)  # Should be about -18 [1] -21.52281 >     BIC(m01) - BIC(m03)  # Should be about -37 [1] -41.08403 >     BIC(m02) - BIC(m01)  # Difference from the models [1] 19.56122 >     (-18) - (-37)        # Difference taken from the axis [1] 19 

Similar Posts:

Rate this post

Leave a Comment

Solved – get different BIC values when I use regsubsets and lm in R

I used regsubsets to find a model with lowest BIC; height is our D.V. , the code I typed is below:

male = read.table(file.choose(), header=TRUE) mreg = regsubsets(height ~ biacromial + pelvic.breadth + bitrochanteric + chest.depth           + chest.diam + elbow.diam + wrist.diam + knee.diam + ankle.diam           + shoulder.girth + chest.girth + waist.girth + navel.girth + hip.girth           + thigh.girth + bicep.girth + forearm.girth + knee.girth + calf.girth           + ankle.girth + wrist.girth + age + weight         , data=male) plot(mreg) 

enter image description here

so the best subset for male is: bitrochanteric,waist.girth+hip.girth+thigh.girth+bicep.girth, calf.girth+weight

I regress the model using lm

 mreg2 = lm(height ~ bitrochanteric + waist.girth + hip.girth + thigh.girth               + bicep.girth + calf.girth + weight, data=male)  BIC(reg2) 

Then I got a value of 1461.665 ,which is totally different from my graph and so I don't understand at all why it is different.

Best Answer

Just an investigation, I have never used this command before.

The vertical axis probably means "Drop in BIC" compared to the intercept-only model, not the model BIC.

For instance, if your ideal model has a BIC of 1451.665, corresponding to a drop of 220.

Then the model with just waist.girth and weight should have a BIC of about 1551. Because that model only has a drop of 120, which is still 100 higher than your ideal model.

Here is the track of my investigation:

library(leaps) b<-regsubsets(Fertility~.,data=swiss,nbest=2) summary(b) plot(b) 

enter image description here

Now compare the best and the worst models:

attach(swiss) m01 <- glm(Fertility ~ Agriculture + Education + Catholic + Infant.Mortality) m02 <- glm(Fertility ~ Examination) m03 <- glm(Fertility ~ 1) BIC(m01) BIC(m02) BIC(m03) BIC(m02) - BIC(m03)  # Should be about -18 BIC(m01) - BIC(m03)  # Should be about -37 BIC(m02) - BIC(m01)  # Difference from the models (-18) - (-37)        # Difference taken from the axis 

Results:

>     BIC(m01) [1] 336.3417 >     BIC(m02) [1] 355.9029 >     BIC(m03) [1] 377.4258 >     BIC(m02) - BIC(m03)  # Should be about -18 [1] -21.52281 >     BIC(m01) - BIC(m03)  # Should be about -37 [1] -41.08403 >     BIC(m02) - BIC(m01)  # Difference from the models [1] 19.56122 >     (-18) - (-37)        # Difference taken from the axis [1] 19 

Similar Posts:

Rate this post

Leave a Comment