Skip to content

Bug in stepAIC?

1 message · Martin C. Martin

#
Hi,

It seems that, when I use weights during an initial least-squares 
regression fit, and later try to add terms using stepAIC(), it uses the 
weights when looking to remove terms, but not when looking to add them:

hills.lm <- lm(time ~ dist + climb, data = hills, weights = 1/dist^2)
small.hills.lm <- stepAIC(hills.lm)
stepAIC(small.hills.lm, time ~ dist + climb)

In the first stepAIC(), it says that the AIC for the full "time ~ dist + 
climb" is 94.41.  Yet, during the second stepAIC, it says adding climb 
would produce an AIC of 212.1 (and an RSS of 12633.3).  Is this a bug?

Best,
Martin