NAME
Statistics::Distributions::Ancova - Perl implementation of One-Way Analysis of Covariance for Independent Samples.
VERSION
This document describes Statistics::Distributions::Ancova version 0.03.01
SYNOPSIS
use Statistics::Distributions::Ancova;
use strict;
# Create an Ancova object and use optional named arguments to set option.
# Use significance option to set the significance level for the test - defaults to 0.05 without argument.
# my $anc = Statistics::Distributions::Ancova->new ( { significance => 0.005 } );
my $anc = Statistics::Distributions::Ancova->new ();
# To print the data checking messages on data input to STDOUT when load_data method is called set input_verbosity to 1.
# To print a more detailed report to STDOUT when results method is called set output_verbosity to 1.
my $anc = Statistics::Distributions::Ancova->new ( {
significance => 0.005, input_verbosity => 1, output_verbosity => 1
} );
# Example using k=3 groups our dependent variable of interest (Y) along with covariant data for the concomitant
# variable (X) used to adjust (Y) to eliminate obscuring effects of covariance.
my @Drug_A_Y = ('29','27','31','33','32','24','16');
my @Drug_A_X = ('53','64','55','67','55','45','35');
my @Drug_B_X = ('24','19','13','18','25','16','16','13');
my @Drug_B_Y = ('39','34','20','35','57','28','32','17');
my @Drug_C_X = ('5','12','12','9','12','3','3');
my @Drug_C_Y = ('12','21','26','17','25','9','12');
# Data is sent to object as nested HASH reference. The individual group names are option, but the variable names Y
# and X are compulsory.
my $h_ref = { 'group_A' => {
Y => \@Drug_A_Y,
X => \@Drug_A_X,
},
'group_B' => {
Y => \@Drug_B_Y,
X => \@Drug_B_X,
},
'group_C' => {
Y => \@Drug_C_Y,
X => \@Drug_C_X,
},
};
# Feed the object the data pass data HASH reference with named argument 'data'.
$anc->load_data ( { data => $h_ref } );
# To clear the object use unload.
$anc->unload;
# To reset the verbosity level use set_verbosity. Without a value both input and output verbosity default to 0 (no
# extended messages).
#$anc->set_verbosity ( { input_verbosity => 1, output_verbosity => 1 } );
$anc->set_verbosity ();
# Reload data.
$anc->load_data ( { data => $h_ref } );
# To reset significance level use set_significance. Without a value it defaults to p = 0.05 to change this use
# set_significance.
#$anc->set_significance();
$anc->set_significance( {significance => q{0.0005} } );
# perform the analysis
$anc->ancova_analysis;
# To print a report to STDOUT call results in VOID context.
$anc->results();
# Calling results method in BOOLEAN returns true or false depending on whether the obtained F score was significant
# at chosen p.
print qq{\nIt is significant.} if ($anc->results);
# Calling results method in STRING returns a string message about test result.
print qq{\n\nCall result in string returns a message : }, ''.$anc->results;
# in this case prints 'This value of F is significant at your chosen .05 level'
# Calling results in LIST without arguments returns the full list of relevant values of F, p, df, MS...
my %hash;
print qq{\n\nCalling in LIST context without arguments:};
@hash{qw($F_score, $p_value, $MS_bg, $SS_bg_Adj, $df_bg_Y,
$MS_wg, $SS_wg_Adj, $df_wg_Y_Adj, $SS_total_Adj)} = $anc->results();
for (keys %hash) { print qq{\n$_ = $hash{$_} } };
# Calling results in LIST with numbered arguments corresponding to those below returns those arguments in the order
# passed to the method.
# 0 1 2 3 4 5 6 7 8
# ($F_score, $p_value, $MS_bg, $SS_bg_Adj, $df_bg_Y, $MS_wg, $SS_wg_Adj, $df_wg_Y_Adj, $SS_total_Adj) = $anc->results(2,3,5)
print qq{\n\nCalling in LIST context. The F value, p_value, MS_bg and MS_wg are: @{$anc->results(0,1,2,,5)}};
DESCRIPTION
A perl implementation of One-Way Analysis of Covariance for Independent Samples. As with paired t-test and repeated-measures ANOVA this test removes the obscuring effects of pre-existing individual differences among subjects. In cases where a substantial portion of the variability that occurs within each of the set of a dependent variable Y is actually covariance with another concomitant variable X measures, this test removes the covariance with X from Y thus removing a portion of the irrelevant variability of individual differences.
See http://en.wikipedia.org/wiki/Analysis_of_covariance for more info.
DEPENDENCIES
'Statistics::Distributions' => '1.02', 'Math::Cephes' => '0.47', 'Carp' => '1.08', 'Perl6::Form' => '0.04', 'Contextual::Return' => '0.2.1', 'List::Util' => '1.19',
AUTHOR
Daniel S. T. Hughes <dsth@cpan.org>
.
LICENCE AND COPYRIGHT
Copyright (c) 2009, Daniel S. T. Hughes <dsth@cpan.org>
. All rights reserved.
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic.
SEE ALSO
Statistics::Descriptive, Statistics::Distributions, Statistics::Distributions::Analyze, Statistics::ANOVA.
DISCLAIMER OF WARRANTY
because this software is licensed free of charge, there is no warranty for the software, to the extent permitted by applicable law. except when otherwise stated in writing the copyright holders and/or other parties provide the software "as is" without warranty of any kind, either expressed or implied, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose. the entire risk as to the quality and performance of the software is with you. should the software prove defective, you assume the cost of all necessary servicing, repair, or correction.
in no event unless required by applicable law or agreed to in writing will any copyright holder, or any other party who may modify and/or redistribute the software as permitted by the above licence, be liable to you for damages, including any general, special, incidental, or consequential damages arising out of the use or inability to use the software (including but not limited to loss of data or data being rendered inaccurate or losses sustained by you or third parties or a failure of the software to operate with any other software), even if such holder or other party has been advised of the possibility of such damages.