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

Confidence intervals #27

Merged
merged 6 commits into from
Jun 23, 2023
Merged

Confidence intervals #27

merged 6 commits into from
Jun 23, 2023

Conversation

kdund
Copy link
Collaborator

@kdund kdund commented Jun 22, 2023

function to compute confidence intervals. Code to test:

from alea.examples.gaussian_model import GaussianModel

model = GaussianModel()

data = model.generate_data(mu=0,sigma=1)
data[0]["hat_mu"] = 0.
model.data = data

model.parameters.sigma.fittable = False
model.parameters.sigma.nominal_value = 1.
model.parameters.mu.nominal_value = 1.
model.parameters.mu.fittable = True
ci_upper =  model.confidence_interval(parameter="mu", parameter_interval_bounds=[-10,10], confidence_interval_kind="upper") #should return nan, sps.norm().isf(0.1) = 1.28
ci_lower = model.confidence_interval(parameter="mu", parameter_interval_bounds=[-10,10], confidence_interval_kind="lower") #should return -sps.norm().isf(0.1) = 1.28 , nan
ci_central = model.confidence_interval(parameter="mu", parameter_interval_bounds=[-10,10], confidence_interval_kind="central") #should return [-1,1]* sps.norm().isf(0.05) = 1.64

@kdund kdund self-assigned this Jun 22, 2023
@kdund kdund added the inference Statistics code label Jun 22, 2023
@kdund kdund linked an issue Jun 22, 2023 that may be closed by this pull request
@kdund kdund requested a review from hammannr June 22, 2023 22:21
Copy link
Collaborator

@hammannr hammannr left a comment

Choose a reason for hiding this comment

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

Hi @kdund and thanks a lot for this addition. Looks great and works as intedned! 😊
I have a few suggestions and I quickly fixed the Parameters class init.

Copy link
Collaborator

@hammannr hammannr left a comment

Choose a reason for hiding this comment

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

Looks great! 😊

@kdund kdund merged commit b83bf7c into master Jun 23, 2023
@kdund kdund deleted the confidence_intervals branch June 23, 2023 18:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
inference Statistics code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement confidence interval
2 participants