From 5c071fcbb22171b47d36f8f114249d658f7aa7fd Mon Sep 17 00:00:00 2001 From: ergz Date: Mon, 5 Sep 2022 01:50:00 -0700 Subject: [PATCH] more work added --- R/ch2.html | 151 +++++++++++++++++++++++++++++++++++------------------ R/ch2.qmd | 37 +++++++++++-- 2 files changed, 134 insertions(+), 54 deletions(-) diff --git a/R/ch2.html b/R/ch2.html index 90e5bbd..c574ee7 100644 --- a/R/ch2.html +++ b/R/ch2.html @@ -243,12 +243,12 @@ Probability and Likelihood gt::cols_width(everything() ~ px(100))
-
+
@@ -733,11 +733,60 @@ Probability and Likelihood -

A couple things to note about our table (1) + (2) = .4 and (2) + (4) = .6. (1) + (2) + (3) + (4) = 1.

-
    -
  1. \(P(A \cap B) = P(A|B)P(B)\) we know the likelihood of \(L(B|A) = P(A|B)\) and we also know the prior so we insert these to get \[ P(A \cap B) = P(A|B)P(B) = .267 \times .4 = .1068\]

  2. -
  3. \(P(A^c \cap B) = P(A^c|B)P(B)\) in this case we do know the prior \(P(B) = .4\), but we don’t directly know the value of \(P(A^c|B)\), however, we note that \(P(A|B) + P(A^c|B) = 1\), therefore we compute \(P(A^c|B) = 1 - P(A|B) = 1 - .267 = .733\) \[ P(A^c \cap B) = P(A^c|B)P(B) = .733 \times .4 = .2932\]

  4. -
+

A couple things to note about our table (1) + (3) = .4 and (2) + (4) = .6. (1) + (2) + (3) + (4) = 1.

+

(1.) \(P(A \cap B) = P(A|B)P(B)\) we know the likelihood of \(L(B|A) = P(A|B)\) and we also know the prior so we insert these to get \[ P(A \cap B) = P(A|B)P(B) = .267 \times .4 = .1068\]

+

(3.) \(P(A^c \cap B) = P(A^c|B)P(B)\) in this case we do know the prior \(P(B) = .4\), but we don’t directly know the value of \(P(A^c|B)\), however, we note that \(P(A|B) + P(A^c|B) = 1\), therefore we compute \(P(A^c|B) = 1 - P(A|B) = 1 - .267 = .733\) \[ P(A^c \cap B) = P(A^c|B)P(B) = .733 \times .4 = .2932\]

+

we now can confirm that \(.1068 + .2932 = .4\)

+

Moving on to (2), (4)

+

(2.) \(P(A \cap B^c) = P(A|B^c)P(B^c)\). In this case know the likelihood \(L(B^c|A) = P(A|B^c)\) and we know the prior \(P(B^c)\) therefore, \[P(A \cap B^c) = P(A|B^c)P(B^c) = .022 \times .6 = .0132\]

+

(4.) \(P(A^c \cap B^c) = P(A^c|B^c)P(B^c) = (1 - .022) \times .6 = .5868\)

+

and can confirm that \(.0132 + .5868 = .6\)

+

and we can fill the rest of the table:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
\(B\)\(B^c\)Total
\(A\).1068.0132.12
\(A^c\).2932.5868.88
Total.4.61
+

An important concept we implemented in above is the idea of total probability

+
+
+
+ +
+
+total probability +
+
+
+

The total probability of observing a real article is made up the sum of its parts. Namely

+

\[P(B^c) = P(A \cap B^c) + P(A^c \cap B^c)\] \[=P(A|B^c)P(B^c) + P(A^c|B^c)P(B^c)\] \[=.0132 + .5868 = .6\]

+
+
diff --git a/R/ch2.qmd b/R/ch2.qmd index 17fd6ac..ef93a80 100644 --- a/R/ch2.qmd +++ b/R/ch2.qmd @@ -140,13 +140,44 @@ probability table: A couple things to note about our table (1) + (3) = .4 and (2) + (4) = .6. (1) + (2) + (3) + (4) = 1. -(1) $P(A \cap B) = P(A|B)P(B)$ we know the likelihood of $L(B|A) = P(A|B)$ and we also +(1.) $P(A \cap B) = P(A|B)P(B)$ we know the likelihood of $L(B|A) = P(A|B)$ and we also know the prior so we insert these to get $$ P(A \cap B) = P(A|B)P(B) = .267 \times .4 = .1068$$ -(3) $P(A^c \cap B) = P(A^c|B)P(B)$ in this case we do know the prior $P(B) = .4$, but we +(3.) $P(A^c \cap B) = P(A^c|B)P(B)$ in this case we do know the prior $P(B) = .4$, but we don't directly know the value of $P(A^c|B)$, however, we note that $P(A|B) + P(A^c|B) = 1$, therefore we compute $P(A^c|B) = 1 - P(A|B) = 1 - .267 = .733$ $$ P(A^c \cap B) = P(A^c|B)P(B) = .733 \times .4 = .2932$$ -we now can confirm that $.1068 + .2932 = .4$ \ No newline at end of file +we now can confirm that $.1068 + .2932 = .4$ + +Moving on to (2), (4) + +(2.) $P(A \cap B^c) = P(A|B^c)P(B^c)$. In this case know the likelihood $L(B^c|A) = P(A|B^c)$ and +we know the prior $P(B^c)$ therefore, +$$P(A \cap B^c) = P(A|B^c)P(B^c) = .022 \times .6 = .0132$$ + +(4.) $P(A^c \cap B^c) = P(A^c|B^c)P(B^c) = (1 - .022) \times .6 = .5868$ + +and can confirm that $.0132 + .5868 = .6$ + +and we can fill the rest of the table: + +| | $B$ | $B^c$ | Total | +|------|---- |------ |-------| +|$A$ | .1068 | .0132 | .12 | +|$A^c$ | .2932 | .5868 | .88 | +|Total | .4 | .6 | 1 | + +An important concept we implemented in above is the idea of **total probability** + +:::{.callout-tip} +## total probability + +The **total probability** of observing a real article is made up the sum of its +parts. Namely + +$$P(B^c) = P(A \cap B^c) + P(A^c \cap B^c)$$ +$$=P(A|B^c)P(B^c) + P(A^c|B^c)P(B^c)$$ +$$=.0132 + .5868 = .6$$ +::: \ No newline at end of file