Skip to content

Commit

Permalink
fix/variation: fix divisor in CI computations
Browse files Browse the repository at this point in the history
We were using np.sqrt(n - 1) instead of the correct np.sqrt(n), which
slightly overestimated the CIs (i.e. made us more conservative, so this
fix is not a problem for results).
  • Loading branch information
wehlutyk committed Mar 11, 2017
1 parent 00677bb commit 6a3e350
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions notebooks/variation.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@
" for j, alpha in enumerate([.05, .01, .001]):\n",
" cis[i, j] = (stats.t.ppf(1 - alpha/2, n - 1)\n",
" * values[indices].std(ddof=1)\n",
" / np.sqrt(n - 1))\n",
" / np.sqrt(n))\n",
"\n",
" print(null_name + ' |', end='')\n",
" differences = ((bin_values[:,np.newaxis]\n",
Expand Down Expand Up @@ -349,7 +349,7 @@
" h0ns[i] = h0n[indices].mean()\n",
" values[i] = y[indices].mean()\n",
" cis[i] = (stats.t.ppf(.975, n - 1) * y[indices].std(ddof=1)\n",
" / np.sqrt(n - 1))\n",
" / np.sqrt(n))\n",
" \n",
" # Plot.\n",
" nuphi = r'\\nu_{\\phi' + (',r' if relative else '') + '}'\n",
Expand Down Expand Up @@ -464,7 +464,7 @@
" h0ns[i] = h0n[indices].mean()\n",
" values[i] = y[indices].mean()\n",
" cis[i] = (stats.t.ppf(.975, n - 1) * y[indices].std(ddof=1)\n",
" / np.sqrt(n - 1))\n",
" / np.sqrt(n))\n",
" \n",
" # Plot.\n",
" scale = abs(h0s.mean())\n",
Expand Down

0 comments on commit 6a3e350

Please sign in to comment.