Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.


[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 <scott.merryman@gmail.com>
To   statalist@hsphsun2.harvard.edu
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
<mgarciagranero@gmail.com> 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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index