From martin at martincmartin.com  Thu Oct  5 02:17:28 2006
From: martin at martincmartin.com (Martin C. Martin)
Date: Wed, 04 Oct 2006 20:17:28 -0400
Subject: [Rd] Bug in stepAIC?
Message-ID: <45244F18.2040302@martincmartin.com>

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




[Rd] Bug in stepAIC?
Martin C. Martin