Win has asked for the wisdom of the Perl Monks concerning the following question:
in the context ofuse Statistics::LineFit;
Is there a quick and easy way for me to return all the points that exist above the trend line and all the points that exist below the trend line as two seperate groups (in two arrays).sub correlation { my ($x_ref, $y_ref) = @_; my $output = "output_test.txt"; open (OUTPUT_TEST, ">$output"); print OUTPUT_TEST Dumper ($x_ref, $y_ref); #print Dumper length($x_ref); #print Dumper length($y_ref); my $lfit = Statistics::LineFit->new(); $lfit->setData($x_ref, $y_ref); my ($intercept, $slope) = $lfit->coefficients(); my $rSquared = $lfit->rSquared(); my $hashref = { a => $intercept, b => $slope, c => $rSquared }; return $hashref; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Cluster points above and below trendline with use Statistics::LineFit;
by moklevat (Priest) on Dec 05, 2007 at 16:27 UTC | |
by Win (Novice) on Dec 05, 2007 at 17:37 UTC |