Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
tijana-zrnic committed Jun 4, 2024
2 parents 0e4cb55 + 08faaef commit 0cec802
Showing 1 changed file with 5 additions and 13 deletions.
18 changes: 5 additions & 13 deletions ppi_py/baselines.py
Original file line number Diff line number Diff line change
Expand Up @@ -310,11 +310,13 @@ def classical_logistic_ci(X, Y, alpha=0.1, alternative="two-sided"):
pointest, np.sqrt(np.diag(cov_mat) / n), alpha, alternative
)


"""
BOOTSTRAP CI
"""


def classical_bootstrap_ci(
estimator,
Y,
Expand Down Expand Up @@ -344,11 +346,7 @@ def classical_bootstrap_ci(
pointest = estimator(Y)

bootstrap_distribution = np.array(
bootstrap(
[Y],
estimator,
n_resamples=n_resamples
)
bootstrap([Y], estimator, n_resamples=n_resamples)
)

else:
Expand All @@ -357,10 +355,7 @@ def classical_bootstrap_ci(

bootstrap_distribution = np.array(
bootstrap(
[X, Y],
estimator,
n_resamples=n_resamples,
paired=[[0, 1]]
[X, Y], estimator, n_resamples=n_resamples, paired=[[0, 1]]
)
)

Expand All @@ -377,9 +372,7 @@ def classical_bootstrap_ci(

# Compute the lower and upper bounds depending on the method
if method == "percentile":
lower_bound = np.quantile(
bootstrap_distribution, alpha_lower, axis=0
)
lower_bound = np.quantile(bootstrap_distribution, alpha_lower, axis=0)
upper_bound = np.quantile(
bootstrap_distribution, 1 - alpha_upper, axis=0
)
Expand All @@ -405,4 +398,3 @@ def classical_bootstrap_ci(
raise ValueError(
"Alternative must be either 'two-sided', 'larger' or 'smaller'."
)

0 comments on commit 0cec802

Please sign in to comment.