Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
jackknife estimate of median and CI
# Leave one observation out to get the jackknife sample and store the median length
median_lengths = []
for i in range(n):
jk_sample = wrench_lengths[index != i]
median_lengths.append(np.median(jk_sample))
median_lengths = np.array(median_lengths)
# Calculate jackknife estimate and it's variance
jk_median_length = np.mean(median_lengths)
jk_var = (n-1)*np.var(median_lengths)
# Assuming normality, calculate lower and upper 95% confidence intervals
print("Jackknife 95% CI lower = {}, upper = {}".format(jk_median_length - 1.96*np.sqrt(jk_var), jk_median_length + 1.96*np.sqrt(jk_var)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.