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
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;
Subject: [rt.cpan.org #71240] divide by zero error
Date: Fri, 23 Oct 2015 18:47:30 +0200
To: bug-Statistics-Regression [...] rt.cpan.org
From: Cédric Meschin <c.meschin [...] free.fr>
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