Skip to content
Snippets Groups Projects
Commit 1ded9720 authored by François  LAURENT's avatar François LAURENT
Browse files

rebase: no changes

parent 45698534
No related branches found
No related tags found
1 merge request!12024 update of stats-related content
...@@ -40,14 +40,14 @@ def illustration_confidence_interval(m=46, s=1, alpha=0.05): ...@@ -40,14 +40,14 @@ def illustration_confidence_interval(m=46, s=1, alpha=0.05):
ml = (grid[0]+4*ci_low)/5 ml = (grid[0]+4*ci_low)/5
pl = (2*pdf(ci_low)+pdf(m))/3 pl = (2*pdf(ci_low)+pdf(m))/3
plt.annotate(f'${alpha/2*100}\%$', plt.annotate(f'${alpha/2*100}\\%$',
[ml, .1*pdf(ml)], [ml, pl], [ml, .1*pdf(ml)], [ml, pl],
arrowprops=dict(arrowstyle="->"), arrowprops=dict(arrowstyle="->"),
horizontalalignment='center') horizontalalignment='center')
ml1 = (4*m+ci_high)/5 ml1 = (4*m+ci_high)/5
ml2 = (m+ci_high)/2 ml2 = (m+ci_high)/2
plt.annotate(f'${(1-alpha)*100:.0f}\%$ prob. mass', plt.annotate(f'${(1-alpha)*100:.0f}\\%$ prob. mass',
[ml1, pl], [ml2, (pdf(ml2)+pdf(m))/2], [ml1, pl], [ml2, (pdf(ml2)+pdf(m))/2],
arrowprops=dict(arrowstyle="->")) arrowprops=dict(arrowstyle="->"))
...@@ -56,7 +56,7 @@ def illustration_confidence_interval(m=46, s=1, alpha=0.05): ...@@ -56,7 +56,7 @@ def illustration_confidence_interval(m=46, s=1, alpha=0.05):
width=line_width, head_length=head_length, linestyle='none') width=line_width, head_length=head_length, linestyle='none')
t = plt.arrow(ci_high-head_length, height, ci_low-ci_high+2*head_length, 0, t = plt.arrow(ci_high-head_length, height, ci_low-ci_high+2*head_length, 0,
width=line_width, head_length=head_length, linestyle='none') width=line_width, head_length=head_length, linestyle='none')
plt.text(m, height+line_width, f'${(1-alpha)*100:.0f}\%$ confidence interval', plt.text(m, height+line_width, f'${(1-alpha)*100:.0f}\\%$ confidence interval',
ha='center') ha='center')
plt.legend(loc='upper left') plt.legend(loc='upper left')
...@@ -76,7 +76,7 @@ def illustration_onesided_probabilitymass(z, N = stats.norm(0, 1), onesided_pval ...@@ -76,7 +76,7 @@ def illustration_onesided_probabilitymass(z, N = stats.norm(0, 1), onesided_pval
plt.xlim(grid[[0,-1]]) plt.xlim(grid[[0,-1]])
plt.xlabel('$X$') plt.xlabel('$X$')
plt.ylabel('probability density') plt.ylabel('probability density')
plt.legend([pdf_curve, z_line], ['$\mathcal{N}(0,1)$', '$z$']) plt.legend([pdf_curve, z_line], [r'$\mathcal{N}(0,1)$', '$z$'])
plt.annotate(f'$\\approx {onesided_pvalue:.2f}$', (1.8, .03), xytext=(2, .13), arrowprops=dict(arrowstyle="->")) plt.annotate(f'$\\approx {onesided_pvalue:.2f}$', (1.8, .03), xytext=(2, .13), arrowprops=dict(arrowstyle="->"))
def illustration_t_pdfs(): def illustration_t_pdfs():
...@@ -121,7 +121,7 @@ def illustration_skewness_kurtosis(): ...@@ -121,7 +121,7 @@ def illustration_skewness_kurtosis():
ax = axes[0] ax = axes[0]
for sigma, color in zip((.25, .5, 1), colors): for sigma, color in zip((.25, .5, 1), colors):
ax.plot(grid, skewed_dist(sigma, grid), '-', color=color, label=f'$\sigma={sigma:.2f}$') ax.plot(grid, skewed_dist(sigma, grid), '-', color=color, label=f'$\\sigma={sigma:.2f}$')
ax.axhline(0, linestyle='--', color='grey', linewidth=1) ax.axhline(0, linestyle='--', color='grey', linewidth=1)
ax.set_xlim(grid[[0,-1]]) ax.set_xlim(grid[[0,-1]])
...@@ -159,7 +159,7 @@ def illustration_chi2(): ...@@ -159,7 +159,7 @@ def illustration_chi2():
ax.axhline(0, linestyle='--', color='grey', linewidth=1) ax.axhline(0, linestyle='--', color='grey', linewidth=1)
ax.set_xlim(grid[0],grid[-1]) ax.set_xlim(grid[0],grid[-1])
ax.set_xlabel('$\chi^2$') ax.set_xlabel(r'$\chi^2$')
ax.set_ylabel('probability density') ax.set_ylabel('probability density')
ax.legend([ f'$df={df}$' for df in dfs ]) ax.legend([ f'$df={df}$' for df in dfs ])
...@@ -169,7 +169,7 @@ def illustration_chi2(): ...@@ -169,7 +169,7 @@ def illustration_chi2():
ax.plot(grid, chi2, '-', color=color) ax.plot(grid, chi2, '-', color=color)
ax.axhline(0, linestyle='--', color='grey', linewidth=1) ax.axhline(0, linestyle='--', color='grey', linewidth=1)
ax.set_xlim(grid[0],grid[-1]) ax.set_xlim(grid[0],grid[-1])
ax.set_xlabel('$\chi^2$') ax.set_xlabel(r'$\chi^2$')
ax.set_ylabel('probability density'); ax.set_ylabel('probability density');
A = [85, 86, 88, 75, 78, 94, 98, 79, 71, 80] A = [85, 86, 88, 75, 78, 94, 98, 79, 71, 80]
......
This diff is collapsed.
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment