Skip to content

Commit 1cbe2d3

Browse files
authored
Merge pull request #22 from RuiDongDR/main
fix typos
2 parents d32ed07 + 98b1116 commit 1cbe2d3

7 files changed

Lines changed: 85 additions & 45 deletions

Bayesian_mixture_model.ipynb

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@
2222
"cell_type": "markdown",
2323
"id": "0fea5f8a",
2424
"metadata": {},
25-
"source": "![Fig](./graphical_summary/slides/Slide30.png)"
25+
"source": [
26+
"![Fig](./graphical_summary/slides/Slide30.png)"
27+
]
2628
},
2729
{
2830
"cell_type": "markdown",
@@ -158,8 +160,8 @@
158160
"In reality, genetic variants follow different biological mechanisms that we cannot condition on:\n",
159161
"\n",
160162
"- Most variants have null effects on both traits\n",
161-
"- Some affect only Height (growth pathways)\n",
162-
"- Others affect only Weight (metabolism) \n",
163+
"- Some affect only height (growth pathways)\n",
164+
"- Others affect only weight (metabolism) \n",
163165
"- A few affect both traits with varying correlations\n",
164166
"\n",
165167
"Since we cannot condition on which mechanism generated each variant, we observe only a heterogeneous scatter of effects with no clear pattern -- a mixture of all models!\n",
@@ -177,8 +179,8 @@
177179
"We generate data for multiple genetic variants from the same list of models as in [Lecture: Bayesian model comparison](https://statfungen.github.io/statgen-primer/Bayesian_model_comparison.html):\n",
178180
"\n",
179181
"- $\\text{M}_0$ (No effect): $\\boldsymbol{\\beta} = (0, 0)$\n",
180-
"- $\\text{M}_1$ (Height Only): $\\beta_2 = 0$\n",
181-
"- $\\text{M}_2$ (Weight Only): $\\beta_1 = 0$\n",
182+
"- $\\text{M}_1$ (Height Only): $\\beta_1 \\neq 0, \\beta_2 = 0$\n",
183+
"- $\\text{M}_2$ (Weight Only): $\\beta_1 = 0, \\beta_2 \\neq 0$\n",
182184
"- $\\text{M}_3$ (Perfect Correlation): $\\text{cor}(\\beta_1, \\beta_2) = 1$\n",
183185
"- $\\text{M}_4$ (Weak Correlation): $\\text{cor}(\\beta_1, \\beta_2) = 0.1$\n",
184186
"- $\\text{M}_5$ (Medium Correlation): $\\text{cor}(\\beta_1, \\beta_2) = 0.5$\n",
@@ -1368,4 +1370,4 @@
13681370
},
13691371
"nbformat": 4,
13701372
"nbformat_minor": 5
1371-
}
1373+
}

Bayesian_model_comparison.ipynb

Lines changed: 37 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@
2222
"cell_type": "markdown",
2323
"id": "6988ab81",
2424
"metadata": {},
25-
"source": "![Fig](./graphical_summary/slides/Slide29.png)"
25+
"source": [
26+
"![Fig](./graphical_summary/slides/Slide29.png)"
27+
]
2628
},
2729
{
2830
"cell_type": "markdown",
@@ -53,13 +55,42 @@
5355
"cell_type": "markdown",
5456
"id": "f5aa6a8c",
5557
"metadata": {},
56-
"source": "# Technical Details\n\n## Bayes Factor\n\nRecall in [Lecture: Bayes factor](https://statfungen.github.io/statgen-primer/Bayes_factor.html), we learn that the **Bayes factor** quantifies the relative evidence data provides for competing models:\n\n$$\n\\text{BF}_{12} = \\frac{L(\\text{M}_1|\\text{D})}{L(\\text{M}_2|\\text{D})} ={\\frac {\\int \\Pr(\\theta_{1}|M_{1})\\Pr(D|\\theta_{1},M_{1})\\,d\\theta _{1}}{\\int \\Pr(\\theta_{2}|M_{2})\\Pr(D|\\theta_{2},M_{2})\\,d\\theta _{2}}}\n$$\n\n**Interpretation**: \n- $\\text{BF}_{12} > 1$: Data favors $\\text{M}_1$ over $\\text{M}_2$\n- $\\text{BF}_{12} < 1$: Data favors $\\text{M}_2$ over $\\text{M}_1$\n- $\\text{BF}_{12} = 1$: Data uninformative for model choice\n"
58+
"source": [
59+
"# Technical Details\n",
60+
"\n",
61+
"## Bayes Factor\n",
62+
"\n",
63+
"Recall in [Lecture: Bayes factor](https://statfungen.github.io/statgen-primer/Bayes_factor.html), we learn that the **Bayes factor** quantifies the relative evidence data provides for competing models:\n",
64+
"\n",
65+
"$$\n",
66+
"\\text{BF}_{12} = \\frac{L(\\text{M}_1|\\text{D})}{L(\\text{M}_2|\\text{D})} ={\\frac {\\int \\Pr(\\theta_{1}|M_{1})\\Pr(D|\\theta_{1},M_{1})\\,d\\theta _{1}}{\\int \\Pr(\\theta_{2}|M_{2})\\Pr(D|\\theta_{2},M_{2})\\,d\\theta _{2}}}\n",
67+
"$$\n",
68+
"\n",
69+
"**Interpretation**: \n",
70+
"- $\\text{BF}_{12} > 1$: Data favors $\\text{M}_1$ over $\\text{M}_2$\n",
71+
"- $\\text{BF}_{12} < 1$: Data favors $\\text{M}_2$ over $\\text{M}_1$\n",
72+
"- $\\text{BF}_{12} = 1$: Data uninformative for model choice\n"
73+
]
5774
},
5875
{
5976
"cell_type": "markdown",
6077
"id": "649cf697",
6178
"metadata": {},
62-
"source": "## Posterior Odds\n\nThe Bayes factor updates prior beliefs about models:\n\n$$\n\\frac{P(\\text{M}_1|D)}{P(\\text{M}_2|D)} = \\text{BF}_{12} \\times \\frac{P(\\text{M}_1)}{P(\\text{M}_2)}\n$$\n\nThis shows how conditioning on data transforms our uncertainty:\n\n$$\n\\text{Posterior Uncertainty} = \\text{Evidence Update} \\times \\text{Prior Uncertainty}\n$$"
79+
"source": [
80+
"## Posterior Odds\n",
81+
"\n",
82+
"The Bayes factor updates prior beliefs about models:\n",
83+
"\n",
84+
"$$\n",
85+
"\\frac{P(\\text{M}_1|D)}{P(\\text{M}_2|D)} = \\text{BF}_{12} \\times \\frac{P(\\text{M}_1)}{P(\\text{M}_2)}\n",
86+
"$$\n",
87+
"\n",
88+
"This shows how conditioning on data transforms our uncertainty:\n",
89+
"\n",
90+
"$$\n",
91+
"\\text{Posterior Uncertainty} = \\text{Evidence Update} \\times \\text{Prior Uncertainty}\n",
92+
"$$"
93+
]
6394
},
6495
{
6596
"cell_type": "markdown",
@@ -564,8 +595,8 @@
564595
"In practice, this variant could affect height and weight $\\boldsymbol{\\beta} = (\\beta_1, \\beta_2)$ in multiple ways:\n",
565596
"\n",
566597
"- $\\text{M}_0$ (No effect): $\\boldsymbol{\\beta} = (0, 0)$\n",
567-
"- $\\text{M}_1$ (Height Only): $\\beta_2 = 0$\n",
568-
"- $\\text{M}_2$ (Weight Only): $\\beta_1 = 0$\n",
598+
"- $\\text{M}_1$ (Height Only): $\\beta_1 \\neq 0, \\beta_2 = 0$\n",
599+
"- $\\text{M}_2$ (Weight Only): $\\beta_1 = 0, \\beta_2 \\neq 0$\n",
569600
"- $\\text{M}_3$ (Perfect Correlation): $\\text{cor}(\\beta_1, \\beta_2) = 1$\n",
570601
"- $\\text{M}_4$ (Weak Correlation): $\\text{cor}(\\beta_1, \\beta_2) = 0.1$\n",
571602
"- $\\text{M}_5$ (Medium Correlation): $\\text{cor}(\\beta_1, \\beta_2) = 0.5$\n",
@@ -1290,4 +1321,4 @@
12901321
},
12911322
"nbformat": 4,
12921323
"nbformat_minor": 5
1293-
}
1324+
}

Bayesian_multivariate_normal_mean_model.ipynb

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@
2222
"cell_type": "markdown",
2323
"id": "5b89dfea",
2424
"metadata": {},
25-
"source": "![Fig](./graphical_summary/slides/Slide28.png)"
25+
"source": [
26+
"![Fig](./graphical_summary/slides/Slide28.png)"
27+
]
2628
},
2729
{
2830
"cell_type": "markdown",
@@ -230,7 +232,7 @@
230232
"### Posterior as Weighted Combination\n",
231233
"\n",
232234
"$$\n",
233-
"\\boldsymbol{\\beta}_1 = \\boldsymbol{W} \\cdot \\frac{\\mathbf{T}_2}{T_1} + (\\boldsymbol{I} - \\boldsymbol{W}) \\cdot \\boldsymbol{\\beta}_0\n",
235+
"\\boldsymbol{\\beta}_1 = \\boldsymbol{W} \\cdot \\frac{\\mathbf{T}_2}{\\mathbf{T}_1} + (\\boldsymbol{I} - \\boldsymbol{W}) \\cdot \\boldsymbol{\\beta}_0\n",
234236
"$$\n",
235237
"\n",
236238
"where $\\boldsymbol{W}$ balances prior beliefs and observed data based on their relative information content.\n"
@@ -910,4 +912,4 @@
910912
},
911913
"nbformat": 4,
912914
"nbformat_minor": 5
913-
}
915+
}

graphical_summary/slides.pptx

-16.5 KB
Binary file not shown.
-1.35 KB
Loading

hidden_Markov_model.ipynb

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@
2828
"cell_type": "markdown",
2929
"id": "3e69e867",
3030
"metadata": {},
31-
"source": "![Fig](./graphical_summary/slides/Slide33.png)"
31+
"source": [
32+
"![Fig](./graphical_summary/slides/Slide33.png)"
33+
]
3234
},
3335
{
3436
"cell_type": "markdown",
@@ -1059,7 +1061,7 @@
10591061
"id": "d65f0a79",
10601062
"metadata": {},
10611063
"source": [
1062-
"** Emission Probability** $P(h_m | Y_m = k)$\n",
1064+
"**Emission Probability** $P(h_m | Y_m = k)$\n",
10631065
"\n",
10641066
"Given ancestral haplotype $k$, the observed allele follows a Bernoulli distribution:\n",
10651067
"\n",
@@ -1568,4 +1570,4 @@
15681570
},
15691571
"nbformat": 4,
15701572
"nbformat_minor": 5
1571-
}
1573+
}

p_value_and_Bayesian_hypothesis_testing.ipynb

Lines changed: 30 additions & 27 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)