# HG changeset patch
# User Andrew Hou <hou.andrew@gmail.com>
# Date 1258419548 28800
# Node ID b3ad60106bf5fa4cb2e98caee947b23ecc0db4d8
# Parent faf0b8837f76ed1e651646126bfc09ec42909904
Fixed documentation
diff r faf0b8837f76 r b3ad60106bf5 sage/stats/basic_stats.py
a

b


12  12  separating the higher half of a sample from the lower half. The ``mode`` 
13  13  returns the most common occuring member of a sample, plus the number of times 
14  14  it occurs. If entries occur equally common, a list of the most common entries 
15   are returned. The ``moving average`` is a finite impulse response filter, 
 15  are returned. The ``moving_average`` is a finite impulse response filter, 
16  16  creating a series of averages using a userdefined number of subsets of the 
17  17  full data set. The ``standard deviation`` and the ``variance`` return a 
18  18  measurement of how far data points tend to be from the arithmetic mean. 
… 
… 

41  41  
42  42  def mean(v): 
43  43  """ 
44   Return the mean of the elements of ``v``. 
 44  Return the mean of the elements of `v`. 
45  45  
46  46  We define the mean of the empty list to be NaN, following the 
47  47  convention of MATLAB, Scipy, and R. 
48  48  
49  49  INPUT: 
50  50  
51    ``v``  a list of numbers 
 51   `v`  a list of numbers 
52  52  
53  53  OUTPUT: 
54  54  
… 
… 

84  84  
85  85  def mode(v): 
86  86  """ 
87   Return the mode (most common) of the elements of ``v`` 
 87  Return the mode (most common) of the elements of `v` 
88  88  
89   If ``v`` is empty, we define the mode to be null. 
 89  If `v` is empty, we define the mode to be null. 
90  90  If all elements occur only once, we define the mode to be null. 
91  91  If multiple elements occur at the same frequency, all will be 
92  92  displayed. 
… 
… 

94  94  
95  95  INPUT: 
96  96  
97    ``v``  a list 
 97   `v`  a list 
98  98  
99  99  OUTPUT: 
100  100  
… 
… 

137  137  
138  138  def std(v, bias=False): 
139  139  """ 
140   Returns the standard deviation of the elements of ``v`` 
 140  Returns the standard deviation of the elements of `v` 
141  141  
142  142  We define the standard deviation of the empty list to be NaN, 
143  143  following the convention of MATLAB, Scipy, and R. 
144  144  
145  145  INPUT: 
146  146  
147    ``v``  a list of numbers 
 147   `v`  a list of numbers 
148  148  
149  149   ``bias``  bool (default: False); if False, divide by 
150  150  len(v)  1 instead of len(v) 
… 
… 

211  211  
212  212  def variance(v, bias=False): 
213  213  """ 
214   Returns the variance of the elements of ``v`` 
 214  Returns the variance of the elements of `v` 
215  215  
216  216  We define the variance of the empty list to be NaN, 
217  217  following the convention of MATLAB, Scipy, and R. 
218  218  
219  219  INPUT: 
220  220  
221    ``v``  a list of numbers 
 221   `v`  a list of numbers 
222  222  
223  223   ``bias``  bool (default: False); if False, divide by 
224  224  len(v)  1 instead of len(v) 
… 
… 

292  292  
293  293  def median(v): 
294  294  """ 
295   Return the median (middle value) of the elements of ``v`` 
 295  Return the median (middle value) of the elements of `v` 
296  296  
297   If ``v`` is empty, we define the median to be null. 
298   If ``v`` is comprised of strings, TypeError occurs. 
 297  If `v` is empty, we define the median to be null. 
 298  If `v` is comprised of strings, TypeError occurs. 
299  299  For elements other than numbers, the median is a result of ``sorted()`` 
300  300  
301  301  INPUT: 
302  302  
303    ``v``  a list 
 303   `v`  a list 
304  304  
305  305  OUTPUT: 
306  306  
307    median element of ``v`` 
 307   median element of `v` 
308  308  
309  309  EXAMPLES:: 
310  310  
… 
… 

331  331  
332  332  def moving_average(v, bins=1): 
333  333  """ 
334   Provides the moving average of a list 
 334  Provides the moving average of a list `v` 
335  335  
336  336  The moving average of a list is often used to smooth out noisy 
337  337  data. Given a selected number of bins, the original list will be 
338  338  cut up into that number of bins. Then, the mean of each bin is 
339  339  calculated, and appended into a new list. 
340  340  
341   If ``v`` is empty, we define the entries of the moving average to be NaN. 
 341  If `v` is empty, we define the entries of the moving average to be NaN. 
342  342  
343  343  INPUT: 
344  344  
345    ``v``  a list 
 345   `v`  a list 
346  346  
347  347   ``bins``  number of bins, default set to 1 
348  348  