Win has asked for the wisdom of the Perl Monks concerning the following question:
This sub is activated like:sub correlation { print "\nWe are in the correlation subroutine\n\n"; my ($x_ref, $y_ref) = @_; my @x = @{$x_ref}; my @y = @{$y_ref}; my $lfit = Statistics::LineFit->new(); $lfit->setData(@x, @y); printf "a=%.4f, b=%.4f, R2=%.4f\n", $lfit->coefficients(), $lfit->r +Squared(); return "a=%.4f, b=%.4f, R2=%.4f\n", $lfit->coefficients(), $lfit->r +Squared(); }
The error message that I get is:my ($y_axis_intercept, $gradient, $R2) = correlation(\@primarys, \@sec +ondarys);
Can't use an undefined value as an ARRAY reference at c:/Perl/site/lib +/Statistic s/LineFit.pm line 191, <DATA> line 164.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: LineFit.pm error due to undef value
by jdporter (Paladin) on Nov 20, 2007 at 15:44 UTC | |
by jdporter (Paladin) on Nov 20, 2007 at 15:48 UTC | |
|