Return-Path: Delivered-To: apmail-jakarta-commons-user-archive@www.apache.org Received: (qmail 9822 invoked from network); 9 Nov 2006 20:21:00 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 9 Nov 2006 20:21:00 -0000 Received: (qmail 75767 invoked by uid 500); 9 Nov 2006 20:21:05 -0000 Delivered-To: apmail-jakarta-commons-user-archive@jakarta.apache.org Received: (qmail 75544 invoked by uid 500); 9 Nov 2006 20:21:04 -0000 Mailing-List: contact commons-user-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Jakarta Commons Users List" Reply-To: "Jakarta Commons Users List" Delivered-To: mailing list commons-user@jakarta.apache.org Received: (qmail 75533 invoked by uid 99); 9 Nov 2006 20:21:04 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 09 Nov 2006 12:21:04 -0800 X-ASF-Spam-Status: No, hits=0.6 required=10.0 tests=NO_REAL_NAME X-Spam-Check-By: apache.org Received-SPF: pass (herse.apache.org: local policy) Received: from [212.27.42.30] (HELO smtp4-g19.free.fr) (212.27.42.30) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 09 Nov 2006 12:20:50 -0800 Received: from imp3-g19.free.fr (imp3-g19.free.fr [212.27.42.3]) by smtp4-g19.free.fr (Postfix) with ESMTP id C18C888F1 for ; Thu, 9 Nov 2006 21:20:27 +0100 (CET) Received: by imp3-g19.free.fr (Postfix, from userid 33) id 4EF739DE7; Thu, 9 Nov 2006 21:45:55 +0100 (CET) Received: from cla92-3-82-228-32-163.fbx.proxad.net (cla92-3-82-228-32-163.fbx.proxad.net [82.228.32.163]) by imp3-g19.free.fr (IMP) with HTTP for ; Thu, 09 Nov 2006 21:45:55 +0100 Message-ID: <1163105155.4553938334424@imp3-g19.free.fr> Date: Thu, 09 Nov 2006 21:45:55 +0100 From: luc.maisonobe@free.fr To: Jakarta Commons Users List Subject: Re: Commons Math vs. Excel stats? References: <273488080611071451r71067e1araba4aaa3843448ba@mail.gmail.com> In-Reply-To: <273488080611071451r71067e1araba4aaa3843448ba@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit User-Agent: Internet Messaging Program (IMP) 3.2.5 X-Originating-IP: 82.228.32.163 X-Virus-Checked: Checked by ClamAV on apache.org Selon Jeff Drew : > I'm having a weird problem when using the commons math package. When I run > statistics using the Commons math, then compare the results to Excel, I get > different standard deviation and median, but min, max, and count are the > same. I'd appreciate any ideas on how Commons Math and Excel differ in > these calculations. > > MEDIAN: Excel: 468,231 CommonsMath: 485,711 > STD: Excel: 11,861 CommonsMath: 10,678 > > The data set is 18,000 integers so I won't include those. They are mostly 6 > digit numbers. Here's the code: This is weird ... For the median, one way to check what happens is to sort your data in ascending order set and look at the data at the middle index. If you have an even number of samples 2k and 468231 is at index k (counting from 1) and 485711 is at index k+1 then it is a matter of interpretation. If you have an even number of samples 2k+1, then the result MUST BE the value at index k+1 (counting from 1). Could you check this in both Excel and CommonsMath ? For the standard deviation, one way to check is to split your data set in two parts, compute the various moments and combine them afterwards to check. Unfortunately, I am currently replying to you from a public area and cannot provide you with the equations for the combination. These equations are based on the linearity of the expectancy (is this the right english term ?) and the definition of the variance from the expectancy. If you prefer to wait until Monday, I can provide this equations for you. Luc --------------------------------------------------------------------- To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org For additional commands, e-mail: commons-user-help@jakarta.apache.org