OpenMPCD
Public Member Functions | List of all members
MPCDAnalysis.OnTheFlyStatisticsDDDA.OnTheFlyStatisticsDDDA Class Reference

Public Member Functions

def __init__ (self)
 
def addDatum (self, datum)
 
def merge (self, rhs)
 
def getSampleSize (self)
 
def getSampleMean (self)
 
def getMaximumBlockSize (self)
 
def getMaximumBlockID (self)
 
def hasBlockVariance (self, blockID)
 
def getBlockVariance (self, blockID)
 
def getBlockStandardDeviation (self, blockID)
 
def getSampleStandardDeviation (self)
 
def getBlockStandardErrorOfTheMean (self, blockID)
 
def getEstimatedStandardDeviationOfBlockStandardErrorOfTheMean (self, blockID)
 
def getOptimalBlockIDForStandardErrorOfTheMean (self)
 
def optimalStandardErrorOfTheMeanEstimateIsReliable (self)
 
def getOptimalStandardErrorOfTheMean (self)
 
def serializeToString (self)
 
def unserializeFromString (self, state)
 
def getMPLAxes (self, showEstimatedStandardDeviation=True)
 
def __eq__ (self, rhs)
 
def __ne__ (self, rhs)
 
def __repr__ (self)
 

Detailed Description

Computes sample means and their errors for (possibly) serially correlated
data.

The algorithm used is called "Dynamic Distributable Decorrelation
Algorithm" (DDDA), and is described in
"Efficient algorithm for “on-the-fly” error analysis of local or distributed
serially correlated data"
by David R. Kent IV, Richard P. Muller, Amos G. Anderson,
William A. Goddard III, and Michael T. Feldmann,
Journal of Computational Chemistry,
November 2007, Vol. 28, No. 14, pp. 2309-2316,
DOI: 10.1002/jcc.20746,
which in turn is partly based on the article
"Error estimates on averages of correlated data"
by H. Flyvbjerg and H. G. Petersen,
The Journal of Chemical Physics, July 1989, Vol. 91, No. 1, pp. 461-466
DOI: 10.1063/1.457480

Definition at line 29 of file OnTheFlyStatisticsDDDA.py.

Constructor & Destructor Documentation

◆ __init__()

def MPCDAnalysis.OnTheFlyStatisticsDDDA.OnTheFlyStatisticsDDDA.__init__ (   self)
    The constructor.

Definition at line 35 of file OnTheFlyStatisticsDDDA.py.

Member Function Documentation

◆ __eq__()

def MPCDAnalysis.OnTheFlyStatisticsDDDA.OnTheFlyStatisticsDDDA.__eq__ (   self,
  rhs 
)
    Returns whether this instance and `rhs` are equivalent, i.e. whether the
    two instances behave as if they had been supplied the same data.

    @throw TypeError
           Throws if `rhs` is not of type `OnTheFlyStatisticsDDDA`.

    @param[in] rhs
               The `OnTheFlyStatisticsDDDA` instance to compare to.

Definition at line 559 of file OnTheFlyStatisticsDDDA.py.

◆ __ne__()

def MPCDAnalysis.OnTheFlyStatisticsDDDA.OnTheFlyStatisticsDDDA.__ne__ (   self,
  rhs 
)
    Returns the negation of `self == rhs`.

    @throw TypeError
           Throws if `rhs` is not of type `OnTheFlyStatisticsDDDA`.

    @param[in] rhs
               The `OnTheFlyStatisticsDDDA` instance to compare to.

Definition at line 577 of file OnTheFlyStatisticsDDDA.py.

◆ __repr__()

def MPCDAnalysis.OnTheFlyStatisticsDDDA.OnTheFlyStatisticsDDDA.__repr__ (   self)
    Returns a string (type `str`) representation of this instance.

Definition at line 586 of file OnTheFlyStatisticsDDDA.py.

◆ addDatum()

def MPCDAnalysis.OnTheFlyStatisticsDDDA.OnTheFlyStatisticsDDDA.addDatum (   self,
  datum 
)
    Adds a datum to the sample.

    It is assumed that the "time" intervals between subsequently added data
    are constant; here, "time" may, for example, refer to Molecular Dynamics
    or Monte Carlo steps.

Definition at line 51 of file OnTheFlyStatisticsDDDA.py.

◆ getBlockStandardDeviation()

def MPCDAnalysis.OnTheFlyStatisticsDDDA.OnTheFlyStatisticsDDDA.getBlockStandardDeviation (   self,
  blockID 
)
    Returns the sample standard deviation in the block with the given
    `blockID`.

    @throw TypeError
           Throws if `blockID` is not of type `int`.
    @throw ValueError
           Throws if `blockID` is out of range.
    @throw RuntimeError
           Throws if `not self.hasBlockVariance(blockID)`.

    @param[in] blockID
               The block ID, which must be an integer in the range
               [0, `getMaximumBlockID()`].

Definition at line 237 of file OnTheFlyStatisticsDDDA.py.

◆ getBlockStandardErrorOfTheMean()

def MPCDAnalysis.OnTheFlyStatisticsDDDA.OnTheFlyStatisticsDDDA.getBlockStandardErrorOfTheMean (   self,
  blockID 
)
    Returns an estimate for the standard deviation of the standard error of
    the mean for a given `blockID`.

    @throw RuntimeError
           Throws if `not self.hasBlockVariance(blockID)`.

    @param[in] blockID
               The block ID, which must be an integer in the range
               [0, `getMaximumBlockID()`].

Definition at line 268 of file OnTheFlyStatisticsDDDA.py.

◆ getBlockVariance()

def MPCDAnalysis.OnTheFlyStatisticsDDDA.OnTheFlyStatisticsDDDA.getBlockVariance (   self,
  blockID 
)
    Returns the sample variance in the block with the given `blockID`.

    @throw RuntimeError
           Throws if `not self.hasBlockVariance(blockID)`.

    @param[in] blockID
               The block ID, which must be an integer in the range
               [0, `getMaximumBlockID()`].

Definition at line 207 of file OnTheFlyStatisticsDDDA.py.

◆ getEstimatedStandardDeviationOfBlockStandardErrorOfTheMean()

def MPCDAnalysis.OnTheFlyStatisticsDDDA.OnTheFlyStatisticsDDDA.getEstimatedStandardDeviationOfBlockStandardErrorOfTheMean (   self,
  blockID 
)
    Returns an estimate for the standard deviation of the standard error of
    the mean for a given `blockID`.

    The returned estimate corresponds to Eq. (28) in
    "Error estimates on averages of correlated data"
    by H. Flyvbjerg and H. G. Petersen,
    The Journal of Chemical Physics, July 1989, Vol. 91, No. 1, pp. 461-466
    DOI: 10.1063/1.457480

    @throw RuntimeError
           Throws if `not self.hasBlockVariance(blockID)`.

    @param[in] blockID
               The block ID, which must be an integer in the range
               [0, `getMaximumBlockID()`].

Definition at line 301 of file OnTheFlyStatisticsDDDA.py.

◆ getMaximumBlockID()

def MPCDAnalysis.OnTheFlyStatisticsDDDA.OnTheFlyStatisticsDDDA.getMaximumBlockID (   self)
    Returns the ID of the largest block size created so far.

Definition at line 171 of file OnTheFlyStatisticsDDDA.py.

◆ getMaximumBlockSize()

def MPCDAnalysis.OnTheFlyStatisticsDDDA.OnTheFlyStatisticsDDDA.getMaximumBlockSize (   self)
    Returns the largest block size for which there is at least one data
    point.

    If no values have been added so far, `Exception` is raised.

Definition at line 159 of file OnTheFlyStatisticsDDDA.py.

◆ getMPLAxes()

def MPCDAnalysis.OnTheFlyStatisticsDDDA.OnTheFlyStatisticsDDDA.getMPLAxes (   self,
  showEstimatedStandardDeviation = True 
)
    Returns an `matplotlib.axes.Axes` object that plots the estimated
    standard error of the mean, and optionally its estimated standard
    deviation, as a function of the base-2 logarithm of the block size.

    @throw TypeError
           Throws if any of the arguments have invalid types.

    @param[in] showEstimatedStandardDeviation
               Whether to show, for each data point, the estimated standard
               deviation of the estimated standard error of the mean.
               Must be a `bool` value.

Definition at line 510 of file OnTheFlyStatisticsDDDA.py.

◆ getOptimalBlockIDForStandardErrorOfTheMean()

def MPCDAnalysis.OnTheFlyStatisticsDDDA.OnTheFlyStatisticsDDDA.getOptimalBlockIDForStandardErrorOfTheMean (   self)
    Returns the block ID corresponding to the optimal block size, in the
    sense that the corresponding block provides the most accurate estimate
    for the standard error of the mean.

    If there is no variance in the data, `0` is returned.

    The algorithm used is described in Section IV of the article
    "Strategies for improving the efficiency of quantum Monte Carlo
    calculations"
    by R. M. Lee, G. J. Conduit, N. Nemec, P. López Ríos, and
    N. D. Drummond,
    Physical Review E, June 2011, Vol. 83, No. 6, pp. 066706
    DOI: 10.1103/PhysRevE.83.066706

    @throw RuntimeError
           Throws if fewer than two data points have been supplied.

Definition at line 339 of file OnTheFlyStatisticsDDDA.py.

◆ getOptimalStandardErrorOfTheMean()

def MPCDAnalysis.OnTheFlyStatisticsDDDA.OnTheFlyStatisticsDDDA.getOptimalStandardErrorOfTheMean (   self)
    Returns the best estimation of the true standard error of the mean of
    the data, after decorrelation.

    @see optimalStandardErrorOfTheMeanEstimateIsReliable

    The algorithm used is described in Section IV of the article
    "Strategies for improving the efficiency of quantum Monte Carlo
    calculations"
    by R. M. Lee, G. J. Conduit, N. Nemec, P. López Ríos, and
    N. D. Drummond,
    Physical Review E, June 2011, Vol. 83, No. 6, pp. 066706
    DOI: 10.1103/PhysRevE.83.066706

    @throw RuntimeError
           Throws if fewer than two data points have been supplied.

Definition at line 413 of file OnTheFlyStatisticsDDDA.py.

◆ getSampleMean()

def MPCDAnalysis.OnTheFlyStatisticsDDDA.OnTheFlyStatisticsDDDA.getSampleMean (   self)
    Returns the mean of all the values added so far.

    Since the mean of all values added is returned, and the sample size may
    not be a power of 2, statistics with different blocking length may
    not incorporate the same amount of information. This may lead to
    difficulties when using the error estimates of statistics of different
    block lengths to estimate the error in the entire, possibly correlated
    data set, since the statistics of different blocking lengths do not
    necessarily incorporate the same measurements.

    If no values have been added so far, `Exception` is raised.

Definition at line 144 of file OnTheFlyStatisticsDDDA.py.

◆ getSampleSize()

def MPCDAnalysis.OnTheFlyStatisticsDDDA.OnTheFlyStatisticsDDDA.getSampleSize (   self)
    Returns the number of data points added so far.

Definition at line 125 of file OnTheFlyStatisticsDDDA.py.

◆ getSampleStandardDeviation()

def MPCDAnalysis.OnTheFlyStatisticsDDDA.OnTheFlyStatisticsDDDA.getSampleStandardDeviation (   self)
    Returns the raw sample standard deviation, i.e. the sample standard
    deviation in block `0`.

    @throw RuntimeError
           Throws if `not self.hasBlockVariance(0)`.

Definition at line 251 of file OnTheFlyStatisticsDDDA.py.

◆ hasBlockVariance()

def MPCDAnalysis.OnTheFlyStatisticsDDDA.OnTheFlyStatisticsDDDA.hasBlockVariance (   self,
  blockID 
)
    Returns whether the block with the given `blockID` has enough data to
    compute a sample variance.

    @param[in] blockID
               The block ID, which must be an integer in the range
               [0, `getMaximumBlockID()`].

Definition at line 185 of file OnTheFlyStatisticsDDDA.py.

◆ merge()

def MPCDAnalysis.OnTheFlyStatisticsDDDA.OnTheFlyStatisticsDDDA.merge (   self,
  rhs 
)
    Merges the information in `rhs` with this instance's.

    Let \f$ x_1, x_2, \ldots, x_{N_1} \f$ be the data that have been
    supplied to this instance prior to calling this function, with
    \f$ N_1 \f$ being the sample size of this instance prior to calling this
    function. Similarly, let \f$ y_1, y_2, \ldots, y_{N_2} \f$ be the data
    supplied to `rhs` previously.
    Then, after this function successfully returns, this instance's state is
    approximately as if it had started empty, and then the data
    \f$ x_1, x_2, \ldots, x_{N_1}, y_1, y_2, \ldots, y_{N_2} \f$
    had been supplied. This is true to a high degree for the state of block
    `0`; other blocks may have significantly different state due to the way
    blocks are populated with data points. The implementation is equivalent
    to the one named `Decorrelation.addition` in Appendix B of
    @cite Kent2007.

    The `rhs` instance is left unchanged (unless, of course, it is the same
    object as this instance, which is allowed).

    @throw TypeError
           Throws if `rhs` is not of type `OnTheFlyStatisticsDDDA`.

    @param[in] rhs
               The instance to merge into this one. Must be an instance of
               `OnTheFlyStatisticsDDDA`.

Definition at line 84 of file OnTheFlyStatisticsDDDA.py.

◆ optimalStandardErrorOfTheMeanEstimateIsReliable()

def MPCDAnalysis.OnTheFlyStatisticsDDDA.OnTheFlyStatisticsDDDA.optimalStandardErrorOfTheMeanEstimateIsReliable (   self)
    Returns whether the sample is large enough for the estimate of the
    standard error of the mean, as provided by the block indicated by
    `getOptimalBlockIDForStandardErrorOfTheMean`, to be reliable.

    The algorithm used is described in Section IV of the article
    "Strategies for improving the efficiency of quantum Monte Carlo
    calculations"
    by R. M. Lee, G. J. Conduit, N. Nemec, P. López Ríos, and
    N. D. Drummond,
    Physical Review E, June 2011, Vol. 83, No. 6, pp. 066706
    DOI: 10.1103/PhysRevE.83.066706

    @throw RuntimeError
           Throws if fewer than two data points have been supplied.

Definition at line 387 of file OnTheFlyStatisticsDDDA.py.

◆ serializeToString()

def MPCDAnalysis.OnTheFlyStatisticsDDDA.OnTheFlyStatisticsDDDA.serializeToString (   self)
    Returns a `str` that contains the state of this instance.

    @see unserializeFromString

Definition at line 426 of file OnTheFlyStatisticsDDDA.py.

◆ unserializeFromString()

def MPCDAnalysis.OnTheFlyStatisticsDDDA.OnTheFlyStatisticsDDDA.unserializeFromString (   self,
  state 
)
    Discards the current state, and loads the state specified in the given
    string instead.

    @throw TypeError
           Throws if `state` is of the wrong type.
    @throw ValueError
           Throws if `state` does not encode a valid state.

    @param[in] state
               The state to load. Must be a `str` created by
               `serializeToString`.

Definition at line 456 of file OnTheFlyStatisticsDDDA.py.


The documentation for this class was generated from the following file: