[R] BIC vz SBIC vz SIC

Mayeul KAUFFMANN mayeul.kauffmann at tiscali.fr
Tue Jul 27 22:36:50 CEST 2004


>> 2) question: alwasy on BIC, from stepAIC() function help page I found a
>> "k=log(n)" argument to add. Since that produce an error, is there a way
to
>> found the "n" dinamically?
>
>stepAIC(mydata.logistic, trace = F, k=log(nrow(mydata)))
>
>-- 
>Daniele Medri

(It was 3 weeks ago but I was just myself faced to the same question)

Just a little warning, it is not really "dynamically" done: stepAIC takes
the part of "mydata" that was used to fit "mydata.logistic" but
k=log(nrow(mydata)) will still use the entire set.
thus, if there were some missing data in mydata, I suggest you use
something like:
k=log(sum(complete.cases(mydata)))
which will be smaller than k=log(nrow(mydata)).

If some data are missing only for a covariate and this one is withdrawn,
you will have a warning and it will stop:

Error in stepAIC(mydata.logistic (etc.)
 number of rows in use has changed: remove missing values?

Since (I presume) these criteria need to compare two models with identical
dataset.

In any other case, if you have NAs at the start but the number of NAs does
not change in the process, you won't be warned if you use
k=log(nrow(mydata)).

Mayeul KAUFFMANN
Univ. Pierre Mendes France
Grenoble - France




More information about the R-help mailing list