6
6
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
7
# copies of the Software, and to permit persons to whom the Software is
8
8
# furnished to do so, subject to the following conditions:
9
- #
9
+ #
10
10
# The above copyright notice and this permission notice shall be included in
11
11
# all copies or substantial portions of the Software.
12
- #
12
+ #
13
13
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
14
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
15
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
20
#
21
21
# Comments and/or additions are welcome (send e-mail to:
22
22
23
- #
23
+ #
24
24
"""
25
25
stats.py module
26
26
134
134
ksprob
135
135
fprob
136
136
betacf
137
- gammln
137
+ gammln
138
138
betai
139
139
140
140
ANOVA FUNCTIONS: F_oneway
@@ -960,7 +960,7 @@ def lkendalltau(x, y):
960
960
961
961
def llinregress (x , y ):
962
962
"""
963
- Calculates a regression line on x,y pairs.
963
+ Calculates a regression line on x,y pairs.
964
964
965
965
Usage: llinregress(x,y) x,y are equal-length lists of x-y coordinates
966
966
Returns: slope, intercept, r, two-tailed prob, sterr-of-estimate
@@ -1255,7 +1255,7 @@ def lkruskalwallish(*args):
1255
1255
The Kruskal-Wallis H-test is a non-parametric ANOVA for 3 or more
1256
1256
groups, requiring at least 5 subjects in each group. This function
1257
1257
calculates the Kruskal-Wallis H-test for 3 or more independent samples
1258
- and returns the result.
1258
+ and returns the result.
1259
1259
1260
1260
Usage: lkruskalwallish(*args)
1261
1261
Returns: H-statistic (corrected for ties), associated p-value
@@ -1394,7 +1394,7 @@ def lerfcc(x):
1394
1394
def lzprob (z ):
1395
1395
"""
1396
1396
Returns the area under the normal curve 'to the left of' the given z value.
1397
- Thus,
1397
+ Thus,
1398
1398
for z<0, zprob(z) = 1-tail probability
1399
1399
for z>0, 1.0-zprob(z) = 1-tail probability
1400
1400
for any z, 2.0*(1.0-zprob(abs(z))) = 2-tail probability
@@ -1847,7 +1847,7 @@ def lfindwithin (data):
1847
1847
Returns an integer representing a binary vector, where 1=within-
1848
1848
subject factor, 0=between. Input equals the entire data 2D list (i.e.,
1849
1849
column 0=random factor, column -1=measured values (those two are skipped).
1850
- Note: input data is in |Stat format ... a list of lists ("2D list") with
1850
+ Note: input data is in |Stat format ... a list of lists ("2D list") with
1851
1851
one row per measured value, first column=subject identifier, last column=
1852
1852
score, one in-between column per factor (these columns contain level
1853
1853
designations on each factor). See also stats.anova.__doc__.
@@ -2234,7 +2234,7 @@ def atmean(a,limits=None,inclusive=(1, 1)):
2234
2234
def atvar (a ,limits = None ,inclusive = (1 , 1 )):
2235
2235
"""
2236
2236
Returns the sample variance of values in an array, (i.e., using N-1),
2237
- ignoring values strictly outside the sequence passed to 'limits'.
2237
+ ignoring values strictly outside the sequence passed to 'limits'.
2238
2238
Note: either limit in the sequence, or the value of limits itself,
2239
2239
can be set to None. The inclusive list/tuple determines whether the lower
2240
2240
and upper limiting bounds (respectively) are open/exclusive (0) or
@@ -2387,8 +2387,8 @@ def avariation(a,dimension=None):
2387
2387
return 100.0 * asamplestdev (a , dimension )/ amean (a , dimension )
2388
2388
2389
2389
2390
- def askew (a ,dimension = None ):
2391
- """
2390
+ def askew (a ,dimension = None ):
2391
+ """
2392
2392
Returns the skewness of a distribution (normal ==> 0.0; >0 means extra
2393
2393
weight in left tail). Use askewtest() to see if it's close enough.
2394
2394
Dimension can equal None (ravel array first), an integer (the
@@ -2704,7 +2704,7 @@ def asamplevar (inarray,dimension=None,keepdims=0):
2704
2704
mn = amean (inarray , dimension )[:, N .NewAxis ]
2705
2705
else :
2706
2706
mn = amean (inarray , dimension , keepdims = 1 )
2707
- deviations = inarray - mn
2707
+ deviations = inarray - mn
2708
2708
if isinstance (dimension , list ):
2709
2709
n = 1
2710
2710
for d in dimension :
@@ -3357,7 +3357,7 @@ def attest_ind (a, b, dimension=None, printit=0, name1='Samp1', name2='Samp2',wr
3357
3357
probs = N .reshape (probs , t .shape )
3358
3358
if probs .shape == (1 ,):
3359
3359
probs = probs [0 ]
3360
-
3360
+
3361
3361
if printit != 0 :
3362
3362
if isinstance (t , N .ndarray ):
3363
3363
t = t [0 ]
@@ -3782,7 +3782,7 @@ def aerfcc(x):
3782
3782
def azprob (z ):
3783
3783
"""
3784
3784
Returns the area under the normal curve 'to the left of' the given z value.
3785
- Thus,
3785
+ Thus,
3786
3786
for z<0, zprob(z) = 1-tail probability
3787
3787
for z>0, 1.0-zprob(z) = 1-tail probability
3788
3788
for any z, 2.0*(1.0-zprob(abs(z))) = 2-tail probability
@@ -4373,7 +4373,7 @@ def afindwithin(data):
4373
4373
(acumfreq , (N .ndarray ,)) )
4374
4374
relfreq = Dispatch ( (lrelfreq , (list , tuple )),
4375
4375
(arelfreq , (N .ndarray ,)) )
4376
-
4376
+
4377
4377
## VARIABILITY:
4378
4378
obrientransform = Dispatch ( (lobrientransform , (list , tuple )),
4379
4379
(aobrientransform , (N .ndarray ,)) )
@@ -4394,14 +4394,14 @@ def afindwithin(data):
4394
4394
(az , (N .ndarray ,)) )
4395
4395
zs = Dispatch ( (lzs , (list , tuple )),
4396
4396
(azs , (N .ndarray ,)) )
4397
-
4397
+
4398
4398
## TRIMMING FCNS:
4399
4399
threshold = Dispatch ( (athreshold , (N .ndarray ,)),)
4400
4400
trimboth = Dispatch ( (ltrimboth , (list , tuple )),
4401
4401
(atrimboth , (N .ndarray ,)) )
4402
4402
trim1 = Dispatch ( (ltrim1 , (list , tuple )),
4403
4403
(atrim1 , (N .ndarray ,)) )
4404
-
4404
+
4405
4405
## CORRELATION FCNS:
4406
4406
paired = Dispatch ( (lpaired , (list , tuple )),
4407
4407
(apaired , (N .ndarray ,)) )
@@ -4417,7 +4417,7 @@ def afindwithin(data):
4417
4417
(akendalltau , (N .ndarray ,)) )
4418
4418
linregress = Dispatch ( (llinregress , (list , tuple )),
4419
4419
(alinregress , (N .ndarray ,)) )
4420
-
4420
+
4421
4421
## INFERENTIAL STATS:
4422
4422
ttest_1samp = Dispatch ( (lttest_1samp , (list , tuple )),
4423
4423
(attest_1samp , (N .ndarray ,)) )
@@ -4441,7 +4441,7 @@ def afindwithin(data):
4441
4441
(akruskalwallish , (N .ndarray ,)) )
4442
4442
friedmanchisquare = Dispatch ( (lfriedmanchisquare , (list , tuple )),
4443
4443
(afriedmanchisquare , (N .ndarray ,)) )
4444
-
4444
+
4445
4445
## PROBABILITY CALCS:
4446
4446
chisqprob = Dispatch ( (lchisqprob , (int , float )),
4447
4447
(achisqprob , (N .ndarray ,)) )
@@ -4459,7 +4459,7 @@ def afindwithin(data):
4459
4459
(aerfcc , (N .ndarray ,)) )
4460
4460
gammln = Dispatch ( (lgammln , (int , float )),
4461
4461
(agammln , (N .ndarray ,)) )
4462
-
4462
+
4463
4463
## ANOVA FUNCTIONS:
4464
4464
F_oneway = Dispatch ( (lF_oneway , (list , tuple )),
4465
4465
(aF_oneway , (N .ndarray ,)) )
0 commit comments