Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: Precision issues with Mata. Where's my error?


From   Scott Merryman <[email protected]>
To   [email protected]
Subject   Re: st: Precision issues with Mata. Where's my error?
Date   Wed, 5 Jun 2013 06:49:51 -0500

On Wed, Jun 5, 2013 at 6:23 AM, Marta García-Granero
<[email protected]> wrote:
> The problem is that I expected x42 and x43 to be 9.95 and 36.34 (checked
> with other software, like Winpepi, or SPSS 21 NPTESTS command), and I get
> 10.36 and 36.55.
>
> I can't find my error.

In the Excel code for x40 and x41 you have:

x40 = x16 * x16 - 2 * x39 * x16 * x27 + x27 * x27
x41 = x17 * x17 - 2 * x39 * x17 * x26 + x26 * x26

while the Mata code is:

x40=x16^2-2*x39*x16*(x27^3)
x41=x17^2-2*x39*x17*(x26^3)


x27 + x27 * x27 != x27^3

Scott

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index