[Rd] Bug in stepAIC?
Martin C. Martin
martin at martincmartin.com
Thu Oct 5 02:17:28 CEST 2006
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
More information about the R-devel
mailing list