Robust Equilibration Detection
Project description
Robust Equilibration Detection
A Python package for detecting equilibration in time series where an initial transient is followed by a stationary distribution. Two main approaches are implemented, which differ in the way they account for autocorrelation:
detect_equilibration_init_seq
: This uses the initial sequence methods of Geyer (Geyer, 1992) to determine the truncation point of the sum of autocovariances. Chodera's method (Chodera, 2016) of simply truncating the autocovariance series at the first negative value is also implemented.detect_equilibration_window
: This uses window methods (see Geyer again) when calculating the autocorrelation. Setting the window size to 1 will give you White's original Marginal Standard Error Rule (White, 1997).
For both, the equilibration point can be determined either according to the minimum of the squared standard error (the default), or the maximum effective sample size, by specifying method="min_sse"
or method="max_ess"
.
Installation
The easiest way to install red
is using conda
(or mamba
) (note that the conda-forge/ PyPI name is red-molsim
to avoid conflicts):
conda install -c conda-forge red-molsim
Alternatively, you can install red
from the Python Package Index (PyPI) using pip
:
pip install red-molsim
Usage
Warning: red
will work with multi-run data, but has only been thoroughly tested with single-run data. Using multi-run data is likely to be more robust, but we have not verified this.
Equilibration Detection
import red
# Load your timeseries of interest.
# This should be a 2D numpy array with shape (n_runs, n_samples),
# or a 1D numpy array with shape (n_samples).
my_timeseries = ...
# Detect equilibration based on the minimum squared standard error using
# using the window method with a Bartlett kernel with a window size of
# round(n_samples**0.5) to account for autocorrelation. idx is the index
# of the first sample after equilibration, g is the statistical
# inefficiency of the equilibrated sample, and ess is the effective sample
# size of the equilibrated sample.
idx, g, ess = red.detect_equilibration_window(my_timeseries,
method="min_sse",
plot=True)
# Alternatively, use Geyer's initial convex sequence method to account
# for autocorrelation.
idx, g, ess = red.detect_equilibration_init_seq(my_timeseries,
method="min_sse",
plot=True)
# We can also determine equilibration in the same way as in
# pymbar.timeseries.detect_equilibration(my_timeseries, fast=False)
idx, g, ess = red.detect_equilibration_init_seq(my_timeseries,
method="max_ess",
sequence_estimator="positive")
Uncertainty Quantification
# Estimate the 95 % confidence interval, accounting for autocorrelation using Geyer's initial
# convex sequence method.
ci_95 = red.get_conf_int_init_seq(my_timeseries, alpha_two_tailed=0.05)
For more examples, see the documentation.
Copyright
Copyright (c) 2023, Finlay Clark
Acknowledgements
Project based on the Computational Molecular Science Python Cookiecutter version 1.1, with several ideas (Makefile, documentation) borrowed from Simon Boothroyd's super helpful python-template.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file red_molsim-0.1.1.tar.gz
.
File metadata
- Download URL: red_molsim-0.1.1.tar.gz
- Upload date:
- Size: 150.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b9a8b32b03963228f1a8b4cec5628919344368915683ac1e448b4975b2cb891b |
|
MD5 | 580310751ecae7a9af8da6f93bb2569d |
|
BLAKE2b-256 | b910a864b95d9006753aafb5932e62c27837e91638f3278834a28ec364c597c5 |
File details
Details for the file red_molsim-0.1.1-py3-none-any.whl
.
File metadata
- Download URL: red_molsim-0.1.1-py3-none-any.whl
- Upload date:
- Size: 151.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9bad43ac999a182215807a1b9efdb502def852b25e319f2d5d3c75f098908472 |
|
MD5 | 4ddfab1bc8f6142831a9a372d4da71c5 |
|
BLAKE2b-256 | a5e06258b1c949491322978d717a171c3228e73eb5a4e7152f50cc6f12f52c50 |