[R] Restrict AIC comparison to succesful models?

Manuel Morales Manuel.A.Morales at williams.edu
Thu Jun 11 19:29:25 CEST 2009


Hello list,

I'm doing a bootstrap analysis where some models occasionally fail to
converge. I'd like to automate the process of restricting AIC to the
models that do converge. A contrived example of what I'd like to do is
below:

resp <- c(1,1,2)
pred <- c(1,2,3)

m1 <- lm(resp~pred)
m2 <- lm(resp~poly(pred,2))
m3 <- lm(resp~poly(pred,3)) # Fails, obviously

## Some test to see which models were successful
models <- test(m1,m2,m3)

## AIC on these models only
AIC(models)

-- 
http://mutualism.williams.edu




More information about the R-help mailing list