Skip Menu |
 

This queue is for tickets about the Statistics-Regression CPAN distribution.

Report information
The Basics
Id: 71240
Status: open
Priority: 0/
Queue: Statistics-Regression

People
Owner: Nobody in particular
Requestors: shaohua [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: division by zero when the regression has no error
MIME-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
X-Mailer: MIME-tools 5.427 (Entity 5.427)
Content-Disposition: inline
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
Content-Length: 532
Download (untitled) / with headers
text/plain 532b
I tried to regress the function y = 2x + 5. The input is simple: $reg->include( 9, [ 1.0, 2 ] ); $reg->include( 13, [ 1.0, 4 ] ); $reg->include( 17, [ 1.0, 6 ] ); It reports error: Illegal division by zero at .../Regression.pm line 438 This line of code is: printf "%7.2f", ($theta->[$i]/$standarderrors[$i]); It's clear that $standarderrors[$i] is 0 (a perfect regression). therefore we got the 'division by zero' error. I made a quick fix: printf "%7.2f", $standarderrors[$i] ? ($theta->[$i]/$standarderrors[$i]) : 0;
MIME-Version: 1.0
X-Spam-Status: No, score=-1.199 tagged_above=-99.9 required=10 tests=[BAYES_05=-0.5, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7] autolearn=ham
X-Spam-Flag: NO
X-Antivirus-Status: Clean
X-RT-Interface: API
X-Antivirus: avast! (VPS 151023-0, 23/10/2015), Outbound message
X-Virus-Scanned: Debian amavisd-new at bestpractical.com
Message-ID: <562A64A2.4070507 [...] free.fr>
content-type: text/plain; charset="utf-8"; format="flowed"
X-RT-Original-Encoding: utf-8
X-Spam-Score: -1.199
Received: from localhost (localhost [127.0.0.1]) by hipster.bestpractical.com (Postfix) with ESMTP id 8D830240071 for <cpan-bug+Statistics-Regression [...] hipster.bestpractical.com>; Fri, 23 Oct 2015 12:47:43 -0400 (EDT)
Received: from hipster.bestpractical.com ([127.0.0.1]) by localhost (hipster.bestpractical.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id relI8EbMWeOS for <cpan-bug+Statistics-Regression [...] hipster.bestpractical.com>; Fri, 23 Oct 2015 12:47:42 -0400 (EDT)
Received: from la.mx.develooper.com (x1.develooper.com [207.171.7.70]) by hipster.bestpractical.com (Postfix) with SMTP id E179C240051 for <bug-Statistics-Regression [...] rt.cpan.org>; Fri, 23 Oct 2015 12:47:41 -0400 (EDT)
Received: (qmail 23758 invoked by alias); 23 Oct 2015 16:47:41 -0000
Received: from smtp1-g21.free.fr (HELO smtp1-g21.free.fr) (212.27.42.1) by la.mx.develooper.com (qpsmtpd/0.28) with ESMTP; Fri, 23 Oct 2015 09:47:38 -0700
Received: from [IPv6:::1] (unknown [IPv6:2a01:e34:ec6c:56f0:6827:c6f0:6f63:8f1c]) by smtp1-g21.free.fr (Postfix) with ESMTP id 73E439400DB for <bug-Statistics-Regression [...] rt.cpan.org>; Fri, 23 Oct 2015 18:47:33 +0200 (CEST)
Delivered-To: cpan-bug+Statistics-Regression [...] hipster.bestpractical.com
Subject: [rt.cpan.org #71240] divide by zero error
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0
Return-Path: <c.meschin [...] free.fr>
X-Spam-Check-BY: la.mx.develooper.com
X-Original-To: cpan-bug+Statistics-Regression [...] hipster.bestpractical.com
X-RT-Mail-Extension: statistics-regression
Date: Fri, 23 Oct 2015 18:47:30 +0200
X-Spam-Level:
To: bug-Statistics-Regression [...] rt.cpan.org
Content-Transfer-Encoding: quoted-printable
From: Cédric Meschin <c.meschin [...] free.fr>
RT-Message-ID: <rt-4.0.18-9995-1445618864-824.71240-0-0 [...] rt.cpan.org>
Content-Length: 1334
Download (untitled) / with headers
text/plain 1.3k
Hi, I use this module and i have two case when this error appear. first case when all values are the same (7 is for exemple): like this: 0 7 1 7 2 7 3 7 4 7 5 7 6 7 7 7 8 7 9 7 **************************************************************** Regression 'Title' **************************************************************** Name Theta StdErr T-stat [0='Intercept'] 7.0000 0.0000 26362694432616416.00 [1='Slope'] 0.0000 0.0000 3.36 Illegal division by zero at D:/Strawberry_Perl/perl/site/lib/Statistics/Regression.pm line 382, <> line 1. and the second case with these values: 1 -> 1 1 -> 2 1 -> 3 1 -> 4 1 -> 5 1 -> 6 1 -> 7 1 -> 8 1 -> 9 1 -> 10 like this: 0 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 **************************************************************** Regression 'Title' **************************************************************** Name Theta StdErr T-stat Illegal division by zero at D:/Strawberry_Perl/perl/site/lib/Statistics/Regression.pm line 438, <> line 1. [0='Intercept'] 0.0000 0.0000 the fix proposed by shaohua don't work for me. regards. --- L'absence de virus dans ce courrier électronique a été vérifiée par le logiciel antivirus Avast. https://www.avast.com/antivirus


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.