|
71 | 71 | "alpha_known = np.ones(N_trial)/np.sqrt(N)\n", |
72 | 72 | "\n", |
73 | 73 | "# Create a wide plot\n", |
74 | | - "fig, ax = plt.subplots(figsize=[12.8, 4.8]);\n", |
| 74 | + "fig, ax = plt.subplots(figsize=[12.8, 4.8])\n", |
75 | 75 | "\n", |
76 | 76 | "# Create errorbar plots using known and estimated standard errors,\n", |
77 | 77 | "# shifting each error bar to the left or right by shift_x\n", |
|
95 | 95 | "H0_est = (xbar - alpha_est < 0) & (xbar + alpha_est > 0)\n", |
96 | 96 | "\n", |
97 | 97 | "# Show the fraction of trials consistent with µ = 0 in each case\n", |
98 | | - "print(\"Fraction of trials consistent with µ = 0, known uncertainty: {0:.1f} %\".format(100*np.sum(H0_known)/N_trial))\n", |
99 | | - "print(\"Fraction of trials consistent with µ = 0, estimated uncertainty: {0:.1f} %\".format(100*np.sum(H0_est)/N_trial))\n", |
| 98 | + "print(\"Fraction of trials consistent with µ = 0, known uncertainty: \"\n", |
| 99 | + " f\"{100*np.sum(H0_known)/N_trial:.1f} %\")\n", |
| 100 | + "print(\"Fraction of trials consistent with µ = 0, estimated uncertainty: \"\n", |
| 101 | + " f\"{100*np.sum(H0_est)/N_trial:.1f} %\")\n", |
100 | 102 | "\n", |
101 | 103 | "# Show indices where the known and estimated uncertainties yield different results for H0\n", |
102 | 104 | "print(\"Trials consistent with µ = 0 for known uncertainty but inconsistent for estimated uncertainty:\")\n", |
|
0 commit comments