Skip to content
Prev 245860 / 398506 Next

Calculation of BIC done by leaps-package

On 2010-12-26 06:47, Jan Henckens wrote:
ll$ress is a one-column matrix
Does this help:

bic1 <- extractAIC(lm(Time~Dwgs,data=bridge),k=log(nrow(bridge)))
bic2 <- extractAIC(lm(Time~Dwgs+Spans,data=bridge),k=log(nrow(bridge)))

## NOTE: predictors are 'Dwgs' and 'Spans', not 'Dwgs' and 'Case'.

all.equal(bic2[2] - bic1[2], diff(lm.model$bic)[1])
#[1] TRUE

## or
bic0.1 <- lm.model$bic[1]
bic0.2 <- lm.model$bic[2]
bic1 - bic0.1
#[1] 410.4472
bic2 - bic0.2
#[1] 410.4472

## So, the values do differ from extractAIC by a constant.

BTW: You probably want to omit 'Case'; I doubt that it's an
intended predictor.

Peter Ehlers