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

Set best_fit_args to confidence_interval_args if None #76

Merged
merged 2 commits into from
Aug 10, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions alea/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -396,8 +396,8 @@ def confidence_interval(
parameter_interval_bounds: Tuple[float, float] = None,
confidence_level: float = None,
confidence_interval_kind: str = None,
best_fit_args: dict = None,
confidence_interval_args: dict = None,
best_fit_args: dict = None,
) -> Tuple[float, float]:
"""
Uses self.fit to compute confidence intervals for a certain named parameter.
Expand All @@ -421,15 +421,17 @@ def confidence_interval(
If None, the default kind of the model is used.

Keyword Args:
best_fit_args: the parameters to **only** get the global best-fit likelihood
confidence_interval_args: the parameters to get the profile-likelihood,
also the best-fit parameters of profile-likelihood,
parameter_interval_bounds, and confidence interval
confidence_interval_args (dict, optional (default=None)): Parameters that will be fixed
in the profile likelihood computation. If None, all fittable parameters will be profiled except the poi
best_fit_args (dict, optional (default=None)): If you require the "global" best-fit used to normalise the

Choose a reason for hiding this comment

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

[pep8] reported by reviewdog 🐶
E501 line too long (117 > 100 characters)

profile likelihood ratio to fix fewer parameters than the profile likelihood-- mainly used for 1-D slices
of higher-dimensional confidence volumes, where the global best-fit may not be along the profile.
if None, will be set to confidence_interval_args
"""
if best_fit_args is None:
best_fit_args = {}
if confidence_interval_args is None:
confidence_interval_args = {}
if best_fit_args is None:
best_fit_args = confidence_interval_args
ci_objects = self._confidence_interval_checks(
poi_name,
parameter_interval_bounds,
Expand Down