Return-Path: X-Original-To: apmail-commons-issues-archive@minotaur.apache.org Delivered-To: apmail-commons-issues-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 29E3F4DBE for ; Fri, 10 Jun 2011 17:52:23 +0000 (UTC) Received: (qmail 78871 invoked by uid 500); 10 Jun 2011 17:52:22 -0000 Delivered-To: apmail-commons-issues-archive@commons.apache.org Received: (qmail 78804 invoked by uid 500); 10 Jun 2011 17:52:22 -0000 Mailing-List: contact issues-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: issues@commons.apache.org Delivered-To: mailing list issues@commons.apache.org Received: (qmail 78796 invoked by uid 99); 10 Jun 2011 17:52:22 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 10 Jun 2011 17:52:22 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED,T_RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.116] (HELO hel.zones.apache.org) (140.211.11.116) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 10 Jun 2011 17:52:20 +0000 Received: from hel.zones.apache.org (hel.zones.apache.org [140.211.11.116]) by hel.zones.apache.org (Postfix) with ESMTP id 3E92910DEBE for ; Fri, 10 Jun 2011 17:51:59 +0000 (UTC) Date: Fri, 10 Jun 2011 17:51:59 +0000 (UTC) From: "Christopher Nix (JIRA)" To: issues@commons.apache.org Message-ID: <1135353548.11378.1307728319252.JavaMail.tomcat@hel.zones.apache.org> In-Reply-To: <412205529.38911.1306236887346.JavaMail.tomcat@hel.zones.apache.org> Subject: [jira] [Issue Comment Edited] (MATH-582) Percentile does not work as described in API MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/MATH-582?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13047318#comment-13047318 ] Christopher Nix edited comment on MATH-582 at 6/10/11 5:51 PM: --------------------------------------------------------------- Added a patch for org.apache.commons.math.stat.Percentile documentation in order to better describe the correct implementation of percentiles as recommended by NIST. was (Author: joubert): Added a patch for org.apache.commons.math.stat.Percentile documentation in order to better describe the correct implementation percentiles as recommended by NIST. > Percentile does not work as described in API > -------------------------------------------- > > Key: MATH-582 > URL: https://issues.apache.org/jira/browse/MATH-582 > Project: Commons Math > Issue Type: Bug > Affects Versions: 2.2 > Reporter: Andre Herbst > Attachments: MATH-582.patch > > > example call: > StatUtils.percentile(new double[]{0d, 1d}, 25) returns 0.0 > The API says that there is a position being computed: p*(n+1)/100 -> we have p=25 and n=2 > I would expect position 0.75 as result. Next step according to the API is: interpolation between both values at floor(0.25) and at ceil(0.25). Those values are 0d and 1d ... so lower + d * (upper - lower) should give 0d + 0.25*(1d - 0d) = 0.25 > But the above call returns 0 as result. This does not make sense to me. > another example where I think the result is not correct: > StatUtils.percentile(new double[]{0d, 1d, 1d, 1d}, 25) returns 0.25 > we have pos = 25*5/100 = 1.25 ... so d = 0.25 > values at position floor(1.25) and ceil(1.25) are 1d and 1d. How comes that the result is not between 1d? -- This message is automatically generated by JIRA. For more information on JIRA, see: http://www.atlassian.com/software/jira