[Bioperl-l] how to use bioperl to do Z-scores test
Sean Davis
sdavis2 at mail.nih.gov
Tue Jun 7 06:29:56 EDT 2005
On Jun 7, 2005, at 12:25 AM, Frank Lee wrote:
> Hi, Sean
>
> What I am doing now is like this:
>
> I got a number from my data. Say 122. Then I generate one
> thansand numbers randomly according to similar criteria, Say, (7, 19,
> 45,199,......................). I wish to tell whether the result
> 122 is random distributed in the random dataset or it is small or
> large. And I wish to caculate the p-vlaue as a cutoff since I have
> thousands of such data(set).
>
> Can you give me some suggestions? Thanks!
>
You could try using code like:
#!/usr/bin/perl
use strict;
use warnings;
# Observed data
my $datapoint=90;
# generate 1000 random numbers (from 1 to 100)
my @j;
for my $i ((1..1000)) {
$j[$i-1] = int(rand(100));
}
# these lines return the number of permutation values > (<=) the
observed
# value.
my $count_greater = grep {$_>$datapoint} @j;
my $count_less = grep {$_<=$datapoint} @j;
# output the result
# You're mileage may vary depending on if you want a one-sided test or
two-sided
print "Original Data Point: $datapoint\n";
print "Permutation values greater than Data Point: $count_greater
(p=".($count_greater/1000).") \n";
print "Permutation values less than Data Point: $count_less
(p=".($count_less/1000).") \n";
If you are working with a large dataset, you may really want to
consider moving over to a statistical package like R, which has many
facilities for doing all kinds of testing like this (and more).
Sean
> On 6/7/05, Sean Davis <sdavis2 at mail.nih.gov> wrote:
>> Frank,
>>
>> I don't think there is a bioperl module to do a t-test, but I could be
>> wrong. But you might want to look here:
>>
>> http://search.cpan.org/~yunfang/Statistics-TTest-1.1.0/TTest.pm
>>
>> Also, the open-source statistical package R
>> (http://www.r-project.org) is
>> quite good for such things and can be scripted or used from perl.
>> What are
>> you trying to do?
>>
>> Sean
>>
>> ----- Original Message -----
>> From: "Frank Lee" <lifei03 at gmail.com>
>> To: <Bioperl-l at portal.open-bio.org>
>> Sent: Monday, June 06, 2005 8:43 PM
>> Subject: [Bioperl-l] how to use bioperl to do Z-scores test
>>
>>
>>> Can anybody give me some ideas about how to use bioperl module to do
>>> Z-scores test (Say, Wilcoxon).?
>>>
>>> Thanks very much
>>>
>>> --
>>> Do not guess who I am. I am not Bush in BlackHouse
>>>
>>> _______________________________________________
>>> Bioperl-l mailing list
>>> Bioperl-l at portal.open-bio.org
>>> http://portal.open-bio.org/mailman/listinfo/bioperl-l
>>>
>>
>>
>>
>
>
> --
> Do not guess who I am. I am not Bush in BlackHouse
More information about the Bioperl-l
mailing list