°persist_js_stateÂÙ$a8d4a517-84a7-426e-a49e-482c5fd047aeЧrunning§runtimeÎ ¨¸depends_on_skipped_cellsµpublished_object_keys�§errored§cell_idÙ$a8d4a517-84a7-426e-a49e-482c5fd047ae¹depends_on_disabled_cells¦queued¤logs�¦output†¤mime©text/html¬rootassigneeÀ²last_run_timestampËAÚ¹&•C¯·has_pluto_hook_features¤bodyÚ¾
The Likelihood Function is a Function of What? (*)
When considering the distribution $p(D|\theta)$ , is it more correct to speak about the likelihood of the model parameters $\theta$ than about the likelihood of the observed data set $D$ . And why?
°persist_js_stateÂÙ$3e196d6a-d294-11ef-0795-41c045079251Чrunning§runtimeÎ »|¸depends_on_skipped_cellsµpublished_object_keys�§errored§cell_idÙ$3e196d6a-d294-11ef-0795-41c045079251¹depends_on_disabled_cells¦queued¤logs�¦output†¤mime©text/html¬rootassigneeÀ²last_run_timestampËAÚ¹&•MÆ·has_pluto_hook_features¤bodyÙ¾
The Bayesian viewpoint is clearly favored in the machine learning community. (In this class, we also strongly favor the Bayesian interpretation).
°persist_js_stateÂÙ$218d3b6e-50b6-4b98-a00c-a19dd33d2c03Чrunning§runtimeÎ Èò¸depends_on_skipped_cellsµpublished_object_keys�§errored§cell_idÙ$218d3b6e-50b6-4b98-a00c-a19dd33d2c03¹depends_on_disabled_cells¦queued¤logs�¦output†¤mime©text/html¬rootassigneeÀ²last_run_timestampËAÚ¹&•ð�·has_pluto_hook_features¤bodyÙ¦
Let's plot the distributions for $X$ , $Y$ , and $Z$ .
°persist_js_stateÂÙ$3e1b4b1c-d294-11ef-0423-9152887cc403Чrunning§runtimeÎ \š¸depends_on_skipped_cellsµpublished_object_keys�§errored§cell_idÙ$3e1b4b1c-d294-11ef-0423-9152887cc403¹depends_on_disabled_cells¦queued¤logs�¦output†¤mime©text/html¬rootassigneeÀ²last_run_timestampËAÚ¹&•j¡·has_pluto_hook_features¤bodyÚ˜
Independent, Exclusive, and Exhaustive Events
It will be helpful to introduce some terms concerning special relationships between events.
Joint events
The expression $p(A,B)$ for the probability of the conjuction $A \land B$ is also called the joint probability of events $A$ and $B$ . Note that
$$p(A,B) = p(B,A)\,,$$
since $A\land B = B \land A$ . Therefore, the order of arguments in a joint probability distribution does not matter: $p(A,B,C,D) = p(C,A,D,B)$ , etc.
Independent events
Two events $A$ and $B$ are said to be independent if the probability of one event is not altered by information about the truth of the other event, i.e.,
$$p(A|B) = p(A)\,.$$
It follows that, if $A$ and $B$ are independent, then the product rule simplifies to
$$p(A,B) = p(A) p(B)\,.$$
$A$ and $B$ with given background $I$ are said to be conditionally independent for given $I$ , if
$$p(A|B,I) = p(A|I)\,.$$
In that case, the product rule simplifies to $p(A,B|I) = p(A|I) p(B|I)$ .
Mutually exclusive events
Two events $A_1$ and $A_2$ are said to be mutually exclusive ('disjoint') if they cannot be true simultaneously, i.e., if
$$p(A_1,A_2)=0 \,.$$
For mutually exclusive events, probabilities add (this follows from the sum rule), hence
$$p(A_1 + A_2) = p(A_1) + p(A_2)$$
Collectively exhaustive events
A set of events $A_1, A_2, \ldots, A_N$ is said to be collectively exhaustive if one of the statements is necessarily true, i.e., $A_1+A_2+\cdots +A_N=\mathrm{TRUE}$ , or equivalently
$$p(A_1+A_2+\cdots +A_N) = 1 \,.$$
Partitioning the universe
If a set of events $A_1, A_2, \ldots, A_n$ is both mutually exclusive and collectively exhaustive , then we say that they partition the universe . Technically, this means that
$$\sum_{n=1}^N p(A_n) = p(A_1 + \ldots + A_N) = 1$$
°persist_js_stateÂÙ$d1ab6fc4-e92c-4e77-8c4a-f5f33cb0b52cЧrunning§runtimeά¸depends_on_skipped_cellsµpublished_object_keys�§errored§cell_idÙ$d1ab6fc4-e92c-4e77-8c4a-f5f33cb0b52c¹depends_on_disabled_cells¦queued¤logs�¦output†¤mime©text/html¬rootassigneeÀ²last_run_timestampËAÚ¹&šÕ¼·has_pluto_hook_features¤bodyÚ?õ
Parameters for X
Normal(μ= , σ= )
Parameters for Y
Normal(μ= , σ= )
°persist_js_stateÂÙ$3e1eeb14-d294-11ef-1702-f5d2cf6fe60aЧrunning§runtimeÎ v¸depends_on_skipped_cellsµpublished_object_keys�§errored§cell_idÙ$3e1eeb14-d294-11ef-1702-f5d2cf6fe60a¹depends_on_disabled_cells¦queued¤logs�¦output†¤mime©text/html¬rootassigneeÀ²last_run_timestampËAÚ¹&•¬*·has_pluto_hook_features¤bodyÚ
°persist_js_stateÂÙ$922770f4-ddc8-4089-b378-f14088276b43Чrunning§runtimeÍÁC¸depends_on_skipped_cellsµpublished_object_keys�§errored§cell_idÙ$922770f4-ddc8-4089-b378-f14088276b43¹depends_on_disabled_cells¦queued¤logs�¦output†¤mime©text/html¬rootassigneeÀ²last_run_timestampËAÚ¹&š=Ôx·has_pluto_hook_features¤bodyÚ)
Inference Exercise: Which color does the ball have?
°persist_js_stateÂÙ$f8c8ba53-df36-48a6-afde-2952cbcfbe48Чrunning§runtimeÎ ·'¸depends_on_skipped_cellsµpublished_object_keys�§errored§cell_idÙ$f8c8ba53-df36-48a6-afde-2952cbcfbe48¹depends_on_disabled_cells¦queued¤logs�¦output†¤mime©text/html¬rootassigneeÀ²last_run_timestampËAÚ¹&•a·has_pluto_hook_features¤bodyÚ2
Does this fragment resonate with your own experience?
In this lesson we introduce Probability Theory (PT) again. As we will see in the next lessons, PT is all you need to make sense of machine learning, artificial intelligence, statistics, etc.
°persist_js_stateÂÙ$41bee964-a0a9-4a7f-8505-54a9ee12ef0dЧrunning§runtimeÎ np¸depends_on_skipped_cellsµpublished_object_keys�§errored§cell_idÙ$41bee964-a0a9-4a7f-8505-54a9ee12ef0d¹depends_on_disabled_cells¦queued¤logs�¦output†¤mime©text/html¬rootassigneeÀ²last_run_timestampËAÚ¹&•kH·has_pluto_hook_features¤bodyÚ
Propositional (Boolean) Logic
Define an event (or "proposition") $A$ as a statement that can be considered for its truth by a person. For instance,
$$�= \texttt{``there is life on Mars''}$$
Boolean logic (or propositional logic) is a formal system of logic based on binary truth values: every proposition is either true (with assigned value $1$ ) or false (with assigned value $0$ ). It is named after George Boole, who developed the algebraic formulation of logic in the mid-19th century.
With Boolean operators ($\lor$ , $\land$ , $\implies$ , etc.), we can create and evaluate compound propositions, e.g.,
Given two events $A$ and $B$ , the conjunction (logical-and) $A \land B$ is true if-and-only-if both $A$ and $B$ are true. We write $A \land B$ also shortly as $AB$ (or use a comma as in a joint probability distribution $p(A,B)$ ).
The disjunction (logical-or) $A \lor B$ , is true if either $A$ or $B$ is true or both $A$ and $B$ are true. We write $A \lor B$ also as $A + B$ (Note that the plus-sign is here not an arithmetic operator, but rather a logical operator to process truth values.)
The denial of $A$ , i.e., the event not -A, is written as $\bar{A}$ .
Boolean logic provides the rules of inference for deductive reasoning and underpins all formal reasoning systems in mathematics and philosophy.
°persist_js_stateÂÙ$3e1b8bf4-d294-11ef-04cc-6364e46fdd64Чrunning§runtimeÎ ]7¸depends_on_skipped_cellsµpublished_object_keys�§errored§cell_idÙ$3e1b8bf4-d294-11ef-04cc-6364e46fdd64¹depends_on_disabled_cells¦queued¤logs�¦output†¤mime©text/html¬rootassigneeÀ²last_run_timestampËAÚ¹&•ú·has_pluto_hook_features¤bodyÚw
A very practical application of this law is to get rid of a variable that we are not interested in. For instance, if $X$ and $Y \in \{y_1,y_2,\ldots,y_n\}$ are discrete variables, then
$$p(X) = \sum_{i=1}^n p(X,Y=y_i)\,.$$
°persist_js_stateÂÙ$98fa17a6-7c8b-46e4-b32d-52db183d88f8Чrunning§runtimeÎ x¸depends_on_skipped_cellsµpublished_object_keys�§errored§cell_idÙ$98fa17a6-7c8b-46e4-b32d-52db183d88f8¹depends_on_disabled_cells¦queued¤logs�¦output†¤mime©text/html¬rootassigneeÀ²last_run_timestampËAÚ¹&•Ã]·has_pluto_hook_features¤bodyÙŽ
Set the parameters for the distributions of $X$ and $Y$ :
°persist_js_stateÂÙ$3e1f4f46-d294-11ef-29b8-69e546763781Чrunning§runtimeÎ ¨�¸depends_on_skipped_cellsµpublished_object_keys�§errored§cell_idÙ$3e1f4f46-d294-11ef-29b8-69e546763781¹depends_on_disabled_cells¦queued¤logs�¦output†¤mime©text/html¬rootassigneeÀ²last_run_timestampËAÚ¹&•d·has_pluto_hook_features¤bodyÚß
PDF for the Product of Two Variables
For two continuous independent variables $X$ and $Y$ , with PDF's $p_x(x)$ and $p_y(y)$ , the PDF of $Z = X Y$ is given by
$$p_z(z) = \int_{-\infty}^{\infty} p_x(x) \,p_y(z/x)\, \frac{1}{|x|}\,\mathrm{d}x\,.$$
For proof, see https://en.wikipedia.org/wiki/Product_distribution .
°persist_js_stateÂÙ$3a1d380e-df80-4727-9772-f199214cf05dЧrunning§runtimeÎ Š¹¸depends_on_skipped_cellsµpublished_object_keys�§errored§cell_idÙ$3a1d380e-df80-4727-9772-f199214cf05d¹depends_on_disabled_cells¦queued¤logs�¦output†¤mime©text/html¬rootassigneeÀ²last_run_timestampËAÚ¹&•Ó1·has_pluto_hook_features¤bodyÚq
The Sum Rule (**)
Derive the general sum rule,
$$p(A + B) = p(A) + p(B) - p(A,B)$$
from the elementary sum rule $p(A) + p(\bar A) = 1$ and the product rule.
°persist_js_stateÂÙ$3e1e5a5a-d294-11ef-2fdf-efee4eb1a0f2Чrunning§runtimeÎ %ó¸depends_on_skipped_cellsµpublished_object_keys�§errored§cell_idÙ$3e1e5a5a-d294-11ef-2fdf-efee4eb1a0f2¹depends_on_disabled_cells¦queued¤logs�¦output†¤mime©text/html¬rootassigneeÀ²last_run_timestampËAÚ¹&•
å?·has_pluto_hook_features¤bodyÚ
The second central moment, also known as variance of $x$ is defined as
$$\Sigma_x \triangleq \mathbb{E} \left[(x-\mu_x)(x-\mu_x)^T \right]$$
°persist_js_stateÂÙ$3e1bdd02-d294-11ef-19e8-2f44eccf58afЧrunning§runtimeÎ —¤¸depends_on_skipped_cellsµpublished_object_keys�§errored§cell_idÙ$3e1bdd02-d294-11ef-19e8-2f44eccf58af¹depends_on_disabled_cells¦queued¤logs�¦output†¤mime©text/html¬rootassigneeÀ²last_run_timestampËAÚ¹&•ÇÞ·has_pluto_hook_features¤bodyÚ›
This last formula is called Bayes rule , named after its inventor Thomas Bayes (1701-1761). While Bayes rule is always true, a particularly useful application occurs when $D$ refers to an observed data set and $\theta$ is set of unobserved model parameters. In that case,
the prior probability $p(\theta)$ represents our state-of-knowledge about proper values for $\theta$ , before seeing the data $D$ .
the posterior probability $p(\theta|D)$ represents our state-of-knowledge about $\theta$ after we have seen the data.
°persist_js_stateÂÙ$fea8ae4c-8ef9-4b74-ad13-1314afef97deЧrunning§runtimeÎ °F¸depends_on_skipped_cellsµpublished_object_keys�§errored§cell_idÙ$fea8ae4c-8ef9-4b74-ad13-1314afef97de¹depends_on_disabled_cells¦queued¤logs�¦output†¤mime©text/html¬rootassigneeÀ²last_run_timestampËAÚ¹&•ê·has_pluto_hook_features¤bodyÚ�
True and False Events
In probability theory, events that are certainly true or certainly false are treated as special cases of general events, and they correspond to probabilities of $1$ and $0$ , respectively.
Let $\Omega$ be the sample space, i.e., the set of all possible outcomes of an experiment. Then:
The true event corresponds to the entire sample space $\Omega$ .
It always happens, regardless of the outcome.
For example, for the outcome of a throw of a dice, the sample space is $\Omega = \{1,2,3,4,5,6\}$ .
Its probability is
$$p(\Omega) = 1\,.$$
The false event corresponds to the empty set $\emptyset$ .
$$p(\emptyset) = 0 \,.$$
°persist_js_stateÂÙ$db73766d-643c-41d7-a1eb-f376c657f860Чrunning§runtimeÎ X�¸depends_on_skipped_cellsµpublished_object_keys�§errored§cell_idÙ$db73766d-643c-41d7-a1eb-f376c657f860¹depends_on_disabled_cells¦queued¤logs�¦output†¤mime©text/html¬rootassigneeÀ²last_run_timestampËAÚ¹&•ž
·has_pluto_hook_features¤bodyÚ3
If the transformation $y=h(x)$ is not invertible, then $x=g(y)$ does not exist. In that case, you can still work out the transformation by equating equivalent probability masses in the two domains.
°persist_js_stateÂÙ$3b1b0869-b815-4697-9dba-3c4b4cb5ac47Чrunning§runtimeÎ j¸depends_on_skipped_cellsµpublished_object_keys�§errored§cell_idÙ$3b1b0869-b815-4697-9dba-3c4b4cb5ac47¹depends_on_disabled_cells¦queued¤logs�¦output†¤mime©text/html¬rootassigneeÀ²last_run_timestampËAÚ¹&šbøœ·has_pluto_hook_features¤bodyÚ D
Click for the solution
$$\begin{align}
p\left( A + B \right) &\underset{\mathrm{bool}}{=} p\left( \overline {\bar A \bar B } \right) \\
&\underset{\mathrm{sum}}{=} 1 - p\left( \bar{A} \bar{B} \right) \\
&\underset{\mathrm{prod}}{=} 1 - p\left( \bar{A} |\bar{B} \right) p\left(\bar{B} \right) \\
&\underset{\mathrm{sum}}{=} 1 - \left( 1 - p\left(A|\bar B \right) \right) \left( 1 - p\left( B \right) \right) \\
&= p(B) + \left( {1 - p\left( B \right)} \right)p\left( {A|\bar B } \right) \\
&\underset{\mathrm{prod}}{=} p(B) + \left( 1 - p\left( B \right) \right) p\left( \bar{B} |A \right) \frac{ p\left( A \right) }{ p\left(\bar{B}\right)} \\
&\underset{\mathrm{sum}}{=} p(B) + p\left(\bar{B} |A \right) p\left( A \right) \\
&\underset{\mathrm{sum}}{=} p(B) + \left( 1 - p\left( {B|A} \right) \right) p\left( A \right) \\
&\underset{\mathrm{sum}}{=} p\left( A \right) + p(B) - p\left( A,B \right)
\end{align}$$
Note that, aside from the first boolean rewrite, everything follows straight application of sum and product rules.
°persist_js_stateÂÙ$a8046381-ff11-40af-ae2b-078d71c586e7Чrunning§runtimeÍWÀ¸depends_on_skipped_cellsµpublished_object_keys�§errored§cell_idÙ$a8046381-ff11-40af-ae2b-078d71c586e7¹depends_on_disabled_cells¦queued¤logs�¦output†¤mimeªtext/plain¬rootassignee¦result²last_run_timestampËAÚ¹&š|`W·has_pluto_hook_features¤body±0.060126582278481°persist_js_stateÂÙ$3e1d20e0-d294-11ef-2044-e1fe6590a600Чrunning§runtimeÎ :Ÿdepends_on_skipped_cellsµpublished_object_keys�§errored§cell_idÙ$3e1d20e0-d294-11ef-2044-e1fe6590a600¹depends_on_disabled_cells¦queued¤logs�¦output†¤mime©text/html¬rootassigneeÀ²last_run_timestampËAÚ¹&•
÷·has_pluto_hook_features¤bodyÚ�
Note
The (discrete) sampling distribution is a valid probability distribution.
However, the likelihood function $L(\theta)$ clearly isn't, since $\int_0^1 L(\theta) \mathrm{d}\theta = 0.5 \neq 1$ .
°persist_js_stateÂÙ$fc733d61-fd0f-4a13-9afc-4505ac0253dfЧrunning§runtimeÎZT¸depends_on_skipped_cellsµpublished_object_keys�§errored§cell_idÙ$fc733d61-fd0f-4a13-9afc-4505ac0253df¹depends_on_disabled_cells¦queued¤logs�¦output†¤mimeªtext/plain¬rootassigneeÀ²last_run_timestampËAÚ¹&™)‚à·has_pluto_hook_features¤body °persist_js_stateÂÙ$3e1c60ba-d294-11ef-3a01-cf9e97512857Чrunning§runtimeÎ ¸depends_on_skipped_cellsµpublished_object_keys�§errored§cell_idÙ$3e1c60ba-d294-11ef-3a01-cf9e97512857¹depends_on_disabled_cells¦queued¤logs�¦output†¤mime©text/html¬rootassigneeÀ²last_run_timestampËAÚ¹&•'Ä·has_pluto_hook_features¤bodyÚK
In general, $p(D|\theta)$ is just a function of the two variables $D$ and $\theta$ . We distinguish two interpretations of this function, depending on which variable is observed (or given by other means).
°persist_js_stateÂÙ$3e1bf116-d294-11ef-148b-f7a1ca3f3badЧrunning§runtimeÎ ü¸depends_on_skipped_cellsµpublished_object_keys�§errored§cell_idÙ$3e1bf116-d294-11ef-148b-f7a1ca3f3bad¹depends_on_disabled_cells¦queued¤logs�¦output†¤mime©text/html¬rootassigneeÀ²last_run_timestampËAÚ¹&• D5·has_pluto_hook_features¤bodyÙˆ
Bayes rule tells us how to update our knowledge about model parameters when facing new data. Hence,
°persist_js_stateÂÙ$3e1fa04a-d294-11ef-00c3-a51d1aaa5553Чrunning§runtimeÎ 9˸depends_on_skipped_cellsµpublished_object_keys�§errored§cell_idÙ$3e1fa04a-d294-11ef-00c3-a51d1aaa5553¹depends_on_disabled_cells¦queued¤logs�¦output†¤mime©text/html¬rootassigneeÀ²last_run_timestampËAÚ¹&•…Æ·has_pluto_hook_features¤bodyÚx
If $x$ is defined on a continuous domain, and $p_x(x)$ is a probability density function, then probability mass is represented by the area under a (density) curve. In that case,
$$p_y(y) = p_x(g(y)) g^\prime(y)\,,$$
which is also known as the Change-of-Variable theorem .
°persist_js_stateÂÙ$9b85a92b-c56b-48a3-97c1-6b1882e33a22Чrunning§runtime·ÚY¸depends_on_skipped_cellsµpublished_object_keys�§errored§cell_idÙ$9b85a92b-c56b-48a3-97c1-6b1882e33a22¹depends_on_disabled_cells¦queued¤logs�¦output†¤mime©text/html¬rootassigneeÀ²last_run_timestampËAÚ¹&šDy··has_pluto_hook_features¤bodyÙŸ
Show solution?
°persist_js_stateÂÙ$079157c9-5d97-4dbc-8c47-afa8b661db06Чrunning§runtimeÎÔßܸdepends_on_skipped_cellsµpublished_object_keys�§errored§cell_idÙ$079157c9-5d97-4dbc-8c47-afa8b661db06¹depends_on_disabled_cells¦queued¤logs�¦output†¤mime©text/html¬rootassigneeÀ²last_run_timestampËAÚ¹&š³3Ê·has_pluto_hook_features¤bodyÙ‚
\[p(y|\theta=0.50) = \begin{cases} 0.50 & \text{if }y=0 \\ 0.50 & \text{if } y=1 \end{cases}\]
°persist_js_stateÂÙ$3e1c70be-d294-11ef-14ed-0d46515541c5Чrunning§runtimeÎ g†¸depends_on_skipped_cellsµpublished_object_keys�§errored§cell_idÙ$3e1c70be-d294-11ef-14ed-0d46515541c5¹depends_on_disabled_cells¦queued¤logs�¦output†¤mime©text/html¬rootassigneeÀ²last_run_timestampËAÚ¹&•K·has_pluto_hook_features¤bodyÚÜ
The sampling distribution (a.k.a. the data-generating distribution)
$$p(D|\theta=\theta_0)$$
(which is a function of $D$ only) describes a probability distribution for data $D$ , assuming that it is generated by the given model with parameters fixed at $\theta = \theta_0$ .
°persist_js_stateÂÙ$3e1bffec-d294-11ef-2a49-9ff0f6331addЧrunning§runtimeÎ M¸depends_on_skipped_cellsµpublished_object_keys�§errored§cell_idÙ$3e1bffec-d294-11ef-2a49-9ff0f6331add¹depends_on_disabled_cells¦queued¤logs�¦output†¤mime©text/html¬rootassigneeÀ²last_run_timestampËAÚ¹&• f„·has_pluto_hook_features¤bodyÚ
Bayes Rule Nomenclature
Some nomenclature associated with Bayes rule:
$$\underbrace{p(\theta | D)}_{\text{posterior}} = \frac{\overbrace{p(D|\theta)}^{\text{likelihood}} \times \overbrace{p(\theta)}^{\text{prior}}}{\underbrace{p(D)}_{\text{evidence}}}$$
°persist_js_stateÂÙ$3e198ba6-d294-11ef-3fe7-d70bf4833fa6Чrunning§runtimeΠĸdepends_on_skipped_cellsµpublished_object_keys�§errored§cell_idÙ$3e198ba6-d294-11ef-3fe7-d70bf4833fa6¹depends_on_disabled_cells¦queued¤logs�¦output†¤mime©text/html¬rootassigneeÀ²last_run_timestampËAÚ¹&•€ñ·has_pluto_hook_features¤bodyÙ®
In this class, we aim to turn on the headlights and illuminate the elegance and power of the Bayesian approach to information processing.
°persist_js_stateÂÙ$3e1a8eca-d294-11ef-1ef0-c15b24d05990Чrunning§runtimeÎ £æ¸depends_on_skipped_cellsµpublished_object_keys�§errored§cell_idÙ$3e1a8eca-d294-11ef-1ef0-c15b24d05990¹depends_on_disabled_cells¦queued¤logs�¦output†¤mime©text/html¬rootassigneeÀ²last_run_timestampËAÚ¹&•ÊÉ·has_pluto_hook_features¤bodyÚß
If $X$ is continuously valued, then $p(X=x)$ is a probability density function (PDF) with $p(X=x)\ge 0$ and normalization $\int_x p(x)\mathrm{d}x=1$ .
Note that if $X$ is continuously valued, then the value of $p(x)$ is not necessarily $\le 1$ . E.g., a uniform distribution on the continuous domain $[0,.5]$ has value $p(x) = 2$ over its domain.
°persist_js_stateÂÙ$3e1f68fa-d294-11ef-31b2-e7670da8c08cЧrunning§runtimeÎ 1¬¸depends_on_skipped_cellsµpublished_object_keys�§errored§cell_idÙ$3e1f68fa-d294-11ef-31b2-e7670da8c08c¹depends_on_disabled_cells¦queued¤logs�¦output†¤mime©text/html¬rootassigneeÀ²last_run_timestampËAÚ¹&•F|·has_pluto_hook_features¤bodyÚ(
°persist_js_stateÂÙ$d0f672bd-74c9-4be1-b5ea-8d4040edb5dfЧrunning§runtimeÍ$ù¸depends_on_skipped_cellsµpublished_object_keys�§errored§cell_idÙ$d0f672bd-74c9-4be1-b5ea-8d4040edb5df¹depends_on_disabled_cells¦queued¤logs�¦output†¤mime©text/html¬rootassigneeÀ²last_run_timestampËAÚ¹&šf1œ·has_pluto_hook_features¤bodyÚ—
°persist_js_stateÂÙ$3e1c51e2-d294-11ef-2c6d-d32a98308c6fЧrunning§runtimeÎ Pò¸depends_on_skipped_cellsµpublished_object_keys�§errored§cell_idÙ$3e1c51e2-d294-11ef-2c6d-d32a98308c6f¹depends_on_disabled_cells¦queued¤logs�¦output†¤mime©text/html¬rootassigneeÀ²last_run_timestampËAÚ¹&•Ú·has_pluto_hook_features¤bodyÚ�
The Likelihood Function vs the Sampling Distribution
Consider a distribution $p(D|\theta)$ , where $D$ relates to variables that are observed (i.e., a "data set") and $\theta$ are model parameters.
°persist_js_stateÂÙ$3e1a7c8e-d294-11ef-1f97-55e608d49141Чrunning§runtimeÎ (Ÿdepends_on_skipped_cellsµpublished_object_keys�§errored§cell_idÙ$3e1a7c8e-d294-11ef-1f97-55e608d49141¹depends_on_disabled_cells¦queued¤logs�¦output†¤mime©text/html¬rootassigneeÀ²last_run_timestampËAÚ¹&•¤{·has_pluto_hook_features¤bodyÚ]
If $X$ is a discretely valued variable, then $p(X=x)$ is a probability mass function (PMF) with $0\le p(X=x)\le 1$ and normalization $\sum_x p(x) =1$ .
°persist_js_stateÂÙ$b305a905-06c2-4a15-8042-72ef6375720fЧrunning§runtimeÎdg¸depends_on_skipped_cellsµpublished_object_keys�§errored§cell_idÙ$b305a905-06c2-4a15-8042-72ef6375720f¹depends_on_disabled_cells¦queued¤logs�¦output†¤mimeªtext/plain¬rootassigneeÀ²last_run_timestampËAÚ¹&—ŠþP·has_pluto_hook_features¤body °persist_js_stateÂÙ$3e1d6d00-d294-11ef-1081-e11b8397eb91Чrunning§runtimeÎ !�¸depends_on_skipped_cellsµpublished_object_keys�§errored§cell_idÙ$3e1d6d00-d294-11ef-1081-e11b8397eb91¹depends_on_disabled_cells¦queued¤logs�¦output†¤mime©text/html¬rootassigneeÀ²last_run_timestampËAÚ¹&špb·has_pluto_hook_features¤bodyÚ%Ô
Problem
Given a disease $D \in \{0, 1\}$ with prevalence (overall occurence percentage) of and a test procedure $T \in \{0, 1\}$ with sensitivity (true positive rate) of and specificity (true negative' rate) of , what is the chance that somebody who tests positive actually has the disease?
The percentages are interactive! Click and drag to change the values.
°persist_js_stateÂÙ$3e191b6c-d294-11ef-3174-d1b4b36e252bЧrunning§runtimeÎ —u¸depends_on_skipped_cellsµpublished_object_keys�§errored§cell_idÙ$3e191b6c-d294-11ef-3174-d1b4b36e252b¹depends_on_disabled_cells¦queued¤logs�¦output†¤mime©text/html¬rootassigneeÀ²last_run_timestampËAÚ¹&•œÜ·has_pluto_hook_features¤bodyÚg
Examples
$$p(\,\texttt{future-observations}\,|\,\texttt{past-observations}\,)$$
$$p(\,x\texttt{-belongs-to-class-}k \,|\,x\,)$$
$$p(\,\texttt{model-parameters} \,|\,\texttt{new-observation},\,\texttt{past-observations}\,)$$
°persist_js_stateÂÙ$4a81342c-17c7-4eb9-933b-edb98df7b9c4Чrunning§runtimeÎ][¸depends_on_skipped_cellsµpublished_object_keys�§errored§cell_idÙ$4a81342c-17c7-4eb9-933b-edb98df7b9c4¹depends_on_disabled_cells¦queued¤logs�¦output†¤mimeªtext/plain¬rootassigneeÀ²last_run_timestampËAÚ¹&š‡�Á·has_pluto_hook_features¤bodyÙ"n (generic function with 1 method)°persist_js_stateÂÙ$9f4125a2-d5d2-4acf-8bad-82f94af230e8Чrunning§runtime΃>͸depends_on_skipped_cellsµpublished_object_keys�§errored§cell_idÙ$9f4125a2-d5d2-4acf-8bad-82f94af230e8¹depends_on_disabled_cells¦queued¤logs�¦output†¤mime©text/html¬rootassigneeÀ²last_run_timestampËAÚ¹&˜ß•‰·has_pluto_hook_features¤bodyÚ¸
Preface
"As an undergraduate, I always found the subject of statistics to be rather mysterious. This topic wasn’t entirely new to me, as we had been taught a little bit about probability earlier at high school; for example, I was already familiar with the binomial, Poisson and normal distributions. Most of this made sense, but only seemed to relate to things like rolling dice, flipping coins, shuffling cards and so on. However, having aspirations of becoming a scientist, what I really wanted to know was how to analyse experimental data. Thus, I eagerly looked forward to the lectures on statistics. Sadly, they were a great disappointment. Although many of the tests and procedures expounded were intuitively reasonable, there was something deeply unsatisfactory about the whole affair: there didn’t seem to be any underlying basic principles! Hence, the course on ‘probability and statistics’ had led to an unfortunate dichotomy: probability made sense, but was just a game; statistics was important, but it was a bewildering collection of tests with little obvious rhyme or reason. While not happy with this situation, I decided to put aside the subject and concentrate on real science. After all, the predicament was just a reflection of my own inadequacies and I’d just have to work at it when the time came to really analyse my data.
The story above is not just my own, but is the all too common experience of many scientists. Fortunately, it doesn’t have to be like this. What we were not told in our undergraduate lectures is that there is an alternative approach to the whole subject of data analysis which uses only probability theory. In one sense, it makes the topic of statistics entirely superfluous. In another, it provides the logical justification for many of the prevalent statistical tests and procedures, making explicit the conditions and approximations implicitly assumed in their use."
D.S. Sivia
°persist_js_stateÂÙ$840ab4dc-0d2e-4bf8-acc7-5f1ee2b0dcafЧrunning§runtimeÎ ^ø¸depends_on_skipped_cellsµpublished_object_keys�§errored§cell_idÙ$840ab4dc-0d2e-4bf8-acc7-5f1ee2b0dcaf¹depends_on_disabled_cells¦queued¤logs�¦output†¤mime©text/html¬rootassigneeÀ²last_run_timestampËAÚ¹&•1
·has_pluto_hook_features¤bodyÙ|
Probability Theory as Rational Reasoning
°persist_js_stateÂÙ$3e027ede-4ac1-4521-a026-dc00bfca4adfЧrunning§runtimeÍÁ%¸depends_on_skipped_cellsµpublished_object_keys�§errored§cell_idÙ$3e027ede-4ac1-4521-a026-dc00bfca4adf¹depends_on_disabled_cells¦queued¤logs�¦output†¤mime©text/html¬rootassigneeÀ²last_run_timestampËAÚ¹&š?=6·has_pluto_hook_features¤bodyÚÿ
Inference Exercise: Causality?
°persist_js_stateÂÙ$3e1889b8-d294-11ef-17bb-496655fbd618Чrunning§runtimeÎ '¸depends_on_skipped_cellsµpublished_object_keys�§errored§cell_idÙ$3e1889b8-d294-11ef-17bb-496655fbd618¹depends_on_disabled_cells¦queued¤logs�¦output†¤mime©text/html¬rootassigneeÀ²last_run_timestampËAÚ¹&•”Ä·has_pluto_hook_features¤bodyÚô
The Design of Probability Theory
In the real world, we are rarely completely certain of something. Instead of a truth value for the proposition $A$ , we can attach a degree-of-belief $p(A)$ that represents how likely we think $A$ is.
Now consider the truth value of the proposition
$$�= \texttt{``there is life on Mars''}$$
with
$$I = \texttt{``All known life forms require water''}$$
as background information. Now, assume that a new piece of information
$$B = \texttt{``There is water on Mars''}$$
becomes available, how should our degree of belief in event $A$ be affected if we were rational ?
°persist_js_stateÂÙ$6d07be25-53d0-46b9-b197-a3680d830952Чrunning§runtimeÎ òÙ¸depends_on_skipped_cellsµpublished_object_keys�§errored§cell_idÙ$6d07be25-53d0-46b9-b197-a3680d830952¹depends_on_disabled_cells¦queued¤logs�¦output†¤mime©text/html¬rootassigneeÀ²last_run_timestampËAÚ¹&šE͸·has_pluto_hook_features¤bodyÚ o
Click for the solution
Define $A = \begin{pmatrix} I & I \end{pmatrix}$ and $w = \begin{pmatrix} x \\ y \end{pmatrix}$ , where $I$ is the identity matrix. Then
$$z = A w\,. $$
Let $\mathbb{E}[\cdot]$ refer to the expectation operator. Now apply the formula for the mean and variance of a variable after a linear transformation:
$$\mathbb{E}[z] = \mathbb{E}[Aw] = \mathbb{E}[x+y] = \mathbb{E}[x] + \mathbb{E}[y] \,. $$
For the covariance matrix, first note that
$$\begin{align}
\Sigma_w &= \mathbb{E} \bigg[ \begin{pmatrix} x - \mu_x \\ y- \mu_y\end{pmatrix} \begin{pmatrix} x - \mu_x \\ y- \mu_y\end{pmatrix}^T \bigg] \\
&= \begin{pmatrix} \Sigma_x & \Sigma_{xy} \\ \Sigma_{yx} & \Sigma_y\end{pmatrix}
\end{align} $$
and we note that $\Sigma_{yx} = \Sigma_{xy}^T$ . Then, $\Sigma_z$ evaluates to
$$\begin{align}
\Sigma_z &= A \Sigma_w A^T \\
&= \begin{pmatrix} I & I \end{pmatrix} \begin{pmatrix} \Sigma_x & \Sigma_{xy} \\ \Sigma_{yx} & \Sigma_y\end{pmatrix} \begin{pmatrix}I \\ I \end{pmatrix} \\
&= \Sigma_x + \Sigma_y + \Sigma_{xy} + \Sigma_{yx} \,.
\end{align}$$
°persist_js_stateÂÙ$5f377237-d9a5-4778-aa4d-1c6ce109b705Чrunning§runtimeÎ Ó¸depends_on_skipped_cellsµpublished_object_keys�§errored§cell_idÙ$5f377237-d9a5-4778-aa4d-1c6ce109b705¹depends_on_disabled_cells¦queued¤logs�¦output†¤mime©text/html¬rootassigneeÀ²last_run_timestampËAÚ¹&•õ”·has_pluto_hook_features¤bodyÚÛ
Apples and Oranges
Box 1 contains 8 apples and 4 oranges. Box 2 contains 10 apples and 2 oranges. Boxes are chosen with equal probability. You pick a box and then select a fruit from that box.
(a) (*) What is the probability of choosing an apple?
(b) (**) If an apple is chosen, what is the probability that it came from box 1?
°persist_js_stateÂÙ$d3b003c6-70ca-419f-a343-e35b266323f3Чrunning§runtimeÎ ÒQ¸depends_on_skipped_cellsµpublished_object_keys�§errored§cell_idÙ$d3b003c6-70ca-419f-a343-e35b266323f3¹depends_on_disabled_cells¦queued¤logs�¦output†¤mime©text/html¬rootassigneeÀ²last_run_timestampËAÚ¹&šcŒi·has_pluto_hook_features¤bodyÚO
Click for the solution
Yes, it’s more correct to speak about the likelihood of the model parameters, not of the observed data set. Once $D$ has been observed, it is no longer a random variable; it’s just a fixed outcome. What varies is $\theta$ , so $L(\theta) = p(D|\theta)$ is a function of the parameters, not of the data.
Saying “likelihood of the data� is misleading because it confuses likelihood with the sampling distribution $p(D|\theta)$ seen as a function of $D$ (where $\theta$ is fixed). The latter is a probability distribution over possible data sets before observing them.
°persist_js_stateÂÙ$3e1fb370-d294-11ef-1fb6-63a41a024691Чrunning§runtimeΉ`¸depends_on_skipped_cellsµpublished_object_keys�§errored§cell_idÙ$3e1fb370-d294-11ef-1fb6-63a41a024691¹depends_on_disabled_cells¦queued¤logs�¦output†¤mime©text/html¬rootassigneeÀ²last_run_timestampËAÚ¹&š`cª·has_pluto_hook_features¤bodyÚ»
Let $p_x(x) = \mathcal{N}(x|\mu,\sigma^2)$ where
$$\mathcal{N}(x|\mu,\sigma^2) \triangleq \frac{1}{\sigma \sqrt{2\pi}} \,\exp\left(-\frac{(x-\mu)^2}{2 \sigma^2}\right)$$
is a Gaussian distribution . Let $y = \frac{x-\mu}{\sigma}$ . Evaluate $p_y(y)$ as a Gaussian distribution.
°persist_js_state±published_objects€julia_version§v1.13.3±cell_dependenciesÞ †Ù$3e1bba8e-d294-11ef-1f61-295af16078ce„´precedence_heuristic §cell_idÙ$3e1bba8e-d294-11ef-1f61-295af16078ce´downstream_cells_map€²upstream_cells_map‚§@md_str�¨getindex�Ù$3e1eba72-d294-11ef-2f53-b56f1862fcbb„´precedence_heuristic §cell_idÙ$3e1eba72-d294-11ef-2f53-b56f1862fcbb´downstream_cells_map€²upstream_cells_map‚§@md_str�¨getindex�Ù$9b9be452-9681-43e8-bb09-cc8728df384f„´precedence_heuristic §cell_idÙ$9b9be452-9681-43e8-bb09-cc8728df384f´downstream_cells_map€²upstream_cells_map‚§@md_str�¨getindex�Ù$3e1f8e48-d294-11ef-0f8a-b58294a8543d„´precedence_heuristic §cell_idÙ$3e1f8e48-d294-11ef-0f8a-b58294a8543d´downstream_cells_map€²upstream_cells_mapƒ§@md_str�ªhide_proof�¨getindex�Ù$5b681e41-ad14-4c58-8ea0-4b6d85885c51„´precedence_heuristic §cell_idÙ$5b681e41-ad14-4c58-8ea0-4b6d85885c51´downstream_cells_map€²upstream_cells_map‚§@md_str�¨getindex�Ù$42b47af6-b850-4987-a2d7-805a2cb64e43„´precedence_heuristic§cell_idÙ$42b47af6-b850-4987-a2d7-805a2cb64e43´downstream_cells_map�¤@mdx’Ù$079157c9-5d97-4dbc-8c47-afa8b661db06Ù$2156f96e-eebe-4190-8ce9-c76825c6da71²upstream_cells_map€Ù$726e7e9f-3d68-4d02-9954-1edd98b74fdc„´precedence_heuristic §cell_idÙ$726e7e9f-3d68-4d02-9954-1edd98b74fdc´downstream_cells_map€²upstream_cells_mapƒ§@md_str�¨getindex�ªkeyconcept�Ù$3e18e4bc-d294-11ef-38bc-cb97cb4e0963„´precedence_heuristic §cell_idÙ$3e18e4bc-d294-11ef-38bc-cb97cb4e0963´downstream_cells_map€²upstream_cells_mapƒ§@md_str�¨getindex�ªkeyconcept�Ù$e3157dc0-5a64-4479-a37a-40fe25cccc07„´precedence_heuristic §cell_idÙ$e3157dc0-5a64-4479-a37a-40fe25cccc07´downstream_cells_map€²upstream_cells_map�¬code_example�Ù$3e1c806a-d294-11ef-1fad-17e5625279f7„´precedence_heuristic §cell_idÙ$3e1c806a-d294-11ef-1fad-17e5625279f7´downstream_cells_map€²upstream_cells_map‚§@md_str�¨getindex�Ù$3e1ea442-d294-11ef-1364-8dd9986325f7„´precedence_heuristic §cell_idÙ$3e1ea442-d294-11ef-1364-8dd9986325f7´downstream_cells_map€²upstream_cells_map‚§@md_str�¨getindex�Ù$3e1c4224-d294-11ef-2707-49470aaae6eb„´precedence_heuristic §cell_idÙ$3e1c4224-d294-11ef-2707-49470aaae6eb´downstream_cells_map€²upstream_cells_map‚§@md_str�¨getindex�Ù$3e1f225a-d294-11ef-04c6-f3ca018ab286„´precedence_heuristic §cell_idÙ$3e1f225a-d294-11ef-04c6-f3ca018ab286´downstream_cells_map€²upstream_cells_mapƒ¬code_example�§@md_str�¨getindex�Ù$5613e9b7-ff0d-435a-9de6-aaf293ebf592„´precedence_heuristic §cell_idÙ$5613e9b7-ff0d-435a-9de6-aaf293ebf592´downstream_cells_map€²upstream_cells_mapƒhide_solution�§@md_str�¨getindex�Ù$3e1c1e3e-d294-11ef-0955-bdf9d0ba3c53„´precedence_heuristic §cell_idÙ$3e1c1e3e-d294-11ef-0955-bdf9d0ba3c53´downstream_cells_map€²upstream_cells_map‚§@md_str�¨getindex�Ù$9b92fc89-2036-4525-979b-d296ab29329c„´precedence_heuristic §cell_idÙ$9b92fc89-2036-4525-979b-d296ab29329c´downstream_cells_map€²upstream_cells_map‚§@md_str�¨getindex�Ù$eeb9a1f5-b857-4843-920b-2e4a9656f66b„´precedence_heuristic§cell_idÙ$eeb9a1f5-b857-4843-920b-2e4a9656f66b´downstream_cells_map‚¬LaTeXStrings’Ù$8a7dd8b7-5faf-4091-8451-9769f842accbÙ$c0ea3253-a06b-426c-91a3-a6dd33e42779¥Plots�²upstream_cells_map€Ù$5377c5a4-77c4-4fa7-9f84-0c511e3bf708„´precedence_heuristic §cell_idÙ$5377c5a4-77c4-4fa7-9f84-0c511e3bf708´downstream_cells_map€²upstream_cells_mapƒ§@md_str�ªhide_proof�¨getindex�Ù$3e1e7742-d294-11ef-1204-f9be24da07ab„´precedence_heuristic §cell_idÙ$3e1e7742-d294-11ef-1204-f9be24da07ab´downstream_cells_map€²upstream_cells_map‚§@md_str�¨getindex�Ù$ff9142ba-3a85-48cf-8b78-07e0b554e280„´precedence_heuristic §cell_idÙ$ff9142ba-3a85-48cf-8b78-07e0b554e280´downstream_cells_map€²upstream_cells_map‚§@md_str�¨getindex�Ù$ea803646-b18e-4f13-ab6a-fc5080d44e92„´precedence_heuristic §cell_idÙ$ea803646-b18e-4f13-ab6a-fc5080d44e92´downstream_cells_map€²upstream_cells_map�²challenge_solution�Ù$3e192ef4-d294-11ef-1fc4-87175eeec5eb„´precedence_heuristic §cell_idÙ$3e192ef4-d294-11ef-1fc4-87175eeec5eb´downstream_cells_map€²upstream_cells_map‚§@md_str�¨getindex�Ù$3e1b9ba8-d294-11ef-18f2-db8eed3d87d0„´precedence_heuristic §cell_idÙ$3e1b9ba8-d294-11ef-18f2-db8eed3d87d0´downstream_cells_map€²upstream_cells_map‚§@md_str�¨getindex�Ù$317707a3-9ef1-4c67-b451-6adcfcff50f0„´precedence_heuristic §cell_idÙ$317707a3-9ef1-4c67-b451-6adcfcff50f0´downstream_cells_map€²upstream_cells_mapƒhide_solution�§@md_str�¨getindex�Ù$8a7dd8b7-5faf-4091-8451-9769f842accb„´precedence_heuristic §cell_idÙ$8a7dd8b7-5faf-4091-8451-9769f842accb´downstream_cells_map€²upstream_cells_map‰¸LaTeXStrings.latexstring�¡:�¡f‘Ù$fc733d61-fd0f-4a13-9afc-4505ac0253df¬LaTeXStrings‘Ù$eeb9a1f5-b857-4843-920b-2e4a9656f66b¤plot�§nothing�¨scatter!�¢Î¸‘Ù$fc733d61-fd0f-4a13-9afc-4505ac0253df¦@L_str�Ù$99d9099f-4908-4bb3-8d59-da9cb69af04c„´precedence_heuristic §cell_idÙ$99d9099f-4908-4bb3-8d59-da9cb69af04c´downstream_cells_map€²upstream_cells_mapƒ¤hint�§@md_str�¨getindex�Ù$dd11e93a-3dad-4e97-8642-fb70edfa6aae„´precedence_heuristic §cell_idÙ$dd11e93a-3dad-4e97-8642-fb70edfa6aae´downstream_cells_map€²upstream_cells_map‚§@md_str�¨getindex�Ù$3e1de32c-d294-11ef-1f63-f190c8361404„´precedence_heuristic §cell_idÙ$3e1de32c-d294-11ef-1f63-f190c8361404´downstream_cells_map€²upstream_cells_map‚§@md_str�¨getindex�Ù$fae6f2ce-ac8f-4ea6-b2cf-38b30a7e20d4„´precedence_heuristic §cell_idÙ$fae6f2ce-ac8f-4ea6-b2cf-38b30a7e20d4´downstream_cells_map€²upstream_cells_map‚§@md_str�¨getindex�Ù$3e1a69f4-d294-11ef-103e-efc47025fb8f„´precedence_heuristic §cell_idÙ$3e1a69f4-d294-11ef-103e-efc47025fb8f´downstream_cells_map€²upstream_cells_map‚§@md_str�¨getindex�Ù$3e198336-d294-11ef-26fd-03cd15876486„´precedence_heuristic §cell_idÙ$3e198336-d294-11ef-26fd-03cd15876486´downstream_cells_map€²upstream_cells_map‚§@md_str�¨getindex�Ù$6fafc778-c2c8-4e23-8d2e-6dc02e49e935„´precedence_heuristic §cell_idÙ$6fafc778-c2c8-4e23-8d2e-6dc02e49e935´downstream_cells_map€²upstream_cells_map‚§@md_str�¨getindex�Ù$5394e37c-ae00-4042-8ada-3bbf32fbca9e„´precedence_heuristic§cell_idÙ$5394e37c-ae00-4042-8ada-3bbf32fbca9e´downstream_cells_map�Distributions�²upstream_cells_map€Ù$3e1ab104-d294-11ef-1a98-412946949fba„´precedence_heuristic §cell_idÙ$3e1ab104-d294-11ef-1a98-412946949fba´downstream_cells_map€²upstream_cells_mapƒ§@md_str�¨getindex�¤HTML�Ù$c0ea3253-a06b-426c-91a3-a6dd33e42779„´precedence_heuristic §cell_idÙ$c0ea3253-a06b-426c-91a3-a6dd33e42779´downstream_cells_map€²upstream_cells_mapŠ¥plot!�¦@L_str�¡x‘Ù$d1ab6fc4-e92c-4e77-8c4a-f5f33cb0b52c¸LaTeXStrings.latexstring�£pdf�¡y‘Ù$d1ab6fc4-e92c-4e77-8c4a-f5f33cb0b52c¬LaTeXStrings‘Ù$eeb9a1f5-b857-4843-920b-2e4a9656f66b¤plot�¡z‘Ù$34f1f3cb-9346-4bd3-ae9f-a25b4d5de781¥range�Ù$b176ceae-884e-4460-9f66-020c1ac447f1„´precedence_heuristic §cell_idÙ$b176ceae-884e-4460-9f66-020c1ac447f1´downstream_cells_map€²upstream_cells_map‚§@md_str�¨getindex�Ù$d2202628-e4f9-4289-b48e-23b5a0073f94„´precedence_heuristic §cell_idÙ$d2202628-e4f9-4289-b48e-23b5a0073f94´downstream_cells_map€²upstream_cells_mapƒ§@md_str�ªhide_proof�¨getindex�Ù$b7445b9b-7fbb-4560-b947-a23af0fcf101„´precedence_heuristic §cell_idÙ$b7445b9b-7fbb-4560-b947-a23af0fcf101´downstream_cells_map€²upstream_cells_mapƒ§Î¸_bond‘Ù$fc733d61-fd0f-4a13-9afc-4505ac0253df§@md_str�¨getindex�Ù$bcb4be20-0439-4809-a166-8c50b6b9206b„´precedence_heuristic §cell_idÙ$bcb4be20-0439-4809-a166-8c50b6b9206b´downstream_cells_map€²upstream_cells_map‚·PlutoUI.TableOfContents�§PlutoUI�Ù$50bdc2fe-f48d-4c4e-8b4e-170782681366„´precedence_heuristic §cell_idÙ$50bdc2fe-f48d-4c4e-8b4e-170782681366´downstream_cells_map€²upstream_cells_mapƒ§@md_str�ªhide_proof�¨getindex�Ù$fc3151f9-e143-4e31-b7b7-3f25b4fe9dab„´precedence_heuristic §cell_idÙ$fc3151f9-e143-4e31-b7b7-3f25b4fe9dab´downstream_cells_map€²upstream_cells_map‚§@md_str�¨getindex�Ù$1cb8b2c4-e1ae-4973-ba53-fc6c7fe1f37a„´precedence_heuristic §cell_idÙ$1cb8b2c4-e1ae-4973-ba53-fc6c7fe1f37a´downstream_cells_map€²upstream_cells_map‚§@md_str�¨getindex�Ù$d93f73d4-2783-4777-b0ce-cdc0444cb300„´precedence_heuristic §cell_idÙ$d93f73d4-2783-4777-b0ce-cdc0444cb300´downstream_cells_map€²upstream_cells_mapƒ§Î¸_bond‘Ù$fc733d61-fd0f-4a13-9afc-4505ac0253df§@md_str�¨getindex�Ù$3e1803d0-d294-11ef-0304-df2b9b698cd1„´precedence_heuristic §cell_idÙ$3e1803d0-d294-11ef-0304-df2b9b698cd1´downstream_cells_map€²upstream_cells_map‚§@md_str�¨getindex�Ù$3e18d2ea-d294-11ef-35e9-2332dd31dbf0„´precedence_heuristic §cell_idÙ$3e18d2ea-d294-11ef-35e9-2332dd31dbf0´downstream_cells_map€²upstream_cells_map‚§@md_str�¨getindex�Ù$2156f96e-eebe-4190-8ce9-c76825c6da71„´precedence_heuristic §cell_idÙ$2156f96e-eebe-4190-8ce9-c76825c6da71´downstream_cells_map�«#462#result�²upstream_cells_mapްHypertextLiteral�¸HypertextLiteral.content�¡-�Ù MarkdownLiteral.CMParsedRenderer�¤@mdx‘Ù$42b47af6-b850-4987-a2d7-805a2cb64e43¿show_disease_diagnosis_solution‘Ù$9b85a92b-c56b-48a3-97c1-6b1882e33a22ªprevalence‘Ù$4f6dd225-c64d-4b76-b075-0bf71c863b5a¯MarkdownLiteral�¡n‘Ù$4a81342c-17c7-4eb9-933b-edb98df7b9c4·HypertextLiteral.Result�¦result‘Ù$a8046381-ff11-40af-ae2b-078d71c586e7«sensitivity‘Ù$4f6dd225-c64d-4b76-b075-0bf71c863b5a·HypertextLiteral.Bypass�«specificity‘Ù$4f6dd225-c64d-4b76-b075-0bf71c863b5aÙ$ef264651-854e-4374-8ea8-5476c85150c4„´precedence_heuristic §cell_idÙ$ef264651-854e-4374-8ea8-5476c85150c4´downstream_cells_map€²upstream_cells_map‚§@md_str�¨getindex�Ù$91dd40f0-c373-48b3-b83b-6e8df2c43e5a„´precedence_heuristic §cell_idÙ$91dd40f0-c373-48b3-b83b-6e8df2c43e5a´downstream_cells_map€²upstream_cells_mapƒhide_solution�§@md_str�¨getindex�Ù$3e1babca-d294-11ef-37c1-cd821a6488b2„´precedence_heuristic §cell_idÙ$3e1babca-d294-11ef-37c1-cd821a6488b2´downstream_cells_map€²upstream_cells_map‚§@md_str�¨getindex�Ù$58f70d3e-4b64-414e-b560-327be2a0c4c2„´precedence_heuristic §cell_idÙ$58f70d3e-4b64-414e-b560-327be2a0c4c2´downstream_cells_map€²upstream_cells_map�²exercise_statement�Ù$34f1f3cb-9346-4bd3-ae9f-a25b4d5de781„´precedence_heuristic §cell_idÙ$34f1f3cb-9346-4bd3-ae9f-a25b4d5de781´downstream_cells_map�¡z‘Ù$c0ea3253-a06b-426c-91a3-a6dd33e42779²upstream_cells_map‡¡^�¦Normal�¡+�¡y‘Ù$d1ab6fc4-e92c-4e77-8c4a-f5f33cb0b52c¤sqrt�£âˆš�¡x‘Ù$d1ab6fc4-e92c-4e77-8c4a-f5f33cb0b52cÙ$3e18c25c-d294-11ef-11bc-a93c2572b107„´precedence_heuristic §cell_idÙ$3e18c25c-d294-11ef-11bc-a93c2572b107´downstream_cells_map€²upstream_cells_map‚§@md_str�¨getindex�Ù$03692f4d-0daf-4dfc-a7ff-6b954326e4d0„´precedence_heuristic §cell_idÙ$03692f4d-0daf-4dfc-a7ff-6b954326e4d0´downstream_cells_map€²upstream_cells_map�©exercises�Ù$3e1e4dda-d294-11ef-33b7-4bbe3300ca22„´precedence_heuristic §cell_idÙ$3e1e4dda-d294-11ef-33b7-4bbe3300ca22´downstream_cells_map€²upstream_cells_map‚§@md_str�¨getindex�Ù$3e1d33c8-d294-11ef-0a08-bdc419949925„´precedence_heuristic §cell_idÙ$3e1d33c8-d294-11ef-0a08-bdc419949925´downstream_cells_map€²upstream_cells_map‚§@md_str�¨getindex�Ù$3e194ef2-d294-11ef-3b38-1ddc3063ff35„´precedence_heuristic §cell_idÙ$3e194ef2-d294-11ef-3b38-1ddc3063ff35´downstream_cells_map€²upstream_cells_map‚§@md_str�¨getindex�Ù$16c2eb59-16b8-4347-9aab-6e4b99016c79„´precedence_heuristic §cell_idÙ$16c2eb59-16b8-4347-9aab-6e4b99016c79´downstream_cells_map€²upstream_cells_mapƒ§@md_str�¨getindex�ªkeyconcept�Ù$3e1906ea-d294-11ef-236e-c966a9474170„´precedence_heuristic §cell_idÙ$3e1906ea-d294-11ef-236e-c966a9474170´downstream_cells_map€²upstream_cells_map‚§@md_str�¨getindex�Ù$3e1bcb00-d294-11ef-2795-bd225bd00496„´precedence_heuristic §cell_idÙ$3e1bcb00-d294-11ef-2795-bd225bd00496´downstream_cells_map€²upstream_cells_mapƒ§@md_str�¨getindex�¤HTML�Ù$66ebe33c-8360-4938-9b51-625e5bed176c„´precedence_heuristic §cell_idÙ$66ebe33c-8360-4938-9b51-625e5bed176c´downstream_cells_map€²upstream_cells_mapƒhide_solution�§@md_str�¨getindex�Ù$3e1e9224-d294-11ef-38b3-137c2be22400„´precedence_heuristic §cell_idÙ$3e1e9224-d294-11ef-38b3-137c2be22400´downstream_cells_map€²upstream_cells_map‚§@md_str�¨getindex�Ù$3e17df5e-d294-11ef-38c7-f573724871d8„´precedence_heuristic §cell_idÙ$3e17df5e-d294-11ef-38c7-f573724871d8´downstream_cells_map€²upstream_cells_map�¥title�Ù$70d79732-0f55-40ba-929d-fba431318848„´precedence_heuristic §cell_idÙ$70d79732-0f55-40ba-929d-fba431318848´downstream_cells_map€²upstream_cells_map‚§@md_str�¨getindex�Ù$3e1964b4-d294-11ef-373d-712257fc130f„´precedence_heuristic §cell_idÙ$3e1964b4-d294-11ef-373d-712257fc130f´downstream_cells_map€²upstream_cells_map‚§@md_str�¨getindex�Ù$3e1c9184-d294-11ef-3e35-5393d97fbc44„´precedence_heuristic §cell_idÙ$3e1c9184-d294-11ef-3e35-5393d97fbc44´downstream_cells_map€²upstream_cells_map‚§@md_str�¨getindex�Ù$3e18f18c-d294-11ef-33e4-b7f9495e0508„´precedence_heuristic §cell_idÙ$3e18f18c-d294-11ef-33e4-b7f9495e0508´downstream_cells_map€²upstream_cells_map‚§@md_str�¨getindex�Ù$3e1b5c9c-d294-11ef-137f-d75b3731eae4„´precedence_heuristic §cell_idÙ$3e1b5c9c-d294-11ef-137f-d75b3731eae4´downstream_cells_map€²upstream_cells_map‚§@md_str�¨getindex�Ù$4edf38ab-a940-4ab0-be22-fa95cf571146„´precedence_heuristic §cell_idÙ$4edf38ab-a940-4ab0-be22-fa95cf571146´downstream_cells_map€²upstream_cells_map‚§@md_str�¨getindex�Ù$a66ab9df-897c-42e5-8b0f-c520ceaffa23„´precedence_heuristic§cell_idÙ$a66ab9df-897c-42e5-8b0f-c520ceaffa23´downstream_cells_map�¦Printf�²upstream_cells_map€Ù$3e19e95a-d294-11ef-3da4-6d23922a5150„´precedence_heuristic §cell_idÙ$3e19e95a-d294-11ef-3da4-6d23922a5150´downstream_cells_map€²upstream_cells_map‚§@md_str�¨getindex�Ù$3e19436c-d294-11ef-11c5-f9914f7a3a57„´precedence_heuristic §cell_idÙ$3e19436c-d294-11ef-11c5-f9914f7a3a57´downstream_cells_map€²upstream_cells_map‚§@md_str�¨getindex�Ù$3e1b05ee-d294-11ef-33de-efed64d01c0d„´precedence_heuristic §cell_idÙ$3e1b05ee-d294-11ef-33de-efed64d01c0d´downstream_cells_map€²upstream_cells_mapƒ§@md_str�¨getindex�ªkeyconcept�Ù$4f6dd225-c64d-4b76-b075-0bf71c863b5a„´precedence_heuristic §cell_idÙ$4f6dd225-c64d-4b76-b075-0bf71c863b5a´downstream_cells_map†¯prevalence_bond’Ù$3e185ab0-d294-11ef-3f7d-9bd465518274Ù$3e1d6d00-d294-11ef-1081-e11b8397eb91°sensitivity_bond’Ù$3e185ab0-d294-11ef-3f7d-9bd465518274Ù$3e1d6d00-d294-11ef-1081-e11b8397eb91«specificity’Ù$2156f96e-eebe-4190-8ce9-c76825c6da71Ù$a8046381-ff11-40af-ae2b-078d71c586e7«sensitivity’Ù$2156f96e-eebe-4190-8ce9-c76825c6da71Ù$a8046381-ff11-40af-ae2b-078d71c586e7°specificity_bond’Ù$3e185ab0-d294-11ef-3f7d-9bd465518274Ù$3e1d6d00-d294-11ef-1081-e11b8397eb91ªprevalence’Ù$2156f96e-eebe-4190-8ce9-c76825c6da71Ù$a8046381-ff11-40af-ae2b-078d71c586e7²upstream_cells_map‰¤Base�ªScrubbable�¡:�¥@bind�¨Base.get�«PlutoRunner�¯Core.applicable�¤Core�·PlutoRunner.create_bond�Ù$61713e1c-8e37-45d9-9f58-c3db69e15b66„´precedence_heuristic §cell_idÙ$61713e1c-8e37-45d9-9f58-c3db69e15b66´downstream_cells_map€²upstream_cells_map�³challenge_statement�Ù$3e1f7d5e-d294-11ef-2878-05744036f32c„´precedence_heuristic §cell_idÙ$3e1f7d5e-d294-11ef-2878-05744036f32c´downstream_cells_map€²upstream_cells_map‚§@md_str�¨getindex�Ù$3e1b7d14-d294-11ef-0d10-1148a928dd57„´precedence_heuristic §cell_idÙ$3e1b7d14-d294-11ef-0d10-1148a928dd57´downstream_cells_map€²upstream_cells_map‚§@md_str�¨getindex�Ù$2292c667-862e-4924-8f15-de0a8893c439„´precedence_heuristic §cell_idÙ$2292c667-862e-4924-8f15-de0a8893c439´downstream_cells_map€²upstream_cells_mapƒhide_solution�§@md_str�¨getindex�Ù$3e1ed1a4-d294-11ef-2de4-d7cc540e06a1„´precedence_heuristic §cell_idÙ$3e1ed1a4-d294-11ef-2de4-d7cc540e06a1´downstream_cells_map€²upstream_cells_map‚§@md_str�¨getindex�Ù$dd31ec7c-708d-4fd7-958d-f9887798a5bc„´precedence_heuristic §cell_idÙ$dd31ec7c-708d-4fd7-958d-f9887798a5bc´downstream_cells_map€²upstream_cells_map‚§@md_str�¨getindex�Ù$577c6e08-9b74-43a4-9e27-9c477980406b„´precedence_heuristic §cell_idÙ$577c6e08-9b74-43a4-9e27-9c477980406b´downstream_cells_map�ªNormalBind‘Ù$d1ab6fc4-e92c-4e77-8c4a-f5f33cb0b52c²upstream_cells_map‹°HypertextLiteral�¸HypertextLiteral.content�¤@htl�Ù&PlutoUI.Experimental.transformed_value�¯PlutoUI.combine�¦Normal�¦String�·HypertextLiteral.Result�§PlutoUI�·HypertextLiteral.Bypass�Ù HypertextLiteral.attribute_value�Ù$7d493e09-f7cc-4e13-a506-b792edcbf390„´precedence_heuristic §cell_idÙ$7d493e09-f7cc-4e13-a506-b792edcbf390´downstream_cells_map€²upstream_cells_map‚§@md_str�¨getindex�Ù$727dc817-0284-4c0f-9a92-21dcbea50807„´precedence_heuristic §cell_idÙ$727dc817-0284-4c0f-9a92-21dcbea50807´downstream_cells_map€²upstream_cells_mapƒhide_solution�§@md_str�¨getindex�Ù$3e1e2b96-d294-11ef-3a68-fdc78232142e„´precedence_heuristic §cell_idÙ$3e1e2b96-d294-11ef-3a68-fdc78232142e´downstream_cells_map€²upstream_cells_map‚§@md_str�¨getindex�Ù$4c639e65-e06b-4c5e-b6e7-aabed6b6c0b4„´precedence_heuristic §cell_idÙ$4c639e65-e06b-4c5e-b6e7-aabed6b6c0b4´downstream_cells_map€²upstream_cells_mapƒhide_solution�§@md_str�¨getindex�Ù$3e18b2fa-d294-11ef-1255-df048f0dcec2„´precedence_heuristic §cell_idÙ$3e18b2fa-d294-11ef-1255-df048f0dcec2´downstream_cells_map€²upstream_cells_map‚§@md_str�¨getindex�Ù$3e185ab0-d294-11ef-3f7d-9bd465518274„´precedence_heuristic §cell_idÙ$3e185ab0-d294-11ef-3f7d-9bd465518274´downstream_cells_map€²upstream_cells_map…¯prevalence_bond‘Ù$4f6dd225-c64d-4b76-b075-0bf71c863b5a°sensitivity_bond‘Ù$4f6dd225-c64d-4b76-b075-0bf71c863b5a§@md_str�°specificity_bond‘Ù$4f6dd225-c64d-4b76-b075-0bf71c863b5a¨getindex�Ù$3e1c0e80-d294-11ef-0d19-375e01988f16„´precedence_heuristic §cell_idÙ$3e1c0e80-d294-11ef-0d19-375e01988f16´downstream_cells_map€²upstream_cells_map‚§@md_str�¨getindex�Ù$5da42e9a-4318-48ea-9f43-4c1e1c97bceb„´precedence_heuristic §cell_idÙ$5da42e9a-4318-48ea-9f43-4c1e1c97bceb´downstream_cells_map€²upstream_cells_map�±keyconceptsummary�Ù$a8d4a517-84a7-426e-a49e-482c5fd047ae„´precedence_heuristic §cell_idÙ$a8d4a517-84a7-426e-a49e-482c5fd047ae´downstream_cells_map€²upstream_cells_map‚§@md_str�¨getindex�Ù$3e196d6a-d294-11ef-0795-41c045079251„´precedence_heuristic §cell_idÙ$3e196d6a-d294-11ef-0795-41c045079251´downstream_cells_map€²upstream_cells_map‚§@md_str�¨getindex�Ù$218d3b6e-50b6-4b98-a00c-a19dd33d2c03„´precedence_heuristic §cell_idÙ$218d3b6e-50b6-4b98-a00c-a19dd33d2c03´downstream_cells_map€²upstream_cells_map‚§@md_str�¨getindex�Ù$3e1b4b1c-d294-11ef-0423-9152887cc403„´precedence_heuristic §cell_idÙ$3e1b4b1c-d294-11ef-0423-9152887cc403´downstream_cells_map€²upstream_cells_map‚§@md_str�¨getindex�Ù$d1ab6fc4-e92c-4e77-8c4a-f5f33cb0b52c„´precedence_heuristic §cell_idÙ$d1ab6fc4-e92c-4e77-8c4a-f5f33cb0b52c´downstream_cells_map‚¡y’Ù$34f1f3cb-9346-4bd3-ae9f-a25b4d5de781Ù$c0ea3253-a06b-426c-91a3-a6dd33e42779¡x’Ù$34f1f3cb-9346-4bd3-ae9f-a25b4d5de781Ù$c0ea3253-a06b-426c-91a3-a6dd33e42779²upstream_cells_mapŒ°HypertextLiteral�¸HypertextLiteral.content�¤@htl�«PlutoRunner�»PlutoRunner.Core.applicable�ªScrubbable�¥@bind�·HypertextLiteral.Result�Ù#PlutoRunner.PlutoRunner.create_bond�·HypertextLiteral.Bypass�ªNormalBind‘Ù$577c6e08-9b74-43a4-9e27-9c477980406b´PlutoRunner.Base.get�Ù$3e1eeb14-d294-11ef-1702-f5d2cf6fe60a„´precedence_heuristic §cell_idÙ$3e1eeb14-d294-11ef-1702-f5d2cf6fe60a´downstream_cells_map€²upstream_cells_map‚§@md_str�¨getindex�Ù$922770f4-ddc8-4089-b378-f14088276b43„´precedence_heuristic §cell_idÙ$922770f4-ddc8-4089-b378-f14088276b43´downstream_cells_map€²upstream_cells_map�²exercise_statement�Ù$f8c8ba53-df36-48a6-afde-2952cbcfbe48„´precedence_heuristic §cell_idÙ$f8c8ba53-df36-48a6-afde-2952cbcfbe48´downstream_cells_map€²upstream_cells_map‚§@md_str�¨getindex�Ù$41bee964-a0a9-4a7f-8505-54a9ee12ef0d„´precedence_heuristic §cell_idÙ$41bee964-a0a9-4a7f-8505-54a9ee12ef0d´downstream_cells_map€²upstream_cells_map‚§@md_str�¨getindex�Ù$3e1b8bf4-d294-11ef-04cc-6364e46fdd64„´precedence_heuristic §cell_idÙ$3e1b8bf4-d294-11ef-04cc-6364e46fdd64´downstream_cells_map€²upstream_cells_map‚§@md_str�¨getindex�Ù$98fa17a6-7c8b-46e4-b32d-52db183d88f8„´precedence_heuristic §cell_idÙ$98fa17a6-7c8b-46e4-b32d-52db183d88f8´downstream_cells_map€²upstream_cells_map‚§@md_str�¨getindex�Ù$3e1f4f46-d294-11ef-29b8-69e546763781„´precedence_heuristic §cell_idÙ$3e1f4f46-d294-11ef-29b8-69e546763781´downstream_cells_map€²upstream_cells_map‚§@md_str�¨getindex�Ù$3a1d380e-df80-4727-9772-f199214cf05d„´precedence_heuristic §cell_idÙ$3a1d380e-df80-4727-9772-f199214cf05d´downstream_cells_map€²upstream_cells_map‚§@md_str�¨getindex�Ù$3e1e5a5a-d294-11ef-2fdf-efee4eb1a0f2„´precedence_heuristic §cell_idÙ$3e1e5a5a-d294-11ef-2fdf-efee4eb1a0f2´downstream_cells_map€²upstream_cells_map‚§@md_str�¨getindex�Ù$3e1bdd02-d294-11ef-19e8-2f44eccf58af„´precedence_heuristic §cell_idÙ$3e1bdd02-d294-11ef-19e8-2f44eccf58af´downstream_cells_map€²upstream_cells_map‚§@md_str�¨getindex�Ù$fea8ae4c-8ef9-4b74-ad13-1314afef97de„´precedence_heuristic §cell_idÙ$fea8ae4c-8ef9-4b74-ad13-1314afef97de´downstream_cells_map€²upstream_cells_map‚§@md_str�¨getindex�Ù$db73766d-643c-41d7-a1eb-f376c657f860„´precedence_heuristic §cell_idÙ$db73766d-643c-41d7-a1eb-f376c657f860´downstream_cells_map€²upstream_cells_map‚§@md_str�¨getindex�Ù$3b1b0869-b815-4697-9dba-3c4b4cb5ac47„´precedence_heuristic §cell_idÙ$3b1b0869-b815-4697-9dba-3c4b4cb5ac47´downstream_cells_map€²upstream_cells_mapƒhide_solution�§@md_str�¨getindex�Ù$a8046381-ff11-40af-ae2b-078d71c586e7„´precedence_heuristic §cell_idÙ$a8046381-ff11-40af-ae2b-078d71c586e7´downstream_cells_map�¦result‘Ù$2156f96e-eebe-4190-8ce9-c76825c6da71²upstream_cells_map‡¡/�«specificity‘Ù$4f6dd225-c64d-4b76-b075-0bf71c863b5a¡+�«sensitivity‘Ù$4f6dd225-c64d-4b76-b075-0bf71c863b5a¡-�ªprevalence‘Ù$4f6dd225-c64d-4b76-b075-0bf71c863b5a¡*�Ù$3e1d20e0-d294-11ef-2044-e1fe6590a600„´precedence_heuristic §cell_idÙ$3e1d20e0-d294-11ef-2044-e1fe6590a600´downstream_cells_map€²upstream_cells_map‚§@md_str�¨getindex�Ù$fc733d61-fd0f-4a13-9afc-4505ac0253df„´precedence_heuristic §cell_idÙ$fc733d61-fd0f-4a13-9afc-4505ac0253df´downstream_cells_mapƒ§Î¸_bond’Ù$d93f73d4-2783-4777-b0ce-cdc0444cb300Ù$b7445b9b-7fbb-4560-b947-a23af0fcf101¡f‘Ù$8a7dd8b7-5faf-4091-8451-9769f842accb¢Î¸’Ù$079157c9-5d97-4dbc-8c47-afa8b661db06Ù$8a7dd8b7-5faf-4091-8451-9769f842accb²upstream_cells_mapŒ¡^�«PlutoRunner�¡-�¯Core.applicable�¤Core�ªScrubbable�¨Base.get�¥@bind�·PlutoRunner.create_bond�¡:�¤Base�¡*�Ù$3e1c60ba-d294-11ef-3a01-cf9e97512857„´precedence_heuristic §cell_idÙ$3e1c60ba-d294-11ef-3a01-cf9e97512857´downstream_cells_map€²upstream_cells_map‚§@md_str�¨getindex�Ù$3e1bf116-d294-11ef-148b-f7a1ca3f3bad„´precedence_heuristic §cell_idÙ$3e1bf116-d294-11ef-148b-f7a1ca3f3bad´downstream_cells_map€²upstream_cells_map‚§@md_str�¨getindex�Ù$3e1fa04a-d294-11ef-00c3-a51d1aaa5553„´precedence_heuristic §cell_idÙ$3e1fa04a-d294-11ef-00c3-a51d1aaa5553´downstream_cells_map€²upstream_cells_map‚§@md_str�¨getindex�Ù$9b85a92b-c56b-48a3-97c1-6b1882e33a22„´precedence_heuristic §cell_idÙ$9b85a92b-c56b-48a3-97c1-6b1882e33a22´downstream_cells_map�¿show_disease_diagnosis_solution‘Ù$2156f96e-eebe-4190-8ce9-c76825c6da71²upstream_cells_map‹°HypertextLiteral�¸HypertextLiteral.content�¤@htl�¨CheckBox�«PlutoRunner�»PlutoRunner.Core.applicable�¥@bind�·HypertextLiteral.Result�Ù#PlutoRunner.PlutoRunner.create_bond�·HypertextLiteral.Bypass�´PlutoRunner.Base.get�Ù$079157c9-5d97-4dbc-8c47-afa8b661db06„´precedence_heuristic §cell_idÙ$079157c9-5d97-4dbc-8c47-afa8b661db06´downstream_cells_map€²upstream_cells_mapаHypertextLiteral�¸HypertextLiteral.content�¯MarkdownLiteral�¡n‘Ù$4a81342c-17c7-4eb9-933b-edb98df7b9c4·HypertextLiteral.Result�¡-�¤@mdx‘Ù$42b47af6-b850-4987-a2d7-805a2cb64e43Ù MarkdownLiteral.CMParsedRenderer�¢Î¸‘Ù$fc733d61-fd0f-4a13-9afc-4505ac0253df·HypertextLiteral.Bypass�Ù$3e1c70be-d294-11ef-14ed-0d46515541c5„´precedence_heuristic §cell_idÙ$3e1c70be-d294-11ef-14ed-0d46515541c5´downstream_cells_map€²upstream_cells_map‚§@md_str�¨getindex�Ù$3e1bffec-d294-11ef-2a49-9ff0f6331add„´precedence_heuristic §cell_idÙ$3e1bffec-d294-11ef-2a49-9ff0f6331add´downstream_cells_map€²upstream_cells_map‚§@md_str�¨getindex�Ù$3e198ba6-d294-11ef-3fe7-d70bf4833fa6„´precedence_heuristic §cell_idÙ$3e198ba6-d294-11ef-3fe7-d70bf4833fa6´downstream_cells_map€²upstream_cells_map‚§@md_str�¨getindex�Ù$3e1a8eca-d294-11ef-1ef0-c15b24d05990„´precedence_heuristic §cell_idÙ$3e1a8eca-d294-11ef-1ef0-c15b24d05990´downstream_cells_map€²upstream_cells_map‚§@md_str�¨getindex�Ù$3e1f68fa-d294-11ef-31b2-e7670da8c08c„´precedence_heuristic §cell_idÙ$3e1f68fa-d294-11ef-31b2-e7670da8c08c´downstream_cells_map€²upstream_cells_map‚§@md_str�¨getindex�Ù$d0f672bd-74c9-4be1-b5ea-8d4040edb5df„´precedence_heuristic §cell_idÙ$d0f672bd-74c9-4be1-b5ea-8d4040edb5df´downstream_cells_map€²upstream_cells_map�²navigate_prev_next�Ù$3e1c51e2-d294-11ef-2c6d-d32a98308c6f„´precedence_heuristic §cell_idÙ$3e1c51e2-d294-11ef-2c6d-d32a98308c6f´downstream_cells_map€²upstream_cells_map‚§@md_str�¨getindex�Ù$3e1a7c8e-d294-11ef-1f97-55e608d49141„´precedence_heuristic §cell_idÙ$3e1a7c8e-d294-11ef-1f97-55e608d49141´downstream_cells_map€²upstream_cells_map‚§@md_str�¨getindex�Ù$b305a905-06c2-4a15-8042-72ef6375720f„´precedence_heuristic§cell_idÙ$b305a905-06c2-4a15-8042-72ef6375720f´downstream_cells_map�²BmlipTeachingTools�²upstream_cells_map€Ù$3e1d6d00-d294-11ef-1081-e11b8397eb91„´precedence_heuristic §cell_idÙ$3e1d6d00-d294-11ef-1081-e11b8397eb91´downstream_cells_map€²upstream_cells_map…¯prevalence_bond‘Ù$4f6dd225-c64d-4b76-b075-0bf71c863b5a°sensitivity_bond‘Ù$4f6dd225-c64d-4b76-b075-0bf71c863b5a§@md_str�°specificity_bond‘Ù$4f6dd225-c64d-4b76-b075-0bf71c863b5a¨getindex�Ù$3e191b6c-d294-11ef-3174-d1b4b36e252b„´precedence_heuristic §cell_idÙ$3e191b6c-d294-11ef-3174-d1b4b36e252b´downstream_cells_map€²upstream_cells_map‚§@md_str�¨getindex�Ù$4a81342c-17c7-4eb9-933b-edb98df7b9c4„´precedence_heuristic §cell_idÙ$4a81342c-17c7-4eb9-933b-edb98df7b9c4´downstream_cells_map�¡n’Ù$079157c9-5d97-4dbc-8c47-afa8b661db06Ù$2156f96e-eebe-4190-8ce9-c76825c6da71²upstream_cells_map�¨@sprintf�Ù$9f4125a2-d5d2-4acf-8bad-82f94af230e8„´precedence_heuristic §cell_idÙ$9f4125a2-d5d2-4acf-8bad-82f94af230e8´downstream_cells_map€²upstream_cells_mapƒ§@md_str�¨getindex�ªblockquote�Ù$840ab4dc-0d2e-4bf8-acc7-5f1ee2b0dcaf„´precedence_heuristic §cell_idÙ$840ab4dc-0d2e-4bf8-acc7-5f1ee2b0dcaf´downstream_cells_map€²upstream_cells_map‚§@md_str�¨getindex�Ù$3e027ede-4ac1-4521-a026-dc00bfca4adf„´precedence_heuristic §cell_idÙ$3e027ede-4ac1-4521-a026-dc00bfca4adf´downstream_cells_map€²upstream_cells_map�²exercise_statement�Ù$3e1889b8-d294-11ef-17bb-496655fbd618„´precedence_heuristic §cell_idÙ$3e1889b8-d294-11ef-17bb-496655fbd618´downstream_cells_map€²upstream_cells_map‚§@md_str�¨getindex�Ù$6d07be25-53d0-46b9-b197-a3680d830952„´precedence_heuristic §cell_idÙ$6d07be25-53d0-46b9-b197-a3680d830952´downstream_cells_map€²upstream_cells_mapƒhide_solution�§@md_str�¨getindex�Ù$5f377237-d9a5-4778-aa4d-1c6ce109b705„´precedence_heuristic §cell_idÙ$5f377237-d9a5-4778-aa4d-1c6ce109b705´downstream_cells_map€²upstream_cells_map‚§@md_str�¨getindex�Ù$d3b003c6-70ca-419f-a343-e35b266323f3„´precedence_heuristic §cell_idÙ$d3b003c6-70ca-419f-a343-e35b266323f3´downstream_cells_map€²upstream_cells_mapƒhide_solution�§@md_str�¨getindex�Ù$3e1fb370-d294-11ef-1fb6-63a41a024691„´precedence_heuristic §cell_idÙ$3e1fb370-d294-11ef-1fb6-63a41a024691´downstream_cells_map€²upstream_cells_mapƒ§@md_str�²exercise_statement�¨getindex�®last_save_timeËAÚ¹&”ú�«notebook_idÙ$196c2d02-d465-11f1-b0e4-2dda9d798eae«in_temp_dir¨metadata�«frontmatter‚«descriptionÙ[Review of probability theory as a foundation for rational reasoning and Bayesian inference.¦author‘‚¤name¥BMLIP£url¸https://github.com/bmlip¥bonds€´cell_execution_orderÜ †Ù$eeb9a1f5-b857-4843-920b-2e4a9656f66bÙ$5394e37c-ae00-4042-8ada-3bbf32fbca9eÙ$b305a905-06c2-4a15-8042-72ef6375720fÙ$42b47af6-b850-4987-a2d7-805a2cb64e43Ù$a66ab9df-897c-42e5-8b0f-c520ceaffa23Ù$3e17df5e-d294-11ef-38c7-f573724871d8Ù$bcb4be20-0439-4809-a166-8c50b6b9206bÙ$3e1803d0-d294-11ef-0304-df2b9b698cd1Ù$9b9be452-9681-43e8-bb09-cc8728df384fÙ$9f4125a2-d5d2-4acf-8bad-82f94af230e8Ù$f8c8ba53-df36-48a6-afde-2952cbcfbe48Ù$61713e1c-8e37-45d9-9f58-c3db69e15b66Ù$840ab4dc-0d2e-4bf8-acc7-5f1ee2b0dcafÙ$41bee964-a0a9-4a7f-8505-54a9ee12ef0dÙ$3e1889b8-d294-11ef-17bb-496655fbd618Ù$3e18b2fa-d294-11ef-1255-df048f0dcec2Ù$3e18c25c-d294-11ef-11bc-a93c2572b107Ù$3e18d2ea-d294-11ef-35e9-2332dd31dbf0Ù$dd11e93a-3dad-4e97-8642-fb70edfa6aaeÙ$3e18e4bc-d294-11ef-38bc-cb97cb4e0963Ù$3e18f18c-d294-11ef-33e4-b7f9495e0508Ù$3e1906ea-d294-11ef-236e-c966a9474170Ù$3e191b6c-d294-11ef-3174-d1b4b36e252bÙ$3e192ef4-d294-11ef-1fc4-87175eeec5ebÙ$3e19436c-d294-11ef-11c5-f9914f7a3a57Ù$4edf38ab-a940-4ab0-be22-fa95cf571146Ù$3e194ef2-d294-11ef-3b38-1ddc3063ff35Ù$3e1964b4-d294-11ef-373d-712257fc130fÙ$3e196d6a-d294-11ef-0795-41c045079251Ù$3e198336-d294-11ef-26fd-03cd15876486Ù$3e198ba6-d294-11ef-3fe7-d70bf4833fa6Ù$3e19e95a-d294-11ef-3da4-6d23922a5150Ù$3e1a69f4-d294-11ef-103e-efc47025fb8fÙ$3e1a7c8e-d294-11ef-1f97-55e608d49141Ù$3e1a8eca-d294-11ef-1ef0-c15b24d05990Ù$3e1ab104-d294-11ef-1a98-412946949fbaÙ$fea8ae4c-8ef9-4b74-ad13-1314afef97deÙ$3e1b4b1c-d294-11ef-0423-9152887cc403Ù$3e1b5c9c-d294-11ef-137f-d75b3731eae4Ù$3e1b7d14-d294-11ef-0d10-1148a928dd57Ù$5377c5a4-77c4-4fa7-9f84-0c511e3bf708Ù$3e1b8bf4-d294-11ef-04cc-6364e46fdd64Ù$3e1b9ba8-d294-11ef-18f2-db8eed3d87d0Ù$3e1babca-d294-11ef-37c1-cd821a6488b2Ù$3e1bba8e-d294-11ef-1f61-295af16078ceÙ$3e1bcb00-d294-11ef-2795-bd225bd00496Ù$3e1bdd02-d294-11ef-19e8-2f44eccf58afÙ$3e1bf116-d294-11ef-148b-f7a1ca3f3badÙ$16c2eb59-16b8-4347-9aab-6e4b99016c79Ù$3e1bffec-d294-11ef-2a49-9ff0f6331addÙ$3e1c0e80-d294-11ef-0d19-375e01988f16Ù$3e1c1e3e-d294-11ef-0955-bdf9d0ba3c53Ù$3e1c4224-d294-11ef-2707-49470aaae6ebÙ$3e1c51e2-d294-11ef-2c6d-d32a98308c6fÙ$3e1c60ba-d294-11ef-3a01-cf9e97512857Ù$3e1c70be-d294-11ef-14ed-0d46515541c5Ù$3e1c806a-d294-11ef-1fad-17e5625279f7Ù$3e1c9184-d294-11ef-3e35-5393d97fbc44Ù$3e1d33c8-d294-11ef-0a08-bdc419949925Ù$3e1b05ee-d294-11ef-33de-efed64d01c0dÙ$b176ceae-884e-4460-9f66-020c1ac447f1Ù$e3157dc0-5a64-4479-a37a-40fe25cccc07Ù$7d493e09-f7cc-4e13-a506-b792edcbf390Ù$3e1d20e0-d294-11ef-2044-e1fe6590a600Ù$fc733d61-fd0f-4a13-9afc-4505ac0253dfÙ$d93f73d4-2783-4777-b0ce-cdc0444cb300Ù$8a7dd8b7-5faf-4091-8451-9769f842accbÙ$b7445b9b-7fbb-4560-b947-a23af0fcf101Ù$922770f4-ddc8-4089-b378-f14088276b43Ù$3e1de32c-d294-11ef-1f63-f190c8361404Ù$4c639e65-e06b-4c5e-b6e7-aabed6b6c0b4Ù$ff9142ba-3a85-48cf-8b78-07e0b554e280Ù$3e027ede-4ac1-4521-a026-dc00bfca4adfÙ$3e1e2b96-d294-11ef-3a68-fdc78232142eÙ$727dc817-0284-4c0f-9a92-21dcbea50807Ù$fae6f2ce-ac8f-4ea6-b2cf-38b30a7e20d4Ù$ea803646-b18e-4f13-ab6a-fc5080d44e92Ù$9b85a92b-c56b-48a3-97c1-6b1882e33a22Ù$ef264651-854e-4374-8ea8-5476c85150c4Ù$3e1e4dda-d294-11ef-33b7-4bbe3300ca22Ù$3e1e5a5a-d294-11ef-2fdf-efee4eb1a0f2Ù$3e1e7742-d294-11ef-1204-f9be24da07abÙ$6fafc778-c2c8-4e23-8d2e-6dc02e49e935Ù$2292c667-862e-4924-8f15-de0a8893c439Ù$3e1e9224-d294-11ef-38b3-137c2be22400Ù$d2202628-e4f9-4289-b48e-23b5a0073f94Ù$726e7e9f-3d68-4d02-9954-1edd98b74fdcÙ$58f70d3e-4b64-414e-b560-327be2a0c4c2Ù$3e1ea442-d294-11ef-1364-8dd9986325f7Ù$6d07be25-53d0-46b9-b197-a3680d830952Ù$3e1eba72-d294-11ef-2f53-b56f1862fcbbÙ$3e1ed1a4-d294-11ef-2de4-d7cc540e06a1Ù$3e1eeb14-d294-11ef-1702-f5d2cf6fe60aÙ$3e1f225a-d294-11ef-04c6-f3ca018ab286Ù$98fa17a6-7c8b-46e4-b32d-52db183d88f8Ù$1cb8b2c4-e1ae-4973-ba53-fc6c7fe1f37aÙ$218d3b6e-50b6-4b98-a00c-a19dd33d2c03Ù$3e1f4f46-d294-11ef-29b8-69e546763781Ù$3e1f68fa-d294-11ef-31b2-e7670da8c08cÙ$3e1f7d5e-d294-11ef-2878-05744036f32cÙ$3e1f8e48-d294-11ef-0f8a-b58294a8543dÙ$3e1fa04a-d294-11ef-00c3-a51d1aaa5553Ù$50bdc2fe-f48d-4c4e-8b4e-170782681366Ù$db73766d-643c-41d7-a1eb-f376c657f860Ù$3e1fb370-d294-11ef-1fb6-63a41a024691Ù$317707a3-9ef1-4c67-b451-6adcfcff50f0Ù$9b92fc89-2036-4525-979b-d296ab29329cÙ$5da42e9a-4318-48ea-9f43-4c1e1c97bcebÙ$03692f4d-0daf-4dfc-a7ff-6b954326e4d0Ù$3a1d380e-df80-4727-9772-f199214cf05dÙ$99d9099f-4908-4bb3-8d59-da9cb69af04cÙ$3b1b0869-b815-4697-9dba-3c4b4cb5ac47Ù$5f377237-d9a5-4778-aa4d-1c6ce109b705Ù$5613e9b7-ff0d-435a-9de6-aaf293ebf592Ù$fc3151f9-e143-4e31-b7b7-3f25b4fe9dabÙ$66ebe33c-8360-4938-9b51-625e5bed176cÙ$5b681e41-ad14-4c58-8ea0-4b6d85885c51Ù$91dd40f0-c373-48b3-b83b-6e8df2c43e5aÙ$a8d4a517-84a7-426e-a49e-482c5fd047aeÙ$d3b003c6-70ca-419f-a343-e35b266323f3Ù$d0f672bd-74c9-4be1-b5ea-8d4040edb5dfÙ$dd31ec7c-708d-4fd7-958d-f9887798a5bcÙ$70d79732-0f55-40ba-929d-fba431318848Ù$4f6dd225-c64d-4b76-b075-0bf71c863b5aÙ$3e185ab0-d294-11ef-3f7d-9bd465518274Ù$3e1d6d00-d294-11ef-1081-e11b8397eb91Ù$a8046381-ff11-40af-ae2b-078d71c586e7Ù$4a81342c-17c7-4eb9-933b-edb98df7b9c4Ù$079157c9-5d97-4dbc-8c47-afa8b661db06Ù$2156f96e-eebe-4190-8ce9-c76825c6da71Ù$577c6e08-9b74-43a4-9e27-9c477980406bÙ$d1ab6fc4-e92c-4e77-8c4a-f5f33cb0b52cÙ$34f1f3cb-9346-4bd3-ae9f-a25b4d5de781Ù$c0ea3253-a06b-426c-91a3-a6dd33e42779®process_status¥readyªcell_orderÜ †Ù$3e17df5e-d294-11ef-38c7-f573724871d8Ù$bcb4be20-0439-4809-a166-8c50b6b9206bÙ$3e1803d0-d294-11ef-0304-df2b9b698cd1Ù$9b9be452-9681-43e8-bb09-cc8728df384fÙ$9f4125a2-d5d2-4acf-8bad-82f94af230e8Ù$f8c8ba53-df36-48a6-afde-2952cbcfbe48Ù$61713e1c-8e37-45d9-9f58-c3db69e15b66Ù$3e185ab0-d294-11ef-3f7d-9bd465518274Ù$840ab4dc-0d2e-4bf8-acc7-5f1ee2b0dcafÙ$41bee964-a0a9-4a7f-8505-54a9ee12ef0dÙ$3e1889b8-d294-11ef-17bb-496655fbd618Ù$3e18b2fa-d294-11ef-1255-df048f0dcec2Ù$3e18c25c-d294-11ef-11bc-a93c2572b107Ù$3e18d2ea-d294-11ef-35e9-2332dd31dbf0Ù$dd11e93a-3dad-4e97-8642-fb70edfa6aaeÙ$3e18e4bc-d294-11ef-38bc-cb97cb4e0963Ù$3e18f18c-d294-11ef-33e4-b7f9495e0508Ù$3e1906ea-d294-11ef-236e-c966a9474170Ù$3e191b6c-d294-11ef-3174-d1b4b36e252bÙ$3e192ef4-d294-11ef-1fc4-87175eeec5ebÙ$3e19436c-d294-11ef-11c5-f9914f7a3a57Ù$4edf38ab-a940-4ab0-be22-fa95cf571146Ù$3e194ef2-d294-11ef-3b38-1ddc3063ff35Ù$3e1964b4-d294-11ef-373d-712257fc130fÙ$3e196d6a-d294-11ef-0795-41c045079251Ù$3e198336-d294-11ef-26fd-03cd15876486Ù$3e198ba6-d294-11ef-3fe7-d70bf4833fa6Ù$3e19e95a-d294-11ef-3da4-6d23922a5150Ù$3e1a69f4-d294-11ef-103e-efc47025fb8fÙ$3e1a7c8e-d294-11ef-1f97-55e608d49141Ù$3e1a8eca-d294-11ef-1ef0-c15b24d05990Ù$3e1ab104-d294-11ef-1a98-412946949fbaÙ$fea8ae4c-8ef9-4b74-ad13-1314afef97deÙ$3e1b4b1c-d294-11ef-0423-9152887cc403Ù$3e1b5c9c-d294-11ef-137f-d75b3731eae4Ù$3e1b7d14-d294-11ef-0d10-1148a928dd57Ù$5377c5a4-77c4-4fa7-9f84-0c511e3bf708Ù$3e1b8bf4-d294-11ef-04cc-6364e46fdd64Ù$3e1b9ba8-d294-11ef-18f2-db8eed3d87d0Ù$3e1babca-d294-11ef-37c1-cd821a6488b2Ù$3e1bba8e-d294-11ef-1f61-295af16078ceÙ$3e1bcb00-d294-11ef-2795-bd225bd00496Ù$3e1bdd02-d294-11ef-19e8-2f44eccf58afÙ$3e1bf116-d294-11ef-148b-f7a1ca3f3badÙ$16c2eb59-16b8-4347-9aab-6e4b99016c79Ù$3e1bffec-d294-11ef-2a49-9ff0f6331addÙ$3e1c0e80-d294-11ef-0d19-375e01988f16Ù$3e1c1e3e-d294-11ef-0955-bdf9d0ba3c53Ù$3e1c4224-d294-11ef-2707-49470aaae6ebÙ$3e1c51e2-d294-11ef-2c6d-d32a98308c6fÙ$3e1c60ba-d294-11ef-3a01-cf9e97512857Ù$3e1c70be-d294-11ef-14ed-0d46515541c5Ù$3e1c806a-d294-11ef-1fad-17e5625279f7Ù$3e1c9184-d294-11ef-3e35-5393d97fbc44Ù$3e1d33c8-d294-11ef-0a08-bdc419949925Ù$3e1b05ee-d294-11ef-33de-efed64d01c0dÙ$b176ceae-884e-4460-9f66-020c1ac447f1Ù$e3157dc0-5a64-4479-a37a-40fe25cccc07Ù$d93f73d4-2783-4777-b0ce-cdc0444cb300Ù$079157c9-5d97-4dbc-8c47-afa8b661db06Ù$7d493e09-f7cc-4e13-a506-b792edcbf390Ù$8a7dd8b7-5faf-4091-8451-9769f842accbÙ$b7445b9b-7fbb-4560-b947-a23af0fcf101Ù$3e1d20e0-d294-11ef-2044-e1fe6590a600Ù$fc733d61-fd0f-4a13-9afc-4505ac0253dfÙ$922770f4-ddc8-4089-b378-f14088276b43Ù$3e1de32c-d294-11ef-1f63-f190c8361404Ù$4c639e65-e06b-4c5e-b6e7-aabed6b6c0b4Ù$ff9142ba-3a85-48cf-8b78-07e0b554e280Ù$3e027ede-4ac1-4521-a026-dc00bfca4adfÙ$3e1e2b96-d294-11ef-3a68-fdc78232142eÙ$727dc817-0284-4c0f-9a92-21dcbea50807Ù$fae6f2ce-ac8f-4ea6-b2cf-38b30a7e20d4Ù$ea803646-b18e-4f13-ab6a-fc5080d44e92Ù$3e1d6d00-d294-11ef-1081-e11b8397eb91Ù$9b85a92b-c56b-48a3-97c1-6b1882e33a22Ù$2156f96e-eebe-4190-8ce9-c76825c6da71Ù$ef264651-854e-4374-8ea8-5476c85150c4Ù$3e1e4dda-d294-11ef-33b7-4bbe3300ca22Ù$3e1e5a5a-d294-11ef-2fdf-efee4eb1a0f2Ù$3e1e7742-d294-11ef-1204-f9be24da07abÙ$6fafc778-c2c8-4e23-8d2e-6dc02e49e935Ù$2292c667-862e-4924-8f15-de0a8893c439Ù$3e1e9224-d294-11ef-38b3-137c2be22400Ù$d2202628-e4f9-4289-b48e-23b5a0073f94Ù$726e7e9f-3d68-4d02-9954-1edd98b74fdcÙ$58f70d3e-4b64-414e-b560-327be2a0c4c2Ù$3e1ea442-d294-11ef-1364-8dd9986325f7Ù$6d07be25-53d0-46b9-b197-a3680d830952Ù$3e1eba72-d294-11ef-2f53-b56f1862fcbbÙ$3e1ed1a4-d294-11ef-2de4-d7cc540e06a1Ù$3e1eeb14-d294-11ef-1702-f5d2cf6fe60aÙ$3e1f225a-d294-11ef-04c6-f3ca018ab286Ù$98fa17a6-7c8b-46e4-b32d-52db183d88f8Ù$d1ab6fc4-e92c-4e77-8c4a-f5f33cb0b52cÙ$1cb8b2c4-e1ae-4973-ba53-fc6c7fe1f37aÙ$34f1f3cb-9346-4bd3-ae9f-a25b4d5de781Ù$218d3b6e-50b6-4b98-a00c-a19dd33d2c03Ù$c0ea3253-a06b-426c-91a3-a6dd33e42779Ù$3e1f4f46-d294-11ef-29b8-69e546763781Ù$3e1f68fa-d294-11ef-31b2-e7670da8c08cÙ$3e1f7d5e-d294-11ef-2878-05744036f32cÙ$3e1f8e48-d294-11ef-0f8a-b58294a8543dÙ$3e1fa04a-d294-11ef-00c3-a51d1aaa5553Ù$50bdc2fe-f48d-4c4e-8b4e-170782681366Ù$db73766d-643c-41d7-a1eb-f376c657f860Ù$3e1fb370-d294-11ef-1fb6-63a41a024691Ù$317707a3-9ef1-4c67-b451-6adcfcff50f0Ù$9b92fc89-2036-4525-979b-d296ab29329cÙ$5da42e9a-4318-48ea-9f43-4c1e1c97bcebÙ$03692f4d-0daf-4dfc-a7ff-6b954326e4d0Ù$3a1d380e-df80-4727-9772-f199214cf05dÙ$99d9099f-4908-4bb3-8d59-da9cb69af04cÙ$3b1b0869-b815-4697-9dba-3c4b4cb5ac47Ù$5f377237-d9a5-4778-aa4d-1c6ce109b705Ù$5613e9b7-ff0d-435a-9de6-aaf293ebf592Ù$fc3151f9-e143-4e31-b7b7-3f25b4fe9dabÙ$66ebe33c-8360-4938-9b51-625e5bed176cÙ$5b681e41-ad14-4c58-8ea0-4b6d85885c51Ù$91dd40f0-c373-48b3-b83b-6e8df2c43e5aÙ$a8d4a517-84a7-426e-a49e-482c5fd047aeÙ$d3b003c6-70ca-419f-a343-e35b266323f3Ù$d0f672bd-74c9-4be1-b5ea-8d4040edb5dfÙ$dd31ec7c-708d-4fd7-958d-f9887798a5bcÙ$eeb9a1f5-b857-4843-920b-2e4a9656f66bÙ$5394e37c-ae00-4042-8ada-3bbf32fbca9eÙ$b305a905-06c2-4a15-8042-72ef6375720fÙ$70d79732-0f55-40ba-929d-fba431318848Ù$4f6dd225-c64d-4b76-b075-0bf71c863b5aÙ$a8046381-ff11-40af-ae2b-078d71c586e7Ù$42b47af6-b850-4987-a2d7-805a2cb64e43Ù$a66ab9df-897c-42e5-8b0f-c520ceaffa23Ù$4a81342c-17c7-4eb9-933b-edb98df7b9c4Ù$577c6e08-9b74-43a4-9e27-9c477980406b«cell_inputsÞ †Ù$3e1bba8e-d294-11ef-1f61-295af16078ce„¨metadataƒ¨disabled©show_logsîskip_as_script§cell_idÙ$3e1bba8e-d294-11ef-1f61-295af16078ce«code_foldedäcodeÙumd"""
Of course, in the continuous domain, marginalization becomes
```math
p(X)=\int_Y p(X,Y) \,\mathrm{d}Y
```
"""Ù$3e1eba72-d294-11ef-2f53-b56f1862fcbb„¨metadataƒ¨disabled©show_logsîskip_as_script§cell_idÙ$3e1eba72-d294-11ef-2f53-b56f1862fcbb«code_foldedäcodeÙ}md"""
Clearly, it follows that if ``X`` and ``Y`` are **independent**, then
```math
\Sigma_z = \Sigma_x + \Sigma_y
```
"""Ù$9b9be452-9681-43e8-bb09-cc8728df384f„¨metadataƒ¨disabled©show_logsîskip_as_script§cell_idÙ$9b9be452-9681-43e8-bb09-cc8728df384f«code_foldedäcodeÙómd"""
## 📕 Data Analysis: A Bayesian Tutorial
The following is an excerpt from the book [Data Analysis: A Bayesian Tutorial](https://global.oup.com/academic/product/data-analysis-9780198568322) (2006), by D.S. Sivia with J.S. Skilling:
"""Ù$3e1f8e48-d294-11ef-0f8a-b58294a8543d„¨metadataƒ¨disabled©show_logsîskip_as_script§cell_idÙ$3e1f8e48-d294-11ef-0f8a-b58294a8543d«code_foldedäcodeÙzhide_proof(
md"""
```math
P_y(\hat{y}) = P(y=\hat{y}) = P(h(x)=\hat{y}) = P(x=g(\hat{y})) = P_x(g(\hat{y})) \,.
```
""")Ù$5b681e41-ad14-4c58-8ea0-4b6d85885c51„¨metadataƒ¨disabled©show_logsîskip_as_script§cell_idÙ$5b681e41-ad14-4c58-8ea0-4b6d85885c51«code_foldedäcodeÚGmd"""
##### Who Speaks the Truth? (***)
The inhabitants of an island tell the truth one-third of the time. They lie with probability ``2/3``. On an occasion, after one of them made a statement, you ask another person "was that statement true?" and he says "yes". What is the probability that the statement was indeed true?
"""Ù$42b47af6-b850-4987-a2d7-805a2cb64e43„¨metadataƒ¨disabled©show_logsîskip_as_script§cell_idÙ$42b47af6-b850-4987-a2d7-805a2cb64e43«code_folded¤codeÙý# The Disease Diagnosis example uses a combination of:
# - PlutoUI.Scrubbable for the interactive input percentages
# - MarkdownLiteral to be able to interpolate numbers into markdown math
# - PrintF for consistent formatting
using MarkdownLiteral: @mdxÙ$726e7e9f-3d68-4d02-9954-1edd98b74fdc„¨metadataƒ¨disabled©show_logsîskip_as_script§cell_idÙ$726e7e9f-3d68-4d02-9954-1edd98b74fdc«code_foldedäcodeÙÚkeyconcept("",
md"""
No matter the specification of ``p(x)``, the mean and covariance matrix for ``z=Ax + b`` are given by
```math
\begin{align}
\mu_z &= A\mu_x + b \\
\Sigma_z &= A\,\Sigma_x\,A^T
\end{align}
```
""")Ù$3e18e4bc-d294-11ef-38bc-cb97cb4e0963„¨metadataƒ¨disabled©show_logsîskip_as_script§cell_idÙ$3e18e4bc-d294-11ef-38bc-cb97cb4e0963«code_foldedäcodeÚkeyconcept(" ",
md"""
When assigning real numbers to **degrees of belief**, logical consistency forces adherence to the sum and product rules of probability theory. This makes probability theory the optimal framework for information processing in the face of uncertainty.
"""
)Ù$e3157dc0-5a64-4479-a37a-40fe25cccc07„¨metadataƒ¨disabled©show_logsîskip_as_script§cell_idÙ$e3157dc0-5a64-4479-a37a-40fe25cccc07«code_foldedäcodeÙOcode_example("Sampling Distribution and Likelihood Function for the Coin Toss")Ù$3e1c806a-d294-11ef-1fad-17e5625279f7„¨metadataƒ¨disabled©show_logsîskip_as_script§cell_idÙ$3e1c806a-d294-11ef-1fad-17e5625279f7«code_foldedäcodeÚ5md"""
In a machine learning context, often the data is observed, and ``\theta`` is the free variable. In that case, for given observations ``D=D_0``, the **likelihood function** (which is a function only of the model parameters ``\theta``) is defined as
```math
L(\theta) \triangleq p(D=D_0|\theta)
```
"""Ù$3e1ea442-d294-11ef-1364-8dd9986325f7„¨metadataƒ¨disabled©show_logsîskip_as_script§cell_idÙ$3e1ea442-d294-11ef-1364-8dd9986325f7«code_foldedäcodeÚ_md"""
You should now be able to derive the following: for any distribution of variables ``X`` and ``Y``, show that the mean and variance of the sum ``Z = X+Y`` is given by
```math
\begin{align*}
\mu_z &= \mu_x + \mu_y \\
\Sigma_z &= \Sigma_x + \Sigma_y + \Sigma_{xy} + \Sigma_{yx}
\end{align*}
```
where ``\Sigma_{yx} = \Sigma_{xy}^T``.
"""Ù$3e1c4224-d294-11ef-2707-49470aaae6eb„¨metadataƒ¨disabled©show_logsîskip_as_script§cell_idÙ$3e1c4224-d294-11ef-2707-49470aaae6eb«code_foldedäcodeÚMmd"""
For a given data set ``D``, the posterior probabilities of the parameters scale relatively against each other as
```math
p(\theta|D) \propto p(D|\theta) p(\theta)
```
Hence, all that we can learn from the observed data is contained in the likelihood function ``p(D|\theta)``. This is called the **likelihood principle**.
"""Ù$3e1f225a-d294-11ef-04c6-f3ca018ab286„¨metadataƒ¨disabled©show_logsîskip_as_script§cell_idÙ$3e1f225a-d294-11ef-04c6-f3ca018ab286«code_foldedäcodeÚÆmd"""
$(code_example("Sum of Two Gaussian-distributed Variables"; big=true, header_level=2))
Consider two independent Gaussian-distributed variables ``X`` and ``Y`` (see [wikipedia normal distribution](https://en.wikipedia.org/wiki/Normal_distribution) for definition of a Gaussian (=Normal) distribution):
```math
\begin{align*}
p_X(x) &= \mathcal{N}(\,x\,|\,\mu_X,\sigma_X^2\,) \\
p_Y(y) &= \mathcal{N}(\,y\,|\,\mu_Y,\sigma_Y^2\,)
\end{align*}
```
Let ``Z = X + Y``. Performing the convolution (nice exercise) yields a Gaussian PDF for ``Z``:
```math
p_Z(z) = \mathcal{N}(\,z\,|\,\mu_X+\mu_Y,\sigma_X^2+\sigma_Y^2\,).
```
We illustrate the distributions for ``X``, ``Y`` and ``Z`` using Julia:
"""Ù$5613e9b7-ff0d-435a-9de6-aaf293ebf592„¨metadataƒ¨disabled©show_logsîskip_as_script§cell_idÙ$5613e9b7-ff0d-435a-9de6-aaf293ebf592«code_foldedäcodeÚhide_solution(
md"""
The following probabilities are given in the problem statement,
```math
\begin{align}
p(b_1) &= p(b_2) = 1/2 \\
p(a|b_1) &= 8/12, \quad p(a|b_2) = 10/12 \\
p(o|b_1) &= 4/12, \quad p(o|b_2) = 2/12
\end{align}
```
(a)
```math
p(a) = \sum_i p(a,b_i) = \sum_i p(a|b_i)p(b_i)=\frac{8}{12}\cdot\frac{1}{2} + \frac{10}{12}\cdot\frac{1}{2} = \frac{3}{4}
```
(b)
```math
p(b_1|a) = \frac{p(a,b_1)}{p(a)} = \frac{p(a|b_1)p(b_1)}{p(a)} = \frac{\frac{8}{12}\cdot\frac{1}{2}}{\frac{3}{4}} = \frac{4}{9}
```
"""
)Ù$3e1c1e3e-d294-11ef-0955-bdf9d0ba3c53„¨metadataƒ¨disabled©show_logsîskip_as_script§cell_idÙ$3e1c1e3e-d294-11ef-0955-bdf9d0ba3c53«code_foldedäcodeÚëmd"""
Hence, having access to likelihood and prior is in principle sufficient to compute both the evidence and the posterior. To emphasize that point, Bayes rule is sometimes written as a transformation:
```math
\underbrace{\underbrace{p(\theta|D)}_{\text{posterior}}\cdot \underbrace{p(D)}_{\text{evidence}}}_{\text{this is what we want to compute}} = \underbrace{\underbrace{p(D|\theta)}_{\text{likelihood}}\cdot \underbrace{p(\theta)}_{\text{prior}}}_{\text{this is available}}
```
"""Ù$9b92fc89-2036-4525-979b-d296ab29329c„¨metadataƒ¨disabled©show_logsîskip_as_script§cell_idÙ$9b92fc89-2036-4525-979b-d296ab29329c«code_foldedäcode³md"""
# Summary
"""Ù$eeb9a1f5-b857-4843-920b-2e4a9656f66b„¨metadataƒ¨disabled©show_logsîskip_as_script§cell_idÙ$eeb9a1f5-b857-4843-920b-2e4a9656f66b«code_folded¤code¹using Plots, LaTeXStringsÙ$5377c5a4-77c4-4fa7-9f84-0c511e3bf708„¨metadataƒ¨disabled©show_logsîskip_as_script§cell_idÙ$5377c5a4-77c4-4fa7-9f84-0c511e3bf708«code_foldedäcodeÚ'hide_proof(
md"""
```math
\begin{align*}
\sum_i p(A,B_i) &= p\big(\sum_i AB_i\big) &&\quad \text{(since all $AB_i$ are disjoint)}\\
&= p\big(A,\sum_i B_i\big) \\
&= p(A,\Omega) &&\quad \text{($\Omega$ is true event, since $B_i$ are exhaustive)} \\
&= p(A)
\end{align*}
```
""")Ù$3e1e7742-d294-11ef-1204-f9be24da07ab„¨metadataƒ¨disabled©show_logsîskip_as_script§cell_idÙ$3e1e7742-d294-11ef-1204-f9be24da07ab«code_foldedäcodeÚçmd"""
The **covariance** matrix between *vectors* ``x`` and ``y`` is a mixed central moment, defined as
```math
\begin{align*}
\Sigma_{xy} &\triangleq \mathbb{E}\left[ (x-\mu_x) (y-\mu_y)^T \right]\\
&= \mathbb{E}\left[ (x-\mu_x) (y^T-\mu_y^T) \right]\\
&= \mathbb{E}[x y^T] - \mu_x \mu_y^T
\end{align*}
```
Clearly, if ``x`` and ``y`` are independent, then ``\Sigma_{xy} = 0``, since in that case ``\mathbb{E}[x y^T] = \mathbb{E}[x] \mathbb{E}[y^T] = \mu_x \mu_y^T``.
"""Ù$ff9142ba-3a85-48cf-8b78-07e0b554e280„¨metadataƒ¨disabled©show_logsîskip_as_script§cell_idÙ$ff9142ba-3a85-48cf-8b78-07e0b554e280«code_foldedäcodeÚumd"""
Note that the physical state of the bag—either containing one black ball or one white ball—remains unchanged after the “put one in, take one out� procedure.
Yet, the probability we assign to the color of the ball in the bag changes.
This illustrates a key point: probabilities describe a person’s state of knowledge, not an intrinsic property of nature.
"""Ù$ea803646-b18e-4f13-ab6a-fc5080d44e92„¨metadataƒ¨disabled©show_logsîskip_as_script§cell_idÙ$ea803646-b18e-4f13-ab6a-fc5080d44e92«code_foldedäcodeÙ6challenge_solution("Disease Diagnosis",header_level=1)Ù$3e192ef4-d294-11ef-1fc4-87175eeec5eb„¨metadataƒ¨disabled©show_logsîskip_as_script§cell_idÙ$3e192ef4-d294-11ef-1fc4-87175eeec5eb«code_foldedäcodeÙÙmd"""
## Frequentist vs. Bayesian Interpretation of Probabilities
The interpretation of a probability as a **degree-of-belief** about the truth value of an event is also called the **Bayesian** interpretation.
"""Ù$3e1b9ba8-d294-11ef-18f2-db8eed3d87d0„¨metadataƒ¨disabled©show_logsîskip_as_script§cell_idÙ$3e1b9ba8-d294-11ef-18f2-db8eed3d87d0«code_foldedäcodeÙ¹md"""
Summing ``Y`` out of a joint distribution ``p(X,Y)`` is called **marginalization** and the result ``p(X)`` is sometimes referred to as the **marginal probability** of ``X``.
"""Ù$317707a3-9ef1-4c67-b451-6adcfcff50f0„¨metadataƒ¨disabled©show_logsîskip_as_script§cell_idÙ$317707a3-9ef1-4c67-b451-6adcfcff50f0«code_foldedäcodeÚ|hide_solution(
md"""
Note that ``h(x)`` is invertible with ``x = g(y) = \sigma y + \mu``. The change-of-variable formula leads to
```math
\begin{align*}
p_y(y) &= p_x(g(y)) \cdot g^\prime(y) \\
&= p_x(\sigma y + \mu) \cdot \sigma \\
&= \frac{1}{\sigma\sqrt{2 \pi}} \exp\left( - \frac{(\sigma y + \mu - \mu)^2}{2\sigma^2}\right) \cdot \sigma \\
&= \frac{1}{\sqrt{2 \pi}} \exp\left( - \frac{y^2 }{2}\right)\\
&= \mathcal{N}(y|0,1)
\end{align*}
```
In the statistics literature, ``y = \frac{x-\mu}{\sigma}`` is called the **standardized** variable since it transforms a general normal variable into a standard normal one.)
""")Ù$8a7dd8b7-5faf-4091-8451-9769f842accb„¨metadataƒ¨disabled©show_logsîskip_as_script§cell_idÙ$8a7dd8b7-5faf-4091-8451-9769f842accb«code_foldedäcodeÚ¦let
p1 = plot(
[0,1], f([0,1], θ);
line=:stem,
marker=:circle,
xrange=(-0.5, 1.5), yrange=(0,1),
title="Sampling Distribution",
xlabel="y", ylabel=L"p(y|θ=%$θ)", label=""
)
_θ = 0:0.01:1
y=1
p2 = plot(
_θ, f(y, _θ);
ylabel=L"p(y=%$y | θ)", xlabel=L"θ",
title="Likelihood Function", label=""
)
scatter!(p2,
[θ], [f(y, θ)];
label=nothing,
)
plot(p1, p2)
endÙ$99d9099f-4908-4bb3-8d59-da9cb69af04c„¨metadataƒ¨disabled©show_logsîskip_as_script§cell_idÙ$99d9099f-4908-4bb3-8d59-da9cb69af04c«code_foldedäcodeÙuhint(
md"""
Here, you may make use of the (Boolean logic) fact that ``A + B = \overline {\bar A \bar B }``.
"""
)Ù$dd11e93a-3dad-4e97-8642-fb70edfa6aae„¨metadataƒ¨disabled©show_logsîskip_as_script§cell_idÙ$dd11e93a-3dad-4e97-8642-fb70edfa6aae«code_foldedäcodeÚÔmd"""
##### Some notational conventions
In the above sum and product rules,
- the **conditional probability** of ``A`` given ``I``, denoted by ``p(A|I)``, indicates the degree of belief in event ``A``, given that ``I`` is true.
- ``p(A,B|I)`` should be read as the *joint* probabability that both ``A`` and ``B`` are true, given that ``I`` is true.
- Similarly, ``p(A|B,I)`` is the probability that ``A`` is true, given that both ``B`` and ``I`` are true.
"""Ù$3e1de32c-d294-11ef-1f63-f190c8361404„¨metadataƒ¨disabled©show_logsîskip_as_script§cell_idÙ$3e1de32c-d294-11ef-1f63-f190c8361404«code_foldedäcodeÚmd"""
##### Problem
- A bag contains one ball, known to be either white or black. A white ball is put in , and the bag is shaken. Next, a ball is drawn out, which proves to be white. If we now take out another ball, what is the probability it will be white?
"""Ù$fae6f2ce-ac8f-4ea6-b2cf-38b30a7e20d4„¨metadataƒ¨disabled©show_logsîskip_as_script§cell_idÙ$fae6f2ce-ac8f-4ea6-b2cf-38b30a7e20d4«code_foldedäcodeÙámd"""
In this case, knowledge about the future influences our state of knowledge about the present. Once again, we see that conditional probabilities capture implications for a state of knowledge, not temporal causality.
"""Ù$3e1a69f4-d294-11ef-103e-efc47025fb8f„¨metadataƒ¨disabled©show_logsîskip_as_script§cell_idÙ$3e1a69f4-d294-11ef-103e-efc47025fb8f«code_foldedäcodeÚmd"""
If ``X`` is a variable, then an *assignment* ``X=x`` (where ``x`` is a value, e.g., ``X=5``) can be interpreted as an event. Hence, the expression ``p(X=5)`` should be interpreted as the *degree-of-belief of the event* that variable ``X`` takes on the value ``5``.
"""Ù$3e198336-d294-11ef-26fd-03cd15876486„¨metadataƒ¨disabled©show_logsîskip_as_script§cell_idÙ$3e198336-d294-11ef-26fd-03cd15876486«code_foldedäcodeÚ(md"""
Aubrey Clayton, in his wonderful book [Bernoulli's fallacy](https://aubreyclayton.com/bernoulli.html) (2021), writes about this issue:
> “Compared with Bayesian methods, standard [frequentist] statistical techniques use only a small fraction of the available information about a research hypothesis (how well it predicts some observation), so naturally they will struggle when that limited information proves inadequate. Using standard statistical methods is like driving a car at night on a poorly lit highway: to keep from going in a ditch, we could build an elaborate system of bumpers and guardrails and equip the car with lane departure warnings and sophisticated navigation systems, and even then we could at best only drive to a few destinations. Or we could turn on the headlights.�
"""Ù$6fafc778-c2c8-4e23-8d2e-6dc02e49e935„¨metadataƒ¨disabled©show_logsîskip_as_script§cell_idÙ$6fafc778-c2c8-4e23-8d2e-6dc02e49e935«code_foldedäcodeÙ@md"""
Exercise: Prove that ``\Sigma_{xy} = \Sigma_{yx}^{T}``
"""Ù$5394e37c-ae00-4042-8ada-3bbf32fbca9e„¨metadataƒ¨disabled©show_logsîskip_as_script§cell_idÙ$5394e37c-ae00-4042-8ada-3bbf32fbca9e«code_folded¤code³using DistributionsÙ$3e1ab104-d294-11ef-1a98-412946949fba„¨metadataƒ¨disabled©show_logsîskip_as_script§cell_idÙ$3e1ab104-d294-11ef-1a98-412946949fba«code_foldedäcodeÙQmd"""
# $(HTML("
Probability Theory Calculus "))
"""Ù$c0ea3253-a06b-426c-91a3-a6dd33e42779„¨metadataƒ¨disabled©show_logsîskip_as_script§cell_idÙ$c0ea3253-a06b-426c-91a3-a6dd33e42779«code_foldedäcodeÚÞlet
# Calculate the x-range for plotting
# range_min = min(μx-2*σx, μy-2*σy, μz-2*σz)
# range_max = max(μx+2*σx, μy+2*σy, μz+2*σz)
range_min = 0
range_max = 6
range_grid = range(range_min, stop=range_max, length=100)
plot(ylim=(0,1))
plot!(range_grid, t -> pdf(x,t), label=L"X", lw=2, fill=(0, 0.1))
plot!(range_grid, t -> pdf(y,t), label=L"Y", lw=2, fill=(0, 0.1))
plot!(range_grid, t -> pdf(z,t), label=L"Z", lw=2, fill=(0, 0.1), linestyle=:dash)
endÙ$b176ceae-884e-4460-9f66-020c1ac447f1„¨metadataƒ¨disabled©show_logsîskip_as_script§cell_idÙ$b176ceae-884e-4460-9f66-020c1ac447f1«code_foldedäcode´md"""
# Examples
"""Ù$d2202628-e4f9-4289-b48e-23b5a0073f94„¨metadataƒ¨disabled©show_logsîskip_as_script§cell_idÙ$d2202628-e4f9-4289-b48e-23b5a0073f94«code_foldedäcodeÚ_hide_proof(
md"""
Let ``\mathbb{E}[\cdot]`` refer to the expectation (mean) operator. By linearity of expectation and the fact that ``A`` and ``b`` are constants,
```math
\mu_z = \mathbb{E}[z] = \mathbb{E}[A x + b] = A\,\mathbb{E}[x] + b = A\mu_x + b\,.
```
For the covariance matrix,
```math
\begin{align}
\Sigma_z &= \mathbb{E}\big[(z-\mu_z)(z-\mu_z)^T \big] \\
&= \mathbb{E}\big[(Ax + b - (A\mu_x + b))(Ax + b - (A\mu_x + b))^T \big] \\
&= \mathbb{E}\big[(Ax - A\mu_x)(Ax - A\mu_x)^T \big] \\
&= A\,\mathbb{E}\big[(x-\mu_x)(x-\mu_x)^\top\big]A^T \\
&= A\Sigma_x A^T \,.
\end{align}
```
"""
)Ù$b7445b9b-7fbb-4560-b947-a23af0fcf101„¨metadataƒ¨disabled©show_logsîskip_as_script§cell_idÙ$b7445b9b-7fbb-4560-b947-a23af0fcf101«code_foldedäcodeÙDmd"""
Click and drag this number to change ``\theta``: $θ_bond.
"""Ù$bcb4be20-0439-4809-a166-8c50b6b9206b„¨metadataƒ¨disabled©show_logsîskip_as_script§cell_idÙ$bcb4be20-0439-4809-a166-8c50b6b9206b«code_foldedäcode¹PlutoUI.TableOfContents()Ù$50bdc2fe-f48d-4c4e-8b4e-170782681366„¨metadataƒ¨disabled©show_logsîskip_as_script§cell_idÙ$50bdc2fe-f48d-4c4e-8b4e-170782681366«code_foldedäcodeÚPhide_proof(
md"""
We assume again that ``y = h(x)`` is a one-to-one function with ``x = g(y) = h^{-1}(y)``. Let ``a=g(c)`` and ``b=g(d)``. Then
```math
\begin{align}
P(a ≤ x ≤ b) &= \int_a^b p_x(x)\mathrm{d}x \\
&= \int_{g(c)}^{g(d)} p_x(x)\mathrm{d}x \\
&= \int_c^d p_x(g(y))\mathrm{d}g(y) \\
&= \int_c^d \underbrace{p_x(g(y)) g^\prime(y)}_{p_y(y)}\mathrm{d}y \\
&= P(c ≤ y ≤ d)
\end{align}
```
Equating the two probability masses, ``p_y(y)\mathrm{d}y = p_x(x)\mathrm{d}x``, leads to the identification of the relation
```math
p_y(y) = p_x(g(y)) g^\prime(y)\,,
```
"""
)Ù$fc3151f9-e143-4e31-b7b7-3f25b4fe9dab„¨metadataƒ¨disabled©show_logsîskip_as_script§cell_idÙ$fc3151f9-e143-4e31-b7b7-3f25b4fe9dab«code_foldedäcodeÙumd"""
##### What is a Random Signal? (*)
Is a speech signal a "probabilistic" (random) or a deterministic signal?
"""Ù$1cb8b2c4-e1ae-4973-ba53-fc6c7fe1f37a„¨metadataƒ¨disabled©show_logsîskip_as_script§cell_idÙ$1cb8b2c4-e1ae-4973-ba53-fc6c7fe1f37a«code_foldedäcodeÙGmd"""
Compute the parameters for the distribution of ``Z = X + Y``:
"""Ù$d93f73d4-2783-4777-b0ce-cdc0444cb300„¨metadataƒ¨disabled©show_logsîskip_as_script§cell_idÙ$d93f73d4-2783-4777-b0ce-cdc0444cb300«code_foldedäcodeÚJmd"""
Consider the following simple model for the outcome ``y \in \{0,1\}`` (tail = ``0``, head = ``1``) of a biased coin toss with a real parameter $θ_bond ``= \theta \in [0,1]``:
```math
\begin{align*}
p(y|\theta) = \theta^y (1-\theta)^{1-y}\\
\end{align*}
```
Next, we use Julia to plot both the sampling distribution
"""Ù$3e1803d0-d294-11ef-0304-df2b9b698cd1„¨metadataƒ¨disabled©show_logsîskip_as_script§cell_idÙ$3e1803d0-d294-11ef-0304-df2b9b698cd1«code_foldedäcodeÚ…md"""
## Preliminaries
##### Goal
- Review of Probability Theory as a theory for rational/logical reasoning with uncertainties (i.e., a Bayesian interpretation)
##### Materials
- Mandatory
- These lecture notes
- Optional
- Bishop pp. 12-24
- [3Blue1Brown, YouTube video on Bayes theorem (2019)](https://youtu.be/HZGCoVF3YvM?si=JaXdesPjU8B_BtrC)
- Nice animated tutorial on Bayes rule.
- [Edwin Jaynes, Probability Theory–The Logic of Science (2003)](https://bayes.wustl.edu/etj/science.pdf.html)
- Brilliant book on the Bayesian view of probability theory. Just for fun, scan the annotated bibliography and references.
- [Aubrey Clayton, Bernoulli's Fallacy–Statistical Illogic and the Crisis of Modern Science (2021)](https://aubreyclayton.com/bernoulli.html)
- A very readable account of the history of statistics and probability theory. Discusses why most popular statistics recipes are very poor scientific analysis tools. Use probability theory instead!
- [Ariel Caticha, Entropic Inference and the Foundations of Physics (2012)](https://github.com/bmlip/course/blob/main/assets/files/Caticha-2012-Entropic-Inference-and-the-Foundations-of-Physics.pdf), pp.7-56 (ch.2: probability)
- Great introduction to probability theory, in particular w.r.t. its correct interpretation as a state-of-knowledge.
- Absolutely worth your time to read the whole chapter, even if you skip section 2.2.4 (pp.15-18) on Cox's proof.
- [Joram Soch et al ., The Book of Statistical Proofs (2023 - )](https://statproofbook.github.io/)
- Online resource for proofs in probability theory and statistical inference.
"""Ù$3e18d2ea-d294-11ef-35e9-2332dd31dbf0„¨metadataƒ¨disabled©show_logsîskip_as_script§cell_idÙ$3e18d2ea-d294-11ef-35e9-2332dd31dbf0«code_foldedäcodeÚþmd"""
Under these assumptions, Cox showed that any consistent system of reasoning about uncertainty must obey the **rules of probability theory** (see [Cox theorem, 1946](https://en.wikipedia.org/wiki/Cox%27s_theorem), and [Caticha, 2012](https://github.com/bmlip/course/blob/main/assets/files/Caticha-2012-Entropic-Inference-and-the-Foundations-of-Physics.pdf), pp.7-26). These rules are the sum and product rules:
##### The sum rule
- The degree of belief in the disjunction of two events ``A`` and ``B``, with given background information ``I``, is evaluated as
```math
p(A+B|I) = p(A|I) + p(B|I) - p(A,B|I)
```
##### The product rule
- The degree of belief in the conjunction of two events ``A`` and ``B``, with given background information ``I``, is evaluated as
```math
p(A,B|I) = p(A|B,I)\,p(B|I)
```
Cox’s Theorem derives the rules of probability theory from first principles, not as arbitrary postulates but as consequences of rational reasoning.
In other words: **Probability = extended logic**.
"""Ù$2156f96e-eebe-4190-8ce9-c76825c6da71„¨metadataƒ¨disabled©show_logsîskip_as_script§cell_idÙ$2156f96e-eebe-4190-8ce9-c76825c6da71«code_foldedäcodeÚif show_disease_diagnosis_solution
@mdx("""
- The given information is ``p(D=1)=$(n(prevalence))``, ``p(T=1|D=1)=$(n(sensitivity))`` and ``p(T=0|D=0)=$(n(specificity))``. We are asked to derive ``p( D=1 | T=1)``. We just follow the sum and product rules to derive the requested probability:
```math
\\begin{align*}
p( D=1 &| T=1) \\\\
&\\stackrel{p}{=} \\frac{p(T=1,D=1)}{p(T=1)} \\\\
&\\stackrel{p}{=} \\frac{p(T=1|D=1)p(D=1)}{p(T=1)} \\\\
&\\stackrel{s}{=} \\frac{p(T=1|D=1)p(D=1)}{p(T=1|D=1)p(D=1)+p(T=1|D=0)p(D=0)} \\\\
&= \\frac{$(n(sensitivity))\\times$(n(prevalence))}{$(n(sensitivity))\\times$(n(prevalence)) + $(n(1 - specificity))\\times$(n(1 - prevalence))} = \\boldsymbol{$(n(result; digits=4))}
\\end{align*}
```
Note that ``p(\\text{sick}|\\text{positive test}) = $(n(result))`` while ``p(\\text{positive test} | \\text{sick}) = $(n(sensitivity))``. This is a huge difference that is sometimes called the "medical test paradox" or the [base rate fallacy](https://en.wikipedia.org/wiki/Base_rate_fallacy).
Many people have trouble distinguishing ``p(A|B)`` from ``p(B|A)`` in their heads. This has led to major negative consequences. For instance, unfounded convictions in the legal arena and numerous unfounded conclusions in the pursuit of scientific results. See [Ioannidis (2005)](https://journals.plos.org/plosmedicine/article?id=10.1371/journal.pmed.0020124) and [Clayton (2021)](https://aubreyclayton.com/bernoulli.html).
""")
endÙ$ef264651-854e-4374-8ea8-5476c85150c4„¨metadataƒ¨disabled©show_logsîskip_as_script§cell_idÙ$ef264651-854e-4374-8ea8-5476c85150c4«code_foldedäcodeÙ!md"# Moments and Transformations"Ù$91dd40f0-c373-48b3-b83b-6e8df2c43e5a„¨metadataƒ¨disabled©show_logsîskip_as_script§cell_idÙ$91dd40f0-c373-48b3-b83b-6e8df2c43e5a«code_foldedäcodeÚ%hide_solution(
md"""
We use variables ``S_1 \in \{\text{t},\text{f}\}`` and ``S_2 \in \{\text{y},\text{n}\}`` for statements 1 and 2 and shorthand "y", "n", "t" and "f" for "yes", "no", "true" and "false", respectively. The problem statement provides us with the following probabilities,
```math
\begin{align}
p(S_1=\text{t}) &= 1/3 \\
p(S_1=\text{f}) &= 1 - p(S_1=\text{t}) = 2/3\\
p(S_2=\text{y} | S_1=\text{t}) &= 1/3 \\
p(S_2=\text{y} | S_1=\text{f}) &= 2/3
\end{align}
```
We are asked to compute ``p(S_1=\text{t} | S_2=\text{y})``. Use Bayes rule,
```math
\begin{align}
p(S_1=\text{t} | S_2=\text{y}) &= \frac{p(S_1=\text{t},S_2=\text{y})}{p(S_2=\text{y})} \\
&= \frac{\overbrace{p(S_2=\text{y}|S_1=\text{t})p(S_1=\text{t})}^{\text{both speak the truth}}}{\underbrace{p(S_2=\text{y}|S_1=\text{t})p(S_1=\text{t})}_{\text{both speak the truth}}+\underbrace{p(S_2=\text{y}|S_1=\text{f})p(S_1=\text{f})}_{\text{both lie}}}\\
&= \frac{\frac{1}{3}\cdot\frac{1}{3}}{\frac{1}{3}\cdot\frac{1}{3}+\frac{2}{3}\cdot\frac{2}{3}} = \frac{1}{5}
\end{align}
```
""")Ù$3e1babca-d294-11ef-37c1-cd821a6488b2„¨metadataƒ¨disabled©show_logsîskip_as_script§cell_idÙ$3e1babca-d294-11ef-37c1-cd821a6488b2«code_foldedäcodeÙÌmd"""
Note that marginalization can be understood as applying a "generalized" sum rule. Bishop (p.14) and some other authors also refer to this as the sum rule, but we do not follow that terminology.
"""Ù$58f70d3e-4b64-414e-b560-327be2a0c4c2„¨metadataƒ¨disabled©show_logsîskip_as_script§cell_idÙ$58f70d3e-4b64-414e-b560-327be2a0c4c2«code_foldedäcodeÙ:exercise_statement("The PDF for the Sum of Two Variables")Ù$34f1f3cb-9346-4bd3-ae9f-a25b4d5de781„¨metadataƒ¨disabled©show_logsîskip_as_script§cell_idÙ$34f1f3cb-9346-4bd3-ae9f-a25b4d5de781«code_folded¤codeÙIz = Normal(
x.μ + y.μ, # mean
√(x.σ^2 + y.σ^2) # stdev
)Ù$3e18c25c-d294-11ef-11bc-a93c2572b107„¨metadataƒ¨disabled©show_logsîskip_as_script§cell_idÙ$3e18c25c-d294-11ef-11bc-a93c2572b107«code_foldedäcodeÚmd"""
In developing this calculus, only some very agreeable assumptions were made, including:
- Degrees of belief are represented by real numbers.
- Plausibility assessments are consistent, e.g.,
- if ``A`` becomes more plausible under new information ``B``, the assigned degree-of-belief should increase accordingly.
- If the belief in ``A`` is greater than the belief in ``B``, and the belief in ``B`` is greater than the belief in ``C``, then the belief in ``A`` must be greater than the belief in ``C``.
- Logical equivalences are preserved, e.g.,
- If the belief in an event can be inferred in two different ways, for example, either by first updating on information ``I_1`` and then ``I_2`` or the other way around, then the two ways must agree on the resulting belief.
"""Ù$03692f4d-0daf-4dfc-a7ff-6b954326e4d0„¨metadataƒ¨disabled©show_logsîskip_as_script§cell_idÙ$03692f4d-0daf-4dfc-a7ff-6b954326e4d0«code_foldedäcode¬exercises()
Ù$3e1e4dda-d294-11ef-33b7-4bbe3300ca22„¨metadataƒ¨disabled©show_logsîskip_as_script§cell_idÙ$3e1e4dda-d294-11ef-33b7-4bbe3300ca22«code_foldedäcodeÚUmd"""
## Moments of the PDF
Distributions can often usefully be summarized by a set of values known as moments of the distribution.
Consider a distribution ``p(x)``. The first moment, also known as **expected value** or **mean** of ``p(x)`` is defined as
```math
\mu_x = \mathbb{E}[x] \triangleq \int x \,p(x) \,\mathrm{d}{x}
```
"""Ù$3e1d33c8-d294-11ef-0a08-bdc419949925„¨metadataƒ¨disabled©show_logsîskip_as_script§cell_idÙ$3e1d33c8-d294-11ef-0a08-bdc419949925«code_foldedäcodeÚUmd"""
## Probabilistic Inference
**Probabilistic inference** refers to computing
```math
p(\,\text{whatever-we-want-to-know}\, | \,\text{whatever-we-already-know}\,)
```
For example:
```math
\begin{align*}
p(\,\text{Mr.S.-killed-Mrs.S.} \;&|\; \text{he-has-her-blood-on-his-shirt}\,) \\
p(\,\text{transmitted-codeword} \;&|\;\text{received-codeword}\,)
\end{align*}
```
This can be accomplished by repeatedly applying the sum and product rules.
In particular, consider a joint distribution ``p(X,Y,Z)``. Assume we are interested in ``p(X|Z)``:
```math
\begin{align*}
p(X|Z) \stackrel{p}{=} \frac{p(X,Z)}{p(Z)} \stackrel{s}{=} \frac{\sum_Y p(X,Y,Z)}{\sum_{X,Y} p(X,Y,Z)} \,,
\end{align*}
```
where the ``s`` and ``p`` above the equality sign indicate whether the sum or product rule was used.
In the rest of this course, we'll encounter many lengthy probabilistic derivations. For each manipulation, you should be able to associate an 's' (for sum rule), a 'p' (for product or Bayes rule) or an 'm' (for a simplifying model assumption like conditional independency) above any equality sign.
"""Ù$3e194ef2-d294-11ef-3b38-1ddc3063ff35„¨metadataƒ¨disabled©show_logsîskip_as_script§cell_idÙ$3e194ef2-d294-11ef-3b38-1ddc3063ff35«code_foldedäcodeÚ›md"""
The Bayesian interpretation contrasts with the **frequentist** interpretation of a probability as the relative frequency that an event would occur under repeated execution of an experiment.
* For instance, if the experiment is tossing a coin, then ``p(\texttt{outcome} = \texttt{tail}) = 0.4`` means that in the limit of a large number of coin tosses, 40% of outcomes turn up as ``\texttt{tail}``.
"""Ù$16c2eb59-16b8-4347-9aab-6e4b99016c79„¨metadataƒ¨disabled©show_logsîskip_as_script§cell_idÙ$16c2eb59-16b8-4347-9aab-6e4b99016c79«code_foldedäcodeÙNkeyconcept("", md"Bayes rule is the fundamental rule for learning from data!")Ù$3e1906ea-d294-11ef-236e-c966a9474170„¨metadataƒ¨disabled©show_logsîskip_as_script§cell_idÙ$3e1906ea-d294-11ef-236e-c966a9474170«code_foldedäcodeÚ_md"""
In general, nearly all interesting questions in machine learning (and information processing in general) can be stated in the following form (a conditional probability):
```math
p(\texttt{whatever-we-want-to-know}\, | \,\texttt{whatever-we-do-know})
```
where ``p(A|B)`` means the probability that ``A`` is true, given that ``B`` is true.
"""Ù$3e1bcb00-d294-11ef-2795-bd225bd00496„¨metadataƒ¨disabled©show_logsîskip_as_script§cell_idÙ$3e1bcb00-d294-11ef-2795-bd225bd00496«code_foldedäcodeÚrmd"""
## $(HTML("
Bayes Rule "))
Consider two variables ``D`` and ``\theta``. It follows from symmetry arguments that
```math
p(D,\theta)=p(\theta,D)\,,
```
and hence that
```math
p(D|\theta)p(\theta)=p(\theta|D)p(D)\,,
```
or equivalently,
```math
p(\theta|D) = \frac{p(D|\theta) }{p(D)}p(\theta)\,.\qquad \text{(Bayes rule)}
```
"""Ù$66ebe33c-8360-4938-9b51-625e5bed176c„¨metadataƒ¨disabled©show_logsîskip_as_script§cell_idÙ$66ebe33c-8360-4938-9b51-625e5bed176c«code_foldedäcodeÚíhide_solution(
md"""
That depends. The term “probabilistic� refers to a state-of-knowledge (or beliefs) about something—in this case, about the values of a speech signal. The key point is that the signal itself is neither inherently probabilistic nor deterministic; these labels describe our knowledge about it.
If you had a perfect microphone and recorded the speech signal flawlessly at its source, you would know all its values exactly—no uncertainty—so you could call it deterministic.
However, before making the recording, how would you represent your knowledge about the signal values you are going to measure? You face uncertainty, so the appropriate description is a probability distribution over all possible signal values.
""")Ù$3e1e9224-d294-11ef-38b3-137c2be22400„¨metadataƒ¨disabled©show_logsîskip_as_script§cell_idÙ$3e1e9224-d294-11ef-38b3-137c2be22400«code_foldedäcodeÚkmd"""
## Linear Transformations
Consider an arbitrary distribution ``p(x)`` with mean ``\mu_x`` and covariance matrix ``\Sigma_x``. Define
```math
z = A x + b \,.
```
No matter the specification of ``p(x)``, the mean and covariance matrix for ``z`` are given by
```math
\begin{align*}
\mu_z &= A\mu_x + b \\
\Sigma_z &= A\,\Sigma_x\,A^T
\end{align*}
```
"""Ù$3e17df5e-d294-11ef-38c7-f573724871d8„¨metadataƒ¨disabled©show_logsîskip_as_script§cell_idÙ$3e17df5e-d294-11ef-38c7-f573724871d8«code_foldedäcodeÙ"title("Probability Theory Review")Ù$70d79732-0f55-40ba-929d-fba431318848„¨metadataƒ¨disabled©show_logsîskip_as_script§cell_idÙ$70d79732-0f55-40ba-929d-fba431318848«code_foldedäcodeÙ0md"""
##### Disease diagnosis implementation
"""Ù$3e1964b4-d294-11ef-373d-712257fc130f„¨metadataƒ¨disabled©show_logsîskip_as_script§cell_idÙ$3e1964b4-d294-11ef-373d-712257fc130f«code_foldedäcodeÙÈmd"""
The Bayesian viewpoint is more generally applicable than the frequentist viewpoint, e.g., it is hard to apply the frequentist viewpoint to events like ``\texttt{"it will rain tomorrow"}``.
"""Ù$3e1c9184-d294-11ef-3e35-5393d97fbc44„¨metadataƒ¨disabled©show_logsîskip_as_script§cell_idÙ$3e1c9184-d294-11ef-3e35-5393d97fbc44«code_foldedäcodeÙ†md"""
Note that ``L(\theta)`` is not a probability distribution for ``\theta`` since in general ``\sum_\theta L(\theta) \neq 1``.
"""Ù$3e18f18c-d294-11ef-33e4-b7f9495e0508„¨metadataƒ¨disabled©show_logsîskip_as_script§cell_idÙ$3e18f18c-d294-11ef-33e4-b7f9495e0508«code_foldedäcodeÚmd"""
## Why Probability Theory for Machine Learning?
Machine learning concerns updating our beliefs about appropriate settings for model parameters from new information (namely a data set), and therefore PT provides the *optimal calculus for machine learning*.
"""Ù$3e1b5c9c-d294-11ef-137f-d75b3731eae4„¨metadataƒ¨disabled©show_logsîskip_as_script§cell_idÙ$3e1b5c9c-d294-11ef-137f-d75b3731eae4«code_foldedäcodeÙÏmd"""
We mentioned before that every inference problem in PT can be evaluated through the sum and product rules. Next, we present two useful corollaries:
- (1) *Marginalization*
- (2) *Bayes rule*.
"""Ù$4edf38ab-a940-4ab0-be22-fa95cf571146„¨metadataƒ¨disabled©show_logsîskip_as_script§cell_idÙ$4edf38ab-a940-4ab0-be22-fa95cf571146«code_foldedäcodeÚ�md"""
In the Bayesian interpretation, all probabilities are, in principle, conditional probabilities of the type ``p(A|I)``, since there is always some background knowledge. However, we often write ``p(A)`` rather than ``p(A|I)`` if the background knowledge ``I`` is assumed to be obviously present. E.g., we usually write ``p(A)`` rather than ``p(\,A\,|\,\text{the-sun-comes-up-tomorrow}\,)``.
"""Ù$a66ab9df-897c-42e5-8b0f-c520ceaffa23„¨metadataƒ¨disabled©show_logsîskip_as_script§cell_idÙ$a66ab9df-897c-42e5-8b0f-c520ceaffa23«code_folded¤code¬using PrintfÙ$3e19e95a-d294-11ef-3da4-6d23922a5150„¨metadataƒ¨disabled©show_logsîskip_as_script§cell_idÙ$3e19e95a-d294-11ef-3da4-6d23922a5150«code_foldedäcodeÙ4md"""
## Variable Assignments as Propositions
"""Ù$3e19436c-d294-11ef-11c5-f9914f7a3a57„¨metadataƒ¨disabled©show_logsîskip_as_script§cell_idÙ$3e19436c-d294-11ef-11c5-f9914f7a3a57«code_foldedäcodeÚ
md"""
In the **Bayesian** interpretation, the probability is associated with a **state-of-knowledge** (usually held by a person, but formally by a rational agent).
* For instance, in a coin tossing experiment, ``p(\texttt{outcome} = \texttt{tail}) = 0.4`` should be interpreted as the belief that there is a 40% chance that ``\texttt{tail}`` comes up if the coin were tossed.
* Under the Bayesian interpretation, PT calculus (sum and product rules) **extends boolean logic to rational reasoning with uncertainty**.
"""Ù$3e1b05ee-d294-11ef-33de-efed64d01c0d„¨metadataƒ¨disabled©show_logsîskip_as_script§cell_idÙ$3e1b05ee-d294-11ef-33de-efed64d01c0d«code_foldedäcodeÚ[keyconcept(
"",
md"""
All valid probabilistic relations can be derived from just two fundamental principles: the **sum rule** and the **product rule**. These two rules form the foundation of probability theory, from which more complex constructs such as conditional probabilities, Bayes’ theorem, and marginalization naturally follow.
"""
)Ù$4f6dd225-c64d-4b76-b075-0bf71c863b5a„¨metadataƒ¨disabled©show_logsîskip_as_script§cell_idÙ$4f6dd225-c64d-4b76-b075-0bf71c863b5a«code_folded¤codeÚ
begin
prevalence_bond = @bind prevalence Scrubbable(0:0.01:1; format=".0%", default=0.01)
sensitivity_bond = @bind sensitivity Scrubbable(0:0.01:1; format=".0%", default=0.95)
specificity_bond = @bind specificity Scrubbable(0:0.01:1; format=".0%", default=0.85)
end;Ù$61713e1c-8e37-45d9-9f58-c3db69e15b66„¨metadataƒ¨disabled©show_logsîskip_as_script§cell_idÙ$61713e1c-8e37-45d9-9f58-c3db69e15b66«code_foldedäcodeÙ7challenge_statement("Disease Diagnosis",header_level=1)Ù$3e1f7d5e-d294-11ef-2878-05744036f32c„¨metadataƒ¨disabled©show_logsîskip_as_script§cell_idÙ$3e1f7d5e-d294-11ef-2878-05744036f32c«code_foldedäcodeÙømd"""
## General Variable Transformations
Suppose ``x`` is a **discrete** variable with probability **mass** function ``P_x(x)``, and ``y = h(x)`` is a one-to-one function with ``x = g(y) = h^{-1}(y)``. Then
```math
P_y(y) = P_x(g(y))\,.
```
"""Ù$3e1b7d14-d294-11ef-0d10-1148a928dd57„¨metadataƒ¨disabled©show_logsîskip_as_script§cell_idÙ$3e1b7d14-d294-11ef-0d10-1148a928dd57«code_foldedäcodeÚLmd"""
## Marginalization (through the Law of Total Probability)
Let ``A`` and ``B_1,B_2,\ldots,B_n`` be events, where ``B_1,B_2,\ldots,B_n`` partitions the universe. Then
```math
\sum_{i=1}^n p(A,B_i) = p(A) \,.
```
This rule is called the [law of total probability](https://en.wikipedia.org/wiki/Law_of_total_probability).
"""Ù$2292c667-862e-4924-8f15-de0a8893c439„¨metadataƒ¨disabled©show_logsîskip_as_script§cell_idÙ$2292c667-862e-4924-8f15-de0a8893c439«code_foldedäcodeÚGhide_solution(
md"""
```math
\begin{align*}
\Sigma_{yx}^T &\triangleq \Big( \mathbb{E}\left[ (y-\mu_y)(x-\mu_x)^T \right] \Big)^T \\
&= \mathbb{E}\left[ \big((y-\mu_y)(x-\mu_x)^T \big)^T\right] \\
&= \mathbb{E}\left[ (x-\mu_x)(y-\mu_y)^T \right] \quad \text{using }(AB)^T = B^TA^T \\
&= \Sigma_{xy}
\end{align*}
```
""" )Ù$3e1ed1a4-d294-11ef-2de4-d7cc540e06a1„¨metadataƒ¨disabled©show_logsîskip_as_script§cell_idÙ$3e1ed1a4-d294-11ef-2de4-d7cc540e06a1«code_foldedäcodeÚwmd"""
More generally, assume two jointly continuous variables ``X`` and ``Y``, with joint PDF ``p_{xy}(x,y)``. Let ``Z=X+Y``, then
```math
\begin{align*}
\text{Prob}(Z\leq z) &= \text{Prob}(X+Y\leq z)\\
&= \int_{-\infty}^\infty \biggl( \int_{-\infty}^{z-x} p_{xy}(x,y) \mathrm{d}y \biggr) \mathrm{d}x \\
&= \int_{-\infty}^\infty \biggl( \int_{-\infty}^{z} p_{xy}(x,t-x) \mathrm{d}t \biggr) \mathrm{d}x \\
&= \int_{-\infty}^z \biggl( \underbrace{\int_{-\infty}^{\infty} p_{xy}(x,t-x) \mathrm{d}x}_{p_z(t)} \biggr) \mathrm{d}t
\end{align*}
```
Hence, the PDF for the sum ``Z`` is given by ``p_z(z) = \int_{-\infty}^{\infty} p_{xy}(x,z-x) \mathrm{d}x``.
In particular, if ``X`` and ``Y`` are **independent** variables, then
```math
p_z (z) = \int_{-\infty}^{\infty} p_x(x) p_y(z - x)\,\mathrm{d}{x} = p_x(z) * p_y(z)\,,
```
which is the **convolution** of the two marginal PDFs.
"""Ù$dd31ec7c-708d-4fd7-958d-f9887798a5bc„¨metadataƒ¨disabled©show_logsîskip_as_script§cell_idÙ$dd31ec7c-708d-4fd7-958d-f9887798a5bc«code_foldedäcode°md"""
# Code
"""Ù$577c6e08-9b74-43a4-9e27-9c477980406b„¨metadataƒ¨disabled©show_logsîskip_as_script§cell_idÙ$577c6e08-9b74-43a4-9e27-9c477980406b«code_foldedäcodeÚLfunction NormalBind(bond_mu, bond_sigma; style_css::String="")
PlutoUI.Experimental.transformed_value(
function((x,y))
Normal(x,y)
end,
PlutoUI.combine() do Child
@htl """
Normal(μ=$(Child(bond_mu)), σ=$(Child(bond_sigma)))
"""
end
)
endÙ$7d493e09-f7cc-4e13-a506-b792edcbf390„¨metadataƒ¨disabled©show_logsîskip_as_script§cell_idÙ$7d493e09-f7cc-4e13-a506-b792edcbf390«code_foldedäcodeÙemd"""
and the likelihood function
```math
L(\theta) \triangleq p(y=1|\theta) = \theta \,.
```
"""Ù$727dc817-0284-4c0f-9a92-21dcbea50807„¨metadataƒ¨disabled©show_logsîskip_as_script§cell_idÙ$727dc817-0284-4c0f-9a92-21dcbea50807«code_foldedäcodeÚ*hide_solution(
md"""
(a) ``p(S_1=R) = \frac{N_\text{red}}{N_\text{red}+N_\text{green}} = \frac{5}{12}``
(b) The outcome of the ``n``-th draw is referred to by ``S_n``. Use Bayes rule to get,
```math
\begin{align}
p(S_1=\text{R} | S_2=\text{G}) &= \frac{p(S_2=\text{G} | S_1=\text{R}) p(S_1=\text{R})} {p(S_2=\text{G} | S_1 = \text{R}) p(S_1=\text{R}) + p(S_2=\text{G} | S_1=\text{G}) p(S_1=\text{G})} \\
&= \frac{\frac{7}{11}\cdot\frac{5}{12}}{\frac{7}{11}\cdot\frac{5}{12}+\frac{6}{11}\cdot\frac{7}{12}} \\
&= \frac{5}{11}
\end{align}
```
""")Ù$3e1e2b96-d294-11ef-3a68-fdc78232142e„¨metadataƒ¨disabled©show_logsîskip_as_script§cell_idÙ$3e1e2b96-d294-11ef-3a68-fdc78232142e«code_foldedäcodeÚcmd"""
##### Problem
- A dark bag contains five red balls and seven green ones.
- (a) What is the probability of drawing a red ball on the first draw?
- Balls are not returned to the bag after each draw.
- (b) If you know that on the second draw the ball was a green one, what is now the probability of drawing a red ball on the first draw?
"""Ù$4c639e65-e06b-4c5e-b6e7-aabed6b6c0b4„¨metadataƒ¨disabled©show_logsîskip_as_script§cell_idÙ$4c639e65-e06b-4c5e-b6e7-aabed6b6c0b4«code_foldedäcodeÚlhide_solution(
md"""
There are two hypotheses: let ``H = 0`` mean that the original ball in the bag was white and ``H = 1`` that it was black. Assume the prior probabilities are equal, i.e.,
```math
P(H =0) = 1/2, \quad P(H =1) = 1/2 \,.
```
The data is that when a randomly selected ball was drawn from the bag, which contained a white one and the unknown one, it turned out to be white. The probability of this result according to each hypothesis is:
```math
P(D|H =0) = 1, \quad P(D|H =1) = 1/2 \,.
```
So by Bayes theorem,
```math
\begin{align}
P(H=0|D) &= \frac{P(H=0,D)}{P(D)} \\
&= \frac{P(D|H=0) P(H=0)}{P(D|H=0) P(H=0) + P(D|H=1) P(H=1)} \\
&= \frac{1 \cdot \frac{1}{2}}{1 \cdot \frac{1}{2} + \frac{1}{2} \cdot \frac{1}{2}} \\
&= \frac{2}{3}
\end{align}
```
and consequently,
```math
P(H =1|D) = 1 - P(H =0|D) = \frac{1}{3}
```
""")Ù$3e18b2fa-d294-11ef-1255-df048f0dcec2„¨metadataƒ¨disabled©show_logsîskip_as_script§cell_idÙ$3e18b2fa-d294-11ef-1255-df048f0dcec2«code_foldedäcodeÚmd"""
[Richard T. Cox (1946)](https://aapt.scitation.org/doi/10.1119/1.1990764) developed a **calculus for rational reasoning** about how to represent and update the **degree-of-belief** about the truth value of an event when faced with new information.
"""Ù$3e185ab0-d294-11ef-3f7d-9bd465518274„¨metadataƒ¨disabled©show_logsîskip_as_script§cell_idÙ$3e185ab0-d294-11ef-3f7d-9bd465518274«code_foldedäcodeÚÔmd"""
##### Problem
- Given is a disease with a prevalence of $(prevalence_bond) and a test procedure with sensitivity ('true positive' rate) of $(sensitivity_bond), and specificity ('true negative' rate) of $(specificity_bond). What is the chance that somebody who tests positive actually has the disease?
##### Solution
- [See later in this lecture](#Challenge-Revisited:-Disease-Diagnosis). We will use probabilistic inference, which we will discuss next.
"""Ù$3e1c0e80-d294-11ef-0d19-375e01988f16„¨metadataƒ¨disabled©show_logsîskip_as_script§cell_idÙ$3e1c0e80-d294-11ef-0d19-375e01988f16«code_foldedäcodeÙìmd"""
Note that the evidence (a.k.a. *marginal likelihood* ) can be computed from the numerator through marginalization since
```math
p(D) = \int p(D,\theta) \,\mathrm{d}\theta = \int p(D|\theta)\,p(\theta) \,\mathrm{d}\theta
```
"""Ù$5da42e9a-4318-48ea-9f43-4c1e1c97bceb„¨metadataƒ¨disabled©show_logsîskip_as_script§cell_idÙ$5da42e9a-4318-48ea-9f43-4c1e1c97bceb«code_foldedäcode³keyconceptsummary()Ù$a8d4a517-84a7-426e-a49e-482c5fd047ae„¨metadataƒ¨disabled©show_logsîskip_as_script§cell_idÙ$a8d4a517-84a7-426e-a49e-482c5fd047ae«code_foldedäcodeÚmd"""
##### The Likelihood Function is a Function of What? (*)
When considering the distribution ``p(D|\theta)``, is it more correct to speak about the likelihood of the model parameters ``\theta`` than about the likelihood of the observed data set ``D``. And why?
"""Ù$3e196d6a-d294-11ef-0795-41c045079251„¨metadataƒ¨disabled©show_logsîskip_as_script§cell_idÙ$3e196d6a-d294-11ef-0795-41c045079251«code_foldedäcodeÙ�md"""
The Bayesian viewpoint is clearly favored in the machine learning community. (In this class, we also strongly favor the Bayesian interpretation).
"""Ù$218d3b6e-50b6-4b98-a00c-a19dd33d2c03„¨metadataƒ¨disabled©show_logsîskip_as_script§cell_idÙ$218d3b6e-50b6-4b98-a00c-a19dd33d2c03«code_foldedäcodeÙCmd"""
Let's plot the distributions for ``X``, ``Y``, and ``Z``.
"""Ù$3e1b4b1c-d294-11ef-0423-9152887cc403„¨metadataƒ¨disabled©show_logsîskip_as_script§cell_idÙ$3e1b4b1c-d294-11ef-0423-9152887cc403«code_foldedäcodeÚ·md"""
## Independent, Exclusive, and Exhaustive Events
It will be helpful to introduce some terms concerning special relationships between events.
##### Joint events
The expression ``p(A,B)`` for the probability of the conjuction ``A \land B`` is also called the **joint probability** of events ``A`` and ``B``. Note that
```math
p(A,B) = p(B,A)\,,
```
since ``A\land B = B \land A``. Therefore, the order of arguments in a joint probability distribution does not matter: ``p(A,B,C,D) = p(C,A,D,B)``, etc.
##### Independent events
Two events ``A`` and ``B`` are said to be **independent** if the probability of one event is not altered by information about the truth of the other event, i.e.,
```math
p(A|B) = p(A)\,.
```
It follows that, if ``A`` and ``B`` are independent, then the product rule simplifies to
```math
p(A,B) = p(A) p(B)\,.
```
``A`` and ``B`` with given background ``I`` are said to be **conditionally independent** for given ``I``, if
```math
p(A|B,I) = p(A|I)\,.
```
In that case, the product rule simplifies to ``p(A,B|I) = p(A|I) p(B|I)``.
##### Mutually exclusive events
Two events ``A_1`` and ``A_2`` are said to be **mutually exclusive** ('disjoint') if they cannot be true simultaneously, i.e., if
```math
p(A_1,A_2)=0 \,.
```
For mutually exclusive events, probabilities add (this follows from the sum rule), hence
```math
p(A_1 + A_2) = p(A_1) + p(A_2)
```
##### Collectively exhaustive events
A set of events ``A_1, A_2, \ldots, A_N`` is said to be **collectively exhaustive** if one of the statements is necessarily true, i.e., ``A_1+A_2+\cdots +A_N=\mathrm{TRUE}``, or equivalently
```math
p(A_1+A_2+\cdots +A_N) = 1 \,.
```
##### Partitioning the universe
If a set of events ``A_1, A_2, \ldots, A_n`` is both **mutually exclusive** and **collectively exhaustive**, then we say that they **partition the universe**. Technically, this means that
```math
\sum_{n=1}^N p(A_n) = p(A_1 + \ldots + A_N) = 1
```
"""Ù$d1ab6fc4-e92c-4e77-8c4a-f5f33cb0b52c„¨metadataƒ¨disabled©show_logsîskip_as_script§cell_idÙ$d1ab6fc4-e92c-4e77-8c4a-f5f33cb0b52c«code_foldedäcodeÚÕ@htl """
Parameters for X
$(@bind x NormalBind(Scrubbable(2.0), Scrubbable(1.0)))
Parameters for Y
$(@bind y NormalBind(Scrubbable(2.0), Scrubbable(0.5)))
"""Ù$3e1eeb14-d294-11ef-1702-f5d2cf6fe60a„¨metadataƒ¨disabled©show_logsîskip_as_script§cell_idÙ$3e1eeb14-d294-11ef-1702-f5d2cf6fe60a«code_foldedäcodeÙîmd"""
[Wikipedia's List of convolutions of probability distributions](https://en.wikipedia.org/wiki/List_of_convolutions_of_probability_distributions) shows how these convolutions work out for a few common probability distributions.
"""Ù$922770f4-ddc8-4089-b378-f14088276b43„¨metadataƒ¨disabled©show_logsîskip_as_script§cell_idÙ$922770f4-ddc8-4089-b378-f14088276b43«code_foldedäcodeÙJexercise_statement("Which color does the ball have?"; prefix="Inference ")Ù$f8c8ba53-df36-48a6-afde-2952cbcfbe48„¨metadataƒ¨disabled©show_logsîskip_as_script§cell_idÙ$f8c8ba53-df36-48a6-afde-2952cbcfbe48«code_foldedäcodeÚmd"""
Does this fragment resonate with your own experience?
In this lesson we introduce *Probability Theory* (PT) again. As we will see in the next lessons, PT is all you need to make sense of machine learning, artificial intelligence, statistics, etc.
"""Ù$41bee964-a0a9-4a7f-8505-54a9ee12ef0d„¨metadataƒ¨disabled©show_logsîskip_as_script§cell_idÙ$41bee964-a0a9-4a7f-8505-54a9ee12ef0d«code_foldedäcodeÚ†md"""
## Propositional (Boolean) Logic
Define an **event** (or "proposition") ``A`` as a statement that can be considered for its truth by a person. For instance,
```math
�= \texttt{``there is life on Mars''}
```
Boolean logic (or propositional logic) is a formal system of logic based on binary truth values: every proposition is either true (with assigned value ``1``) or false (with assigned value ``0``). It is named after George Boole, who developed the algebraic formulation of logic in the mid-19th century.
With Boolean operators (``\lor``, ``\land``, ``\implies``, etc.), we can create and evaluate compound propositions, e.g.,
- Given two events ``A`` and ``B``, the **conjunction** (logical-and) ``A \land B`` is true if-and-only-if both ``A`` and ``B`` are true. We write ``A \land B`` also shortly as ``AB`` (or use a comma as in a joint probability distribution ``p(A,B)``).
- The **disjunction** (logical-or) ``A \lor B``, is true if either ``A`` or ``B`` is true or both ``A`` and ``B`` are true. We write ``A \lor B`` also as ``A + B`` (Note that the plus-sign is here not an arithmetic operator, but rather a logical operator to process truth values.)
- The denial of ``A``, i.e., the event **not**-A, is written as ``\bar{A}``.
Boolean logic provides the rules of inference for **deductive reasoning** and underpins all formal reasoning systems in mathematics and philosophy.
"""Ù$3e1b8bf4-d294-11ef-04cc-6364e46fdd64„¨metadataƒ¨disabled©show_logsîskip_as_script§cell_idÙ$3e1b8bf4-d294-11ef-04cc-6364e46fdd64«code_foldedäcodeÙömd"""
A very practical application of this law is to get rid of a variable that we are not interested in. For instance, if ``X`` and ``Y \in \{y_1,y_2,\ldots,y_n\}`` are discrete variables, then
```math
p(X) = \sum_{i=1}^n p(X,Y=y_i)\,.
```
"""Ù$98fa17a6-7c8b-46e4-b32d-52db183d88f8„¨metadataƒ¨disabled©show_logsîskip_as_script§cell_idÙ$98fa17a6-7c8b-46e4-b32d-52db183d88f8«code_foldedäcodeÙFmd"""
Set the parameters for the distributions of ``X`` and ``Y``:
"""Ù$3e1f4f46-d294-11ef-29b8-69e546763781„¨metadataƒ¨disabled©show_logsîskip_as_script§cell_idÙ$3e1f4f46-d294-11ef-29b8-69e546763781«code_foldedäcodeÚ–md"""
## PDF for the Product of Two Variables
For two continuous **independent** variables ``X`` and ``Y``, with PDF's ``p_x(x)`` and ``p_y(y)``, the PDF of ``Z = X Y`` is given by
```math
p_z(z) = \int_{-\infty}^{\infty} p_x(x) \,p_y(z/x)\, \frac{1}{|x|}\,\mathrm{d}x\,.
```
For proof, see [https://en.wikipedia.org/wiki/Product_distribution](https://en.wikipedia.org/wiki/Product_distribution).
"""Ù$3a1d380e-df80-4727-9772-f199214cf05d„¨metadataƒ¨disabled©show_logsîskip_as_script§cell_idÙ$3a1d380e-df80-4727-9772-f199214cf05d«code_foldedäcodeÙ¼md"""
##### The Sum Rule (**)
Derive the general sum rule,
```math
p(A + B) = p(A) + p(B) - p(A,B)
```
from the _elementary_ sum rule ``p(A) + p(\bar A) = 1`` and the product rule.
"""Ù$3e1e5a5a-d294-11ef-2fdf-efee4eb1a0f2„¨metadataƒ¨disabled©show_logsîskip_as_script§cell_idÙ$3e1e5a5a-d294-11ef-2fdf-efee4eb1a0f2«code_foldedäcodeÙ§md"""
The second central moment, also known as **variance** of ``x`` is defined as
```math
\Sigma_x \triangleq \mathbb{E} \left[(x-\mu_x)(x-\mu_x)^T \right]
```
"""Ù$3e1bdd02-d294-11ef-19e8-2f44eccf58af„¨metadataƒ¨disabled©show_logsîskip_as_script§cell_idÙ$3e1bdd02-d294-11ef-19e8-2f44eccf58af«code_foldedäcodeÚfmd"""
This last formula is called **Bayes rule**, named after its inventor [Thomas Bayes](https://en.wikipedia.org/wiki/Thomas_Bayes) (1701-1761). While Bayes rule is always true, a particularly useful application occurs when ``D`` refers to an observed data set and ``\theta`` is set of unobserved model parameters. In that case,
* the **prior** probability ``p(\theta)`` represents our **state-of-knowledge** about proper values for ``\theta``, before seeing the data ``D``.
* the **posterior** probability ``p(\theta|D)`` represents our state-of-knowledge about ``\theta`` after we have seen the data.
"""Ù$fea8ae4c-8ef9-4b74-ad13-1314afef97de„¨metadataƒ¨disabled©show_logsîskip_as_script§cell_idÙ$fea8ae4c-8ef9-4b74-ad13-1314afef97de«code_foldedäcodeÚmd"""
## True and False Events
In probability theory, events that are certainly true or certainly false are treated as special cases of general events, and they correspond to probabilities of ``1`` and ``0``, respectively.
Let ``\Omega`` be the sample space, i.e., the set of all possible outcomes of an experiment. Then:
- The true event corresponds to the entire sample space ``\Omega``.
- It always happens, regardless of the outcome.
- For example, for the outcome of a throw of a dice, the sample space is ``\Omega = \{1,2,3,4,5,6\}``.
- Its probability is
```math
p(\Omega) = 1\,.
```
The false event corresponds to the empty set ``\emptyset``.
- It never happens (no possible outcomes).
- Its probability is
```math
p(\emptyset) = 0 \,.
```
"""Ù$db73766d-643c-41d7-a1eb-f376c657f860„¨metadataƒ¨disabled©show_logsîskip_as_script§cell_idÙ$db73766d-643c-41d7-a1eb-f376c657f860«code_foldedäcodeÙÓmd"""
If the transformation ``y=h(x)`` is not invertible, then ``x=g(y)`` does not exist. In that case, you can still work out the transformation by equating equivalent probability masses in the two domains.
"""Ù$3b1b0869-b815-4697-9dba-3c4b4cb5ac47„¨metadataƒ¨disabled©show_logsîskip_as_script§cell_idÙ$3b1b0869-b815-4697-9dba-3c4b4cb5ac47«code_foldedäcodeÚ.hide_solution(
md"""
```math
\begin{align}
p\left( A + B \right) &\underset{\mathrm{bool}}{=} p\left( \overline {\bar A \bar B } \right) \\
&\underset{\mathrm{sum}}{=} 1 - p\left( \bar{A} \bar{B} \right) \\
&\underset{\mathrm{prod}}{=} 1 - p\left( \bar{A} |\bar{B} \right) p\left(\bar{B} \right) \\
&\underset{\mathrm{sum}}{=} 1 - \left( 1 - p\left(A|\bar B \right) \right) \left( 1 - p\left( B \right) \right) \\
&= p(B) + \left( {1 - p\left( B \right)} \right)p\left( {A|\bar B } \right) \\
&\underset{\mathrm{prod}}{=} p(B) + \left( 1 - p\left( B \right) \right) p\left( \bar{B} |A \right) \frac{ p\left( A \right) }{ p\left(\bar{B}\right)} \\
&\underset{\mathrm{sum}}{=} p(B) + p\left(\bar{B} |A \right) p\left( A \right) \\
&\underset{\mathrm{sum}}{=} p(B) + \left( 1 - p\left( {B|A} \right) \right) p\left( A \right) \\
&\underset{\mathrm{sum}}{=} p\left( A \right) + p(B) - p\left( A,B \right)
\end{align}
```
Note that, aside from the first boolean rewrite, everything follows straight application of sum and product rules.
""")Ù$a8046381-ff11-40af-ae2b-078d71c586e7„¨metadataƒ¨disabled©show_logsîskip_as_script§cell_idÙ$a8046381-ff11-40af-ae2b-078d71c586e7«code_foldedäcodeÙeresult = (sensitivity * prevalence) / (sensitivity * prevalence + (1 - specificity)*(1 - prevalence))Ù$3e1d20e0-d294-11ef-2044-e1fe6590a600„¨metadataƒ¨disabled©show_logsîskip_as_script§cell_idÙ$3e1d20e0-d294-11ef-2044-e1fe6590a600«code_foldedäcodeÙÜmd"""
!!! note
The (discrete) sampling distribution is a valid probability distribution.
However, the likelihood function ``L(\theta)`` clearly isn't, since ``\int_0^1 L(\theta) \mathrm{d}\theta = 0.5 \neq 1``.
"""Ù$fc733d61-fd0f-4a13-9afc-4505ac0253df„¨metadataƒ¨disabled©show_logsîskip_as_script§cell_idÙ$fc733d61-fd0f-4a13-9afc-4505ac0253df«code_foldedäcodeÙwbegin
f(y,θ) = θ.^y .* (1 .- θ).^(1 .- y); # p(y|θ)
θ_bond = @bind θ Scrubbable(0.0:0.02:1; format=".2f");
end;Ù$3e1c60ba-d294-11ef-3a01-cf9e97512857„¨metadataƒ¨disabled©show_logsîskip_as_script§cell_idÙ$3e1c60ba-d294-11ef-3a01-cf9e97512857«code_foldedäcodeÙÝmd"""
In general, ``p(D|\theta)`` is just a function of the two variables ``D`` and ``\theta``. We distinguish two interpretations of this function, depending on which variable is observed (or given by other means).
"""Ù$3e1bf116-d294-11ef-148b-f7a1ca3f3bad„¨metadataƒ¨disabled©show_logsîskip_as_script§cell_idÙ$3e1bf116-d294-11ef-148b-f7a1ca3f3bad«code_foldedäcodeÙomd"""
Bayes rule tells us how to update our knowledge about model parameters when facing new data. Hence,
"""Ù$3e1fa04a-d294-11ef-00c3-a51d1aaa5553„¨metadataƒ¨disabled©show_logsîskip_as_script§cell_idÙ$3e1fa04a-d294-11ef-00c3-a51d1aaa5553«code_foldedäcodeÚÈmd"""
If ``x`` is defined on a **continuous** domain, and ``p_x(x)`` is a probability **density** function, then probability mass is represented by the area under a (density) curve. In that case,
```math
p_y(y) = p_x(g(y)) g^\prime(y)\,,
```
which is also known as the [Change-of-Variable theorem](https://en.wikipedia.org/wiki/Probability_density_function#Function_of_random_variables_and_change_of_variables_in_the_probability_density_function).
"""Ù$9b85a92b-c56b-48a3-97c1-6b1882e33a22„¨metadataƒ¨disabled©show_logsîskip_as_script§cell_idÙ$9b85a92b-c56b-48a3-97c1-6b1882e33a22«code_foldedäcodeÙŠ@htl """
Show solution? $(@bind(show_disease_diagnosis_solution, CheckBox(default=false)))
"""Ù$079157c9-5d97-4dbc-8c47-afa8b661db06„¨metadataƒ¨disabled©show_logsîskip_as_script§cell_idÙ$079157c9-5d97-4dbc-8c47-afa8b661db06«code_foldedäcodeÙ¥let
θ_str = n(θ)
@mdx """
```math
p(y|\\theta=$(n(θ))) = \\begin{cases} $(n(1-θ)) & \\text{if }y=0 \\\\ $(n(θ)) & \\text{if } y=1 \\end{cases}
```
"""
endÙ$3e1c70be-d294-11ef-14ed-0d46515541c5„¨metadataƒ¨disabled©show_logsîskip_as_script§cell_idÙ$3e1c70be-d294-11ef-14ed-0d46515541c5«code_foldedäcodeÚ4md"""
The **sampling distribution** (a.k.a. the **data-generating** distribution)
```math
p(D|\theta=\theta_0)
```
(which is a function of ``D`` only) describes a probability distribution for data ``D``, assuming that it is generated by the given model with parameters fixed at ``\theta = \theta_0``.
"""Ù$3e1bffec-d294-11ef-2a49-9ff0f6331add„¨metadataƒ¨disabled©show_logsîskip_as_script§cell_idÙ$3e1bffec-d294-11ef-2a49-9ff0f6331add«code_foldedäcodeÚmd"""
## Bayes Rule Nomenclature
Some nomenclature associated with Bayes rule:
```math
\underbrace{p(\theta | D)}_{\text{posterior}} = \frac{\overbrace{p(D|\theta)}^{\text{likelihood}} \times \overbrace{p(\theta)}^{\text{prior}}}{\underbrace{p(D)}_{\text{evidence}}}
```
"""Ù$3e198ba6-d294-11ef-3fe7-d70bf4833fa6„¨metadataƒ¨disabled©show_logsîskip_as_script§cell_idÙ$3e198ba6-d294-11ef-3fe7-d70bf4833fa6«code_foldedäcodeÙ•md"""
In this class, we aim to turn on the headlights and illuminate the elegance and power of the Bayesian approach to information processing.
"""Ù$3e1a8eca-d294-11ef-1ef0-c15b24d05990„¨metadataƒ¨disabled©show_logsîskip_as_script§cell_idÙ$3e1a8eca-d294-11ef-1ef0-c15b24d05990«code_foldedäcodeÚ€md"""
If ``X`` is *continuously* valued, then ``p(X=x)`` is a probability *density* function (PDF) with ``p(X=x)\ge 0`` and normalization ``\int_x p(x)\mathrm{d}x=1``.
* Note that if ``X`` is continuously valued, then the value of ``p(x)`` is not necessarily ``\le 1``. E.g., a uniform distribution on the continuous domain ``[0,.5]`` has value ``p(x) = 2`` over its domain.
"""Ù$3e1f68fa-d294-11ef-31b2-e7670da8c08c„¨metadataƒ¨disabled©show_logsîskip_as_script§cell_idÙ$3e1f68fa-d294-11ef-31b2-e7670da8c08c«code_foldedäcodeÚ^md"""
Generally, this integral does not lead to an analytical expression for ``p_z(z)``.
As a crucial example, [the product of two independent variables that are both Gaussian-distributed does **not** lead to a Gaussian distribution](https://bmlip.github.io/course/minis/Sum%20and%20product%20of%20Gaussians.html).
* Exception: the distribution of the product of two variables that both have [log-normal distributions](https://en.wikipedia.org/wiki/Log-normal_distribution) is again a lognormal distribution. (If ``X`` has a normal distribution, then ``Y=\exp(X)`` has a log-normal distribution.)
"""Ù$d0f672bd-74c9-4be1-b5ea-8d4040edb5df„¨metadataƒ¨disabled©show_logsîskip_as_script§cell_idÙ$d0f672bd-74c9-4be1-b5ea-8d4040edb5df«code_foldedäcodeÙ²navigate_prev_next(
"https://bmlip.github.io/course/lectures/Machine%20Learning%20Overview.html",
"https://bmlip.github.io/course/lectures/Bayesian%20Machine%20Learning.html"
)Ù$3e1c51e2-d294-11ef-2c6d-d32a98308c6f„¨metadataƒ¨disabled©show_logsîskip_as_script§cell_idÙ$3e1c51e2-d294-11ef-2c6d-d32a98308c6f«code_foldedäcodeÙÙmd"""
## The Likelihood Function vs the Sampling Distribution
Consider a distribution ``p(D|\theta)``, where ``D`` relates to variables that are observed (i.e., a "data set") and ``\theta`` are model parameters.
"""Ù$3e1a7c8e-d294-11ef-1f97-55e608d49141„¨metadataƒ¨disabled©show_logsîskip_as_script§cell_idÙ$3e1a7c8e-d294-11ef-1f97-55e608d49141«code_foldedäcodeÙ®md"""
If ``X`` is a *discretely* valued variable, then ``p(X=x)`` is a probability *mass* function (PMF) with ``0\le p(X=x)\le 1`` and normalization ``\sum_x p(x) =1``.
"""Ù$b305a905-06c2-4a15-8042-72ef6375720f„¨metadataƒ¨disabled©show_logsîskip_as_script§cell_idÙ$b305a905-06c2-4a15-8042-72ef6375720f«code_folded¤code¸using BmlipTeachingToolsÙ$3e1d6d00-d294-11ef-1081-e11b8397eb91„¨metadataƒ¨disabled©show_logsîskip_as_script§cell_idÙ$3e1d6d00-d294-11ef-1081-e11b8397eb91«code_foldedäcodeÚÃmd"""
##### Problem
- Given a disease ``D \in \{0, 1\}`` with prevalence (overall occurence percentage) of $(prevalence_bond) and a test procedure ``T \in \{0, 1\}`` with sensitivity (true positive rate) of $(sensitivity_bond) and specificity (true negative' rate) of $(specificity_bond), what is the chance that somebody who tests positive actually has the disease?
_The percentages are interactive! **Click and drag** to change the values._
"""Ù$3e191b6c-d294-11ef-3174-d1b4b36e252b„¨metadataƒ¨disabled©show_logsîskip_as_script§cell_idÙ$3e191b6c-d294-11ef-3174-d1b4b36e252b«code_foldedäcodeÚvmd"""
##### Examples
* Predictions
```math
p(\,\texttt{future-observations}\,|\,\texttt{past-observations}\,)
```
* Classify a received data point ``x``
```math
p(\,x\texttt{-belongs-to-class-}k \,|\,x\,)
```
* Update a model based on a new observation
```math
p(\,\texttt{model-parameters} \,|\,\texttt{new-observation},\,\texttt{past-observations}\,)
```
"""Ù$4a81342c-17c7-4eb9-933b-edb98df7b9c4„¨metadataƒ¨disabled©show_logsîskip_as_script§cell_idÙ$4a81342c-17c7-4eb9-933b-edb98df7b9c4«code_folded¤codeÙ,n(x; digits=2) = @sprintf("%.*f", digits, x)Ù$9f4125a2-d5d2-4acf-8bad-82f94af230e8„¨metadataƒ¨disabled©show_logsîskip_as_script§cell_idÙ$9f4125a2-d5d2-4acf-8bad-82f94af230e8«code_foldedäcodeÚµblockquote(
md"""
#### Preface
"As an undergraduate, I always found the subject of statistics to be rather mysterious. This topic wasn’t entirely new to me, as we had been taught a little bit about probability earlier at high school; for example, I was already familiar with the binomial, Poisson and normal distributions. Most of this made sense, but only seemed to relate to things like rolling dice, flipping coins, shuffling cards and so on. However, having aspirations of becoming a scientist, what I really wanted to know was how to analyse experimental data. Thus, I eagerly looked forward to the lectures on statistics. Sadly, they were a great disappointment. Although many of the tests and procedures expounded were intuitively reasonable, there was something deeply unsatisfactory about the whole affair: there didn’t seem to be any underlying basic principles! Hence, the course on ‘probability and statistics’ had led to an unfortunate dichotomy: probability made sense, but was just a game; statistics was important, but it was a bewildering collection of tests with little obvious rhyme or reason. While not happy with this situation, I decided to put aside the subject and concentrate on real science. After all, the predicament was just a reflection of my own inadequacies and I’d just have to work at it when the time came to really analyse my data.
The story above is not just my own, but is the all too common experience of many scientists. Fortunately, it doesn’t have to be like this. What we were not told in our undergraduate lectures is that there is an alternative approach to the whole subject of data analysis which uses only probability theory. In one sense, it makes the topic of statistics entirely superfluous. In another, it provides the logical justification for many of the prevalent statistical tests and procedures, making explicit the conditions and approximations implicitly assumed in their use."
""",
"D.S. Sivia"
)Ù$840ab4dc-0d2e-4bf8-acc7-5f1ee2b0dcaf„¨metadataƒ¨disabled©show_logsîskip_as_script§cell_idÙ$840ab4dc-0d2e-4bf8-acc7-5f1ee2b0dcaf«code_foldedäcodeÙ4md"""
# Probability Theory as Rational Reasoning
"""Ù$3e027ede-4ac1-4521-a026-dc00bfca4adf„¨metadataƒ¨disabled©show_logsîskip_as_script§cell_idÙ$3e027ede-4ac1-4521-a026-dc00bfca4adf«code_foldedäcodeÙ5exercise_statement("Causality?"; prefix="Inference ")Ù$3e1889b8-d294-11ef-17bb-496655fbd618„¨metadataƒ¨disabled©show_logsîskip_as_script§cell_idÙ$3e1889b8-d294-11ef-17bb-496655fbd618«code_foldedäcodeÚšmd"""
## The Design of Probability Theory
In the real world, we are rarely completely certain of something. Instead of a truth value for the proposition ``A``, we can attach a **degree-of-belief** ``p(A)`` that represents how likely we think ``A`` is.
Now consider the truth value of the proposition
```math
�= \texttt{``there is life on Mars''}
```
with
```math
I = \texttt{``All known life forms require water''}
```
as background information. Now, assume that a new piece of information
```math
B = \texttt{``There is water on Mars''}
```
becomes available, how **should** our degree of belief in event ``A`` be affected *if we were rational*?
"""Ù$6d07be25-53d0-46b9-b197-a3680d830952„¨metadataƒ¨disabled©show_logsîskip_as_script§cell_idÙ$6d07be25-53d0-46b9-b197-a3680d830952«code_foldedäcodeÚkhide_solution(
md"""
Define ``A = \begin{pmatrix} I & I \end{pmatrix}`` and ``w = \begin{pmatrix} x \\ y \end{pmatrix}``, where ``I`` is the identity matrix. Then
```math
z = A w\,.
```
Let ``\mathbb{E}[\cdot]`` refer to the expectation operator. Now apply the formula for the mean and variance of a variable after a linear transformation:
```math
\mathbb{E}[z] = \mathbb{E}[Aw] = \mathbb{E}[x+y] = \mathbb{E}[x] + \mathbb{E}[y] \,.
```
For the covariance matrix, first note that
```math
\begin{align}
\Sigma_w &= \mathbb{E} \bigg[ \begin{pmatrix} x - \mu_x \\ y- \mu_y\end{pmatrix} \begin{pmatrix} x - \mu_x \\ y- \mu_y\end{pmatrix}^T \bigg] \\
&= \begin{pmatrix} \Sigma_x & \Sigma_{xy} \\ \Sigma_{yx} & \Sigma_y\end{pmatrix}
\end{align}
```
and we note that ``\Sigma_{yx} = \Sigma_{xy}^T``. Then, ``\Sigma_z`` evaluates to
```math
\begin{align}
\Sigma_z &= A \Sigma_w A^T \\
&= \begin{pmatrix} I & I \end{pmatrix} \begin{pmatrix} \Sigma_x & \Sigma_{xy} \\ \Sigma_{yx} & \Sigma_y\end{pmatrix} \begin{pmatrix}I \\ I \end{pmatrix} \\
&= \Sigma_x + \Sigma_y + \Sigma_{xy} + \Sigma_{yx} \,.
\end{align}
```
""" )Ù$5f377237-d9a5-4778-aa4d-1c6ce109b705„¨metadataƒ¨disabled©show_logsîskip_as_script§cell_idÙ$5f377237-d9a5-4778-aa4d-1c6ce109b705«code_foldedäcodeÚ^md"""
##### Apples and Oranges
Box 1 contains 8 apples and 4 oranges. Box 2 contains 10 apples and 2 oranges. Boxes are chosen with equal probability. You pick a box and then select a fruit from that box.
- (a) (*) What is the probability of choosing an apple?
- (b) (**) If an apple is chosen, what is the probability that it came from box 1?
"""Ù$d3b003c6-70ca-419f-a343-e35b266323f3„¨metadataƒ¨disabled©show_logsîskip_as_script§cell_idÙ$d3b003c6-70ca-419f-a343-e35b266323f3«code_foldedäcodeÚchide_solution(
md"""
Yes, it’s more correct to speak about the likelihood of the model parameters, not of the observed data set. Once ``D`` has been observed, it is no longer a random variable; it’s just a fixed outcome. What varies is ``\theta``, so ``L(\theta) = p(D|\theta)`` is a function of the parameters, not of the data.
Saying “likelihood of the data� is misleading because it confuses likelihood with the sampling distribution ``p(D|\theta)`` seen as a function of ``D`` (where ``\theta`` is fixed). The latter is a probability distribution over possible data sets before observing them.
""")Ù$3e1fb370-d294-11ef-1fb6-63a41a024691„¨metadataƒ¨disabled©show_logsîskip_as_script§cell_idÙ$3e1fb370-d294-11ef-1fb6-63a41a024691«code_foldedäcodeÚýmd"""
$(exercise_statement("Transformation of a Gaussian Variable"; big=true, header_level=2))
Let ``p_x(x) = \mathcal{N}(x|\mu,\sigma^2)`` where
```math
\mathcal{N}(x|\mu,\sigma^2) \triangleq \frac{1}{\sigma \sqrt{2\pi}} \,\exp\left(-\frac{(x-\mu)^2}{2 \sigma^2}\right)
```
is a [Gaussian distribution](https://bmlip.github.io/course/lectures/Density%20Estimation.html#Continuous-Data-and-the-Gaussian-Distribution). Let ``y = \frac{x-\mu}{\sigma}``.
Evaluate ``p_y(y)`` as a Gaussian distribution.
"""´last_hot_reload_timeË ©shortpath¼Probability Theory Review.jl¥nbpkgŠbusy_packages�Ù,waiting_for_permission_but_probably_disabled§enabledðterminal_outputs‡¯MarkdownLiteralÚp
[0m[1mWaiting for other notebooks to finish Pkg operations...[22m
[90m===[39m
[0m[1mResolving...[22m
[90m===[39m
[36m[1m Project[22m[39m No packages added to or removed from `~/.julia/scratchspaces/c3e4b0f8-55cb-11ea-2926-15256bba5781/pkg_envs/env_baqychzsut/Project.toml`
[36m[1m Manifest[22m[39m No packages added to or removed from `~/.julia/scratchspaces/c3e4b0f8-55cb-11ea-2926-15256bba5781/pkg_envs/env_baqychzsut/Manifest.toml`
[0m[1mInstantiating...[22m
[90m===[39m
[0m[1mPrecompiling...[22m
[90m===[39m
Waiting for notebook process to start... Done. Starting precompilation...ªnbpkg_syncÚp
[0m[1mWaiting for other notebooks to finish Pkg operations...[22m
[90m===[39m
[0m[1mResolving...[22m
[90m===[39m
[36m[1m Project[22m[39m No packages added to or removed from `~/.julia/scratchspaces/c3e4b0f8-55cb-11ea-2926-15256bba5781/pkg_envs/env_baqychzsut/Project.toml`
[36m[1m Manifest[22m[39m No packages added to or removed from `~/.julia/scratchspaces/c3e4b0f8-55cb-11ea-2926-15256bba5781/pkg_envs/env_baqychzsut/Manifest.toml`
[0m[1mInstantiating...[22m
[90m===[39m
[0m[1mPrecompiling...[22m
[90m===[39m
Waiting for notebook process to start... Done. Starting precompilation...²BmlipTeachingToolsÚp
[0m[1mWaiting for other notebooks to finish Pkg operations...[22m
[90m===[39m
[0m[1mResolving...[22m
[90m===[39m
[36m[1m Project[22m[39m No packages added to or removed from `~/.julia/scratchspaces/c3e4b0f8-55cb-11ea-2926-15256bba5781/pkg_envs/env_baqychzsut/Project.toml`
[36m[1m Manifest[22m[39m No packages added to or removed from `~/.julia/scratchspaces/c3e4b0f8-55cb-11ea-2926-15256bba5781/pkg_envs/env_baqychzsut/Manifest.toml`
[0m[1mInstantiating...[22m
[90m===[39m
[0m[1mPrecompiling...[22m
[90m===[39m
Waiting for notebook process to start... Done. Starting precompilation...¬LaTeXStringsÚp
[0m[1mWaiting for other notebooks to finish Pkg operations...[22m
[90m===[39m
[0m[1mResolving...[22m
[90m===[39m
[36m[1m Project[22m[39m No packages added to or removed from `~/.julia/scratchspaces/c3e4b0f8-55cb-11ea-2926-15256bba5781/pkg_envs/env_baqychzsut/Project.toml`
[36m[1m Manifest[22m[39m No packages added to or removed from `~/.julia/scratchspaces/c3e4b0f8-55cb-11ea-2926-15256bba5781/pkg_envs/env_baqychzsut/Manifest.toml`
[0m[1mInstantiating...[22m
[90m===[39m
[0m[1mPrecompiling...[22m
[90m===[39m
Waiting for notebook process to start... Done. Starting precompilation...DistributionsÚp
[0m[1mWaiting for other notebooks to finish Pkg operations...[22m
[90m===[39m
[0m[1mResolving...[22m
[90m===[39m
[36m[1m Project[22m[39m No packages added to or removed from `~/.julia/scratchspaces/c3e4b0f8-55cb-11ea-2926-15256bba5781/pkg_envs/env_baqychzsut/Project.toml`
[36m[1m Manifest[22m[39m No packages added to or removed from `~/.julia/scratchspaces/c3e4b0f8-55cb-11ea-2926-15256bba5781/pkg_envs/env_baqychzsut/Manifest.toml`
[0m[1mInstantiating...[22m
[90m===[39m
[0m[1mPrecompiling...[22m
[90m===[39m
Waiting for notebook process to start... Done. Starting precompilation...¥PlotsÚp
[0m[1mWaiting for other notebooks to finish Pkg operations...[22m
[90m===[39m
[0m[1mResolving...[22m
[90m===[39m
[36m[1m Project[22m[39m No packages added to or removed from `~/.julia/scratchspaces/c3e4b0f8-55cb-11ea-2926-15256bba5781/pkg_envs/env_baqychzsut/Project.toml`
[36m[1m Manifest[22m[39m No packages added to or removed from `~/.julia/scratchspaces/c3e4b0f8-55cb-11ea-2926-15256bba5781/pkg_envs/env_baqychzsut/Manifest.toml`
[0m[1mInstantiating...[22m
[90m===[39m
[0m[1mPrecompiling...[22m
[90m===[39m
Waiting for notebook process to start... Done. Starting precompilation...¦PrintfÚp
[0m[1mWaiting for other notebooks to finish Pkg operations...[22m
[90m===[39m
[0m[1mResolving...[22m
[90m===[39m
[36m[1m Project[22m[39m No packages added to or removed from `~/.julia/scratchspaces/c3e4b0f8-55cb-11ea-2926-15256bba5781/pkg_envs/env_baqychzsut/Project.toml`
[36m[1m Manifest[22m[39m No packages added to or removed from `~/.julia/scratchspaces/c3e4b0f8-55cb-11ea-2926-15256bba5781/pkg_envs/env_baqychzsut/Manifest.toml`
[0m[1mInstantiating...[22m
[90m===[39m
[0m[1mPrecompiling...[22m
[90m===[39m
Waiting for notebook process to start... Done. Starting precompilation...¶waiting_for_permission·restart_recommended_msgÀ´restart_required_msgÀ²installed_versionsˆ¯MarkdownLiteral¥0.1.5¸__internal_julia_version¦1.13.3²BmlipTeachingTools¥1.4.1¬LaTeXStrings¥1.4.1Distributions¨0.25.132¥Plots¦1.41.7¦Printf¦stdlibÙ!__internal_julia_manifest_version¦1.13.3¯install_time_nsÎAk+0¬instantiatedÃpluto_version¦v1.1.0