Matrix Science header

tools_shapiro_wilk.pl

Using the Shapiro-Wilk W test algorithm.

#!/usr/local/bin/perl
##############################################################################
# file: tools_shapiro_wilk.pl                                                #
# Mascot Parser toolkit example code                                         #
##############################################################################
# COPYRIGHT NOTICE                                                           #
# Copyright 1998-2010 Matrix Science Limited  All Rights Reserved.           #
#                                                                            #
##############################################################################
#     $Source: parser/examples/test_perl/tools_shapiro_wilk.pl $
#     $Author: villek@matrixscience.com $
#       $Date: 2018-07-30 16:23:53 +0100 $
#   $Revision: 1b450440f9c97e1e41d0fc6016a27d68951d4532 | MSPARSER_REL_2_8_1-0-gea32989045 $ 
##############################################################################
use strict;
##############################################################################

use msparser;

my $sw = new msparser::ms_shapiro_wilk;

$sw->appendSampleValue(-0.1420);
$sw->appendSampleValue(-0.1184);
$sw->appendSampleValue(-0.0583);
$sw->appendSampleValue(-0.0402);
$sw->appendSampleValue(-0.0363);
$sw->appendSampleValue(-0.0363);
$sw->appendSampleValue(-0.0348);
$sw->appendSampleValue(-0.0333);
$sw->appendSampleValue(-0.0222);
$sw->appendSampleValue(-0.0139);
$sw->appendSampleValue(-0.0114);
$sw->appendSampleValue(-0.0042);
$sw->appendSampleValue(-0.0036);
$sw->appendSampleValue(-0.0026);
$sw->appendSampleValue( 0.0000);
$sw->appendSampleValue( 0.0016);
$sw->appendSampleValue( 0.0058);
$sw->appendSampleValue( 0.0077);
$sw->appendSampleValue( 0.0084);
$sw->appendSampleValue( 0.0102);
$sw->appendSampleValue( 0.0132);
$sw->appendSampleValue( 0.0172);
$sw->appendSampleValue( 0.0180);
$sw->appendSampleValue( 0.0191);
$sw->appendSampleValue( 0.0194);
$sw->appendSampleValue( 0.0200);
$sw->appendSampleValue( 0.0246);
$sw->appendSampleValue( 0.0293);
$sw->appendSampleValue( 0.0533);
$sw->appendSampleValue( 0.0987);

$sw->calculate(30,30,15);
my $fmt = "%16s W = %8.6f and P = %8.6f%s\n";
printf $fmt, "Test should give", 0.892184, 0.0054, '';
printf $fmt, "Results:", $sw->getResult, $sw->getPValue(), "; error code = " . $sw->getErrorCode();


Copyright © 2022 Matrix Science Ltd.  All Rights Reserved. Generated on Thu Mar 31 2022 01:12:29