Probability
index
/Users/amos/Documents/Database/Mental/Programming/python/lib/avatar/Personal2/www.amos/Python/lib/mathlib/Probability/Probability.py

the base class for probability laws, and a subclass that con apply a  linear transformation to another probability law

 
Classes
       
Probability
Affine

 
class Affine(Probability)
    the probability law governing Z*s + m, if Z obeys probBase.
 
  Methods defined here:
Affine(self, xZ)
Density(self, x)
Distribution(self, x)
InverseDistribution(self, y)
Sample(self)
Standardize(self, xX)
__init__(self, probBase, xM=0.0, xS=1.0)
__repr__(self)
getMean(self)
getVariance(self)

Methods inherited from Probability:
DensityTest(self, xX, **dArgs)
Compare the Density() with the numerically differentiated Distribution().
 
This doesn't make much sense in the abstract base class. But in general, the Density() method will be redefined, and this will be a real test.
InverseTest(self, xY, **dArgs)
Run a y value through InverseDistribution and then through Distribution, and compare the results.
__str__(self)
getIQR(self)
getMedian(self)
getStDev(self)
html(self)

 
class Probability
    the base class for probability laws
 
  Methods defined here:
Density(self, xX, xDelta=4.9999999999999998e-07)
the density function of the probability law, equal to the derivative of the distribution function
 
By default, numerically differentiate the distribution function.
DensityTest(self, xX, **dArgs)
Compare the Density() with the numerically differentiated Distribution().
 
This doesn't make much sense in the abstract base class. But in general, the Density() method will be redefined, and this will be a real test.
Distribution(self, xX)
the distribution function of the probability law
InverseDistribution(self, xY, xX=0.0, xEpsilon=9.9999999999999995e-07)
the inverse of the distribution function of the probability law
 
By default, invert using Newton's method.
 
Note that using a numerically calculated derivative, as in the default Density(), with Newton's method as here, is numerically problematic. One or the other, or both, should be redefined in any (non-abstract) extension. Fortunately, alternate expressions are available for commonly-used distributions.
InverseTest(self, xY, **dArgs)
Run a y value through InverseDistribution and then through Distribution, and compare the results.
Sample(self)
Return a random sample distributed according to the probability law.
 
By default, pass a uniform random sample to InverseDistribution().
 
Similarly, passing a sample through Distribution() will give you a uniform sample on [0, 1].
__repr__(self)
__str__(self)
getIQR(self)
getMean(self)
getMedian(self)
getStDev(self)
getVariance(self)
html(self)

 
Functions
       
random(...)
random() -> x in the interval [0, 1).
sqrt(...)
sqrt(x)
 
Return the square root of x.