Return-Path: X-Original-To: apmail-commons-user-archive@www.apache.org Delivered-To: apmail-commons-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id E80EB17B12 for ; Mon, 31 Aug 2015 16:21:44 +0000 (UTC) Received: (qmail 33938 invoked by uid 500); 31 Aug 2015 16:21:44 -0000 Delivered-To: apmail-commons-user-archive@commons.apache.org Received: (qmail 33816 invoked by uid 500); 31 Aug 2015 16:21:43 -0000 Mailing-List: contact user-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Commons Users List" Delivered-To: mailing list user@commons.apache.org Received: (qmail 33804 invoked by uid 99); 31 Aug 2015 16:21:43 -0000 Received: from Unknown (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 31 Aug 2015 16:21:43 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id 117201AB2B2 for ; Mon, 31 Aug 2015 16:21:43 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 2.999 X-Spam-Level: ** X-Spam-Status: No, score=2.999 tagged_above=-999 required=6.31 tests=[HTML_MESSAGE=3, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=disabled Received: from mx1-us-west.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id PRuL8l6Q4mHR for ; Mon, 31 Aug 2015 16:21:34 +0000 (UTC) Received: from na01-bn1-obe.outbound.protection.outlook.com (mail-bn1on0085.outbound.protection.outlook.com [157.56.110.85]) by mx1-us-west.apache.org (ASF Mail Server at mx1-us-west.apache.org) with ESMTPS id EE3D220647 for ; Mon, 31 Aug 2015 16:21:33 +0000 (UTC) Received: from CY1PR0201CA0041.namprd02.prod.outlook.com (10.163.30.179) by BLUPR02MB406.namprd02.prod.outlook.com (10.141.80.16) with Microsoft SMTP Server (TLS) id 15.1.256.15; Mon, 31 Aug 2015 16:21:25 +0000 Received: from BY2FFO11FD054.protection.gbl (2a01:111:f400:7c0c::103) by CY1PR0201CA0041.outlook.office365.com (2a01:111:e400:58b9::51) with Microsoft SMTP Server (TLS) id 15.1.256.15 via Frontend Transport; Mon, 31 Aug 2015 16:21:25 +0000 Authentication-Results: spf=pass (sender IP is 208.89.76.182) smtp.mailfrom=leegov.com; commons.apache.org; dkim=none (message not signed) header.d=none;commons.apache.org; dmarc=bestguesspass action=none header.from=leegov.com; Received-SPF: Pass (protection.outlook.com: domain of leegov.com designates 208.89.76.182 as permitted sender) receiver=protection.outlook.com; client-ip=208.89.76.182; helo=LCFEMB02.lee-county-fl.gov; Received: from LCFEMB02.lee-county-fl.gov (208.89.76.182) by BY2FFO11FD054.mail.protection.outlook.com (10.1.15.191) with Microsoft SMTP Server (TLS) id 15.1.256.10 via Frontend Transport; Mon, 31 Aug 2015 16:21:24 +0000 Received: from LCFEMB01.Lee-County-FL.gov (10.110.0.181) by LCFEMB02.lee-county-fl.gov (10.110.0.182) with Microsoft SMTP Server (TLS) id 15.0.1076.9; Mon, 31 Aug 2015 12:21:23 -0400 Received: from LCFEMB01.Lee-County-FL.gov ([fe80::d11b:45a4:8e30:e0aa]) by LCFEMB01.lee-county-fl.gov ([fe80::d11b:45a4:8e30:e0aa%14]) with mapi id 15.00.1076.000; Mon, 31 Aug 2015 12:21:23 -0400 From: "Kulpanowski, David" To: "user@commons.apache.org" Subject: [math] Poisson distribution to show how many ambulances are dispatched per hour Thread-Topic: [math] Poisson distribution to show how many ambulances are dispatched per hour Thread-Index: AdDkCRFU0UTmBW7WRgKvYhY8aAbv5g== Date: Mon, 31 Aug 2015 16:21:23 +0000 Message-ID: <043b11da1a48491eb5c13e2bd579ac24@LCFEMB01.lee-county-fl.gov> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [10.232.42.71] x-leegov-extdisclaimer: ready Content-Type: multipart/alternative; boundary="_000_043b11da1a48491eb5c13e2bd579ac24LCFEMB01leecountyflgov_" MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-Microsoft-Exchange-Diagnostics: 1;BY2FFO11FD054;1:N/38Es1/t9ilelXjeR1prEnf9aypKn3PY1dSrBa/BpEj8VgQkAMFMG2LG57fhDAPmn5adA2uQcz+0q18LeqBk1r512Qu2gYtGe6oZ7B4Ha1HI50cVR8cLCmk0l81FxvSZLY6aUY+mY7Zmbw3CzVSB0bLj1LtwPokJnWayTAp84nMqgTHH6I845Xsm/BNi3MCPxUS57ua42gbMbB/E4N33AXSl9EA35OMN0jAHZSXeHxrwFVcmKUH06MX6qy5jRV219s2nDAfddoB13TO0yRbHgv+5P0ZKQaXHbT4YlJOyyG9rLLBmOUXVDQ4a7YZ/AkppAOXiofTbcO1VLofr2nNQQ== X-Forefront-Antispam-Report: CIP:208.89.76.182;CTRY:US;IPV:NLI;EFV:NLI;SFV:NSPM;SFS:(10009020)(6009001)(2980300002)(438002)(3050300001)(51744003)(199003)(189002)(107886002)(5001830100001)(106466001)(2351001)(229853001)(5001960100002)(110136002)(80792005)(53416004)(4001540100001)(54356999)(189998001)(16236675004)(19300405004)(5001860100001)(81156007)(24736003)(5250100002)(84326002)(16796002)(97736004)(50986999)(512954002)(69596002)(18717965001)(2501003)(77156002)(64706001)(5004730100002)(87936001)(2656002)(6806004)(62966003)(86362001)(19625215002)(102836002)(19580405001)(5007970100001)(19580395003)(450100001)(68736005)(46102003)(92566002)(33646002)(5003600100002)(15975445007)(2900100001)(108616004)(7099028)(554374003);DIR:OUT;SFP:1101;SCL:1;SRVR:BLUPR02MB406;H:LCFEMB02.lee-county-fl.gov;FPR:;SPF:Pass;PTR:InfoDomainNonexistent;A:1;MX:1;LANG:en; X-Microsoft-Exchange-Diagnostics: 1;BLUPR02MB406;2:VxMBGJyCOmjid3aWDM33CXuPcHVQJcdZzs1u90zX6Lr3VToWIaHH4r5iKSYgr5SUkSx5jNU1DtZO0OsCWfSz4XSdJsM9rBX7bHIyVaKrDmPzOaqKOyabeWgkguKvK4hGDpsP3nf0SkmPmW798iUU+T9iDewo6HANWVDiV5+Eiv4=;3:OV2CZZBIcMjQV1er5TuyNWBoEzRNjQjySlYHxZQmsLxEPXETT0sTRQRNucdGM2uLXedQRZoJM+ApUFYwHvXcAJ/G4fLdOodt1kYsYrO3yOxyZCZNgGSnvZ5D0dDVNvs2gjpqJxsGXjA8fBQpUgpZ+hw7t5SkUEa4KRrI1a1DofCULYHS9CbTQ9iVym/18cYt9qnhnwA+28qnxN0P11JFfFjABz7u5vf9VjTowO8y3sac1vTHxwoB1DMpGEi2TIYFuGV2hy25DPjJEq927irY0g==;25:dUuDSe3dzyd80iVSTRjZZjg/j2k/8zx/d2N5SpbU0JcsTubof0PvjmE8bdF7syHjGHPR4Dn3mut8UrVUdb90I0KnERO4VpeUld7l38qOlISDzb7/1PUJ/t2kuqSmRoOV2B3pSIYGbmaqRQ9KiDl8BGs0y0ldqNfrWhEsJ05m79D8am8t8W5/OnWcMnyw1E0dYr+AuGGr+CvTLhf5J+lM9Ld772cqthyNPLiwLpaECPhZaSVL0PVEDRVIvfVs8aiFLVfNWnki5nYyCJzhrpTULA== X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(8251501001);SRVR:BLUPR02MB406; X-Microsoft-Exchange-Diagnostics: 1;BLUPR02MB406;20:UK6wLKxE8yXYVvtvu6eujFW7n2nfPlcO7NbudvJftq5DKb67YcHSZi/a39dJQ7uSnwtbgbjGU4WunYd+MXzrNQW8GS2zZB2cfKvxX8RAKqaZz90GfNUJch36dO13QZ6mRo12W5vI+5dz0XCyO3aZeZTInpg6LaBQd7Zg5E34Z2IWhpUfz+ajGJvCbMVDg/fAcEDmB8CcuNlZ0r7syVJNFoXjMwv6m9x4hjG0Sz0DiUFInYOku1xQIS+kuaMh9khguBdsjYjVS+6B0ps5S4zDjp7x0uLYDOT+lCpD8zD1rk3Jkx6+x+HTuceCedGD0PdIMJBEIygEqFw4uIkcoaS3DyHTb9vyazHo7pgTb7W5ZMI0jTmmt2Al+Vfxczs4kUZhg2ZP7Qd5fZ4X+5IXsr8hlrzAjxLk1mhywoUuLQoiYCpVIC5jMCrD/3LZTye4v9aBJUShI41eOwG2x1Ht7jOMO6KOQ1RwnPAg6R/V8uSlvUu30UanYE9FbPNPJbZZumFx;4:uUEgUa4mrjmJR0m8a/HT0DOlLrwX2420DKodxmRdI5gaY6M4lA5CIrkaV42EA9I4/dxHbZMEIDeUVtc13KSdV6ZgIOhsXOExryOMsctOZS5MEVQlv9Eo54R5P5woO8tGUclG575pAMlzXhqVaHBtdjsBpblB/4UV4jXMBeuWONkaLXbr1w9BzZfLijhmMTs8ymqkv4BrBaOUywaOspB46lhl5uWtiWfdTdhhPcYLwliz4VxvLnnpytvAz9V0jPDoZTqchSmHxKuKIUGI1tB3scwp5QHYCCCJoeitS2onas6LQF86c3jRtzKVT5jMIy8dkVauAM/CGjW9Ym2VmbnZ/g== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(108003899814671); X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(601004)(5005006)(8121501046)(3002001);SRVR:BLUPR02MB406;BCL:0;PCL:0;RULEID:;SRVR:BLUPR02MB406; X-Forefront-PRVS: 0685122203 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;BLUPR02MB406;23:uyXztmb+GqYwwb173l2F8jIk2+45kjnrMn7gYdc9hV?= =?us-ascii?Q?lEutbUSA7+txBnS1oNsFvIACx14ebdGoRe9BG2jkl1yQxYOeiX4cOs2IVeON?= =?us-ascii?Q?wxB8WhGmAN1pr+8ix3QR6T0xUMVJ/oR357h5pCErlPX3oxJb4jU812+LHv+b?= =?us-ascii?Q?IzpToePy+kX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Yu0SxUT+?= =?us-ascii?Q?NkbLvDiql98EQQinmnd/I/haGtIBLyT5tJtIKUKbTjfdPs/BeeARFmOdjvo2?= =?us-ascii?Q?Tr7LGwccFUwEjT0Wtf0gEkDSIx4jOVwVzZ2DFHMO0SHUzL/QQZXDMimn80mM?= =?us-ascii?Q?l99RlDEgpD/3mHQ6EBIQoM4D90VpPLiuePgczMyEQ6WDcFRpp0Kg0/WcVHO7?= =?us-ascii?Q?Pl2q2tR2EWEsna6wFJwuFiLcV7PV0BXZH6sX2qRWXjWRgWpuznTCNFWKlrmF?= =?us-ascii?Q?uKAZ0dNhPhheYP3zHuZ7I9T7CgMjQivkZhZg7YQgYBunbZ8XeGqXZKp/fHSW?= =?us-ascii?Q?7So1PPeUASaF9abvPAdstTTmTJv+gynjhJSZ+gGKrz4ozWETzyBEUSisyvpE?= =?us-ascii?Q?+CSMr1XSQJU6reHM9rB2cybeNK/TAflHEVHB/wHLi0bbzwl3w77kcPxq8d1K?= =?us-ascii?Q?jlHGkygEqDQPQPb+fXR+525cgtxfy/pkI=3D?= X-Microsoft-Exchange-Diagnostics: 1;BLUPR02MB406;5:pe6ayw7clASMUQoCRUKuoeDZswALu+yj66UUixnQxRcMQRn1TjJQMH0v+8YxkRb0d3BNQ0NlscKBOBjL6MYqNQWQrG08YJJD2kBEHDNx0hpNNXGmuCK0zDISaKlHCs+2xL9GAytj4xWgrELwpChlvA==;24:nJeYeF47n3xTzgLh9FEcS0Zoqqw6WEas79EVK3CQUvRikAJNJdcZ+GQ65jRG8cEKDbX3ySObg5kfYtQICjDChmgX5dRUcozj9dNvcYoO9/o=;20:21q6dkB0e2UqB4btBYKOa7TsgyhlzGPnb2nAlLtHPkv//THui73yCFNeBNl3MH+qaewpfa6JFhrfLD1s5SX0YQ== SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: leegov.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 Aug 2015 16:21:24.8343 (UTC) X-MS-Exchange-CrossTenant-Id: 18110fb3-e841-4e7f-b43e-cb0b8f452f87 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=18110fb3-e841-4e7f-b43e-cb0b8f452f87;Ip=[208.89.76.182];Helo=[LCFEMB02.lee-county-fl.gov] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLUPR02MB406 --_000_043b11da1a48491eb5c13e2bd579ac24LCFEMB01leecountyflgov_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hi: I am working on a relatively simple project. I am attempting to generate a = Poisson distribution for the number of ambulances that are dispatched. I ha= ve looked at my database and determined the average number of ambulances di= spatched is 9 How do I get a Poisson distribution to be generated using the Commons Math? The output I am expecting to generate looks like this.... Likelihood of 1 ambulance dispatched is 0.005 Likelihood of 2 ambulances dispatched is 0.015 Likelihood of 3 ambulances dispatched is 0.034 Likelihood of 4 ambulances dispatched is 0.61 Likelihood of 5 ambulances dispatched is 0.091 Likelihood of 6 ambulances dispatched is 0.117 Etc. This is probably a very simple programming question for many of you. But fo= r me as a novice it is not easy. So far, here is what I have using Commons Math; import org.apache.commons.math3.distribution.PoissonDistribution; public class poissonDistribution { public static void main(String[] args) { PoissonDistribution ambulanceDistribution =3D new PoissonDist= ribution(9); System.out.println(ambulanceDistribution); } } The console output is; "org.apache.commons.math3.distribution.PoissonDistri= bution@27716f4" I did try and take matters into my own hands and write the equation out (sh= own below). But I have a very strong preference to use a method provided by= Commons Math. I am much more confident in Commons Math than my own abiliti= es. The following is my code. It works in a fashion, but I am not confident in = it. Shown below is what I am currently using - but prefer to avoid using th= is; import java.lang.Math; public class PoissonExperiment1 { public static void main(String[] args) { // c is the average number of calls per hour. This is a varia= ble that is // derived from your database. double c =3D 9.0; // k is the number of expected calls we want to determine the= probability int k =3D 1; while (k <=3D 20) { int factorialResult =3D 1; for (int i =3D 1; i <=3D k; i++) { factorialResult =3D factorialResult * i; } double term1 =3D (Math.pow(Math.E, -c)); double term2 =3D Math.pow(c, k); double numerator =3D term1 * term2; double answer =3D numerator / factorialResult; System.out.format("%10.3f:%n ", answer); k++; } } } Thank you for your consideration and time, David David Kulpanowski Database Analyst Lee County Public Safety PO Box 398 Fort Myers, FL 33902 DKulpanowski@Leegov.com 239-533-3962 ________________________________ Please note: Florida has a very broad public records law. Most written comm= unications to or from County Employees and officials regarding County busin= ess are public records available to the public and media upon request. Your= email communication may be subject to public disclosure. Under Florida law, email addresses are public records. If you do not want y= our email address released in response to a public records request, do not = send electronic mail to this entity. Instead, contact this office by phone = or in writing. --_000_043b11da1a48491eb5c13e2bd579ac24LCFEMB01leecountyflgov_--