Ticket #7197: trac_7197_part8.patch

File trac_7197_part8.patch, 4.2 KB (added by amhou, 12 years ago)
  • sage/stats/basic_stats.py

    # 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  
    1212separating the higher half of a sample from the lower half. The ``mode``
    1313returns the most common occuring member of a sample, plus the number of times
    1414it 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,
     15are returned. The ``moving_average`` is a finite impulse response filter,
    1616creating a series of averages using a user-defined number of subsets of the
    1717full data set. The ``standard deviation`` and the ``variance`` return a
    1818measurement of how far data points tend to be from the arithmetic mean.
     
    4141
    4242def mean(v):
    4343    """
    44     Return the mean of the elements of ``v``.
     44    Return the mean of the elements of `v`.
    4545
    4646    We define the mean of the empty list to be NaN, following the
    4747    convention of MATLAB, Scipy, and R.
    4848
    4949    INPUT:
    5050
    51         - ``v`` -- a list of numbers
     51        - `v` -- a list of numbers
    5252
    5353    OUTPUT:
    5454
     
    8484
    8585def mode(v):
    8686    """
    87     Return the mode (most common) of the elements of ``v``
     87    Return the mode (most common) of the elements of `v`
    8888   
    89     If ``v`` is empty, we define the mode to be null.
     89    If `v` is empty, we define the mode to be null.
    9090    If all elements occur only once, we define the mode to be null.
    9191    If multiple elements occur at the same frequency, all will be
    9292    displayed.
     
    9494   
    9595    INPUT:
    9696
    97         - ``v`` -- a list
     97        - `v` -- a list
    9898
    9999    OUTPUT:
    100100
     
    137137
    138138def std(v, bias=False):
    139139    """
    140     Returns the standard deviation of the elements of ``v``
     140    Returns the standard deviation of the elements of `v`
    141141
    142142    We define the standard deviation of the empty list to be NaN,
    143143    following the convention of MATLAB, Scipy, and R.
    144144
    145145    INPUT:
    146146
    147         - ``v`` -- a list of numbers
     147        - `v` -- a list of numbers
    148148       
    149149        - ``bias`` -- bool (default: False); if False, divide by
    150150                      len(v) - 1 instead of len(v)
     
    211211
    212212def variance(v, bias=False):
    213213    """
    214     Returns the variance of the elements of ``v``
     214    Returns the variance of the elements of `v`
    215215
    216216    We define the variance of the empty list to be NaN,
    217217    following the convention of MATLAB, Scipy, and R.
    218218
    219219    INPUT:
    220220
    221         - ``v`` -- a list of numbers
     221        - `v` -- a list of numbers
    222222       
    223223        - ``bias`` -- bool (default: False); if False, divide by
    224224                      len(v) - 1 instead of len(v)
     
    292292
    293293def median(v):
    294294    """
    295     Return the median (middle value) of the elements of ``v``
     295    Return the median (middle value) of the elements of `v`
    296296
    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.
    299299    For elements other than numbers, the median is a result of ``sorted()``
    300300
    301301    INPUT:
    302302
    303         - ``v`` -- a list
     303        - `v` -- a list
    304304
    305305    OUTPUT:
    306306
    307         - median element of ``v``
     307        - median element of `v`
    308308
    309309    EXAMPLES::
    310310
     
    331331
    332332def moving_average(v, bins=1):
    333333    """
    334     Provides the moving average of a list
     334    Provides the moving average of a list `v`
    335335
    336336    The moving average of a list is often used to smooth out noisy
    337337    data. Given a selected number of bins, the original list will be
    338338    cut up into that number of bins. Then, the mean of each bin is
    339339    calculated, and appended into a new list.
    340340
    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.
    342342
    343343    INPUT:
    344344 
    345         - ``v`` -- a list
     345        - `v` -- a list
    346346
    347347        - ``bins`` -- number of bins, default set to 1
    348348