[R] BIC vz SBIC vz SIC

From: Mayeul KAUFFMANN <mayeul.kauffmann_at_tiscali.fr>
Date: Wed 28 Jul 2004 - 06:36:50 EST


>> 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



R-help@stat.math.ethz.ch mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Wed Jul 28 06:46:22 2004

This archive was generated by hypermail 2.1.8 : Wed 03 Nov 2004 - 22:55:18 EST