Posted on 2008-01-08 10:12:14-08 by ninu in response to 436
Re: Statistics-LineFit
use Statistics::LineFit; $lineFit = Statistics::LineFit->new(); $lineFit->setData(\@x, \@y) or die "Invalid regression data\n"; if (defined $lineFit->rSquared() and $lineFit->rSquared() > $threshold) { ($intercept, $slope) = $lineFit->coefficients(); print "Slope: $slope Y-intercept: $intercept\n"; }
I have picked the example from http://search.cpan.org/~randerson/Statistics-LineFit-0.07/lib/Statistics/LineFit.pm You can get the details of this module from the above url. Cheers.
Direct Responses: Write a response
Perl Weekly newsletter
A free weekly newsletter for people who are busy to read all the blogs. click here to check it out.