Skip to content

Commit edb2e68

Browse files
committed
old posts
1 parent 5177744 commit edb2e68

File tree

31 files changed

+3520
-28
lines changed

31 files changed

+3520
-28
lines changed

categories/index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,14 +82,14 @@ <h2 class="archive-title">2021</h2>
8282
<article class="archive-item">
8383
<a href="/categories/statistics/" class="archive-item-link">Statistics</a>
8484
<span class="archive-item-date">
85-
2021-11-22
85+
2021-11-27
8686
</span>
8787
</article>
8888

8989
<article class="archive-item">
9090
<a href="/categories/linear-algebra/" class="archive-item-link">Linear Algebra</a>
9191
<span class="archive-item-date">
92-
2021-11-21
92+
2021-11-22
9393
</span>
9494
</article>
9595

categories/index.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,14 @@
2525
<item>
2626
<title>Statistics</title>
2727
<link>/categories/statistics/</link>
28-
<pubDate>Mon, 22 Nov 2021 00:00:00 +0000</pubDate>
28+
<pubDate>Sat, 27 Nov 2021 15:19:26 -0600</pubDate>
2929
<guid>/categories/statistics/</guid>
3030
<description></description>
3131
</item>
3232
<item>
3333
<title>Linear Algebra</title>
3434
<link>/categories/linear-algebra/</link>
35-
<pubDate>Sun, 21 Nov 2021 00:00:00 +0000</pubDate>
35+
<pubDate>Mon, 22 Nov 2021 21:18:26 -0600</pubDate>
3636
<guid>/categories/linear-algebra/</guid>
3737
<description></description>
3838
</item>

categories/linear-algebra/index.html

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,13 @@
6262

6363
<h2 class="archive-title">2021</h2>
6464

65+
<article class="archive-item">
66+
<a href="/post/svd/" class="archive-item-link">Calculate SVD by hand (and decompose Spongebob)</a>
67+
<span class="archive-item-date">
68+
2021-11-22
69+
</span>
70+
</article>
71+
6572
<article class="archive-item">
6673
<a href="/post/pca1/" class="archive-item-link">Calculate PCA by hand (via eigen-decomposition)</a>
6774
<span class="archive-item-date">

categories/linear-algebra/index.xml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,15 @@
66
<description>Recent content in Linear Algebra on A Hugo website</description>
77
<generator>Hugo</generator>
88
<language>en-US</language>
9-
<lastBuildDate>Sun, 21 Nov 2021 00:00:00 +0000</lastBuildDate>
9+
<lastBuildDate>Mon, 22 Nov 2021 21:18:26 -0600</lastBuildDate>
1010
<atom:link href="/categories/linear-algebra/index.xml" rel="self" type="application/rss+xml" />
11+
<item>
12+
<title>Calculate SVD by hand (and decompose Spongebob)</title>
13+
<link>/post/svd/</link>
14+
<pubDate>Mon, 22 Nov 2021 21:18:26 -0600</pubDate>
15+
<guid>/post/svd/</guid>
16+
<description>&lt;p&gt;In my &lt;a href=&#34;/post/pca1/&#34;&gt;previous post&lt;/a&gt;, I have manually implemented PCA by finding the eigenvectors and eigenvalues of a covariance matrix. In this post, let&amp;rsquo;s try to perform PCA using a different approach called Singular Value Decomposition. Then we are going to decompose SPONGEBOB!&lt;/p&gt;&#xA;&lt;p&gt;Note: you might find this &lt;a href=&#34;/post/pca1/&#34;&gt;post&lt;/a&gt; to be useful, if you are new to PCA.&#xA; &lt;br&gt;&#xA; &lt;br&gt;&#xA; &lt;br&gt;&#xA; &lt;br&gt;&#xA; &lt;/p&gt;&#xA;&lt;h2 id=&#34;algorithm&#34;&gt;Algorithm&lt;/h2&gt;&#xA;&lt;p&gt;Again, we are going to use the same dataset we have used before.&lt;/p&gt;&#xA;&lt;p&gt;$$&#xA;\mathbf{ M} =&#xA;\begin{bmatrix}&#xA;1 &amp;amp; 0 \\&#xA;0 &amp;amp; 1 \\&#xA;-1 &amp;amp; -1&#xA;\end{bmatrix}&#xA;$$&lt;/p&gt;</description>
17+
</item>
1118
<item>
1219
<title>Calculate PCA by hand (via eigen-decomposition)</title>
1320
<link>/post/pca1/</link>

categories/statistics/index.html

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,69 @@
6262

6363
<h2 class="archive-title">2021</h2>
6464

65+
<article class="archive-item">
66+
<a href="/post/bayesian_network/" class="archive-item-link">An Intuitive Explanation of Bayesian Network</a>
67+
<span class="archive-item-date">
68+
2021-11-27
69+
</span>
70+
</article>
71+
72+
<article class="archive-item">
73+
<a href="/post/gene_exp2/" class="archive-item-link">Model the Gene Expression (2): Likelihood Ratio Test</a>
74+
<span class="archive-item-date">
75+
2021-11-23
76+
</span>
77+
</article>
78+
79+
<article class="archive-item">
80+
<a href="/post/gene_exp1/" class="archive-item-link">Model the Gene Expression (1): A GLM framework</a>
81+
<span class="archive-item-date">
82+
2021-11-23
83+
</span>
84+
</article>
85+
86+
<article class="archive-item">
87+
<a href="/post/bayesian5/" class="archive-item-link">Dive into Bayesian statistics (5): Intro to PyMC3</a>
88+
<span class="archive-item-date">
89+
2021-11-22
90+
</span>
91+
</article>
92+
93+
<article class="archive-item">
94+
<a href="/post/bayesian4/" class="archive-item-link">Dive into Bayesian statistics (4): Markov Chain Monte Carlo</a>
95+
<span class="archive-item-date">
96+
2021-11-22
97+
</span>
98+
</article>
99+
100+
<article class="archive-item">
101+
<a href="/post/bayesian3/" class="archive-item-link">Dive into Bayesian statistics (3): Markov Chain Monte Carlo</a>
102+
<span class="archive-item-date">
103+
2021-11-22
104+
</span>
105+
</article>
106+
107+
<article class="archive-item">
108+
<a href="/post/bayesian2/" class="archive-item-link">Dive into Bayesian statistics (2): Solve the nasty denominator!</a>
109+
<span class="archive-item-date">
110+
2021-11-22
111+
</span>
112+
</article>
113+
114+
<article class="archive-item">
115+
<a href="/post/bayesian1/" class="archive-item-link">Dive into Bayesian statistics (1): Maximum A Posteriori</a>
116+
<span class="archive-item-date">
117+
2021-11-22
118+
</span>
119+
</article>
120+
121+
<article class="archive-item">
122+
<a href="/post/monte_carlo/" class="archive-item-link">How to draw sample from a generic distribution?</a>
123+
<span class="archive-item-date">
124+
2021-11-22
125+
</span>
126+
</article>
127+
65128
<article class="archive-item">
66129
<a href="/post/mle/" class="archive-item-link">Maximum likelihood estimation</a>
67130
<span class="archive-item-date">

categories/statistics/index.xml

Lines changed: 64 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,71 @@
66
<description>Recent content in Statistics on A Hugo website</description>
77
<generator>Hugo</generator>
88
<language>en-US</language>
9-
<lastBuildDate>Mon, 22 Nov 2021 00:00:00 +0000</lastBuildDate>
9+
<lastBuildDate>Sat, 27 Nov 2021 15:19:26 -0600</lastBuildDate>
1010
<atom:link href="/categories/statistics/index.xml" rel="self" type="application/rss+xml" />
11+
<item>
12+
<title>An Intuitive Explanation of Bayesian Network</title>
13+
<link>/post/bayesian_network/</link>
14+
<pubDate>Sat, 27 Nov 2021 15:19:26 -0600</pubDate>
15+
<guid>/post/bayesian_network/</guid>
16+
<description>&lt;h2 id=&#34;introduction&#34;&gt;Introduction&lt;/h2&gt;&#xA;&lt;p&gt;Bayesian network, a probabilistic model that represents the causal relationship between variables, has gain its popularity in various fields. In biology, for example, people start to use this model to infer genetic regulatory network (GRN) due to its nice property of being directional. The aim of this blog post is to provide a gentle and less-mathematical introduction to Bayesian network.&lt;/p&gt;&#xA;&lt;p&gt; &lt;br&gt;&#xA; &lt;br&gt;&#xA; &lt;br&gt;&#xA; &lt;/p&gt;&#xA;&lt;h2 id=&#34;an-example&#34;&gt;An example&lt;/h2&gt;&#xA;&lt;p&gt;Suppose we are going to take a math exam next week. The outcome of the exam heavily depends on two factors: &lt;strong&gt;sleep&lt;/strong&gt; and &lt;strong&gt;study&lt;/strong&gt;. If we study and sleep well, chances are high that we will do a good job in the exam. Also, &lt;strong&gt;sleep&lt;/strong&gt; can affect our attention and therefore influence our &lt;strong&gt;study&lt;/strong&gt; quality. Since the world is probabilistic, we need to define the probability of each action (&lt;strong&gt;sleep&lt;/strong&gt;, &lt;strong&gt;study&lt;/strong&gt; and &lt;strong&gt;exam&lt;/strong&gt;):&lt;/p&gt;</description>
17+
</item>
18+
<item>
19+
<title>Model the Gene Expression (2): Likelihood Ratio Test</title>
20+
<link>/post/gene_exp2/</link>
21+
<pubDate>Tue, 23 Nov 2021 15:19:26 -0600</pubDate>
22+
<guid>/post/gene_exp2/</guid>
23+
<description>&lt;p&gt;In the &lt;a href=&#34;/post/gene_exp1/&#34;&gt;last post&lt;/a&gt;, we used a GLM framework to model the gene expression.&#xA;$$&#xA;y \sim NB(\mu, r) \\&#xA;log( \mu )= b_1 x + b_0&#xA;$$&lt;/p&gt;&#xA;&lt;p&gt;Using &lt;a href=&#34;/post/mle/&#34;&gt;maximum likelihood estimation&lt;/a&gt;, we were able to find a set of parameters &lt;code&gt;\(\hat b_0, \hat b_1, \hat r\)&lt;/code&gt;, that maximizes the likelihood function.&lt;/p&gt;&#xA;&lt;p&gt;But if you send this model (the estimated parameters) to biologists, they wouldn&amp;rsquo;t be happy. And we all know what is lacking: &lt;strong&gt;the p-value!&lt;/strong&gt;&lt;/p&gt;</description>
24+
</item>
25+
<item>
26+
<title>Model the Gene Expression (1): A GLM framework</title>
27+
<link>/post/gene_exp1/</link>
28+
<pubDate>Tue, 23 Nov 2021 15:18:26 -0600</pubDate>
29+
<guid>/post/gene_exp1/</guid>
30+
<description>&lt;p&gt;Before you start reading this post, please familiarize yourself with &lt;a href=&#34;/post/mle/&#34;&gt;MLE&lt;/a&gt; and linear model.&lt;/p&gt;&#xA;&lt;p&gt; &lt;br&gt;&#xA; &lt;/p&gt;&#xA;&lt;h2 id=&#34;background&#34;&gt;Background&lt;/h2&gt;&#xA;&lt;p&gt;In transcriptomic research, we often want to determine if genes are unregulated or down-regulated under a particular perturbation. For example, we have a medication that may cure type 2 diabetes. In our experiment, 6 patients are split into two groups, with 3 patients taking the medication, and 3 patients taking the placebo. The patients&amp;rsquo; blood samples are then collected to measure the transcriptomic profile (mRNA abundance level for each gene) using NGS technology (&lt;a href=&#34;https://en.wikipedia.org/wiki/RNA-Seq&#34;&gt;RNA seq&lt;/a&gt;). The mRNA abundance levels are quantified by the number of &lt;a href=&#34;https://en.wikipedia.org/wiki/Read_(biology)&#34;&gt;reads&lt;/a&gt; that were mapped to the reference genome. Finally, we use statistical tests to determine if the level of change is big enough to be considered as a DEG (differentially expressed gene).&lt;/p&gt;</description>
31+
</item>
32+
<item>
33+
<title>Dive into Bayesian statistics (5): Intro to PyMC3</title>
34+
<link>/post/bayesian5/</link>
35+
<pubDate>Mon, 22 Nov 2021 20:19:26 -0600</pubDate>
36+
<guid>/post/bayesian5/</guid>
37+
<description>&lt;p&gt;In &lt;a href=&#34;/post/bayesian3/&#34;&gt;our previous post&lt;/a&gt;, we manually implemented the Markov Chain Monte Carlo (MCMC) algorithm, specifically Metropolis-Hastings, to draw samples from the posterior distribution. The code isn’t particularly difficult to understand, but it’s also not very intuitive to read or write. Besides the challenges of implementation, algorithm performance (i.e., speed) is a major consideration in more realistic applications. Fortunately, well-optimized tools are available to address these obstacles, namely Stan and PyMC3.&lt;/p&gt;&#xA;&lt;p&gt;Subjectively speaking, Stan is not my cup of tea. I remember spending an entire afternoon trying to install RStan, only to fail. To make matters worse, Stan has its own specialized language, adding another layer of complexity. In contrast, PyMC3 is much easier to install. The documentation and tutorials are well-written, and anyone with a basic understanding of Bayesian statistics should be able to follow them without much trouble. In this post—and future posts—I will stick with PyMC3.&lt;/p&gt;</description>
38+
</item>
39+
<item>
40+
<title>Dive into Bayesian statistics (4): Markov Chain Monte Carlo</title>
41+
<link>/post/bayesian4/</link>
42+
<pubDate>Mon, 22 Nov 2021 20:18:26 -0600</pubDate>
43+
<guid>/post/bayesian4/</guid>
44+
<description>&lt;p&gt;In the last few posts, we tried three methods (&lt;a href=&#34;/post/bayesian2/&#34;&gt;Integration, Conjugate Prior&lt;/a&gt; and &lt;a href=&#34;/post/bayesian3/&#34;&gt;MCMC&lt;/a&gt; to infer the posterior distribution &lt;code&gt;\(P(\lambda | \text{data})\)&lt;/code&gt;, which gave us&lt;/p&gt;&#xA;&lt;p&gt;&lt;code&gt;$$\lambda \sim \text{Gamma}(\alpha = 20, \beta = 6)$$&lt;/code&gt;&lt;/p&gt;&#xA;&lt;p&gt;In this post, we are going to see 1) how to use Bayesian model to make prediction; 2) the internal relationship between a Poisson distribution, a Gamma distribution and a Negative binomial distribution.&lt;/p&gt;&#xA;&lt;p&gt; &lt;br&gt;&#xA; &#xA; &lt;/p&gt;&#xA;&lt;h2 id=&#34;question&#34;&gt;Question:&lt;/h2&gt;&#xA;&lt;p&gt;Here is the data we have worked so far:&lt;/p&gt;</description>
45+
</item>
46+
<item>
47+
<title>Dive into Bayesian statistics (3): Markov Chain Monte Carlo</title>
48+
<link>/post/bayesian3/</link>
49+
<pubDate>Mon, 22 Nov 2021 19:18:26 -0600</pubDate>
50+
<guid>/post/bayesian3/</guid>
51+
<description>&lt;p&gt;In this post, I will continue to use the same example that I used before (&lt;a href=&#34;/post/bayesian1/&#34;&gt;Bayesian: MAP&lt;/a&gt; and &lt;a href=&#34;/post/bayesian2/&#34;&gt;Bayesian: solve denominator&lt;/a&gt;. Also, it will be very helpful to first understand accept-reject sampling that I discussed in &lt;a href=&#34;/post/monte_carlo/&#34;&gt;this post&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt; &lt;br&gt;&#xA; &lt;br&gt;&#xA; &lt;/p&gt;&#xA;&lt;p&gt;Now let&amp;rsquo;s get started!&lt;/p&gt;&#xA;&lt;p&gt;As we discussed at the end of &lt;a href=&#34;/post/bayesian2/&#34;&gt;this post&lt;/a&gt;, solving the denominator is a non-trivial work, especially when you have many parameters to estimate. One way to overcome this obstacle is to use a method called Markov Chain Monte Carlo (MCMC).&lt;/p&gt;</description>
52+
</item>
53+
<item>
54+
<title>Dive into Bayesian statistics (2): Solve the nasty denominator!</title>
55+
<link>/post/bayesian2/</link>
56+
<pubDate>Mon, 22 Nov 2021 18:18:26 -0600</pubDate>
57+
<guid>/post/bayesian2/</guid>
58+
<description>&lt;p&gt;In the &lt;a href=&#34;/post/bayesian1/&#34;&gt;last post&lt;/a&gt;, we tried to use a Bayesian framework to model the number of visitors per hour. After concatenating a Poisson distribution with a Gamma prior, we get something like:&#xA;$$&#xA;P(\lambda | \text{data}) = c \cdot \lambda^{19} e^{-6\lambda}&#xA;$$&lt;/p&gt;&#xA;&lt;p&gt;Since we are interested to find &lt;code&gt;\(\lambda_0\)&lt;/code&gt; that gives the maximum value of &lt;code&gt;\(P(\lambda | \text{data})\)&lt;/code&gt; (a.k.a. &lt;strong&gt;Maximum A Posteriori&lt;/strong&gt;), we don&amp;rsquo;t need to worry too much about a constant &lt;code&gt;\(c\)&lt;/code&gt;. But in this post, we are going to solve &lt;code&gt;\(c\)&lt;/code&gt;, and consolidate our understanding of Bayesian inference.&lt;/p&gt;</description>
59+
</item>
60+
<item>
61+
<title>Dive into Bayesian statistics (1): Maximum A Posteriori</title>
62+
<link>/post/bayesian1/</link>
63+
<pubDate>Mon, 22 Nov 2021 17:18:26 -0600</pubDate>
64+
<guid>/post/bayesian1/</guid>
65+
<description>&lt;p&gt;Before you read this post, I assume you are already familiar with basic probability theories, maximum likelihood estimation and bayes theorem. I encourage you to read my previous post that discussed &lt;a href=&#34;/post/mle/&#34;&gt;MLE&lt;/a&gt;, and we are going to use the same dataset in this post.&lt;/p&gt;&#xA;&lt;p&gt;Okay, let&amp;rsquo;s get started.&lt;/p&gt;&#xA;&lt;p&gt; &lt;br&gt;&#xA; &#xA; &lt;br&gt;&#xA; &lt;/p&gt;&#xA;&lt;h2 id=&#34;1-bayes-theorem&#34;&gt;1. Bayes theorem&lt;/h2&gt;&#xA;&lt;p&gt;In inferential statistics, our goal is to &lt;strong&gt;infer the population parameters&lt;/strong&gt;. That is, we observe the data, and from the data we guess the most likely population parameters. There are, in general, two ways to approach this goal.&lt;/p&gt;</description>
66+
</item>
67+
<item>
68+
<title>How to draw sample from a generic distribution?</title>
69+
<link>/post/monte_carlo/</link>
70+
<pubDate>Mon, 22 Nov 2021 16:18:26 -0600</pubDate>
71+
<guid>/post/monte_carlo/</guid>
72+
<description>&lt;p&gt;In this post, I am going to show two methods to draw samples from a generic distribution.&lt;/p&gt;&#xA;&lt;p&gt;But before we get started, we should define what do I mean generic distribution. Here is one example:&lt;/p&gt;&#xA;&lt;p&gt;$$&#xA;f(x)= \begin{cases}&#xA;0 &amp;amp; \text{if &lt;code&gt;\(x\)&lt;/code&gt; &amp;lt; 0} \\&#xA;c \cdot \sqrt{x} &amp;amp; \text{if $0 &amp;lt; x &amp;lt; 1 $} \\&#xA;0 &amp;amp; \text{if &lt;code&gt;\(x &amp;gt; 1\)&lt;/code&gt;} \end{cases}&#xA;$$&lt;/p&gt;&#xA;&lt;p&gt;First, let&amp;rsquo;s take a look at the probability density function (pdf):&lt;br&gt;&#xA; &lt;/p&gt;</description>
73+
</item>
1174
<item>
1275
<title>Maximum likelihood estimation</title>
1376
<link>/post/mle/</link>

category/index.html

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,31 @@ <h1 class="article-title">Category</h1>
6565
<h3 id="linear-algebra">Linear algebra</h3>
6666
<ul>
6767
<li><a href="/post/pca1/">Calculate PCA by hand (via eigen-decomposition)</a></li>
68+
<li><a href="/post/svd/">Calculate SVD by hand (and decompose Spongebob)</a></li>
69+
</ul>
70+
<p> 
71+
 </p>
72+
<h3 id="bayesian-network">Bayesian Network</h3>
73+
<ul>
74+
<li><a href="/post/bayesian_network/">An Intuitive Explanation of Bayesian Network</a></li>
6875
</ul>
6976
<p> 
7077
 </p>
7178
<h3 id="inferential-statistics">Inferential Statistics</h3>
7279
<ul>
7380
<li><a href="/post/mle/">Maximum likelihood estimation</a></li>
81+
<li><a href="/post/gene_exp1/">Model the Gene Expression (1): A GLM framework</a></li>
82+
<li><a href="/post/gene_exp2/">Model the Gene Expression (2): Likelihood Ratio Test</a></li>
83+
</ul>
84+
<p> 
85+
 </p>
86+
<h3 id="bayesian-statistics">Bayesian Statistics</h3>
87+
<ul>
88+
<li><a href="/post/bayesian1/">Dive into Bayesian statistics (1): Maximum A Posteriori</a></li>
89+
<li><a href="/post/bayesian2/">Dive into Bayesian statistics (2): Solve the nasty denominator!</a></li>
90+
<li><a href="/post/bayesian3/">Dive into Bayesian statistics (3): Markov Chain Monte Carlo</a></li>
91+
<li><a href="/post/bayesian4/">Dive into Bayesian statistics (4): Posterior predictive distribution</a></li>
92+
<li><a href="/post/bayesian5/">Dive into Bayesian statistics (5): Intro to PyMC3</a></li>
7493
</ul>
7594
<p> 
7695
 </p>
@@ -88,6 +107,13 @@ <h3 id="genetics">Genetics</h3>
88107
<ul>
89108
<li><a href="/post/gwas/">Genome-wide association studies</a></li>
90109
<li><a href="/post/ldsc/">Linkage Disequilibrium Score Regression</a></li>
110+
</ul>
111+
<p> 
112+
 </p>
113+
<h3 id="rna-seq">RNA-seq</h3>
114+
<ul>
115+
<li><a href="/post/gene_exp1/">Model the Gene Expression (1): A GLM framework</a></li>
116+
<li><a href="/post/gene_exp2/">Model the Gene Expression (2): Likelihood Ratio Test</a></li>
91117
</ul>
92118

93119
</div>

images/.DS_Store

2 KB
Binary file not shown.

0 commit comments

Comments
 (0)