in reply to covariance calculation
#!/usr/bin/perl use strict; use warnings; use Statistics::Basic qw(:all); use constant HITS => qw(2378 4024 9696 7314 7710); use constant SALES => qw(310.94 315.88 514.15 500.18 610.37); my $cov = (HITS, SALES); print "The covariance is : $cov\n";
Update: Fixed---here's the corrected code:
#!/usr/bin/perl use strict; use warnings; use Statistics::Basic qw(:all); $Statistics::Basic::DEBUG = 1; use constant HITS => qw(2378 4024 9696 7314 7710); use constant SALES => qw(310.94 315.88 514.15 500.18 610.37); my $cov = Statistics::Basic::Covariance->new; $cov = covariance( [HITS], [SALES] ); print "The covariance is : $cov\n";
|
|---|