Skip to content

Added confidence intervals#6

Open
frankcorneliusmartin wants to merge 2 commits intomainfrom
feature/add-convidence-interval
Open

Added confidence intervals#6
frankcorneliusmartin wants to merge 2 commits intomainfrom
feature/add-convidence-interval

Conversation

@frankcorneliusmartin
Copy link

@frankcorneliusmartin frankcorneliusmartin commented Apr 7, 2025

  • Added confidence intervals

Copy link
Member

@bartvanb bartvanb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't really verify whether this is correct as I don't know the algorithm well enough.

What I'm missing is documentation and unit tests for this change.

# Calculate confidence interval using cumulative variance
if n_i > d_i and n_i > 0 and S_t > 0:
std_err = S_t * np.sqrt(cumulative_var)
z = stats.norm.ppf(1 - 0.05 / 2) # 95% CI
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had to think about this code. Isn't it more easily readable to put CI_95_PCT_TWOSIDED = 0.975 and then use that one?

import numpy as np

from typing import Dict, List, Union
from scipy import stats
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

scipy is not included in requirements.txt - maybe it is a dependency of one of the other ones? Not sure if you need to include it.
Same for numpy and pandas actually

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.

2 participants