About gsl_cdf_tdist_P from PDL::GSL::CDF (Perl)

200 views Asked by At

Could you please let me know how to get the full p-value from gsl_cdf_tdist_P function when p-value is smaller than 1E-16? I am getting 0 instead.

Thanks, Woody

print "t-test p-value = " . ttest(\@n,\@t) . "\n";

sub ttest{

    my ($n,$t) = @_;
    my @n = @$n;
    my @t = @$t;
    my $nn = pdl(@n);
    my $tt = pdl(@t);
    my ($tstats, $df) = t_test( $nn, $tt );
    use PDL::GSL::CDF; 
    my $p_2tail = 2 * (1 - gsl_cdf_tdist_P( $tstats->abs, $df ));
    return $p_2tail;
}

My input values as follows:

my @n = qw (1 2 4 2 3 1 2 4 2 1 2 4 2 3 1 2 4 2 1 2 4 2 3 1 2 4 2);
my @t = qw (11 12 13 12 13 11 14 11 12 13 12 13 11 14 11 12 13 12 13 11 14);
1

There are 1 answers

0
Woody Lin On BEST ANSWER

I found an easy solution for this problem. I used gsl_cdf_tdist_Q to get p-values. The p-values are not limited to 16 digits after decimal because they are not remapped p-values like (1-gsl_cdf_tdist_P).

Woody