Skip to content

Instantly share code, notes, and snippets.

@galenseilis
Created October 16, 2022 19:00
Show Gist options
  • Select an option

  • Save galenseilis/9ef90b510ba4ed51c3cc55e0ab692ecc to your computer and use it in GitHub Desktop.

Select an option

Save galenseilis/9ef90b510ba4ed51c3cc55e0ab692ecc to your computer and use it in GitHub Desktop.
from astropy.stats import jackknife_stats
import numpy as np
from scipy.spatial.distance import pdist
data = np.random.normal(size=10**3)
def test_statistic(x):
x = np.unique(x)
x = x.reshape(-1,1)
return np.min(pdist(x, metric='cityblock'))
estimate, bias, stderr, conf_interval = jackknife_stats(data, test_statistic, 0.95)
print(estimate, bias, stderr, conf_interval)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment