You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This can be interpreted as a version of what a Bayesian calls **Bayes' Law**.
436
+
Formula {eq}`eq:condprobbayes` is also what a Bayesian calls **Bayes' Law**. A Bayesian statistician regards marginal probability distribution $\textrm{Prob}({X=i}), i = 1, \ldots, J$ as a **prior** distribution that describes his personal subjective beliefs about $X$.
437
+
He then interprets formula {eq}`eq:condprobbayes` as a procedure for constructing a **posterior** distribution that describes how he would revise his subjective beliefs after observing that $Y$ equals $j$.
437
438
```
438
439
439
440
@@ -588,9 +589,15 @@ Marginal distributions are
588
589
$$ \textrm{Prob}(X=i)=\sum_j{f_{ij}}=u_i $$
589
590
$$ \textrm{Prob}(Y=j)=\sum_i{f_{ij}}=v_j $$
590
591
591
-
Below we draw some samples confirm that the "sampling" distribution agrees well with the "population" distribution.
592
592
593
-
**Sample results:**
593
+
**Sampling:**
594
+
595
+
Let's write some Python code that let's us draw some long samples and compute relative frequencies.
596
+
597
+
The code will let us check whether the "sampling" distribution agrees with the "population" distribution - confirming that
598
+
the population distribution correctly tells us the relative frequencies that we should expect in a large sample.
599
+
600
+
594
601
595
602
```{code-cell} ipython3
596
603
# specify parameters
@@ -615,7 +622,9 @@ x[1, p < f_cum[0]] = ys[0]
615
622
print(x)
616
623
```
617
624
618
-
Here, we use exactly the inverse CDF technique to generate sample from the joint distribution $F$.
625
+
```{note}
626
+
To generate random draws from the joint distribution $F$, we use the inverse CDF technique described in {doc}`this companion lecture <stats_examples>`.
These population objects closely resemble sample counterparts computed above.
727
+
These population objects closely resemble the sample counterparts computed above.
719
728
720
-
Let's wrap some of the functions we have used in a Python class for a general discrete bivariate joint distribution.
729
+
Let's wrap some of the functions we have used in a Python class that will let us generate and sample from a
730
+
discrete bivariate joint distribution.
721
731
722
732
```{code-cell} ipython3
723
733
class discrete_bijoint:
@@ -951,7 +961,7 @@ ax.set_xticks([])
951
961
plt.show()
952
962
```
953
963
954
-
Next we can simulate from a built-in `numpy` function and calculate a **sample** marginal distribution from the sample mean and variance.
964
+
Next we can use a built-in `numpy` function to draw random samples, then calculate a **sample** marginal distribution from the sample mean and variance.
955
965
956
966
```{code-cell} ipython3
957
967
μ= np.array([0, 5])
@@ -984,7 +994,7 @@ plt.show()
984
994
985
995
**Conditional distribution**
986
996
987
-
The population conditional distribution is
997
+
For a bivariate normal population distribution, the conditional distributions are also normal:
988
998
989
999
$$
990
1000
\begin{aligned} \\
@@ -993,6 +1003,10 @@ $$
993
1003
\end{aligned}
994
1004
$$
995
1005
1006
+
```{note}
1007
+
Please see this {doc}`quantecon lecture <multivariate_normal>` for more details.
1008
+
```
1009
+
996
1010
Let's approximate the joint density by discretizing and mapping the approximating joint density into a matrix.
997
1011
998
1012
We can compute the discretized marginal density by just using matrix algebra and noting that
@@ -1221,7 +1235,7 @@ But the joint distributions differ.
1221
1235
Thus, multiple joint distributions $[f_{ij}]$ can have the same marginals.
1222
1236
1223
1237
**Remark:**
1224
-
- Couplings are important in optimal transport problems and in Markov processes.
1238
+
- Couplings are important in optimal transport problems and in Markov processes. Please see this {doc}`lecture about optimal transport <opt_transport>`
0 commit comments