Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correct TI error estimation #58

Closed
wants to merge 6 commits into from
Closed

Conversation

harlor
Copy link
Contributor

@harlor harlor commented Oct 15, 2018

The error estimation for the free energy differences doesn't consider covariances. So I suggest to also take them into account.

@codecov-io
Copy link

codecov-io commented Oct 15, 2018

Codecov Report

Merging #58 into master will increase coverage by 0.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #58      +/-   ##
==========================================
+ Coverage   98.11%   98.13%   +0.01%     
==========================================
  Files           9        9              
  Lines         478      482       +4     
  Branches       94       94              
==========================================
+ Hits          469      473       +4     
  Misses          4        4              
  Partials        5        5
Impacted Files Coverage Δ
src/alchemlyb/estimators/ti_.py 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e5b2e58...baca4c3. Read the comment docs.

@mrshirts
Copy link

Sampling at independent lambdas should be uncorrelated, since they are expected to come from independent simulations. Nonzero covariance is likely to be noise.

If it comes from some sort of replica exchange or expanded ensemble simulation, that's a bit different, but probably needs to be thought about a bit more.

@harlor
Copy link
Contributor Author

harlor commented Oct 16, 2018

Sampling at independent lambdas should be uncorrelated, since they are expected to come from independent simulations. Nonzero covariance is likely to be noise.

I completely agree. I was a bit imprecise. Acually I don't mean covariances between the mean dhdls but of the trapezoid areas. When one mean dhdl changes it changes the area of 2 trapezoids (Except it is a boundary value).

Example with 3 dhdl-mean-values - 3 lambdas - 2 delta_lamdas:

Integral calculates as:
image

Using propagation of uncertainty the integral has the variance:
image

The current formula is missing the mixed term
image

Edit: Sorry the first version of this comment was completely unreadable

@mrshirts
Copy link

But we can rewrite the contribution of the trapezoids into a sum of independent calculations I.e. although it's derived as the area of a set of trapezoids, it is writeable (give it a try!) as:

\sum w_i <dh/dl>_i

where w_i is a weight determined by the choice of lambdas and <dh/dl>_i is the ensemble average of dh/dl at state i. No correlations are necessary; at best, they should cancel out.

Note that I realized that I actually haven't looked at THIS code in alchemlyb. The error analysis code I wrote is at: https://github.com/MobleyLab/alchemical-analysis. If the error analysis calculation in alchemlyb does not reflect the code in alchemical-analysis, then the alchemlyb should be checked and updated.

But it is possible (and far preferable) to do WITHOUT any correlation matrix. Any autocorrelation matrix approach assume simple error propagation, which may not quite hold, and thus even if the overall effect is correct in the limit that simple error propagation is correct, they will introduce some error for most calculations.

@harlor
Copy link
Contributor Author

harlor commented Oct 16, 2018

Note that I realized that I actually haven't looked at THIS code in alchemlyb. The error analysis code I wrote is at: https://github.com/MobleyLab/alchemical-analysis. If the error analysis calculation in alchemlyb does not reflect the code in alchemical-analysis, then the alchemlyb should be checked and updated.

If I'm not mistaken, the error estimates differ. With this pull request I actually try to reproduce the results from alchemical-analysis.

@harlor
Copy link
Contributor Author

harlor commented Oct 16, 2018

Sorry these commits should have never appeared here. This PR can be closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants