Subject: | Correlation |
The correlation can be outside of [-1,1].
CODE EXAMPLE 1:
use Math::NumberCruncher;
my $ref = Math::NumberCruncher->new();
my @array1 = (2,2,2,2,1,2,2,2,2);
my @array2 = (1,1,1,1,1,1,1,1,1);
my $correlation = $ref->Correlation(\@array1, \@array2);
print $correlation."\n";
OUTPUT EXAMPLE 1:
NaN
CODE EXAMPLE 2:
use Math::NumberCruncher;
my $ref = Math::NumberCruncher->new();
my @array1 =
(0.0001,0.0001,0.0001,0.0001,0.0001,0.0001,0.0001,0.0001,0.0001,0.0001,0.0001,0.0001,0.0001,0.0001,0.0001,0.0001,0.0001,0.0001,0.0001,0.0001,0.0001,0.0001,0.0001,0.0001,0.0001,0.0001,0.0001,0.0001,0.0001,0.0001,0.0001,0.0001,0.0001,0.0001,0.0001,0.0001,0.0001,0.0001,0.0001,0.0001,0.0001,0.0001,0.0001,0.0001,0.0001,0.0001,0.0001,0.0001,0.0001,0.0001,0.0001,0.0001,0.0001,0.0001,0.0001,0.0001,0.0001,0.0001,0.0001,0.0001,0.0001);
my @array2 =
(0.00016,0.00016,0.00016,0.00016,0.00016,0.00016,0.00016,0.00016,0.00016,0.00016,0.00016,,0.00016,0.00016,0.00016,0.00016,0.00016,0.00016,0.00016,0.00016,0.00016,0.00016,0.00016,0.00016,0.00016,0.00016,0.00016,,0.00016,0.00016,0.00016,0.00016,0.00016,0.00016,0.00016,0.00016,0.00016,0.00016,0.00016,0.00016,0.00016,0.00016,0.00016,,0.00016,0.00016,0.00016,0.00016,0.00016,0.00016,0.00016,0.00016,0.00016,0.00016,0.00016,0.00016,0.00016,0.00016,0.00016,,0.00016,0.00016,0.00016,0.00016,0.00016);
print $#array1."\n";
print $#array2."\n";
my $correlation = $ref->Correlation(\@array1, \@array2);
print $correlation."\n";
OUTPUT EXAMPLE 2:
60
60
-1.23117562372392666667
SYSTEM:
perl -v
This is perl, v5.8.5 built for x86_64-linux-thread-multi
uname -a
Linux localhost.localdomain 2.6.9-34.ELsmp #1 SMP Fri Feb 24 16:56:28
EST 2006 x86_64 x86_64 x86_64 GNU/Linux
OUTPUT ON INSTALLATION OF MODULE:
Show quoted text
cpan> force install Math::NumberCruncher
Running install for module Math::NumberCruncher
Running make for S/SI/SIFUKURT/Math-NumberCruncher-5.00.tar.gz
CPAN: Module::Signature security checks disabled because Module::Signature
not installed. Please consider installing the Module::Signature module.
You may also need to be able to connect over the Internet to the public
keyservers like pgp.mit.edu (port 11371).
Checksum for
/root/.cpan/sources/authors/id/S/SI/SIFUKURT/Math-NumberCruncher-5.00.tar.gz
ok
Math-NumberCruncher-5.00/
Math-NumberCruncher-5.00/README
Math-NumberCruncher-5.00/Makefile.PL
Math-NumberCruncher-5.00/Changes
Math-NumberCruncher-5.00/NumberCruncher.pm
Math-NumberCruncher-5.00/NumberCruncher.pod
Math-NumberCruncher-5.00/MANIFEST
Math-NumberCruncher-5.00/test.pl
Removing previously used /root/.cpan/build/Math-NumberCruncher-5.00
CPAN.pm: Going to build S/SI/SIFUKURT/Math-NumberCruncher-5.00.tar.gz
Checking if your kit is complete...
Looks good
Writing Makefile for Math::NumberCruncher
cp NumberCruncher.pod blib/lib/Math/NumberCruncher.pod
cp NumberCruncher.pm blib/lib/Math/NumberCruncher.pm
Manifying blib/man3/Math::NumberCruncher.3pm
/usr/bin/make -- OK
Running make test
PERL_DL_NONLAZY=1 /usr/bin/perl "-Iblib/lib" "-Iblib/arch" test.pl
Testing Math::NumberCruncher v5.00
##########################################
# IMPORTANT #
##########################################
Significant improvements have been made to
Math::NumberCruncher starting with v5.00.
Every attempt was made to maintain backward
compatibility, but in some cases, this wasn't
possible. Be certain to test scripts written
using versions < 5.00 very thoroughly.
(sleeping 3 seconds)
Testing......99/99
Total Tests: 99
Failed Tests: 3
Success Rate: 96.97%
The following tests encountered errors:
Test 23: Union()
Test 24: Intersection()
Test 25: Difference()
/usr/bin/make test -- OK
Running make install
Writing
/usr/lib64/perl5/site_perl/5.8.5/x86_64-linux-thread-multi/auto/Math/NumberCruncher/.packlist
Appending installation info to
/usr/lib64/perl5/5.8.5/x86_64-linux-thread-multi/perllocal.pod
/usr/bin/make install -- OK