thinkstats
index
/home/downey/thinkstats/trunk/workspace.thinkstats/ThinkStats/thinkstats.py

This file contains code for use with "Think Stats",
by Allen B. Downey, available from greenteapress.com
 
Copyright 2010 Allen B. Downey
License: GNU GPLv3 http://www.gnu.org/licenses/gpl.html

 
Modules
       
bisect
random

 
Classes
       
__builtin__.object
Interpolator

 
class Interpolator(__builtin__.object)
    Represents a mapping between sorted sequences; performs linear interp.
 
Attributes:
    xs: sorted list
    ys: sorted list
 
  Methods defined here:
Lookup(self, x)
Looks up x and returns the corresponding value of y.
Reverse(self, y)
Looks up y and returns the corresponding value of x.
__init__(self, xs, ys)

Data descriptors defined here:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

 
Functions
       
Binom(n, k, d={})
Compute the binomial coefficient "n choose k".
 
Args:
  n: number of trials
  k: number of successes
  d: map from (n,k) tuples to cached results
 
Returns:
  int
Jitter(values, jitter=0.5)
Jitters the values by adding a uniform variate in (-jitter, jitter).
Mean(t)
Computes the mean of a sequence of numbers.
 
Args:
    t: sequence of numbers
 
Returns:
    float
MeanVar(t)
Computes the mean and variance of a sequence of numbers.
 
Args:
    t: sequence of numbers
 
Returns:
    tuple of two floats
Trim(t, p=0.01)
Trims the largest and smallest elements of t.
 
Args:
    t: sequence of numbers
    p: fraction of values to trim off each end
 
Returns:
    sequence of values
TrimmedMean(t, p=0.01)
Computes the trimmed mean of a sequence of numbers.
 
Side effect: sorts the list.
 
Args:
    t: sequence of numbers
    p: fraction of values to trim off each end
 
Returns:
    float
TrimmedMeanVar(t, p=0.01)
Computes the trimmed mean and variance of a sequence of numbers.
 
Side effect: sorts the list.
 
Args:
    t: sequence of numbers
    p: fraction of values to trim off each end
 
Returns:
    float
Var(t, mu=None)
Computes the variance of a sequence of numbers.
 
Args:
    t: sequence of numbers
    mu: value around which to compute the variance; by default,
        computes the mean.
 
Returns:
    float