Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: implementation of boschloo's test: very slow execution


From   "Eva Poen" <eva.poen@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: implementation of boschloo's test: very slow execution
Date   Fri, 22 Feb 2008 18:49:47 +0000

Nick,

thank you very much for your helpful comments; I will do as you
suggested. I don't know any Mata, so I'll probably keep it as Stata
code.

In the meantime, I have prepared an ado file for the Boschloo test
which computes (albeit slowly, for large samples) the uncorrected as
well as the confidence interval corrected p-values for this test. If
anyone is interested, I am happy to send it out by email.

Eva


2008/2/22, Nick Cox <n.j.cox@durham.ac.uk>:
> I see.
>
>  My guess is that the multiplication itself is trivial. You might take a
>  pencil and paper to the combinatorics
>
>  Binomial(A)- Binomial(B) * Binomial(C) -Binomial(D)
>
>  and see if it boils down to something much simpler.
>
>  On the other hand, the real problem is possibly just that you are using
>  an interpreted language to do quite a lot of work.
>
>
>  Nick
>  n.j.cox@durham.ac.uk
>
>  Eva Poen
>
>
> Upon reading my post again, I realised that I was not careful enough
>  when simplifying the code for the purpose of sending it to the list.
>
>  The line involving the binomial:
>  qui replace current  =
>
> Binomial(n1,`xx1',theta)-Binomial(n1,`=`xx1'+1',theta))*(Binomial(n2,`xx
>  2',theta)-Binomial(n2,`=`xx2'+1',theta))
>
>
> should have -theta- replaced by -p-. Therefore, -current- and -PH0sum-
>  are not constant; the binomial product is calculated for all values of
>  -p-, which are 10001 in my case.
>
>  The p-value of the test is the maximum (well, supremum, actually) of
>  the variable -PH0sum-.
>
>  It seems to be the case that the most time-consuming thing inside the
>  nested loop is this product of binomial probability mass functions. Is
>  there a way outside Mata to speed this bit up?
*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index