ete2.clustering.stats

Package ete2 :: Package clustering :: Module stats |
[hide private]
[frames] | no frames]

# Module stats

source code

Version: 0.6

Classes | [hide private]
| Dispatch The Dispatch class, care of David Ascher, allows different functions to be called depending on the argument types.

Functions | [hide private]
lgeometricmean(inlist) Calculates the geometric mean of the values in the passed list. | source code
lharmonicmean(inlist) Calculates the harmonic mean of the values in the passed list. | source code
lmean(inlist) Returns the arithematic mean of the values in the passed list. | source code
lmedian(inlist, numbins=1000) Returns the computed median value of a list of numbers, given the number of bins to use for the histogram (more bins brings the computed value closer to the median score, default number of bins = 1000). | source code
lmedianscore(inlist) Returns the 'middle' score of the passed list. | source code
lmode(inlist) Returns a list of the modal (most common) score(s) in the passed list. | source code
lmoment(inlist, moment=1) Calculates the nth moment about the mean for a sample (defaults to the 1st moment). | source code
lvariation(inlist) Returns the coefficient of variation, as defined in CRC Standard Probability and Statistics, p.6. | source code
lskew(inlist) Returns the skewness of a distribution, as defined in Numerical Recipies (alternate defn in CRC Standard Probability and Statistics, p.6.) | source code
lkurtosis(inlist) Returns the kurtosis of a distribution, as defined in Numerical Recipies (alternate defn in CRC Standard Probability and Statistics, p.6.) | source code
ldescribe(inlist) Returns some descriptive statistics of the passed list (assumed to be 1D). | source code
litemfreq(inlist) Returns a list of pairs. | source code
lscoreatpercentile(inlist, percent) Returns the score at a given percentile relative to the distribution given by inlist. | source code
lpercentileofscore(inlist, score, histbins=10, defaultlimits=None) Returns the percentile value of a score relative to the distribution given by inlist. | source code
lhistogram(inlist, numbins=10, defaultreallimits=None, printextras=0) Returns (i) a list of histogram bin counts, (ii) the smallest value of the histogram binning, and (iii) the bin width (the last 2 are not necessarily integers). | source code
lcumfreq(inlist, numbins=10, defaultreallimits=None) Returns a cumulative frequency histogram, using the histogram function. | source code
lrelfreq(inlist, numbins=10, defaultreallimits=None) Returns a relative frequency histogram, using the histogram function. | source code
lobrientransform(*args) Computes a transform on input data (any number of columns). | source code
lsamplevar(inlist) Returns the variance of the values in the passed list using N for the denominator (i.e., DESCRIBES the sample variance only). | source code
lsamplestdev(inlist) Returns the standard deviation of the values in the passed list using N for the denominator (i.e., DESCRIBES the sample stdev only). | source code
lcov(x, y, keepdims=0) Returns the estimated covariance of the values in the passed array (i.e., N-1). | source code
lvar(inlist) Returns the variance of the values in the passed list using N-1 for the denominator (i.e., for estimating population variance). | source code
lstdev(inlist) Returns the standard deviation of the values in the passed list using N-1 in the denominator (i.e., to estimate population stdev). | source code
lsterr(inlist) Returns the standard error of the values in the passed list using N-1 in the denominator (i.e., to estimate population standard error). | source code
lsem(inlist) Returns the estimated standard error of the mean (sx-bar) of the values in the passed list. | source code
lz(inlist, score) Returns the z-score for a given input score, given that score and the list from which that score came. | source code
lzs(inlist) Returns a list of z-scores, one for each score in the passed list. | source code
ltrimboth(l, proportiontocut) Slices off the passed proportion of items from BOTH ends of the passed list (i.e., with proportiontocut=0.1, slices 'leftmost' 10% AND 'rightmost' 10% of scores. | source code
ltrim1(l, proportiontocut, tail=`'``right``'`) Slices off the passed proportion of items from ONE end of the passed list (i.e., if proportiontocut=0.1, slices off 'leftmost' or 'rightmost' 10% of scores). | source code
lpaired(x, y) Interactively determines the type of data and then runs the appropriated statistic for paired group data. | source code
lpearsonr(x, y) Calculates a Pearson correlation coefficient and the associated probability value. | source code
llincc(x, y) Calculates Lin's concordance correlation coefficient. | source code
lspearmanr(x, y) Calculates a Spearman rank-order correlation coefficient. | source code
lpointbiserialr(x, y) Calculates a point-biserial correlation coefficient and the associated probability value. | source code
lkendalltau(x, y) Calculates Kendall's tau ... | source code
llinregress(x, y) Calculates a regression line on x,y pairs. | source code
lttest_1samp(a, popmean, printit=0, name=`'``Sample``'`, writemode=`'``a``'`) Calculates the t-obtained for the independent samples T-test on ONE group of scores a, given a population mean. | source code
lttest_ind(a, b, printit=0, name1=`'``Samp1``'`, name2=`'``Samp2``'`, writemode=`'``a``'`) Calculates the t-obtained T-test on TWO INDEPENDENT samples of scores a, and b. | source code
lttest_rel(a, b, printit=0, name1=`'``Sample1``'`, name2=`'``Sample2``'`, writemode=`'``a``'`) Calculates the t-obtained T-test on TWO RELATED samples of scores, a and b. | source code
lchisquare(f_obs, f_exp=None) Calculates a one-way chi square for list of observed frequencies and returns the result. | source code
lks_2samp(data1, data2) Computes the Kolmogorov-Smirnof statistic on 2 samples. | source code
lmannwhitneyu(x, y) Calculates a Mann-Whitney U statistic on the provided scores and returns the result. | source code
ltiecorrect(rankvals) Corrects for ties in Mann Whitney U and Kruskal Wallis H tests. | source code
lranksums(x, y) Calculates the rank sums statistic on the provided scores and returns the result. | source code
lwilcoxont(x, y) Calculates the Wilcoxon T-test for related samples and returns the result. | source code
lkruskalwallish(*args) The Kruskal-Wallis H-test is a non-parametric ANOVA for 3 or more groups, requiring at least 5 subjects in each group. | source code
lfriedmanchisquare(*args) Friedman Chi-Square is a non-parametric, one-way within-subjects ANOVA. | source code
lchisqprob(chisq, df) Returns the (1-tailed) probability value associated with the provided chi-square value and df. | source code
lerfcc(x) Returns the complementary error function erfc(x) with fractional error everywhere less than 1.2e-7. | source code
lzprob(z) Returns the area under the normal curve 'to the left of' the given z value. | source code
lksprob(alam) Computes a Kolmolgorov-Smirnov t-test significance level. | source code
lfprob(dfnum, dfden, F) Returns the (1-tailed) significance level (p-value) of an F statistic given the degrees of freedom for the numerator (dfR-dfF) and the degrees of freedom for the denominator (dfF). | source code
lbetacf(a, b, x) This function evaluates the continued fraction form of the incomplete Beta function, betai. | source code
lgammln(xx) Returns the gamma function of xx. | source code
lbetai(a, b, x) Returns the incomplete beta function: | source code
lF_oneway(*lists) Performs a 1-way ANOVA, returning an F-value and probability given any number of groups. | source code
lF_value(ER, EF, dfnum, dfden) Returns an F-statistic given the following: ER = error associated with the null hypothesis (the Restricted model) EF = error associated with the alternate hypothesis (the Full model) dfR-dfF = degrees of freedom of the numerator dfF = degrees of freedom associated with the denominator/Full model | source code
writecc(listoflists, file, writetype=`'``w``'`, extra=2) Writes a list of lists to a file in columns, customized by the max size of items within the columns (max size of items in col, +2 characters) to specified file. | source code
lincr(l, cap) Simulate a counting system from an n-dimensional list. | source code
lsum(inlist) Returns the sum of the items in the passed list. | source code
lcumsum(inlist) Returns a list consisting of the cumulative sum of the items in the passed list. | source code
lss(inlist) Squares each value in the passed list, adds up these squares and returns the result. | source code
lsummult(list1, list2) Multiplies elements in list1 and list2, element by element, and returns the sum of all resulting multiplications. | source code
lsumdiffsquared(x, y) Takes pairwise differences of the values in lists x and y, squares these differences, and returns the sum of these squares. | source code
lsquare_of_sums(inlist) Adds the values in the passed list, squares the sum, and returns the result. | source code
lshellsort(inlist) Shellsort algorithm. | source code
lrankdata(inlist) Ranks the data in inlist, dealing with ties appropritely. | source code
outputpairedstats(fname, writemode, name1, n1, m1, se1, min1, max1, name2, n2, m2, se2, min2, max2, statname, stat, prob) Prints or write to a file stats for two groups, using the name, n, mean, sterr, min and max for each group, as well as the statistic name, its value, and the associated p-value. | source code
lfindwithin(data) Returns an integer representing a binary vector, where 1=within- subject factor, 0=between. | source code
ageometricmean(inarray, dimension=None, keepdims=0) Calculates the geometric mean of the values in the passed array. | source code
aharmonicmean(inarray, dimension=None, keepdims=0) Calculates the harmonic mean of the values in the passed array. | source code
amean(inarray, dimension=None, keepdims=0) Calculates the arithmatic mean of the values in the passed array. | source code
amedian(inarray, numbins=1000) Calculates the COMPUTED median value of an array of numbers, given the number of bins to use for the histogram (more bins approaches finding the precise median value of the array; default number of bins = 1000). | source code
amedianscore(inarray, dimension=None) Returns the 'middle' score of the passed array. | source code
amode(a, dimension=None) Returns an array of the modal (most common) score in the passed array. | source code
atmean(a, limits=None, inclusive=`(`1`,` 1`)`) Returns the arithmetic mean of all values in an array, ignoring values strictly outside the sequence passed to 'limits'. | source code
atvar(a, limits=None, inclusive=`(`1`,` 1`)`) Returns the sample variance of values in an array, (i.e., using N-1), ignoring values strictly outside the sequence passed to 'limits'. | source code
atmin(a, lowerlimit=None, dimension=None, inclusive=1) Returns the minimum value of a, along dimension, including only values less than (or equal to, if inclusive=1) lowerlimit. | source code
atmax(a, upperlimit, dimension=None, inclusive=1) Returns the maximum value of a, along dimension, including only values greater than (or equal to, if inclusive=1) upperlimit. | source code
atstdev(a, limits=None, inclusive=`(`1`,` 1`)`) Returns the standard deviation of all values in an array, ignoring values strictly outside the sequence passed to 'limits'. | source code
atsem(a, limits=None, inclusive=`(`1`,` 1`)`) Returns the standard error of the mean for the values in an array, (i.e., using N for the denominator), ignoring values strictly outside the sequence passed to 'limits'. | source code
amoment(a, moment=1, dimension=None) Calculates the nth moment about the mean for a sample (defaults to the 1st moment). | source code
avariation(a, dimension=None) Returns the coefficient of variation, as defined in CRC Standard Probability and Statistics, p.6. | source code
askew(a, dimension=None) Returns the skewness of a distribution (normal ==> 0.0; >0 means extra weight in left tail). | source code
akurtosis(a, dimension=None) Returns the kurtosis of a distribution (normal ==> 3.0; >3 means heavier in the tails, and usually more peaked). | source code
adescribe(inarray, dimension=None) Returns several descriptive statistics of the passed array. | source code
askewtest(a, dimension=None) Tests whether the skew is significantly different from a normal distribution. | source code
akurtosistest(a, dimension=None) Tests whether a dataset has normal kurtosis (i.e., kurtosis=3(n-1)/(n+1)) Valid only for n>20. | source code
anormaltest(a, dimension=None) Tests whether skew and/OR kurtosis of dataset differs from normal curve. | source code
aitemfreq(a) Returns a 2D array of item frequencies. | source code
ascoreatpercentile(inarray, percent) Usage: ascoreatpercentile(inarray,percent) 0<percent<100 Returns: score at given percentile, relative to inarray distribution | source code
apercentileofscore(inarray, score, histbins=10, defaultlimits=None) Note: result of this function depends on the values used to histogram the data(!). | source code
ahistogram(inarray, numbins=10, defaultlimits=None, printextras=1) Returns (i) an array of histogram bin counts, (ii) the smallest value of the histogram binning, and (iii) the bin width (the last 2 are not necessarily integers). | source code
acumfreq(a, numbins=10, defaultreallimits=None) Returns a cumulative frequency histogram, using the histogram function. | source code
arelfreq(a, numbins=10, defaultreallimits=None) Returns a relative frequency histogram, using the histogram function. | source code
aobrientransform(*args) Computes a transform on input data (any number of columns). | source code
asamplevar(inarray, dimension=None, keepdims=0) Returns the sample standard deviation of the values in the passed array (i.e., using N). | source code
asamplestdev(inarray, dimension=None, keepdims=0) Returns the sample standard deviation of the values in the passed array (i.e., using N). | source code
asignaltonoise(instack, dimension=0) Calculates signal-to-noise. | source code
acov(x, y, dimension=None, keepdims=0) Returns the estimated covariance of the values in the passed array (i.e., N-1). | source code
avar(inarray, dimension=None, keepdims=0) Returns the estimated population variance of the values in the passed array (i.e., N-1). | source code
astdev(inarray, dimension=None, keepdims=0) Returns the estimated population standard deviation of the values in the passed array (i.e., N-1). | source code
asterr(inarray, dimension=None, keepdims=0) Returns the estimated population standard error of the values in the passed array (i.e., N-1). | source code
asem(inarray, dimension=None, keepdims=0) Returns the standard error of the mean (i.e., using N) of the values in the passed array. | source code
az(a, score) Returns the z-score of a given input score, given thearray from which that score came. | source code
azs(a) Returns a 1D array of z-scores, one for each score in the passed array, computed relative to the passed array. | source code
azmap(scores, compare, dimension=0) Returns an array of z-scores the shape of scores (e.g., [x,y]), compared to array passed to compare (e.g., [time,x,y]). | source code
athreshold(a, threshmin=None, threshmax=None, newval=0) Like Numeric.clip() except that values <threshmid or >threshmax are replaced by newval instead of by threshmin/threshmax (respectively). | source code
atrimboth(a, proportiontocut) Slices off the passed proportion of items from BOTH ends of the passed array (i.e., with proportiontocut=0.1, slices 'leftmost' 10% AND 'rightmost' 10% of scores. | source code
atrim1(a, proportiontocut, tail=`'``right``'`) Slices off the passed proportion of items from ONE end of the passed array (i.e., if proportiontocut=0.1, slices off 'leftmost' or 'rightmost' 10% of scores). | source code
acovariance(X) Computes the covariance matrix of a matrix X. | source code
acorrelation(X) Computes the correlation matrix of a matrix X. | source code
apaired(x, y) Interactively determines the type of data in x and y, and then runs the appropriated statistic for paired group data. | source code
dices(x, y) Calculates Dice's coefficient ... | source code
icc(x, y=None, verbose=0) Calculates intraclass correlation coefficients using simple, Type I sums of squares. | source code
alincc(x, y) Calculates Lin's concordance correlation coefficient. | source code
apearsonr(x, y, verbose=1) Calculates a Pearson correlation coefficient and returns p. | source code
aspearmanr(x, y) Calculates a Spearman rank-order correlation coefficient. | source code
apointbiserialr(x, y) Calculates a point-biserial correlation coefficient and the associated probability value. | source code
akendalltau(x, y) Calculates Kendall's tau ... | source code
alinregress(*args) Calculates a regression line on two arrays, x and y, corresponding to x,y pairs. | source code
amasslinregress(*args) Calculates a regression line on one 1D array (x) and one N-D array (y). | source code
attest_1samp(a, popmean, printit=0, name=`'``Sample``'`, writemode=`'``a``'`) Calculates the t-obtained for the independent samples T-test on ONE group of scores a, given a population mean. | source code
attest_ind(a, b, dimension=None, printit=0, name1=`'``Samp1``'`, name2=`'``Samp2``'`, writemode=`'``a``'`) Calculates the t-obtained T-test on TWO INDEPENDENT samples of scores a, and b. | source code
ap2t(pval, df) Tries to compute a t-value from a p-value (or pval array) and associated df. | source code
attest_rel(a, b, dimension=None, printit=0, name1=`'``Samp1``'`, name2=`'``Samp2``'`, writemode=`'``a``'`) Calculates the t-obtained T-test on TWO RELATED samples of scores, a and b. | source code
achisquare(f_obs, f_exp=None) Calculates a one-way chi square for array of observed frequencies and returns the result. | source code
aks_2samp(data1, data2) Computes the Kolmogorov-Smirnof statistic on 2 samples. | source code
amannwhitneyu(x, y) Calculates a Mann-Whitney U statistic on the provided scores and returns the result. | source code
atiecorrect(rankvals) Tie-corrector for ties in Mann Whitney U and Kruskal Wallis H tests. | source code
aranksums(x, y) Calculates the rank sums statistic on the provided scores and returns the result. | source code
awilcoxont(x, y) Calculates the Wilcoxon T-test for related samples and returns the result. | source code
akruskalwallish(*args) The Kruskal-Wallis H-test is a non-parametric ANOVA for 3 or more groups, requiring at least 5 subjects in each group. | source code
afriedmanchisquare(*args) Friedman Chi-Square is a non-parametric, one-way within-subjects ANOVA. | source code
achisqprob(chisq, df) Returns the (1-tail) probability value associated with the provided chi-square value and df. | source code
aerfcc(x) Returns the complementary error function erfc(x) with fractional error everywhere less than 1.2e-7. | source code
azprob(z) Returns the area under the normal curve 'to the left of' the given z value. | source code
aksprob(alam) Returns the probability value for a K-S statistic computed via ks_2samp. | source code
afprob(dfnum, dfden, F) Returns the 1-tailed significance level (p-value) of an F statistic given the degrees of freedom for the numerator (dfR-dfF) and the degrees of freedom for the denominator (dfF). | source code
abetacf(a, b, x, verbose=1) Evaluates the continued fraction form of the incomplete Beta function, betai. | source code
agammln(xx) Returns the gamma function of xx. | source code
abetai(a, b, x, verbose=1) Returns the incomplete beta function: | source code
aglm(data, para) Calculates a linear model fit ... | source code
aF_oneway(*args) Performs a 1-way ANOVA, returning an F-value and probability given any number of groups. | source code
aF_value(ER, EF, dfR, dfF) Returns an F-statistic given the following:... | source code
outputfstats(Enum, Eden, dfnum, dfden, f, prob) | source code
F_value_multivariate(ER, EF, dfnum, dfden) Returns an F-statistic given the following: ER = error associated with the null hypothesis (the Restricted model) EF = error associated with the alternate hypothesis (the Full model) dfR = degrees of freedom the Restricted model dfF = degrees of freedom associated with the Restricted model where ER and EF are matrices from a multivariate F calculation. | source code
asign(a) Usage: asign(a) Returns: array shape of a, with -1 where a<0 and +1 where a>=0 | source code
asum(a, dimension=None, keepdims=0) An alternative to the Numeric.add.reduce function, which allows one to (1) collapse over multiple dimensions at once, and/or (2) to retain all dimensions in the original array (squashing one down to size. | source code
acumsum(a, dimension=None) Returns an array consisting of the cumulative sum of the items in the passed array. | source code
ass(inarray, dimension=None, keepdims=0) Squares each value in the passed array, adds these squares & returns the result. | source code
asummult(array1, array2, dimension=None, keepdims=0) Multiplies elements in array1 and array2, element by element, and returns the sum (along 'dimension') of all resulting multiplications. | source code
asquare_of_sums(inarray, dimension=None, keepdims=0) Adds the values in the passed array, squares that sum, and returns the result. | source code
asumdiffsquared(a, b, dimension=None, keepdims=0) Takes pairwise differences of the values in arrays a and b, squares these differences, and returns the sum of these squares. | source code
ashellsort(inarray) Shellsort algorithm. | source code
arankdata(inarray) Ranks the data in inarray, dealing with ties appropritely. | source code
afindwithin(data) Returns a binary vector, 1=within-subject factor, 0=between. | source code

Variables | [hide private]
| __VERSION__ = ``'``ete2-2.0rev95``'`` stats.py module
| geometricmean = `Dispatch((lgeometricmean, (ListType, TupleType`...``
| harmonicmean = `Dispatch((lharmonicmean, (ListType, TupleType))`...``
| mean = `Dispatch((lmean, (ListType, TupleType)), (amean, (N.nda`...``
| median = `Dispatch((lmedian, (ListType, TupleType)), (amedian, `...``
| medianscore = `Dispatch((lmedianscore, (ListType, TupleType)), `...``
| mode = `Dispatch((lmode, (ListType, TupleType)), (amode, (N.nda`...``
| tmean = `Dispatch((atmean, (N.ndarray,)))`
| tvar = `Dispatch((atvar, (N.ndarray,)))`
| tstdev = `Dispatch((atstdev, (N.ndarray,)))`
| tsem = `Dispatch((atsem, (N.ndarray,)))`
| moment = `Dispatch((lmoment, (ListType, TupleType)), (amoment, `...``
| variation = `Dispatch((lvariation, (ListType, TupleType)), (ava`...``
| skew = `Dispatch((lskew, (ListType, TupleType)), (askew, (N.nda`...``
| kurtosis = `Dispatch((lkurtosis, (ListType, TupleType)), (akurt`...``
| describe = `Dispatch((ldescribe, (ListType, TupleType)), (adesc`...``
| skewtest = `Dispatch((askewtest, (ListType, TupleType)), (askew`...``
| kurtosistest = `Dispatch((akurtosistest, (ListType, TupleType))`...``
| normaltest = `Dispatch((anormaltest, (ListType, TupleType)), (a`...``
| itemfreq = `Dispatch((litemfreq, (ListType, TupleType)), (aitem`...``
| scoreatpercentile = `Dispatch((lscoreatpercentile, (ListType, T`...``
| percentileofscore = `Dispatch((lpercentileofscore, (ListType, T`...``
| histogram = `Dispatch((lhistogram, (ListType, TupleType)), (ahi`...``
| cumfreq = `Dispatch((lcumfreq, (ListType, TupleType)), (acumfre`...``
| relfreq = `Dispatch((lrelfreq, (ListType, TupleType)), (arelfre`...``
| obrientransform = `Dispatch((lobrientransform, (ListType, Tuple`...``
| samplevar = `Dispatch((lsamplevar, (ListType, TupleType)), (asa`...``
| samplestdev = `Dispatch((lsamplestdev, (ListType, TupleType)), `...``
| signaltonoise = `Dispatch((asignaltonoise, (N.ndarray,)),)`
| var = `Dispatch((lvar, (ListType, TupleType)), (avar, (N.ndarra`...``
| stdev = `Dispatch((lstdev, (ListType, TupleType)), (astdev, (N.`...``
| sterr = `Dispatch((lsterr, (ListType, TupleType)), (asterr, (N.`...``
| sem = `Dispatch((lsem, (ListType, TupleType)), (asem, (N.ndarra`...``
| z = `Dispatch((lz, (ListType, TupleType)), (az, (N.ndarray,)))`
| zs = `Dispatch((lzs, (ListType, TupleType)), (azs, (N.ndarray,)))`
| threshold = `Dispatch((athreshold, (N.ndarray,)),)`
| trimboth = `Dispatch((ltrimboth, (ListType, TupleType)), (atrim`...``
| trim1 = `Dispatch((ltrim1, (ListType, TupleType)), (atrim1, (N.`...``
| paired = `Dispatch((lpaired, (ListType, TupleType)), (apaired, `...``
| lincc = `Dispatch((llincc, (ListType, TupleType)), (alincc, (N.`...``
| pearsonr = `Dispatch((lpearsonr, (ListType, TupleType)), (apear`...``
| spearmanr = `Dispatch((lspearmanr, (ListType, TupleType)), (asp`...``
| pointbiserialr = `Dispatch((lpointbiserialr, (ListType, TupleTy`...``
| kendalltau = `Dispatch((lkendalltau, (ListType, TupleType)), (a`...``
| linregress = `Dispatch((llinregress, (ListType, TupleType)), (a`...``
| ttest_1samp = `Dispatch((lttest_1samp, (ListType, TupleType)), `...``
| ttest_ind = `Dispatch((lttest_ind, (ListType, TupleType)), (att`...``
| ttest_rel = `Dispatch((lttest_rel, (ListType, TupleType)), (att`...``
| chisquare = `Dispatch((lchisquare, (ListType, TupleType)), (ach`...``
| ks_2samp = `Dispatch((lks_2samp, (ListType, TupleType)), (aks_2`...``
| mannwhitneyu = `Dispatch((lmannwhitneyu, (ListType, TupleType))`...``
| tiecorrect = `Dispatch((ltiecorrect, (ListType, TupleType)), (a`...``
| ranksums = `Dispatch((lranksums, (ListType, TupleType)), (arank`...``
| wilcoxont = `Dispatch((lwilcoxont, (ListType, TupleType)), (awi`...``
| kruskalwallish = `Dispatch((lkruskalwallish, (ListType, TupleTy`...``
| friedmanchisquare = `Dispatch((lfriedmanchisquare, (ListType, T`...``
| chisqprob = `Dispatch((lchisqprob, (IntType, FloatType)), (achi`...``
| zprob = `Dispatch((lzprob, (IntType, FloatType)), (azprob, (N.n`...``
| ksprob = `Dispatch((lksprob, (IntType, FloatType)), (aksprob, (`...``
| fprob = `Dispatch((lfprob, (IntType, FloatType)), (afprob, (N.n`...``
| betacf = `Dispatch((lbetacf, (IntType, FloatType)), (abetacf, (`...``
| betai = `Dispatch((lbetai, (IntType, FloatType)), (abetai, (N.n`...``
| erfcc = `Dispatch((lerfcc, (IntType, FloatType)), (aerfcc, (N.n`...``
| gammln = `Dispatch((lgammln, (IntType, FloatType)), (agammln, (`...``
| F_oneway = `Dispatch((lF_oneway, (ListType, TupleType)), (aF_on`...``
| F_value = `Dispatch((lF_value, (ListType, TupleType)), (aF_valu`...``
| incr = `Dispatch((lincr, (ListType, TupleType, N.ndarray)),)`
| sum = `Dispatch((lsum, (ListType, TupleType)), (asum, (N.ndarra`...``
| cumsum = `Dispatch((lcumsum, (ListType, TupleType)), (acumsum, `...``
| ss = `Dispatch((lss, (ListType, TupleType)), (ass, (N.ndarray,)))`
| summult = `Dispatch((lsummult, (ListType, TupleType)), (asummul`...``
| square_of_sums = `Dispatch((lsquare_of_sums, (ListType, TupleTy`...``
| sumdiffsquared = `Dispatch((lsumdiffsquared, (ListType, TupleTy`...``
| shellsort = `Dispatch((lshellsort, (ListType, TupleType)), (ash`...``
| rankdata = `Dispatch((lrankdata, (ListType, TupleType)), (arank`...``
| findwithin = `Dispatch((lfindwithin, (ListType, TupleType)), (a`...``
| __package__ = ``'``ete2.clustering``'``

Function Details | [hide private]

### lgeometricmean(inlist) | source code
Calculates the geometric mean of the values in the passed list. That is: n-th root of (x1 * x2 * ... * xn). Assumes a '1D' list. Usage: lgeometricmean(inlist)

### lharmonicmean(inlist) | source code
Calculates the harmonic mean of the values in the passed list. That is: n / (1/x1 + 1/x2 + ... + 1/xn). Assumes a '1D' list. Usage: lharmonicmean(inlist)

### lmean(inlist) | source code
Returns the arithematic mean of the values in the passed list. Assumes a '1D' list, but will function on the 1st dim of an array(!). Usage: lmean(inlist)

### lmedian(inlist, numbins=1000) | source code
Returns the computed median value of a list of numbers, given the number of bins to use for the histogram (more bins brings the computed value closer to the median score, default number of bins = 1000). See G.W. Heiman's Basic Stats (1st Edition), or CRC Probability & Statistics. Usage: lmedian (inlist, numbins=1000)

### lmedianscore(inlist) | source code
Returns the 'middle' score of the passed list. If there is an even number of scores, the mean of the 2 middle scores is returned. Usage: lmedianscore(inlist)

### lmode(inlist) | source code
Returns a list of the modal (most common) score(s) in the passed list. If there is more than one such score, all are returned. The bin-count for the mode(s) is also returned. Usage: lmode(inlist) Returns: bin-count for mode(s), a list of modal value(s)

### lmoment(inlist, moment=1) | source code
Calculates the nth moment about the mean for a sample (defaults to the 1st moment). Used to calculate coefficients of skewness and kurtosis. Usage: lmoment(inlist,moment=1) Returns: appropriate moment (r) from ... 1/n * SUM((inlist(i)-mean)**r)

### lvariation(inlist) | source code
Returns the coefficient of variation, as defined in CRC Standard Probability and Statistics, p.6. Usage: lvariation(inlist)

### lskew(inlist) | source code
Returns the skewness of a distribution, as defined in Numerical Recipies (alternate defn in CRC Standard Probability and Statistics, p.6.) Usage: lskew(inlist)

### lkurtosis(inlist) | source code
Returns the kurtosis of a distribution, as defined in Numerical Recipies (alternate defn in CRC Standard Probability and Statistics, p.6.) Usage: lkurtosis(inlist)

### ldescribe(inlist) | source code
Returns some descriptive statistics of the passed list (assumed to be 1D). Usage: ldescribe(inlist) Returns: n, mean, standard deviation, skew, kurtosis

### litemfreq(inlist) | source code
Returns a list of pairs. Each pair consists of one of the scores in inlist and it's frequency count. Assumes a 1D list is passed. Usage: litemfreq(inlist) Returns: a 2D frequency table (col [0:n-1]=scores, col n=frequencies)

### lscoreatpercentile(inlist, percent) | source code
Returns the score at a given percentile relative to the distribution given by inlist. Usage: lscoreatpercentile(inlist,percent)

### lpercentileofscore(inlist, score, histbins=10, defaultlimits=None) | source code
Returns the percentile value of a score relative to the distribution given by inlist. Formula depends on the values used to histogram the data(!). Usage: lpercentileofscore(inlist,score,histbins=10,defaultlimits=None)

### lhistogram(inlist, numbins=10, defaultreallimits=None, printextras=0) | source code
Returns (i) a list of histogram bin counts, (ii) the smallest value of the histogram binning, and (iii) the bin width (the last 2 are not necessarily integers). Default number of bins is 10. If no sequence object is given for defaultreallimits, the routine picks (usually non-pretty) bins spanning all the numbers in the inlist. Usage: lhistogram (inlist, numbins=10, defaultreallimits=None,suppressoutput=0) Returns: list of bin values, lowerreallimit, binsize, extrapoints

### lcumfreq(inlist, numbins=10, defaultreallimits=None) | source code
Returns a cumulative frequency histogram, using the histogram function. Usage: lcumfreq(inlist,numbins=10,defaultreallimits=None) Returns: list of cumfreq bin values, lowerreallimit, binsize, extrapoints

### lrelfreq(inlist, numbins=10, defaultreallimits=None) | source code
Returns a relative frequency histogram, using the histogram function. Usage: lrelfreq(inlist,numbins=10,defaultreallimits=None) Returns: list of cumfreq bin values, lowerreallimit, binsize, extrapoints

### lobrientransform(*args) | source code
Computes a transform on input data (any number of columns). Used to test for homogeneity of variance prior to running one-way stats. From Maxwell and Delaney, p.112. Usage: lobrientransform(*args) Returns: transformed data for use in an ANOVA

### lsamplevar(inlist) | source code
Returns the variance of the values in the passed list using N for the denominator (i.e., DESCRIBES the sample variance only). Usage: lsamplevar(inlist)

### lsamplestdev(inlist) | source code
Returns the standard deviation of the values in the passed list using N for the denominator (i.e., DESCRIBES the sample stdev only). Usage: lsamplestdev(inlist)

### lcov(x, y, keepdims=0) | source code
Returns the estimated covariance of the values in the passed array (i.e., N-1). Dimension can equal None (ravel array first), an integer (the dimension over which to operate), or a sequence (operate over multiple dimensions). Set keepdims=1 to return an array with the same number of dimensions as inarray. Usage: lcov(x,y,keepdims=0)

### lvar(inlist) | source code
Returns the variance of the values in the passed list using N-1 for the denominator (i.e., for estimating population variance). Usage: lvar(inlist)

### lstdev(inlist) | source code
Returns the standard deviation of the values in the passed list using N-1 in the denominator (i.e., to estimate population stdev). Usage: lstdev(inlist)

### lsterr(inlist) | source code
Returns the standard error of the values in the passed list using N-1 in the denominator (i.e., to estimate population standard error). Usage: lsterr(inlist)

### lsem(inlist) | source code
Returns the estimated standard error of the mean (sx-bar) of the values in the passed list. sem = stdev / sqrt(n) Usage: lsem(inlist)

### lz(inlist, score) | source code
Returns the z-score for a given input score, given that score and the list from which that score came. Not appropriate for population calculations. Usage: lz(inlist, score)

### lzs(inlist) | source code
Returns a list of z-scores, one for each score in the passed list. Usage: lzs(inlist)

### ltrimboth(l, proportiontocut) | source code
Slices off the passed proportion of items from BOTH ends of the passed list (i.e., with proportiontocut=0.1, slices 'leftmost' 10% AND 'rightmost' 10% of scores. Assumes list is sorted by magnitude. Slices off LESS if proportion results in a non-integer slice index (i.e., conservatively slices off proportiontocut). Usage: ltrimboth (l,proportiontocut) Returns: trimmed version of list l

### ltrim1(l, proportiontocut, tail=`'``right``'`) | source code
Slices off the passed proportion of items from ONE end of the passed list (i.e., if proportiontocut=0.1, slices off 'leftmost' or 'rightmost' 10% of scores). Slices off LESS if proportion results in a non-integer slice index (i.e., conservatively slices off proportiontocut). Usage: ltrim1 (l,proportiontocut,tail='right') or set tail='left' Returns: trimmed version of list l

### lpaired(x, y) | source code
Interactively determines the type of data and then runs the appropriated statistic for paired group data. Usage: lpaired(x,y) Returns: appropriate statistic name, value, and probability

### lpearsonr(x, y) | source code
Calculates a Pearson correlation coefficient and the associated probability value. Taken from Heiman's Basic Statistics for the Behav. Sci (2nd), p.195. Usage: lpearsonr(x,y) where x and y are equal-length lists Returns: Pearson's r value, two-tailed p-value

### llincc(x, y) | source code
Calculates Lin's concordance correlation coefficient. Usage: alincc(x,y) where x, y are equal-length arrays Returns: Lin's CC

### lspearmanr(x, y) | source code
Calculates a Spearman rank-order correlation coefficient. Taken from Heiman's Basic Statistics for the Behav. Sci (1st), p.192. Usage: lspearmanr(x,y) where x and y are equal-length lists Returns: Spearman's r, two-tailed p-value

### lpointbiserialr(x, y) | source code
Calculates a point-biserial correlation coefficient and the associated probability value. Taken from Heiman's Basic Statistics for the Behav. Sci (1st), p.194. Usage: lpointbiserialr(x,y) where x,y are equal-length lists Returns: Point-biserial r, two-tailed p-value

### lkendalltau(x, y) | source code
Calculates Kendall's tau ... correlation of ordinal data. Adapted from function kendl1 in Numerical Recipies. Needs good test-routine.@@@ Usage: lkendalltau(x,y) Returns: Kendall's tau, two-tailed p-value

### llinregress(x, y) | source code
Calculates a regression line on x,y pairs. Usage: llinregress(x,y) x,y are equal-length lists of x-y coordinates Returns: slope, intercept, r, two-tailed prob, sterr-of-estimate

### lttest_1samp(a, popmean, printit=0, name=`'``Sample``'`, writemode=`'``a``'`) | source code
Calculates the t-obtained for the independent samples T-test on ONE group of scores a, given a population mean. If printit=1, results are printed to the screen. If printit='filename', the results are output to 'filename' using the given writemode (default=append). Returns t-value, and prob. Usage: lttest_1samp(a,popmean,Name='Sample',printit=0,writemode='a') Returns: t-value, two-tailed prob

### lttest_ind(a, b, printit=0, name1=`'``Samp1``'`, name2=`'``Samp2``'`, writemode=`'``a``'`) | source code
Calculates the t-obtained T-test on TWO INDEPENDENT samples of scores a, and b. From Numerical Recipies, p.483. If printit=1, results are printed to the screen. If printit='filename', the results are output to 'filename' using the given writemode (default=append). Returns t-value, and prob. Usage: lttest_ind(a,b,printit=0,name1='Samp1',name2='Samp2',writemode='a') Returns: t-value, two-tailed prob

### lttest_rel(a, b, printit=0, name1=`'``Sample1``'`, name2=`'``Sample2``'`, writemode=`'``a``'`) | source code
Calculates the t-obtained T-test on TWO RELATED samples of scores, a and b. From Numerical Recipies, p.483. If printit=1, results are printed to the screen. If printit='filename', the results are output to 'filename' using the given writemode (default=append). Returns t-value, and prob. Usage: lttest_rel(a,b,printit=0,name1='Sample1',name2='Sample2',writemode='a') Returns: t-value, two-tailed prob

### lchisquare(f_obs, f_exp=None) | source code
Calculates a one-way chi square for list of observed frequencies and returns the result. If no expected frequencies are given, the total N is assumed to be equally distributed across all groups. Usage: lchisquare(f_obs, f_exp=None) f_obs = list of observed cell freq. Returns: chisquare-statistic, associated p-value

### lks_2samp(data1, data2) | source code
Computes the Kolmogorov-Smirnof statistic on 2 samples. From Numerical Recipies in C, page 493. Usage: lks_2samp(data1,data2) data1&2 are lists of values for 2 conditions Returns: KS D-value, associated p-value

### lmannwhitneyu(x, y) | source code
Calculates a Mann-Whitney U statistic on the provided scores and returns the result. Use only when the n in each condition is < 20 and you have 2 independent samples of ranks. NOTE: Mann-Whitney U is significant if the u-obtained is LESS THAN or equal to the critical value of U found in the tables. Equivalent to Kruskal-Wallis H with just 2 groups. Usage: lmannwhitneyu(data) Returns: u-statistic, one-tailed p-value (i.e., p(z(U)))

### ltiecorrect(rankvals) | source code
Corrects for ties in Mann Whitney U and Kruskal Wallis H tests. See Siegel, S. (1956) Nonparametric Statistics for the Behavioral Sciences. New York: McGraw-Hill. Code adapted from |Stat rankind.c code. Usage: ltiecorrect(rankvals) Returns: T correction factor for U or H

### lranksums(x, y) | source code
Calculates the rank sums statistic on the provided scores and returns the result. Use only when the n in each condition is > 20 and you have 2 independent samples of ranks. Usage: lranksums(x,y) Returns: a z-statistic, two-tailed p-value

### lwilcoxont(x, y) | source code
Calculates the Wilcoxon T-test for related samples and returns the result. A non-parametric T-test. Usage: lwilcoxont(x,y) Returns: a t-statistic, two-tail probability estimate

### lkruskalwallish(*args) | source code
The Kruskal-Wallis H-test is a non-parametric ANOVA for 3 or more groups, requiring at least 5 subjects in each group. This function calculates the Kruskal-Wallis H-test for 3 or more independent samples and returns the result. Usage: lkruskalwallish(*args) Returns: H-statistic (corrected for ties), associated p-value

### lfriedmanchisquare(*args) | source code
Friedman Chi-Square is a non-parametric, one-way within-subjects ANOVA. This function calculates the Friedman Chi-square test for repeated measures and returns the result, along with the associated probability value. It assumes 3 or more repeated measures. Only 3 levels requires a minimum of 10 subjects in the study. Four levels requires 5 subjects per level(??). Usage: lfriedmanchisquare(*args) Returns: chi-square statistic, associated p-value

### lchisqprob(chisq, df) | source code
Returns the (1-tailed) probability value associated with the provided chi-square value and df. Adapted from chisq.c in Gary Perlman's |Stat. Usage: lchisqprob(chisq,df)

### lerfcc(x) | source code
Returns the complementary error function erfc(x) with fractional error everywhere less than 1.2e-7. Adapted from Numerical Recipies. Usage: lerfcc(x)

### lzprob(z) | source code
    Returns the area under the normal curve 'to the left of' the given z value.
    Thus,
        for z<0, zprob(z) = 1-tail probability
        for z>0, 1.0-zprob(z) = 1-tail probability
        for any z, 2.0*(1.0-zprob(abs(z))) = 2-tail probability
    Adapted from z.c in Gary Perlman's |Stat.

    Usage:   lzprob(z)

### lksprob(alam) | source code
Computes a Kolmolgorov-Smirnov t-test significance level. Adapted from Numerical Recipies. Usage: lksprob(alam)

### lfprob(dfnum, dfden, F) | source code
Returns the (1-tailed) significance level (p-value) of an F statistic given the degrees of freedom for the numerator (dfR-dfF) and the degrees of freedom for the denominator (dfF). Usage: lfprob(dfnum, dfden, F) where usually dfnum=dfbn, dfden=dfwn

### lbetacf(a, b, x) | source code
This function evaluates the continued fraction form of the incomplete Beta function, betai. (Adapted from: Numerical Recipies in C.) Usage: lbetacf(a,b,x)

### lgammln(xx) | source code
    Returns the gamma function of xx.
        Gamma(z) = Integral(0,infinity) of t^(z-1)exp(-t) dt.
    (Adapted from: Numerical Recipies in C.)

    Usage:   lgammln(xx)

### lbetai(a, b, x) | source code
    Returns the incomplete beta function:

        I-sub-x(a,b) = 1/B(a,b)*(Integral(0,x) of t^(a-1)(1-t)^(b-1) dt)

    where a,b>0 and B(a,b) = G(a)*G(b)/(G(a+b)) where G(a) is the gamma
    function of a.  The continued fraction formulation is implemented here,
    using the betacf function.  (Adapted from: Numerical Recipies in C.)

    Usage:   lbetai(a,b,x)

### lF_oneway(*lists) | source code
    Performs a 1-way ANOVA, returning an F-value and probability given
    any number of groups.  From Heiman, pp.394-7.

    Usage:   F_oneway(*lists)    where *lists is any number of lists, one per
                                      treatment group
    Returns: F value, one-tailed p-value

### lF_value(ER, EF, dfnum, dfden) | source code
    Returns an F-statistic given the following:
            ER  = error associated with the null hypothesis (the Restricted model)
            EF  = error associated with the alternate hypothesis (the Full model)
            dfR-dfF = degrees of freedom of the numerator
            dfF = degrees of freedom associated with the denominator/Full model

    Usage:   lF_value(ER,EF,dfnum,dfden)

### writecc(listoflists, file, writetype=`'``w``'`, extra=2) | source code
Writes a list of lists to a file in columns, customized by the max size of items within the columns (max size of items in col, +2 characters) to specified file. File-overwrite is the default. Usage: writecc (listoflists,file,writetype='w',extra=2) Returns: None

### lincr(l, cap) | source code
Simulate a counting system from an n-dimensional list. Usage: lincr(l,cap) l=list to increment, cap=max values for each list pos'n Returns: next set of values for list l, OR -1 (if overflow)

### lsum(inlist) | source code
Returns the sum of the items in the passed list. Usage: lsum(inlist)

### lcumsum(inlist) | source code
Returns a list consisting of the cumulative sum of the items in the passed list. Usage: lcumsum(inlist)

### lss(inlist) | source code
Squares each value in the passed list, adds up these squares and returns the result. Usage: lss(inlist)

### lsummult(list1, list2) | source code
Multiplies elements in list1 and list2, element by element, and returns the sum of all resulting multiplications. Must provide equal length lists. Usage: lsummult(list1,list2)

### lsumdiffsquared(x, y) | source code
Takes pairwise differences of the values in lists x and y, squares these differences, and returns the sum of these squares. Usage: lsumdiffsquared(x,y) Returns: sum[(x[i]-y[i])**2]

### lsquare_of_sums(inlist) | source code
Adds the values in the passed list, squares the sum, and returns the result. Usage: lsquare_of_sums(inlist) Returns: sum(inlist[i])**2

### lshellsort(inlist) | source code
Shellsort algorithm. Sorts a 1D-list. Usage: lshellsort(inlist) Returns: sorted-inlist, sorting-index-vector (for original list)

### lrankdata(inlist) | source code
Ranks the data in inlist, dealing with ties appropritely. Assumes a 1D inlist. Adapted from Gary Perlman's |Stat ranksort. Usage: lrankdata(inlist) Returns: a list of length equal to inlist, containing rank scores

### outputpairedstats(fname, writemode, name1, n1, m1, se1, min1, max1, name2, n2, m2, se2, min2, max2, statname, stat, prob) | source code
    Prints or write to a file stats for two groups, using the name, n,
    mean, sterr, min and max for each group, as well as the statistic name,
    its value, and the associated p-value.

    Usage:   outputpairedstats(fname,writemode,
                               name1,n1,mean1,stderr1,min1,max1,
                               name2,n2,mean2,stderr2,min2,max2,
                               statname,stat,prob)
    Returns: None

### lfindwithin(data) | source code
Returns an integer representing a binary vector, where 1=within- subject factor, 0=between. Input equals the entire data 2D list (i.e., column 0=random factor, column -1=measured values (those two are skipped). Note: input data is in |Stat format ... a list of lists ("2D list") with one row per measured value, first column=subject identifier, last column= score, one in-between column per factor (these columns contain level designations on each factor). See also stats.anova.__doc__. Usage: lfindwithin(data) data in |Stat format

### ageometricmean(inarray, dimension=None, keepdims=0) | source code
Calculates the geometric mean of the values in the passed array. That is: n-th root of (x1 * x2 * ... * xn). Defaults to ALL values in the passed array. Use dimension=None to flatten array first. REMEMBER: if dimension=0, it collapses over dimension 0 ('rows' in a 2D array) only, and if dimension is a sequence, it collapses over all specified dimensions. If keepdims is set to 1, the resulting array will have as many dimensions as inarray, with only 1 'level' per dim that was collapsed over. Usage: ageometricmean(inarray,dimension=None,keepdims=0) Returns: geometric mean computed over dim(s) listed in dimension

### aharmonicmean(inarray, dimension=None, keepdims=0) | source code
Calculates the harmonic mean of the values in the passed array. That is: n / (1/x1 + 1/x2 + ... + 1/xn). Defaults to ALL values in the passed array. Use dimension=None to flatten array first. REMEMBER: if dimension=0, it collapses over dimension 0 ('rows' in a 2D array) only, and if dimension is a sequence, it collapses over all specified dimensions. If keepdims is set to 1, the resulting array will have as many dimensions as inarray, with only 1 'level' per dim that was collapsed over. Usage: aharmonicmean(inarray,dimension=None,keepdims=0) Returns: harmonic mean computed over dim(s) in dimension

### amean(inarray, dimension=None, keepdims=0) | source code
Calculates the arithmatic mean of the values in the passed array. That is: 1/n * (x1 + x2 + ... + xn). Defaults to ALL values in the passed array. Use dimension=None to flatten array first. REMEMBER: if dimension=0, it collapses over dimension 0 ('rows' in a 2D array) only, and if dimension is a sequence, it collapses over all specified dimensions. If keepdims is set to 1, the resulting array will have as many dimensions as inarray, with only 1 'level' per dim that was collapsed over. Usage: amean(inarray,dimension=None,keepdims=0) Returns: arithematic mean calculated over dim(s) in dimension

### amedian(inarray, numbins=1000) | source code
Calculates the COMPUTED median value of an array of numbers, given the number of bins to use for the histogram (more bins approaches finding the precise median value of the array; default number of bins = 1000). From G.W. Heiman's Basic Stats, or CRC Probability & Statistics. NOTE: THIS ROUTINE ALWAYS uses the entire passed array (flattens it first). Usage: amedian(inarray,numbins=1000) Returns: median calculated over ALL values in inarray

### amedianscore(inarray, dimension=None) | source code
Returns the 'middle' score of the passed array. If there is an even number of scores, the mean of the 2 middle scores is returned. Can function with 1D arrays, or on the FIRST dimension of 2D arrays (i.e., dimension can be None, to pre-flatten the array, or else dimension must equal 0). Usage: amedianscore(inarray,dimension=None) Returns: 'middle' score of the array, or the mean of the 2 middle scores

### amode(a, dimension=None) | source code
Returns an array of the modal (most common) score in the passed array. If there is more than one such score, ONLY THE FIRST is returned. The bin-count for the modal values is also returned. Operates on whole array (dimension=None), or on a given dimension. Usage: amode(a, dimension=None) Returns: array of bin-counts for mode(s), array of corresponding modal values

### atmean(a, limits=None, inclusive=`(`1`,` 1`)`) | source code
Returns the arithmetic mean of all values in an array, ignoring values strictly outside the sequence passed to 'limits'. Note: either limit in the sequence, or the value of limits itself, can be set to None. The inclusive list/tuple determines whether the lower and upper limiting bounds (respectively) are open/exclusive (0) or closed/inclusive (1). Usage: atmean(a,limits=None,inclusive=(1,1))

### atvar(a, limits=None, inclusive=`(`1`,` 1`)`) | source code
Returns the sample variance of values in an array, (i.e., using N-1), ignoring values strictly outside the sequence passed to 'limits'. Note: either limit in the sequence, or the value of limits itself, can be set to None. The inclusive list/tuple determines whether the lower and upper limiting bounds (respectively) are open/exclusive (0) or closed/inclusive (1). ASSUMES A FLAT ARRAY (OR ELSE PREFLATTENS). Usage: atvar(a,limits=None,inclusive=(1,1))

### atmin(a, lowerlimit=None, dimension=None, inclusive=1) | source code
Returns the minimum value of a, along dimension, including only values less than (or equal to, if inclusive=1) lowerlimit. If the limit is set to None, all values in the array are used. Usage: atmin(a,lowerlimit=None,dimension=None,inclusive=1)

### atmax(a, upperlimit, dimension=None, inclusive=1) | source code
Returns the maximum value of a, along dimension, including only values greater than (or equal to, if inclusive=1) upperlimit. If the limit is set to None, a limit larger than the max value in the array is used. Usage: atmax(a,upperlimit,dimension=None,inclusive=1)

### atstdev(a, limits=None, inclusive=`(`1`,` 1`)`) | source code
Returns the standard deviation of all values in an array, ignoring values strictly outside the sequence passed to 'limits'. Note: either limit in the sequence, or the value of limits itself, can be set to None. The inclusive list/tuple determines whether the lower and upper limiting bounds (respectively) are open/exclusive (0) or closed/inclusive (1). Usage: atstdev(a,limits=None,inclusive=(1,1))

### atsem(a, limits=None, inclusive=`(`1`,` 1`)`) | source code
Returns the standard error of the mean for the values in an array, (i.e., using N for the denominator), ignoring values strictly outside the sequence passed to 'limits'. Note: either limit in the sequence, or the value of limits itself, can be set to None. The inclusive list/tuple determines whether the lower and upper limiting bounds (respectively) are open/exclusive (0) or closed/inclusive (1). Usage: atsem(a,limits=None,inclusive=(1,1))

### amoment(a, moment=1, dimension=None) | source code
Calculates the nth moment about the mean for a sample (defaults to the 1st moment). Generally used to calculate coefficients of skewness and kurtosis. Dimension can equal None (ravel array first), an integer (the dimension over which to operate), or a sequence (operate over multiple dimensions). Usage: amoment(a,moment=1,dimension=None) Returns: appropriate moment along given dimension

### avariation(a, dimension=None) | source code
Returns the coefficient of variation, as defined in CRC Standard Probability and Statistics, p.6. Dimension can equal None (ravel array first), an integer (the dimension over which to operate), or a sequence (operate over multiple dimensions). Usage: avariation(a,dimension=None)

### askew(a, dimension=None) | source code
Returns the skewness of a distribution (normal ==> 0.0; >0 means extra weight in left tail). Use askewtest() to see if it's close enough. Dimension can equal None (ravel array first), an integer (the dimension over which to operate), or a sequence (operate over multiple dimensions). Usage: askew(a, dimension=None) Returns: skew of vals in a along dimension, returning ZERO where all vals equal

### akurtosis(a, dimension=None) | source code
Returns the kurtosis of a distribution (normal ==> 3.0; >3 means heavier in the tails, and usually more peaked). Use akurtosistest() to see if it's close enough. Dimension can equal None (ravel array first), an integer (the dimension over which to operate), or a sequence (operate over multiple dimensions). Usage: akurtosis(a,dimension=None) Returns: kurtosis of values in a along dimension, and ZERO where all vals equal

### adescribe(inarray, dimension=None) | source code
Returns several descriptive statistics of the passed array. Dimension can equal None (ravel array first), an integer (the dimension over which to operate), or a sequence (operate over multiple dimensions). Usage: adescribe(inarray,dimension=None) Returns: n, (min,max), mean, standard deviation, skew, kurtosis

### askewtest(a, dimension=None) | source code
Tests whether the skew is significantly different from a normal distribution. Dimension can equal None (ravel array first), an integer (the dimension over which to operate), or a sequence (operate over multiple dimensions). Usage: askewtest(a,dimension=None) Returns: z-score and 2-tail z-probability

### akurtosistest(a, dimension=None) | source code
Tests whether a dataset has normal kurtosis (i.e., kurtosis=3(n-1)/(n+1)) Valid only for n>20. Dimension can equal None (ravel array first), an integer (the dimension over which to operate), or a sequence (operate over multiple dimensions). Usage: akurtosistest(a,dimension=None) Returns: z-score and 2-tail z-probability, returns 0 for bad pixels

### anormaltest(a, dimension=None) | source code
Tests whether skew and/OR kurtosis of dataset differs from normal curve. Can operate over multiple dimensions. Dimension can equal None (ravel array first), an integer (the dimension over which to operate), or a sequence (operate over multiple dimensions). Usage: anormaltest(a,dimension=None) Returns: z-score and 2-tail probability

### aitemfreq(a) | source code
Returns a 2D array of item frequencies. Column 1 contains item values, column 2 contains their respective counts. Assumes a 1D array is passed. @@@sorting OK? Usage: aitemfreq(a) Returns: a 2D frequency table (col [0:n-1]=scores, col n=frequencies)

### apercentileofscore(inarray, score, histbins=10, defaultlimits=None) | source code
Note: result of this function depends on the values used to histogram the data(!). Usage: apercentileofscore(inarray,score,histbins=10,defaultlimits=None) Returns: percentile-position of score (0-100) relative to inarray

### ahistogram(inarray, numbins=10, defaultlimits=None, printextras=1) | source code
Returns (i) an array of histogram bin counts, (ii) the smallest value of the histogram binning, and (iii) the bin width (the last 2 are not necessarily integers). Default number of bins is 10. Defaultlimits can be None (the routine picks bins spanning all the numbers in the inarray) or a 2-sequence (lowerlimit, upperlimit). Returns all of the following: array of bin values, lowerreallimit, binsize, extrapoints. Usage: ahistogram(inarray,numbins=10,defaultlimits=None,printextras=1) Returns: (array of bin counts, bin-minimum, min-width, #-points-outside-range)

### acumfreq(a, numbins=10, defaultreallimits=None) | source code
Returns a cumulative frequency histogram, using the histogram function. Defaultreallimits can be None (use all data), or a 2-sequence containing lower and upper limits on values to include. Usage: acumfreq(a,numbins=10,defaultreallimits=None) Returns: array of cumfreq bin values, lowerreallimit, binsize, extrapoints

### arelfreq(a, numbins=10, defaultreallimits=None) | source code
Returns a relative frequency histogram, using the histogram function. Defaultreallimits can be None (use all data), or a 2-sequence containing lower and upper limits on values to include. Usage: arelfreq(a,numbins=10,defaultreallimits=None) Returns: array of cumfreq bin values, lowerreallimit, binsize, extrapoints

### aobrientransform(*args) | source code
Computes a transform on input data (any number of columns). Used to test for homogeneity of variance prior to running one-way stats. Each array in *args is one level of a factor. If an F_oneway() run on the transformed data and found significant, variances are unequal. From Maxwell and Delaney, p.112. Usage: aobrientransform(*args) *args = 1D arrays, one per level of factor Returns: transformed data for use in an ANOVA

### asamplevar(inarray, dimension=None, keepdims=0) | source code
Returns the sample standard deviation of the values in the passed array (i.e., using N). Dimension can equal None (ravel array first), an integer (the dimension over which to operate), or a sequence (operate over multiple dimensions). Set keepdims=1 to return an array with the same number of dimensions as inarray. Usage: asamplevar(inarray,dimension=None,keepdims=0)

### asamplestdev(inarray, dimension=None, keepdims=0) | source code
Returns the sample standard deviation of the values in the passed array (i.e., using N). Dimension can equal None (ravel array first), an integer (the dimension over which to operate), or a sequence (operate over multiple dimensions). Set keepdims=1 to return an array with the same number of dimensions as inarray. Usage: asamplestdev(inarray,dimension=None,keepdims=0)

### asignaltonoise(instack, dimension=0) | source code
    Calculates signal-to-noise.  Dimension can equal None (ravel array
    first), an integer (the dimension over which to operate), or a
    sequence (operate over multiple dimensions).

    Usage:   asignaltonoise(instack,dimension=0):
    Returns: array containing the value of (mean/stdev) along dimension,
             or 0 when stdev=0

### acov(x, y, dimension=None, keepdims=0) | source code
Returns the estimated covariance of the values in the passed array (i.e., N-1). Dimension can equal None (ravel array first), an integer (the dimension over which to operate), or a sequence (operate over multiple dimensions). Set keepdims=1 to return an array with the same number of dimensions as inarray. Usage: acov(x,y,dimension=None,keepdims=0)

### avar(inarray, dimension=None, keepdims=0) | source code
Returns the estimated population variance of the values in the passed array (i.e., N-1). Dimension can equal None (ravel array first), an integer (the dimension over which to operate), or a sequence (operate over multiple dimensions). Set keepdims=1 to return an array with the same number of dimensions as inarray. Usage: avar(inarray,dimension=None,keepdims=0)

### astdev(inarray, dimension=None, keepdims=0) | source code
Returns the estimated population standard deviation of the values in the passed array (i.e., N-1). Dimension can equal None (ravel array first), an integer (the dimension over which to operate), or a sequence (operate over multiple dimensions). Set keepdims=1 to return an array with the same number of dimensions as inarray. Usage: astdev(inarray,dimension=None,keepdims=0)

### asterr(inarray, dimension=None, keepdims=0) | source code
Returns the estimated population standard error of the values in the passed array (i.e., N-1). Dimension can equal None (ravel array first), an integer (the dimension over which to operate), or a sequence (operate over multiple dimensions). Set keepdims=1 to return an array with the same number of dimensions as inarray. Usage: asterr(inarray,dimension=None,keepdims=0)

### asem(inarray, dimension=None, keepdims=0) | source code
Returns the standard error of the mean (i.e., using N) of the values in the passed array. Dimension can equal None (ravel array first), an integer (the dimension over which to operate), or a sequence (operate over multiple dimensions). Set keepdims=1 to return an array with the same number of dimensions as inarray. Usage: asem(inarray,dimension=None, keepdims=0)

### az(a, score) | source code
Returns the z-score of a given input score, given thearray from which that score came. Not appropriate for population calculations, nor for arrays > 1D. Usage: az(a, score)

### azs(a) | source code
Returns a 1D array of z-scores, one for each score in the passed array, computed relative to the passed array. Usage: azs(a)

### azmap(scores, compare, dimension=0) | source code
Returns an array of z-scores the shape of scores (e.g., [x,y]), compared to array passed to compare (e.g., [time,x,y]). Assumes collapsing over dim 0 of the compare array. Usage: azs(scores, compare, dimension=0)

### athreshold(a, threshmin=None, threshmax=None, newval=0) | source code
Like Numeric.clip() except that values <threshmid or >threshmax are replaced by newval instead of by threshmin/threshmax (respectively). Usage: athreshold(a,threshmin=None,threshmax=None,newval=0) Returns: a, with values <threshmin or >threshmax replaced with newval

### atrimboth(a, proportiontocut) | source code
Slices off the passed proportion of items from BOTH ends of the passed array (i.e., with proportiontocut=0.1, slices 'leftmost' 10% AND 'rightmost' 10% of scores. You must pre-sort the array if you want "proper" trimming. Slices off LESS if proportion results in a non-integer slice index (i.e., conservatively slices off proportiontocut). Usage: atrimboth (a,proportiontocut) Returns: trimmed version of array a

### atrim1(a, proportiontocut, tail=`'``right``'`) | source code
Slices off the passed proportion of items from ONE end of the passed array (i.e., if proportiontocut=0.1, slices off 'leftmost' or 'rightmost' 10% of scores). Slices off LESS if proportion results in a non-integer slice index (i.e., conservatively slices off proportiontocut). Usage: atrim1(a,proportiontocut,tail='right') or set tail='left' Returns: trimmed version of array a

### acovariance(X) | source code
Computes the covariance matrix of a matrix X. Requires a 2D matrix input. Usage: acovariance(X) Returns: covariance matrix of X

### acorrelation(X) | source code
Computes the correlation matrix of a matrix X. Requires a 2D matrix input. Usage: acorrelation(X) Returns: correlation matrix of X

### apaired(x, y) | source code
Interactively determines the type of data in x and y, and then runs the appropriated statistic for paired group data. Usage: apaired(x,y) x,y = the two arrays of values to be compared Returns: appropriate statistic name, value, and probability

### dices(x, y) | source code
Calculates Dice's coefficient ... (2*number of common terms)/(number of terms in x + number of terms in y). Returns a value between 0 (orthogonal) and 1. Usage: dices(x,y)

### icc(x, y=None, verbose=0) | source code
Calculates intraclass correlation coefficients using simple, Type I sums of squares. If only one variable is passed, assumed it's an Nx2 matrix Usage: icc(x,y=None,verbose=0) Returns: icc rho, prob ####PROB IS A GUESS BASED ON PEARSON

### alincc(x, y) | source code
Calculates Lin's concordance correlation coefficient. Usage: alincc(x,y) where x, y are equal-length arrays Returns: Lin's CC

### apearsonr(x, y, verbose=1) | source code
Calculates a Pearson correlation coefficient and returns p. Taken from Heiman's Basic Statistics for the Behav. Sci (2nd), p.195. Usage: apearsonr(x,y,verbose=1) where x,y are equal length arrays Returns: Pearson's r, two-tailed p-value

### aspearmanr(x, y) | source code
Calculates a Spearman rank-order correlation coefficient. Taken from Heiman's Basic Statistics for the Behav. Sci (1st), p.192. Usage: aspearmanr(x,y) where x,y are equal-length arrays Returns: Spearman's r, two-tailed p-value

### apointbiserialr(x, y) | source code
Calculates a point-biserial correlation coefficient and the associated probability value. Taken from Heiman's Basic Statistics for the Behav. Sci (1st), p.194. Usage: apointbiserialr(x,y) where x,y are equal length arrays Returns: Point-biserial r, two-tailed p-value

### akendalltau(x, y) | source code
Calculates Kendall's tau ... correlation of ordinal data. Adapted from function kendl1 in Numerical Recipies. Needs good test-cases.@@@ Usage: akendalltau(x,y) Returns: Kendall's tau, two-tailed p-value

### alinregress(*args) | source code
Calculates a regression line on two arrays, x and y, corresponding to x,y pairs. If a single 2D array is passed, alinregress finds dim with 2 levels and splits data into x,y pairs along that dim. Usage: alinregress(*args) args=2 equal-length arrays, or one 2D array Returns: slope, intercept, r, two-tailed prob, sterr-of-the-estimate, n

### amasslinregress(*args) | source code
Calculates a regression line on one 1D array (x) and one N-D array (y). Returns: slope, intercept, r, two-tailed prob, sterr-of-the-estimate, n

### attest_1samp(a, popmean, printit=0, name=`'``Sample``'`, writemode=`'``a``'`) | source code
Calculates the t-obtained for the independent samples T-test on ONE group of scores a, given a population mean. If printit=1, results are printed to the screen. If printit='filename', the results are output to 'filename' using the given writemode (default=append). Returns t-value, and prob. Usage: attest_1samp(a,popmean,Name='Sample',printit=0,writemode='a') Returns: t-value, two-tailed prob

### attest_ind(a, b, dimension=None, printit=0, name1=`'``Samp1``'`, name2=`'``Samp2``'`, writemode=`'``a``'`) | source code
    Calculates the t-obtained T-test on TWO INDEPENDENT samples of scores
    a, and b.  From Numerical Recipies, p.483.  If printit=1, results are
    printed to the screen.  If printit='filename', the results are output
    to 'filename' using the given writemode (default=append).  Dimension
    can equal None (ravel array first), or an integer (the dimension over
    which to operate on a and b).

    Usage:   attest_ind (a,b,dimension=None,printit=0,
                         Name1='Samp1',Name2='Samp2',writemode='a')
    Returns: t-value, two-tailed p-value

### ap2t(pval, df) | source code
Tries to compute a t-value from a p-value (or pval array) and associated df. SLOW for large numbers of elements(!) as it re-computes p-values 20 times (smaller step-sizes) at which point it decides it's done. Keeps the signs of the input array. Returns 1000 (or -1000) if t>100. Usage: ap2t(pval,df) Returns: an array of t-values with the shape of pval

### attest_rel(a, b, dimension=None, printit=0, name1=`'``Samp1``'`, name2=`'``Samp2``'`, writemode=`'``a``'`) | source code
    Calculates the t-obtained T-test on TWO RELATED samples of scores, a
    and b.  From Numerical Recipies, p.483.  If printit=1, results are
    printed to the screen.  If printit='filename', the results are output
    to 'filename' using the given writemode (default=append).  Dimension
    can equal None (ravel array first), or an integer (the dimension over
    which to operate on a and b).

    Usage:   attest_rel(a,b,dimension=None,printit=0,
                        name1='Samp1',name2='Samp2',writemode='a')
    Returns: t-value, two-tailed p-value

### achisquare(f_obs, f_exp=None) | source code
Calculates a one-way chi square for array of observed frequencies and returns the result. If no expected frequencies are given, the total N is assumed to be equally distributed across all groups. @@@NOT RIGHT?? Usage: achisquare(f_obs, f_exp=None) f_obs = array of observed cell freq. Returns: chisquare-statistic, associated p-value

### aks_2samp(data1, data2) | source code
Computes the Kolmogorov-Smirnof statistic on 2 samples. Modified from Numerical Recipies in C, page 493. Returns KS D-value, prob. Not ufunc- like. Usage: aks_2samp(data1,data2) where data1 and data2 are 1D arrays Returns: KS D-value, p-value

### amannwhitneyu(x, y) | source code
Calculates a Mann-Whitney U statistic on the provided scores and returns the result. Use only when the n in each condition is < 20 and you have 2 independent samples of ranks. REMEMBER: Mann-Whitney U is significant if the u-obtained is LESS THAN or equal to the critical value of U. Usage: amannwhitneyu(x,y) where x,y are arrays of values for 2 conditions Returns: u-statistic, one-tailed p-value (i.e., p(z(U)))

### atiecorrect(rankvals) | source code
Tie-corrector for ties in Mann Whitney U and Kruskal Wallis H tests. See Siegel, S. (1956) Nonparametric Statistics for the Behavioral Sciences. New York: McGraw-Hill. Code adapted from |Stat rankind.c code. Usage: atiecorrect(rankvals) Returns: T correction factor for U or H

### aranksums(x, y) | source code
Calculates the rank sums statistic on the provided scores and returns the result. Usage: aranksums(x,y) where x,y are arrays of values for 2 conditions Returns: z-statistic, two-tailed p-value

### awilcoxont(x, y) | source code
Calculates the Wilcoxon T-test for related samples and returns the result. A non-parametric T-test. Usage: awilcoxont(x,y) where x,y are equal-length arrays for 2 conditions Returns: t-statistic, two-tailed p-value

### akruskalwallish(*args) | source code
The Kruskal-Wallis H-test is a non-parametric ANOVA for 3 or more groups, requiring at least 5 subjects in each group. This function calculates the Kruskal-Wallis H and associated p-value for 3 or more independent samples. Usage: akruskalwallish(*args) args are separate arrays for 3+ conditions Returns: H-statistic (corrected for ties), associated p-value

### afriedmanchisquare(*args) | source code
Friedman Chi-Square is a non-parametric, one-way within-subjects ANOVA. This function calculates the Friedman Chi-square test for repeated measures and returns the result, along with the associated probability value. It assumes 3 or more repeated measures. Only 3 levels requires a minimum of 10 subjects in the study. Four levels requires 5 subjects per level(??). Usage: afriedmanchisquare(*args) args are separate arrays for 2+ conditions Returns: chi-square statistic, associated p-value

### achisqprob(chisq, df) | source code
Returns the (1-tail) probability value associated with the provided chi-square value and df. Heavily modified from chisq.c in Gary Perlman's |Stat. Can handle multiple dimensions. Usage: achisqprob(chisq,df) chisq=chisquare stat., df=degrees of freedom

### aerfcc(x) | source code
Returns the complementary error function erfc(x) with fractional error everywhere less than 1.2e-7. Adapted from Numerical Recipies. Can handle multiple dimensions. Usage: aerfcc(x)

### azprob(z) | source code
    Returns the area under the normal curve 'to the left of' the given z value.
    Thus,
        for z<0, zprob(z) = 1-tail probability
        for z>0, 1.0-zprob(z) = 1-tail probability
        for any z, 2.0*(1.0-zprob(abs(z))) = 2-tail probability
    Adapted from z.c in Gary Perlman's |Stat.  Can handle multiple dimensions.

    Usage:   azprob(z)    where z is a z-value

### aksprob(alam) | source code
Returns the probability value for a K-S statistic computed via ks_2samp. Adapted from Numerical Recipies. Can handle multiple dimensions. Usage: aksprob(alam)

### afprob(dfnum, dfden, F) | source code
Returns the 1-tailed significance level (p-value) of an F statistic given the degrees of freedom for the numerator (dfR-dfF) and the degrees of freedom for the denominator (dfF). Can handle multiple dims for F. Usage: afprob(dfnum, dfden, F) where usually dfnum=dfbn, dfden=dfwn

### abetacf(a, b, x, verbose=1) | source code
Evaluates the continued fraction form of the incomplete Beta function, betai. (Adapted from: Numerical Recipies in C.) Can handle multiple dimensions for x. Usage: abetacf(a,b,x,verbose=1)

### agammln(xx) | source code
    Returns the gamma function of xx.
        Gamma(z) = Integral(0,infinity) of t^(z-1)exp(-t) dt.
    Adapted from: Numerical Recipies in C.  Can handle multiple dims ... but
    probably doesn't normally have to.

    Usage:   agammln(xx)

### abetai(a, b, x, verbose=1) | source code
    Returns the incomplete beta function:

        I-sub-x(a,b) = 1/B(a,b)*(Integral(0,x) of t^(a-1)(1-t)^(b-1) dt)

    where a,b>0 and B(a,b) = G(a)*G(b)/(G(a+b)) where G(a) is the gamma
    function of a.  The continued fraction formulation is implemented
    here, using the betacf function.  (Adapted from: Numerical Recipies in
    C.)  Can handle multiple dimensions.

    Usage:   abetai(a,b,x,verbose=1)

### aglm(data, para) | source code
    Calculates a linear model fit ... anova/ancova/lin-regress/t-test/etc. Taken
    from:
        Peterson et al. Statistical limitations in functional neuroimaging
        I. Non-inferential methods and statistical models.  Phil Trans Royal Soc
        Lond B 354: 1239-1260.

    Usage:   aglm(data,para)
    Returns: statistic, p-value ???

### aF_oneway(*args) | source code
    Performs a 1-way ANOVA, returning an F-value and probability given
    any number of groups.  From Heiman, pp.394-7.

    Usage:   aF_oneway (*args)    where *args is 2 or more arrays, one per
                                      treatment group
    Returns: f-value, probability

### aF_value(ER, EF, dfR, dfF) | source code
    Returns an F-statistic given the following:
            ER  = error associated with the null hypothesis (the Restricted model)
            EF  = error associated with the alternate hypothesis (the Full model)
            dfR = degrees of freedom the Restricted model
            dfF = degrees of freedom associated with the Restricted model

### asum(a, dimension=None, keepdims=0) | source code
An alternative to the Numeric.add.reduce function, which allows one to (1) collapse over multiple dimensions at once, and/or (2) to retain all dimensions in the original array (squashing one down to size. Dimension can equal None (ravel array first), an integer (the dimension over which to operate), or a sequence (operate over multiple dimensions). If keepdims=1, the resulting array will have as many dimensions as the input array. Usage: asum(a, dimension=None, keepdims=0) Returns: array summed along 'dimension'(s), same _number_ of dims if keepdims=1

### acumsum(a, dimension=None) | source code
Returns an array consisting of the cumulative sum of the items in the passed array. Dimension can equal None (ravel array first), an integer (the dimension over which to operate), or a sequence (operate over multiple dimensions, but this last one just barely makes sense). Usage: acumsum(a,dimension=None)

### ass(inarray, dimension=None, keepdims=0) | source code
Squares each value in the passed array, adds these squares & returns the result. Unfortunate function name. :-) Defaults to ALL values in the array. Dimension can equal None (ravel array first), an integer (the dimension over which to operate), or a sequence (operate over multiple dimensions). Set keepdims=1 to maintain the original number of dimensions. Usage: ass(inarray, dimension=None, keepdims=0) Returns: sum-along-'dimension' for (inarray*inarray)

### asummult(array1, array2, dimension=None, keepdims=0) | source code
Multiplies elements in array1 and array2, element by element, and returns the sum (along 'dimension') of all resulting multiplications. Dimension can equal None (ravel array first), an integer (the dimension over which to operate), or a sequence (operate over multiple dimensions). A trivial function, but included for completeness. Usage: asummult(array1,array2,dimension=None,keepdims=0)

### asquare_of_sums(inarray, dimension=None, keepdims=0) | source code
Adds the values in the passed array, squares that sum, and returns the result. Dimension can equal None (ravel array first), an integer (the dimension over which to operate), or a sequence (operate over multiple dimensions). If keepdims=1, the returned array will have the same NUMBER of dimensions as the original. Usage: asquare_of_sums(inarray, dimension=None, keepdims=0) Returns: the square of the sum over dim(s) in dimension

### asumdiffsquared(a, b, dimension=None, keepdims=0) | source code
Takes pairwise differences of the values in arrays a and b, squares these differences, and returns the sum of these squares. Dimension can equal None (ravel array first), an integer (the dimension over which to operate), or a sequence (operate over multiple dimensions). keepdims=1 means the return shape = len(a.shape) = len(b.shape) Usage: asumdiffsquared(a,b) Returns: sum[ravel(a-b)**2]

### ashellsort(inarray) | source code
Shellsort algorithm. Sorts a 1D-array. Usage: ashellsort(inarray) Returns: sorted-inarray, sorting-index-vector (for original array)

### arankdata(inarray) | source code
Ranks the data in inarray, dealing with ties appropritely. Assumes a 1D inarray. Adapted from Gary Perlman's |Stat ranksort. Usage: arankdata(inarray) Returns: array of length equal to inarray, containing rank scores

### afindwithin(data) | source code
Returns a binary vector, 1=within-subject factor, 0=between. Input equals the entire data array (i.e., column 1=random factor, last column = measured values. Usage: afindwithin(data) data in |Stat format

Variables Details | [hide private]

### __VERSION__
    stats.py module

    (Requires pstat.py module.)

    #################################################
    #######  Written by:  Gary Strangman  ###########
    #######  Last modified:  Dec 18, 2007 ###########
    #################################################

    A collection of basic statistical functions for python.  The function
    names appear below.

    IMPORTANT:  There are really *3* sets of functions.  The first set has an 'l'
    prefix, which can be used with list or tuple arguments.  The second set has
    an 'a' prefix, which can accept NumPy array arguments.  These latter
    functions are defined only when NumPy is available on the system.  The third
    type has NO prefix (i.e., has the name that appears below).  Functions of
    this set are members of a "Dispatch" class, c/o David Ascher.  This class
    allows different functions to be called depending on the type of the passed
    arguments.  Thus, stats.mean is a member of the Dispatch class and
    stats.mean(range(20)) will call stats.lmean(range(20)) while
    stats.mean(Numeric.arange(20)) will call stats.amean(Numeric.arange(20)).
    This is a handy way to keep consistent function names when different
    argument types require different functions to be called.  Having
    implementated the Dispatch class, however, means that to get info on
    a given function, you must use the REAL function name ... that is
    "print stats.lmean.__doc__" or "print stats.amean.__doc__" work fine,
    while "print stats.mean.__doc__" will print the doc for the Dispatch
    class.  NUMPY FUNCTIONS ('a' prefix) generally have more argument options
    but should otherwise be consistent with the corresponding list functions.

    Disclaimers:  The function list is obviously incomplete and, worse, the
    functions are not optimized.  All functions have been tested (some more
    so than others), but they are far from bulletproof.  Thus, as with any
    free software, no warranty or guarantee is expressed or implied. :-)  A
    few extra functions that don't appear in the list below can be found by
    interested treasure-hunters.  These functions don't necessarily have
    both list and array versions but were deemed useful

    CENTRAL TENDENCY:  geometricmean
                       harmonicmean
                       mean
                       median
                       medianscore
                       mode

    MOMENTS:  moment
              variation
              skew
              kurtosis
              skewtest   (for Numpy arrays only)
              kurtosistest (for Numpy arrays only)
              normaltest (for Numpy arrays only)

    ALTERED VERSIONS:  tmean  (for Numpy arrays only)
                       tvar   (for Numpy arrays only)
                       tmin   (for Numpy arrays only)
                       tmax   (for Numpy arrays only)
                       tstdev (for Numpy arrays only)
                       tsem   (for Numpy arrays only)
                       describe

    FREQUENCY STATS:  itemfreq
                      scoreatpercentile
                      percentileofscore
                      histogram
                      cumfreq
                      relfreq

    VARIABILITY:  obrientransform
                  samplevar
                  samplestdev
                  signaltonoise (for Numpy arrays only)
                  var
                  stdev
                  sterr
                  sem
                  z
                  zs
                  zmap (for Numpy arrays only)

    TRIMMING FCNS:  threshold (for Numpy arrays only)
                    trimboth
                    trim1
                    round (round all vals to 'n' decimals; Numpy only)

    CORRELATION FCNS:  covariance  (for Numpy arrays only)
                       correlation (for Numpy arrays only)
                       paired
                       pearsonr
                       spearmanr
                       pointbiserialr
                       kendalltau
                       linregress

    INFERENTIAL STATS:  ttest_1samp
                        ttest_ind
                        ttest_rel
                        chisquare
                        ks_2samp
                        mannwhitneyu
                        ranksums
                        wilcoxont
                        kruskalwallish
                        friedmanchisquare

    PROBABILITY CALCS:  chisqprob
                        erfcc
                        zprob
                        ksprob
                        fprob
                        betacf
                        gammln
                        betai

    ANOVA FUNCTIONS:  F_oneway
                      F_value

    SUPPORT FUNCTIONS:  writecc
                        incr
                        sign  (for Numpy arrays only)
                        sum
                        cumsum
                        ss
                        summult
                        sumdiffsquared
                        square_of_sums
                        shellsort
                        rankdata
                        outputpairedstats
                        findwithin
  Value:
      'ete2-2.0rev95'

  ### geometricmean Value:
      Dispatch((lgeometricmean, (ListType, TupleType)), (ageometricmean, (N.
      ndarray,)))

  ### harmonicmean Value:
      Dispatch((lharmonicmean, (ListType, TupleType)), (aharmonicmean, (N.nd
      array,)))

  ### mean Value:
      Dispatch((lmean, (ListType, TupleType)), (amean, (N.ndarray,)))

  ### median Value:
      Dispatch((lmedian, (ListType, TupleType)), (amedian, (N.ndarray,)))

  ### medianscore Value:
      Dispatch((lmedianscore, (ListType, TupleType)), (amedianscore, (N.ndar
      ray,)))

  ### mode Value:
      Dispatch((lmode, (ListType, TupleType)), (amode, (N.ndarray,)))

  ### moment Value:
      Dispatch((lmoment, (ListType, TupleType)), (amoment, (N.ndarray,)))

  ### variation Value:
      Dispatch((lvariation, (ListType, TupleType)), (avariation, (N.ndarray,
      )))

  ### skew Value:
      Dispatch((lskew, (ListType, TupleType)), (askew, (N.ndarray,)))

  ### kurtosis Value:
      Dispatch((lkurtosis, (ListType, TupleType)), (akurtosis, (N.ndarray,))
      )

  ### describe Value:
      Dispatch((ldescribe, (ListType, TupleType)), (adescribe, (N.ndarray,))
      )

  ### skewtest Value:
      Dispatch((askewtest, (ListType, TupleType)), (askewtest, (N.ndarray,))
      )

  ### kurtosistest Value:
      Dispatch((akurtosistest, (ListType, TupleType)), (akurtosistest, (N.nd
      array,)))

  ### normaltest Value:
      Dispatch((anormaltest, (ListType, TupleType)), (anormaltest, (N.ndarra
      y,)))

  ### itemfreq Value:
      Dispatch((litemfreq, (ListType, TupleType)), (aitemfreq, (N.ndarray,))
      )

  ### scoreatpercentile Value:
      Dispatch((lscoreatpercentile, (ListType, TupleType)), (ascoreatpercent
      ile, (N.ndarray,)))

  ### percentileofscore Value:
      Dispatch((lpercentileofscore, (ListType, TupleType)), (apercentileofsc
      ore, (N.ndarray,)))

  ### histogram Value:
      Dispatch((lhistogram, (ListType, TupleType)), (ahistogram, (N.ndarray,
      )))

  ### cumfreq Value:
      Dispatch((lcumfreq, (ListType, TupleType)), (acumfreq, (N.ndarray,)))

  ### relfreq Value:
      Dispatch((lrelfreq, (ListType, TupleType)), (arelfreq, (N.ndarray,)))

  ### obrientransform Value:
      Dispatch((lobrientransform, (ListType, TupleType)), (aobrientransform,
       (N.ndarray,)))

  ### samplevar Value:
      Dispatch((lsamplevar, (ListType, TupleType)), (asamplevar, (N.ndarray,
      )))

  ### samplestdev Value:
      Dispatch((lsamplestdev, (ListType, TupleType)), (asamplestdev, (N.ndar
      ray,)))

  ### var Value:
      Dispatch((lvar, (ListType, TupleType)), (avar, (N.ndarray,)))

  ### stdev Value:
      Dispatch((lstdev, (ListType, TupleType)), (astdev, (N.ndarray,)))

  ### sterr Value:
      Dispatch((lsterr, (ListType, TupleType)), (asterr, (N.ndarray,)))

  ### sem Value:
      Dispatch((lsem, (ListType, TupleType)), (asem, (N.ndarray,)))

  ### trimboth Value:
      Dispatch((ltrimboth, (ListType, TupleType)), (atrimboth, (N.ndarray,))
      )

  ### trim1 Value:
      Dispatch((ltrim1, (ListType, TupleType)), (atrim1, (N.ndarray,)))

  ### paired Value:
      Dispatch((lpaired, (ListType, TupleType)), (apaired, (N.ndarray,)))

  ### lincc Value:
      Dispatch((llincc, (ListType, TupleType)), (alincc, (N.ndarray,)))

  ### pearsonr Value:
      Dispatch((lpearsonr, (ListType, TupleType)), (apearsonr, (N.ndarray,))
      )

  ### spearmanr Value:
      Dispatch((lspearmanr, (ListType, TupleType)), (aspearmanr, (N.ndarray,
      )))

  ### pointbiserialr Value:
      Dispatch((lpointbiserialr, (ListType, TupleType)), (apointbiserialr, (
      N.ndarray,)))

  ### kendalltau Value:
      Dispatch((lkendalltau, (ListType, TupleType)), (akendalltau, (N.ndarra
      y,)))

  ### linregress Value:
      Dispatch((llinregress, (ListType, TupleType)), (alinregress, (N.ndarra
      y,)))

  ### ttest_1samp Value:
      Dispatch((lttest_1samp, (ListType, TupleType)), (attest_1samp, (N.ndar
      ray,)))

  ### ttest_ind Value:
      Dispatch((lttest_ind, (ListType, TupleType)), (attest_ind, (N.ndarray,
      )))

  ### ttest_rel Value:
      Dispatch((lttest_rel, (ListType, TupleType)), (attest_rel, (N.ndarray,
      )))

  ### chisquare Value:
      Dispatch((lchisquare, (ListType, TupleType)), (achisquare, (N.ndarray,
      )))

  ### ks_2samp Value:
      Dispatch((lks_2samp, (ListType, TupleType)), (aks_2samp, (N.ndarray,))
      )

  ### mannwhitneyu Value:
      Dispatch((lmannwhitneyu, (ListType, TupleType)), (amannwhitneyu, (N.nd
      array,)))

  ### tiecorrect Value:
      Dispatch((ltiecorrect, (ListType, TupleType)), (atiecorrect, (N.ndarra
      y,)))

  ### ranksums Value:
      Dispatch((lranksums, (ListType, TupleType)), (aranksums, (N.ndarray,))
      )

  ### wilcoxont Value:
      Dispatch((lwilcoxont, (ListType, TupleType)), (awilcoxont, (N.ndarray,
      )))

  ### kruskalwallish Value:
      Dispatch((lkruskalwallish, (ListType, TupleType)), (akruskalwallish, (
      N.ndarray,)))

  ### friedmanchisquare Value:
      Dispatch((lfriedmanchisquare, (ListType, TupleType)), (afriedmanchisqu
      are, (N.ndarray,)))

  ### chisqprob Value:
      Dispatch((lchisqprob, (IntType, FloatType)), (achisqprob, (N.ndarray,)
      ))

  ### zprob Value:
      Dispatch((lzprob, (IntType, FloatType)), (azprob, (N.ndarray,)))

  ### ksprob Value:
      Dispatch((lksprob, (IntType, FloatType)), (aksprob, (N.ndarray,)))

  ### fprob Value:
      Dispatch((lfprob, (IntType, FloatType)), (afprob, (N.ndarray,)))

  ### betacf Value:
      Dispatch((lbetacf, (IntType, FloatType)), (abetacf, (N.ndarray,)))

  ### betai Value:
      Dispatch((lbetai, (IntType, FloatType)), (abetai, (N.ndarray,)))

  ### erfcc Value:
      Dispatch((lerfcc, (IntType, FloatType)), (aerfcc, (N.ndarray,)))

  ### gammln Value:
      Dispatch((lgammln, (IntType, FloatType)), (agammln, (N.ndarray,)))

  ### F_oneway Value:
      Dispatch((lF_oneway, (ListType, TupleType)), (aF_oneway, (N.ndarray,))
      )

  ### F_value Value:
      Dispatch((lF_value, (ListType, TupleType)), (aF_value, (N.ndarray,)))

  ### sum Value:
      Dispatch((lsum, (ListType, TupleType)), (asum, (N.ndarray,)))

  ### cumsum Value:
      Dispatch((lcumsum, (ListType, TupleType)), (acumsum, (N.ndarray,)))

  ### summult Value:
      Dispatch((lsummult, (ListType, TupleType)), (asummult, (N.ndarray,)))

  ### square_of_sums Value:
      Dispatch((lsquare_of_sums, (ListType, TupleType)), (asquare_of_sums, (
      N.ndarray,)))

  ### sumdiffsquared Value:
      Dispatch((lsumdiffsquared, (ListType, TupleType)), (asumdiffsquared, (
      N.ndarray,)))

  ### shellsort Value:
      Dispatch((lshellsort, (ListType, TupleType)), (ashellsort, (N.ndarray,
      )))

  ### rankdata Value:
      Dispatch((lrankdata, (ListType, TupleType)), (arankdata, (N.ndarray,))
      )

  ### findwithin Value:
      Dispatch((lfindwithin, (ListType, TupleType)), (afindwithin, (N.ndarra
      y,)))