0
|
1 <html>
|
|
2 <head>
|
|
3 <title>MayaChemTools:Documentation:StatisticsUtil.pm</title>
|
|
4 <meta http-equiv="content-type" content="text/html;charset=utf-8">
|
|
5 <link rel="stylesheet" type="text/css" href="../../css/MayaChemTools.css">
|
|
6 </head>
|
|
7 <body leftmargin="20" rightmargin="20" topmargin="10" bottommargin="10">
|
|
8 <br/>
|
|
9 <center>
|
|
10 <a href="http://www.mayachemtools.org" title="MayaChemTools Home"><img src="../../images/MayaChemToolsLogo.gif" border="0" alt="MayaChemTools"></a>
|
|
11 </center>
|
|
12 <br/>
|
|
13 <div class="DocNav">
|
|
14 <table width="100%" border=0 cellpadding=0 cellspacing=2>
|
|
15 <tr align="left" valign="top"><td width="33%" align="left"><a href="./SequenceFileUtil.html" title="SequenceFileUtil.html">Previous</a> <a href="./index.html" title="Table of Contents">TOC</a> <a href="./TextUtil.html" title="TextUtil.html">Next</a></td><td width="34%" align="middle"><strong>StatisticsUtil.pm</strong></td><td width="33%" align="right"><a href="././code/StatisticsUtil.html" title="View source code">Code</a> | <a href="./../pdf/StatisticsUtil.pdf" title="PDF US Letter Size">PDF</a> | <a href="./../pdfgreen/StatisticsUtil.pdf" title="PDF US Letter Size with narrow margins: www.changethemargins.com">PDFGreen</a> | <a href="./../pdfa4/StatisticsUtil.pdf" title="PDF A4 Size">PDFA4</a> | <a href="./../pdfa4green/StatisticsUtil.pdf" title="PDF A4 Size with narrow margins: www.changethemargins.com">PDFA4Green</a></td></tr>
|
|
16 </table>
|
|
17 </div>
|
|
18 <p>
|
|
19 </p>
|
|
20 <h2>NAME</h2>
|
|
21 <p>StatisticsUtil</p>
|
|
22 <p>
|
|
23 </p>
|
|
24 <h2>SYNOPSIS</h2>
|
|
25 <p>use StatisticsUtil;</p>
|
|
26 <p>use Statistics qw(:all);</p>
|
|
27 <p>
|
|
28 </p>
|
|
29 <h2>DESCRIPTION</h2>
|
|
30 <p><strong>StatisticsUtil</strong> module provides the following functions:</p>
|
|
31 <p> <a href="#average">Average</a>, <a href="#averagedeviation">AverageDeviation</a>, <a href="#correlation">Correlation</a>, <a href="#covariance">Covariance</a>, <a href="#euclidean">Euclidean</a>, <a href="#factorial">Factorial</a>
|
|
32 , <a href="#factorialdivison">FactorialDivison</a>, <a href="#frequency">Frequency</a>, <a href="#geometricmean">GeometricMean</a>, <a href="#harmonicmean">HarmonicMean</a>, <a href="#klargest">KLargest</a>, <a href="#ksmallest">KSmallest</a>
|
|
33 , <a href="#kurtosis">Kurtosis</a>, <a href="#maximum">Maximum</a>, <a href="#mean">Mean</a>, <a href="#median">Median</a>, <a href="#minimum">Minimum</a>, <a href="#mode">Mode</a>, <a href="#pearsoncorrelation">PearsonCorrelation</a>, <a href="#permutations">Permutations</a>
|
|
34 , <a href="#product">Product</a>, <a href="#rsquare">RSquare</a>, <a href="#range">Range</a>, <a href="#skewness">Skewness</a>, <a href="#standarddeviation">StandardDeviation</a>, <a href="#standarddeviationn">StandardDeviationN</a>
|
|
35 , <a href="#standarderror">StandardError</a>, <a href="#standardscores">StandardScores</a>, <a href="#standardscoresn">StandardScoresN</a>, <a href="#standardize">Standardize</a>, <a href="#sum">Sum</a>, <a href="#sumofsquares">SumOfSquares</a>
|
|
36 , <a href="#trimmean">TrimMean</a>, <a href="#variance">Variance</a>, <a href="#variancen">VarianceN</a>
|
|
37 </p><p>
|
|
38 </p>
|
|
39 <h2>METHODS</h2>
|
|
40 <dl>
|
|
41 <dt><strong><a name="average" class="item"><strong>Average</strong></a></strong></dt>
|
|
42 <dd>
|
|
43 <div class="OptionsBox">
|
|
44 $Value = Average(\@DataArray);</div>
|
|
45 <p>Computes the mean of an array of numbers: SUM( x[i] ) / n</p>
|
|
46 </dd>
|
|
47 <dt><strong><a name="averagedeviation" class="item"><strong>AverageDeviation</strong></a></strong></dt>
|
|
48 <dd>
|
|
49 <div class="OptionsBox">
|
|
50 $Value = AverageDeviation(\@DataArray);</div>
|
|
51 <p>Computes the average of the absolute deviation of an array of numbers: SUM( ABS(x[i] - Xmean) ) / n</p>
|
|
52 </dd>
|
|
53 <dt><strong><a name="correlation" class="item"><strong>Correlation</strong></a></strong></dt>
|
|
54 <dd>
|
|
55 <div class="OptionsBox">
|
|
56 $Value = Correlation(\@XDataArray, \@YDataArray);</div>
|
|
57 <p>Computes the Pearson correlation coefficient between two arrays of numbers:
|
|
58 SUM( (x[i] - Xmean)(y[i] - Ymean) ) / SQRT( SUM( (x[i] - Xmean)^2 )(SUM( (y[i] - Ymean)^2 )) )</p>
|
|
59 </dd>
|
|
60 <dt><strong><a name="euclidean" class="item"><strong>Euclidean</strong></a></strong></dt>
|
|
61 <dd>
|
|
62 <div class="OptionsBox">
|
|
63 $Return = Euclidean(\@DataArray);</div>
|
|
64 <p>Computes the euclidean distance of an array of numbers: SQRT( SUM( x[i] ** 2) )</p>
|
|
65 </dd>
|
|
66 <dt><strong><a name="covariance" class="item"><strong>Covariance</strong></a></strong></dt>
|
|
67 <dd>
|
|
68 <div class="OptionsBox">
|
|
69 $Value = Covariance(\@XDataArray, \@YDataArray);</div>
|
|
70 <p>Computes the covariance between two arrays of numbers: SUM( (x[i] - Xmean) (y[i] - Ymean) ) / n</p>
|
|
71 </dd>
|
|
72 <dt><strong><a name="factorial" class="item"><strong>Factorial</strong></a></strong></dt>
|
|
73 <dd>
|
|
74 <div class="OptionsBox">
|
|
75 $Value = Factorial($Num);</div>
|
|
76 <p>Computes the factorial of a positive integer.</p>
|
|
77 </dd>
|
|
78 <dt><strong><a name="factorialdivison" class="item"><strong>FactorialDivison</strong></a></strong></dt>
|
|
79 <dd>
|
|
80 <div class="OptionsBox">
|
|
81 $Value = FactorialDivision($Numerator, $Denominator);</div>
|
|
82 <p>Compute the factorial divison of two positive integers.</p>
|
|
83 </dd>
|
|
84 <dt><strong><a name="frequency" class="item"><strong>Frequency</strong></a></strong></dt>
|
|
85 <dd>
|
|
86 <div class="OptionsBox">
|
|
87 %FrequencyValues = Frequency(\@DataArray, [$NumOfBins]);
|
|
88 <br/> %FrequencyValues = Frequency(\@DataArray, [\@BinRange]);</div>
|
|
89 <p>A hash array is returned with keys and values representing range and frequency values, respectively.
|
|
90 The frequency value for a specific key corresponds to all the values which are greater than
|
|
91 the previous key and less than or equal to the current key. A key value representing maximum value is
|
|
92 added for generating frequency distribution for specific number of bins, and whenever the maximum
|
|
93 array value is greater than the maximum specified in bin range, it is also added to bin range.</p>
|
|
94 </dd>
|
|
95 <dt><strong><a name="geometricmean" class="item"><strong>GeometricMean</strong></a></strong></dt>
|
|
96 <dd>
|
|
97 <div class="OptionsBox">
|
|
98 $Value = GeometricMean(\@DataArray);</div>
|
|
99 <p>Computes the geometric mean of an array of numbers: NthROOT( PRODUCT(x[i]) )</p>
|
|
100 </dd>
|
|
101 <dt><strong><a name="harmonicmean" class="item"><strong>HarmonicMean</strong></a></strong></dt>
|
|
102 <dd>
|
|
103 <div class="OptionsBox">
|
|
104 $Value = HarmonicMean(\@DataArray);</div>
|
|
105 <p>Computes the harmonic mean of an array of numbers: 1 / ( SUM(1/x[i]) / n )</p>
|
|
106 </dd>
|
|
107 <dt><strong><a name="klargest" class="item"><strong>KLargest</strong></a></strong></dt>
|
|
108 <dd>
|
|
109 <div class="OptionsBox">
|
|
110 $Value = KLargest(\@DataArray, $KthNumber);</div>
|
|
111 <p>Returns the k-largest value from an array of numbers.</p>
|
|
112 </dd>
|
|
113 <dt><strong><a name="ksmallest" class="item"><strong>KSmallest</strong></a></strong></dt>
|
|
114 <dd>
|
|
115 <div class="OptionsBox">
|
|
116 $Value = KSmallest(\@DataArray, $KthNumber);</div>
|
|
117 <p>Returns the k-smallest value from an array of numbers.</p>
|
|
118 </dd>
|
|
119 <dt><strong><a name="kurtosis" class="item"><strong>Kurtosis</strong></a></strong></dt>
|
|
120 <dd>
|
|
121 <div class="OptionsBox">
|
|
122 $Value = Kurtosis(\@DataArray);</div>
|
|
123 <p>Computes the kurtosis of an array of numbers:
|
|
124 [ {n(n + 1)/(n - 1)(n - 2)(n - 3)} SUM{ ((x[i] - Xmean)/STDDEV)^4 } ] - {3((n - 1)^2)}/{(n - 2)(n-3)}</p>
|
|
125 </dd>
|
|
126 <dt><strong><a name="maximum" class="item"><strong>Maximum</strong></a></strong></dt>
|
|
127 <dd>
|
|
128 <div class="OptionsBox">
|
|
129 $Value = Maximum(\@DataArray);</div>
|
|
130 <p>Returns the largest value from an array of numbers.</p>
|
|
131 </dd>
|
|
132 <dt><strong><a name="minimum" class="item"><strong>Minimum</strong></a></strong></dt>
|
|
133 <dd>
|
|
134 <div class="OptionsBox">
|
|
135 $Value = Minimum(\@DataArray);</div>
|
|
136 <p>Returns the smallest value from an array of numbers.</p>
|
|
137 </dd>
|
|
138 <dt><strong><a name="mean" class="item"><strong>Mean</strong></a></strong></dt>
|
|
139 <dd>
|
|
140 <div class="OptionsBox">
|
|
141 $Value = Mean(\@DataArray);</div>
|
|
142 <p>Computes the mean of an array of numbers: SUM( x[i] ) / n</p>
|
|
143 </dd>
|
|
144 <dt><strong><a name="median" class="item"><strong>Median</strong></a></strong></dt>
|
|
145 <dd>
|
|
146 <div class="OptionsBox">
|
|
147 $Value = Median(\@DataArray);</div>
|
|
148 <p>Computes the median value of an array of numbers. For an even number array, it's
|
|
149 the average of two middle values.</p>
|
|
150 <p>For even values of n: Xsorted[(n - 1)/2 + 1]
|
|
151 For odd values of n: (Xsorted[n/2] + Xsorted[n/2 + 1])/2</p>
|
|
152 </dd>
|
|
153 <dt><strong><a name="mode" class="item"><strong>Mode</strong></a></strong></dt>
|
|
154 <dd>
|
|
155 <div class="OptionsBox">
|
|
156 $Value = Mode(\@DataArray);</div>
|
|
157 <p>Returns the most frequently occuring value in an array of numbers.</p>
|
|
158 </dd>
|
|
159 <dt><strong><a name="pearsoncorrelation" class="item"><strong>PearsonCorrelation</strong></a></strong></dt>
|
|
160 <dd>
|
|
161 <div class="OptionsBox">
|
|
162 $Value = Correlation(\@XDataArray, \@YDataArray);</div>
|
|
163 <p>Computes the Pearson correlation coefficient between two arrays of numbers:
|
|
164 SUM( (x[i] - Xmean)(y[i] - Ymean) ) / SQRT( SUM( (x[i] - Xmean)^2 )(SUM( (y[i] - Ymean)^2 )) )</p>
|
|
165 </dd>
|
|
166 <dt><strong><a name="permutations" class="item"><strong>Permutations</strong></a></strong></dt>
|
|
167 <dd>
|
|
168 <div class="OptionsBox">
|
|
169 $PermutationsRef = Permutations(@DataToPermute);</div>
|
|
170 <p>Generate all possible permuations or a specific permutations of items in an array
|
|
171 and return a reference to an array containing array references to generated permuations.</p>
|
|
172 <p>This alogrithm is based on the example provided by Mark Jason-Dominus, and is available
|
|
173 at CPAN as mjd_permute standalone script.</p>
|
|
174 </dd>
|
|
175 <dt><strong><a name="product" class="item"><strong>Product</strong></a></strong></dt>
|
|
176 <dd>
|
|
177 <div class="OptionsBox">
|
|
178 $Value = Product(\@DataArray);</div>
|
|
179 <p>Compute the product of an array of numbers.</p>
|
|
180 </dd>
|
|
181 <dt><strong><a name="range" class="item"><strong>Range</strong></a></strong></dt>
|
|
182 <dd>
|
|
183 <div class="OptionsBox">
|
|
184 ($Smallest, $Largest) = Range(\@DataArray);</div>
|
|
185 <p>Return the smallest and largest values from an array of numbers.</p>
|
|
186 </dd>
|
|
187 <dt><strong><a name="rsquare" class="item"><strong>RSquare</strong></a></strong></dt>
|
|
188 <dd>
|
|
189 <div class="OptionsBox">
|
|
190 $Value = RSquare(\@XDataArray, \@YDataArray);</div>
|
|
191 <p>Computes square of the Pearson correlation coefficient between two arrays of numbers.</p>
|
|
192 </dd>
|
|
193 <dt><strong><a name="skewness" class="item"><strong>Skewness</strong></a></strong></dt>
|
|
194 <dd>
|
|
195 <div class="OptionsBox">
|
|
196 $Value = Skewness(\@DataArray);</div>
|
|
197 <p>Computes the skewness of an array of numbers:
|
|
198 {n/(n - 1)(n - 2)} SUM{ ((x[i] - Xmean)/STDDEV)^3 }</p>
|
|
199 </dd>
|
|
200 <dt><strong><a name="standarddeviation" class="item"><strong>StandardDeviation</strong></a></strong></dt>
|
|
201 <dd>
|
|
202 <div class="OptionsBox">
|
|
203 $Value = StandardDeviation(\@DataArray);</div>
|
|
204 <p>Computes the standard deviation of an array of numbers.
|
|
205 SQRT ( SUM( (x[i] - mean)^2 ) / (n - 1) )</p>
|
|
206 </dd>
|
|
207 <dt><strong><a name="standarddeviationn" class="item"><strong>StandardDeviationN</strong></a></strong></dt>
|
|
208 <dd>
|
|
209 <div class="OptionsBox">
|
|
210 $Value = StandardDeviationN(\@DataArray);</div>
|
|
211 <p>Computes the standard deviation of an array of numbers representing entire population:
|
|
212 SQRT ( SUM( (x[i] - mean)^2 ) / n )</p>
|
|
213 </dd>
|
|
214 <dt><strong><a name="standarderror" class="item"><strong>StandardError</strong></a></strong></dt>
|
|
215 <dd>
|
|
216 <div class="OptionsBox">
|
|
217 $Value = StandardError($StandardDeviation, $Count);</div>
|
|
218 <p>Computes the standard error using standard deviation and sample size.</p>
|
|
219 </dd>
|
|
220 <dt><strong><a name="standardize" class="item"><strong>Standardize</strong></a></strong></dt>
|
|
221 <dd>
|
|
222 <div class="OptionsBox">
|
|
223 $Value = Standardize($Value, $Mean, $StandardDeviation);</div>
|
|
224 <p>Standardizes the value using mean and standard deviation.</p>
|
|
225 </dd>
|
|
226 <dt><strong><a name="standardscores" class="item"><strong>StandardScores</strong></a></strong></dt>
|
|
227 <dd>
|
|
228 <div class="OptionsBox">
|
|
229 @Values = StandardScores(\@DataArray);</div>
|
|
230 <p>Computes the standard deviation above the mean for an array of numbers:
|
|
231 (x[i] - mean) / (n - 1)</p>
|
|
232 </dd>
|
|
233 <dt><strong><a name="standardscoresn" class="item"><strong>StandardScoresN</strong></a></strong></dt>
|
|
234 <dd>
|
|
235 <div class="OptionsBox">
|
|
236 @Values = StandardScoresN(\@DataArray);</div>
|
|
237 <p>Computes the standard deviation above the mean for an array of numbers representing entire population:
|
|
238 (x[i] - mean) / n</p>
|
|
239 </dd>
|
|
240 <dt><strong><a name="sum" class="item"><strong>Sum</strong></a></strong></dt>
|
|
241 <dd>
|
|
242 <div class="OptionsBox">
|
|
243 $Value = Sum(\@DataArray);</div>
|
|
244 <p>Compute the sum of an array of numbers.</p>
|
|
245 </dd>
|
|
246 <dt><strong><a name="sumofsquares" class="item"><strong>SumOfSquares</strong></a></strong></dt>
|
|
247 <dd>
|
|
248 <div class="OptionsBox">
|
|
249 $Value = SumOfSquares(\@DataArray);</div>
|
|
250 <p>Computes the sum of an array of numbers.</p>
|
|
251 </dd>
|
|
252 <dt><strong><a name="trimmean" class="item"><strong>TrimMean</strong></a></strong></dt>
|
|
253 <dd>
|
|
254 <div class="OptionsBox">
|
|
255 $Value = TrimMean(\@DataArray, $FractionToExclude));</div>
|
|
256 <p>Computes the mean of an array of numbers by excluding a fraction of
|
|
257 numbers from the top and bottom of the data set.</p>
|
|
258 </dd>
|
|
259 <dt><strong><a name="variance" class="item"><strong>Variance</strong></a></strong></dt>
|
|
260 <dd>
|
|
261 <div class="OptionsBox">
|
|
262 $Value = Variance(\@DataArray);</div>
|
|
263 <p>Computes the variance of an array of numbers: SUM( (x[i] - Xmean)^2 / (n - 1) )</p>
|
|
264 </dd>
|
|
265 <dt><strong><a name="variancen" class="item"><strong>VarianceN</strong></a></strong></dt>
|
|
266 <dd>
|
|
267 <div class="OptionsBox">
|
|
268 $Value = Variance(\@DataArray);</div>
|
|
269 <p>Compute the variance of an array of numbers representing entire population:
|
|
270 SUM( (x[i] - Xmean)^2 / n )</p>
|
|
271 </dd>
|
|
272 </dl>
|
|
273 <p>
|
|
274 </p>
|
|
275 <h2>AUTHOR</h2>
|
|
276 <p><a href="mailto:msud@san.rr.com">Manish Sud</a></p>
|
|
277 <p>
|
|
278 </p>
|
|
279 <h2>SEE ALSO</h2>
|
|
280 <p><a href="./Constants.html">Constants.pm</a>, <a href="./ConversionsUtil.html">ConversionsUtil.pm</a>, <a href="./MathUtil.html">MathUtil.pm</a>
|
|
281 </p>
|
|
282 <p>
|
|
283 </p>
|
|
284 <h2>COPYRIGHT</h2>
|
|
285 <p>Copyright (C) 2015 Manish Sud. All rights reserved.</p>
|
|
286 <p>This file is part of MayaChemTools.</p>
|
|
287 <p>MayaChemTools is free software; you can redistribute it and/or modify it under
|
|
288 the terms of the GNU Lesser General Public License as published by the Free
|
|
289 Software Foundation; either version 3 of the License, or (at your option)
|
|
290 any later version.</p>
|
|
291 <p> </p><p> </p><div class="DocNav">
|
|
292 <table width="100%" border=0 cellpadding=0 cellspacing=2>
|
|
293 <tr align="left" valign="top"><td width="33%" align="left"><a href="./SequenceFileUtil.html" title="SequenceFileUtil.html">Previous</a> <a href="./index.html" title="Table of Contents">TOC</a> <a href="./TextUtil.html" title="TextUtil.html">Next</a></td><td width="34%" align="middle"><strong>March 29, 2015</strong></td><td width="33%" align="right"><strong>StatisticsUtil.pm</strong></td></tr>
|
|
294 </table>
|
|
295 </div>
|
|
296 <br />
|
|
297 <center>
|
|
298 <img src="../../images/h2o2.png">
|
|
299 </center>
|
|
300 </body>
|
|
301 </html>
|