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 <[email protected]>:
> 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
> [email protected]
>
> 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/