I am running an odds ratio calculation for site methylation amongst cases and controls.

In this situation is it preferable to use a conditional or unconditional MLE? I am asking because R uses a conditional estimator while scipy uses an unconditional estimator. See here.

As a result, I am getting differences in the p-values calculated. I found an article from 1984 which suggests that conditional MLE is far superior. If this is the case, why does scipy API suggest that using unconditional MLE is much more common?

It was also asked here by gotgenes. But no answer was provided so far.

odds_extractor <- function(cpg_id,disease,control){
        # Make a temporary data frame to hold just one cpg site frequency table
        temp <- cpg_list[[cpg_id]][c(disease, control),]
        # Get all of the a,b,c,d values
        a <- as.numeric(temp[1,1])
        b <- as.numeric(temp[1,2])
        c <- as.numeric(temp[2,1])
        d <- as.numeric(temp[2,2])
        # Perform the odds ratio calculation

writting[i,4] <- odds_extractor(names(cpg_list)[i],disease,control)$estimate
  • 3
    $\begingroup$ Given the commentary around when this was implemented, I suspect the scipy developers haven't a clue what the difference is. $\endgroup$
    – Devon Ryan
    Jul 3, 2017 at 21:02
  • $\begingroup$ @DevonRyan That's actually quite useful. I did not stumble upon that. And yes it might be good to move it to cross-validated - though considering odds ratios are a popular metric amongst biostatisticians it's probably useful here too. $\endgroup$
    – quantik
    Jul 3, 2017 at 21:05
  • 2
    $\begingroup$ Your comment is slightly unclear (since oddsratio$estimate would be a piece of an object, not a function call). You mean you call the function oddsratio and look at the returned value of estimate? Out of curiosity, what was the problem with fisher.test in vanilla R, which produces an odds ratio and computes a p-value for Fisher's exact test? (Fisher's exact text conditions on the marginal totals, which I presume is the conditioning under discussion here) $\endgroup$
    – Glen_b
    Jul 3, 2017 at 22:48
  • 2
    $\begingroup$ Probably related: stats.stackexchange.com/q/54530/82584 $\endgroup$
    – bli
    Jul 4, 2017 at 7:15
  • 2
    $\begingroup$ Was the 1984 article you mention the one by Hauck? $\endgroup$
    – Glen_b
    Jul 5, 2017 at 21:42


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.