|
709 | 709 | "source": [ |
710 | 710 | "Had we had stronger beliefs, we could have expressed them in the prior above.\n", |
711 | 711 | "\n", |
712 | | - "For this example, consider $p_A = 0.05$, and $N = 1500$ users shown site A, and we will simulate whether the user made a purchase or not. To simulate this from $N$ trials, we will use a *Bernoulli* distribution: if $ X\\ \\sim \\text{Ber}(p)$, then $X$ is 1 with probability $p$ and 0 with probability $1-p$. Of course, in practice we do not know $p_A$, but we will use it here to simulate the data." |
| 712 | + "For this example, consider $p_A = 0.05$, and $N = 1500$ users shown site A, and we will simulate whether the user made a purchase or not. To simulate this from $N$ trials, we will use a *Bernoulli* distribution: if $ X\\ \\sim \\text{Ber}(p)$, then $X$ is 1 with probability $p$ and 0 with probability $1$. Of course, in practice we do not know $p_A$, but we will use it here to simulate the data." |
713 | 713 | ] |
714 | 714 | }, |
715 | 715 | { |
|
1819 | 1819 | "cell_type": "markdown", |
1820 | 1820 | "metadata": {}, |
1821 | 1821 | "source": [ |
1822 | | - "A Normal random variable can take on any real value, but the variable is very likely to be relatively close to $\\mu$. In fact, the expected value of a Normal is equal to its $\\mu$ parameter:\n", |
| 1822 | + "A Normal random variable can be take on any real number, but the variable is very likely to be relatively close to $\\mu$. In fact, the expected value of a Normal is equal to its $\\mu$ parameter:\n", |
1823 | 1823 | "\n", |
1824 | 1824 | "$$ E[ X | \\mu, \\tau] = \\mu$$\n", |
1825 | 1825 | "\n", |
|
2048 | 2048 | "input": [ |
2049 | 2049 | "from scipy.stats.mstats import mquantiles\n", |
2050 | 2050 | "\n", |
2051 | | - "# vectorized bottom and top 5% quantiles for \"confidence interval\"\n", |
2052 | | - "qs = mquantiles(p_t, [0.05, 0.95], axis=0)\n", |
| 2051 | + "# vectorized bottom and top 2.5% quantiles for \"confidence interval\"\n", |
| 2052 | + "qs = mquantiles(p_t, [0.025, 0.975], axis=0)\n", |
2053 | 2053 | "plt.fill_between(t[:, 0], *qs, alpha=0.7,\n", |
2054 | 2054 | " color=\"#7A68A6\")\n", |
2055 | 2055 | "\n", |
|
0 commit comments