Thanks for the comments. In case anyone else runs into a similar problem, I have found a workaround: I have not figured out what's going on with Statistics::TTest or Statistics::Distributions, but I have found another module that works correctly with these data. As I understand it, a one-way ANOVA on a single pair of distributions is equivalent to an Student's T-test. As such, I tried using Statistics::ANOVA and I had success. Using the definitions of %datasets from the above code, the following loop will calculate correct p-values (matching the values that Excel gives):
foreach my $dataset (sort keys %datasets) { my $aov = Statistics::ANOVA->new(); $aov->load( "$dataset\1", \@{$datasets{$dataset}[0]} ); $aov->add( "$dataset\2", \@{$datasets{$dataset}[1]} ); $str = $aov->anova(independent => 1, parametric => 1, ordinal => 0 +); print $str->{_stat}->{p_value} . "\n"; }

In reply to Re^2: strange collision when calculating p-values using Statistics::TTest by roadnottaken
in thread strange collision when calculating p-values using Statistics::TTest by roadnottaken

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.