NAME
Statistics::Zed - Basic ztest/zscore, Fisher's r-to-z, z-to-r, et al.
VERSION
This is documentation for Version 0.01 of Statistics::Zed (2008.06.22).
SYNOPSIS
use Statistics::Zed;
my $zed = Statistics::Zed->new(
ccorr => 1,
tails => 2,
s_precision => 5,
p_precision => 5,
);
my ($z_value, $p_value, $observed_deviation, $standard_deviation) =
$zed->score(
observed => $obs,
expected => $exp,
variance => $variance,
);
my $deviate = $zed->test(
observed => $obs,
expected => $exp,
variance => $variance,
samples => $samples,
);
my $p_value = $zed->p_value($deviate);
DESCRIPTION
Calculates a z-statistic: the ratio of an observed deviation to a standard deviation. Purpose is simply to support Statistics::Sequences, but with some standalone utilities.
METHODS
new
$zed = Statistics::Zed->new();
Returns a Statistics::Zed object. Accepts setting of any of the OPTIONS.
ztest
$zed->ztest(observed => 'number', expected => 'number', variance => 'number (non-zero)', samples => 'number (non-zero)')
Alias: test
You supply the observed and expected values of your statistic, and the variance (or std_dev), and the number of samples ("sample-size", N, etc.).
Optionally specify a logical value for ccorr for performing the continuity-correction to the observed deviation, and a value of either 1 or 2 to specify the tails for reading off the probability associated with the z_value.
When called in array context, returns an array consisting of the z-statistic ("standard normal deviate"), its probability, the observed deviation (the difference between the observed and expected values of your statistic), and the standard deviation (the square-root of the variance supplied).
If you only want the z-value, then expect a string:
$z_value = $zed->test(...)
The basic formula is the basic:
Z× = ( × – µ ) / SD / ¬/n
zscore
$zed->zscore(observed => 'number', expected => 'number', variance => 'number (non-zero)')
Alias: score
You supply the observed and expected values of your statistic, and the variance (or std_dev).
Optionally specify a logical value for ccorr for performing the continuity-correction to the observed deviation, and a value of either 1 or 2 to specify the tails for reading off the probability associated with the z_value.
When called in array context, returns an array consisting of the z-statistic ("standard score"), its probability, the observed deviation (the difference between the observed and expected values of your statistic), and the standard deviation (the square-root of the variance supplied).
If you only want the z-value, then expect a string:
$z_value = $zed->score(...)
The basic formula is the basic:
Z = ( × – X ) / SD
where X is the expected value (mean, etc.).
p_value
$p = $zed->p_value($z)
Send a z-value, get its associated p-value, 2-tailed by default.
r_2_z
$z = $zed->r_2_z($r)
Performs the Fisher r-to-z transformation. Send a correlation coefficient - get back a z-value.
z_2_r
$r = $zed->z_2_r($z)
Send a z-value - get back a correlation coefficient.
chi_2_z
$z = $zed->chi_2_z($chi)
Send a chi-value, get back a z-value (the square-root of the thing ...).
OPTIONS
The following can be set in the call to new or test or score.
ccorr
Apply the continuity correction. Default = 0.
tails
Tails from which to assess the association p_value (1 or 2). Default = 2.
s_precision
Precision of the z_value. Default = 2.
p_precision
Precision of the associated p_value. Default = 0.
SEE ALSO
Statistics::Distributions : the uprob
and precision_string
methods are here used for calculating and reporting probability.
TO DO/BUGS
Other distributions.
AUTHOR
Roderick Garton, <rgarton@utas_DOT_edu_DOT_au>
COPYRIGHT/LICENSE/DISCLAIMER
Copyright (C) 2008 Roderick Garton
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.8 or, at your option, any later version of Perl 5 you may have available.
To the maximum extent permitted by applicable law, the author of this module disclaims all warranties, either express or implied, including but not limited to implied warranties of merchantability and fitness for a particular purpose, with regard to the software and the accompanying documentation.