[R-sig-eco] QIC for conditional logistic regression + GEE

Mathieu Basille basille at ase-research.org
Wed Nov 10 20:23:52 CET 2010


Finally, I got a solution, with the help of Thierry Duchesne and Marc
Mazerolle. A coxph object returns a $loglik element, with 2 values, the
second being the quasi-likelihood (under R = I) to estimate the betas.

Here we are, we can thus write a simple function:

QIC <- function(mod, ...)
    UseMethod("QIC")

QIC.coxph <- function(mod, details = FALSE) {
    trace <- sum(diag(solve(mod$naive.var) %*% mod$var))
    quasi <- mod$loglik[2]
    return(-2*quasi + 2*trace)
}

which should just do the trick!
Mathieu.


Le 2010-11-10 10:17, Mathieu Basille a écrit :
> Dear Maarten,
> 
> Thank you for the links! They are very useful!
> 
> However, in both cases, they address the problem of QIC for GLMs, i.e.
> for parametric models. This said, I was unable to adjust the code for
> Cox models, which are semi-parametric, and use partial likelihood
> instead (which should behave similarly). In the end, I have no idea how
> to extract/compute the quasi partial likelihood for such a model, which
> is required for the QIC...
> 
> I'm still struggling a lot about QIC on coxph, any additional hint would
> be greatly appreciated!
> Mathieu.
> 
> 
> Le 10/11/2010 02:32, Maarten de Groot a écrit :
>> Dear Matthieu,
>>
>> Henric Nilsson
>> (http://hisdu.sph.uq.edu.au/lsu/SSAI%20course/course_tools.htm) and
>> Casper Kraan
>> (http://www.waddenacademie.knaw.nl/fileadmin/inhoud/pdf/06-wadweten/Proefschriften/Thesis_Casper_Kraan.pdf)
>>
>> provide the R code for the QIC. Maybe this might be useful to you.
>> Interestingly however is that the code of Nilsson gives another QIC
>> output as you get from the "yags package.
>>
>> Kind regards,
>>
>> Maarten
>>
>> On 11/9/2010 4:50 PM, Mathieu Basille wrote:
>>> Dear Timothy,
>>>
>>> Thanks for the hint! I didn't know about the package "yags"... I was
>>> able to install it and use it in simple cases (glm), and it does
>>> provide a QIC!
>>>
>>> However, it seems to be limited to the case of GLM (any family), but
>>> not Cox models... At least, I was unable to use it with a Cox model
>>> approach.
>>>
>>> Last but not least, the routine that computes the QIC (pan.aic) is in
>>> C, not in R, and my skills in C are below zero.
>>>
>>> Any idea?
>>> Mathieu.
>>>
>>>
>>> PS: I cc-ed back the list, since it could be useful there...
>>>
>>>
>>>
>>>
>>> Le 09/11/2010 05:04, treid a écrit :
>>>> Hi Mathieu,
>>>> Someone has probably already told you, but just in case, there is an R
>>>> package named yags that does QIC. Last I looked, you had to go to the
>>>> R-forge site to get it rather than cran.
>>>> tim.
>>>>
>>>> ----- Original Message -----
>>>> From: Mathieu Basille <basille at ase-research.org>
>>>> Date: Monday, November 8, 2010 16:32
>>>> Subject: [R-sig-eco] QIC for conditional logistic regression + GEE
>>>> To: r-sig-ecology at r-project.org
>>>>
>>>> > Dear list,
>>>> >
>>>> > I'm currently trying to fit a conditional logistic regression on
>>>> > correlated data (these are actually steps from animals, with 1
>>>> > case and a bunch of random controls). The state of the art is to
>>>> > use a GEE approach to estimate the variance of the coefficients,
>>>> > using a coxph model by strata (composed of one step +
>>>> > corresponding random steps), and a clustered estimation of the
>>>> > variances (i.e. robust variances). This is quite easy to achieve
>>>> > in R, with nevertheless some convergence problems...
>>>> >
>>>> > The next step, however, is to select the best model within a set
>>>> > of competing ones. Again, the state of the art is to use the
>>>> > Quasi-likelihood under Independence Criterion (QIC) [1] also
>>>> > sometimes known as modified AIC [2].
>>>> >
>>>> > After an extensive search (with the help of rseek.org), I was
>>>> > unable to find any guidance for this criterion using R. I know
>>>> > the criterion is already available in SAS or Stata, but I was
>>>> > wondering if anyone tried to code QIC in R? That would be a very
>>>> > valuable tool in the R toolbox!
>>>> >
>>>> > I was considering posting this question directly to the main R-
>>>> > help, but decided to try it here first... Let me know if it is
>>>> > the right move!
>>>> >
>>>> > Sincerely,
>>>> > Mathieu Basille.
>>>> >
>>>> >
>>>> > [1] Pan, W. (2001a). Akaike's information criterion in
>>>> > generalized estimating equations. Biometrics, 57, 120-125.
>>>> >
>>>> http://www.biostat.jhsph.edu/~fdominic/teaching/bio655/references/extra/QIC.biometrics.pdf
>>>>
>>>>
>>>> >
>>>> > [2] McCullagh, P., and Nelder, J. A. (1989). Generalized Linear
>>>> > Models (2nd ed.). London:Chapman & Hall.
>>>> >
>>>> > See an example in: A. H. M. M. Latif, M. Z. Hossain and M. A.
>>>> > Islam: Model selection using modified Akaike's Information
>>>> > Criterion: an application to maternal morbidity data. Austrian
>>>> > Journal of Statistics, 37, 2008, 175-184.
>>>> > http://www.stat.tugraz.at/AJS/ausg082/082Latif.pdf
>>>> >
>>>> >
>>>> > --
>>>> >
>>>> > ~$ whoami
>>>> > Mathieu Basille, Post-Doc
>>>> >
>>>> > ~$ locate
>>>> > Laboratoire d'Écologie Comportementale et de Conservation de la Faune
>>>> > + Centre d'Étude de la Forêt
>>>> > Département de Biologie
>>>> > Université Laval, Québec
>>>> >
>>>> > ~$ info
>>>> > http://ase-research.org/basille
>>>> >
>>>> > ~$ fortune
>>>> > ``If you can't win by reason, go for volume.''
>>>> > Calvin, by Bill Watterson.
>>>> >
>>>> > _______________________________________________
>>>> > R-sig-ecology mailing list
>>>> > R-sig-ecology at r-project.org
>>>> > https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
>>>
>>
>> _______________________________________________
>> R-sig-ecology mailing list
>> R-sig-ecology at r-project.org
>> https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
> 

-- 

~$ whoami
Mathieu Basille, Post-Doc

~$ locate
Laboratoire d'Écologie Comportementale et de Conservation de la Faune
+ Centre d'Étude de la Forêt
Département de Biologie
Université Laval, Québec

~$ info
http://ase-research.org/basille

~$ fortune
``If you can't win by reason, go for volume.''
Calvin, by Bill Watterson.



More information about the R-sig-ecology mailing list