Last updated: 2020-06-24
Checks: 2 0
Knit directory: Note/
This reproducible R Markdown analysis was created with workflowr (version 1.6.1). The Checks tab describes the reproducibility checks that were applied when the results were created. The Past versions tab lists the development history.
Great! Since the R Markdown file has been committed to the Git repository, you know the exact version of the code that produced these results.
Great! You are using Git for version control. Tracking code development and connecting the code version to the results is critical for reproducibility.
The results in this page were generated with repository version 65f1da5. See the Past versions tab to see a history of the changes made to the R Markdown and HTML files.
Note that you need to be careful to ensure that all relevant files for the analysis have been committed to Git prior to generating the results (you can use wflow_publish
or wflow_git_commit
). workflowr only checks the R Markdown file, but you know if there are other scripts or data files that it depends on. Below is the status of the Git repository when the results were generated:
Ignored files:
Ignored: .DS_Store
Ignored: .Rhistory
Ignored: .Rproj.user/
Ignored: analysis/.Rhistory
Untracked files:
Untracked: analysis/Li&Stephens.Rmd
Unstaged changes:
Modified: analysis/bibliography.bib
Note that any generated files, e.g. HTML, png, CSS, etc., are not included in this status report because it is ok for generated content to have uncommitted changes.
These are the previous versions of the repository in which changes were made to the R Markdown (analysis/NormalPosterior2.Rmd
) and HTML (docs/NormalPosterior2.html
) files. If you’ve configured a remote Git repository (see ?wflow_git_remote
), click on the hyperlinks in the table below to view the files as they were in that past version.
File | Version | Author | Date | Message |
---|---|---|---|---|
Rmd | 65f1da5 | zouyuxin | 2020-06-24 | wflow_publish(“analysis/NormalPosterior2.Rmd”) |
html | 446ed0c | zouyuxin | 2020-06-23 | Build site. |
Rmd | 0b2bd2d | zouyuxin | 2020-06-23 | wflow_publish(“analysis/NormalPosterior2.Rmd”) |
html | d7acebe | zouyuxin | 2020-06-23 | Build site. |
Rmd | d0654e1 | zouyuxin | 2020-06-23 | wflow_publish(“analysis/NormalPosterior2.Rmd”) |
html | 6e31eb3 | zouyuxin | 2020-06-23 | Build site. |
Rmd | 292f9d3 | zouyuxin | 2020-06-23 | wflow_publish(“analysis/NormalPosterior2.Rmd”) |
Rmd | 24c6c44 | zouyuxin | 2020-06-22 | rm unused files |
html | 24c6c44 | zouyuxin | 2020-06-22 | rm unused files |
html | 14100de | zouyuxin | 2020-06-22 | Build site. |
Rmd | b73b5a7 | zouyuxin | 2020-06-22 | wflow_publish(“analysis/NormalPosterior2.Rmd”) |
In previous file, we derive the posterior assuming \(\Sigma\) is full-rank. We try to relax this constrain in this file.
\[\begin{align} x &\sim N_R(b, \Sigma) \\ b &\sim N_R(0, \Omega) \end{align}\]Let \(VDV^\intercal\) be eigendecomposition of \(\Sigma\), \(V = [V_1 \quad V_2]\), \(V_1 \in \mathbb{R}^{R\times k}\), \(V_2 \in \mathbb{R}^{R\times R-k}\), where \(k\) is the rank of residual variance. \(D = diag(D_1, D_2 = 0)\), \(D_1\) is of size \(k\), \(D_2\) is of size \(R-k\). Note that \(V_1 D_1 V_1^\intercal = \Sigma\).
We have \[\begin{align} \tilde{x}_1 = V_1^\intercal x &\sim N(V_1^\intercal b, D_1), \\ \tilde{b}_1 = V_1^\intercal b &\sim N(0, V_1^\intercal \Omega V_1), \\ \tilde{x}_2 = V_2^\intercal x &\sim N(V_2^\intercal b, 0), \\ \tilde{b}_2 = V_2^\intercal b &\sim N(0, V_2^\intercal \Omega V_2). \end{align}\]Note that \(V_1^\intercal \Omega V_1\) may not be full-rank, so we use result from file.
The posterior for \(\tilde{b}_1 \in \mathbb{R}^{k}\) is \[\begin{align} \tilde{b}_1|\tilde{x}_1 &\sim N_{k}( \mu_1 , \Sigma_1), \\ \Sigma_1 &= V_1^\intercal \Omega V_1 (I + D_1^{-1} V_1^\intercal \Omega V_1 )^{-1} \\ &= V_1^\intercal \Omega (I + \Sigma^\dagger \Omega)^{-1} V_1 \quad (\dagger \text{ means pseudo inverse}), \\ \mu_1 &= \Sigma_1 D_1^{-1} \tilde{x}_1. \end{align}\] The posterior for \(\tilde{b}_2 \in \mathbb{R}^{R-k}\) is a point mass on \(\tilde{x}_2\). We can write it as \[\begin{align} \tilde{b}_2|\tilde{x}_2 \sim N(\tilde{x}_2, 0). \end{align}\]Therefore the posterior for \(V^\intercal b\) is \[ V^\intercal b | V^\intercal x \sim N\left( \left( \begin{matrix} \Sigma_1 D_1^{-1} V_1^\intercal x \\ V_2^\intercal x \end{matrix}\right), \left( \begin{matrix} \Sigma_1 & 0 \\ 0 & 0 \end{matrix} \right) \right). \]
The posterior for \(b\) is \[\begin{align} b | V^\intercal x &\sim N\left( V \left( \begin{matrix} \Sigma_1 D_1^{-1} V_1^\intercal x \\ V_2^\intercal x \end{matrix}\right), V \left( \begin{matrix} \Sigma_1 & 0 \\ 0 & 0 \end{matrix} \right) V^\intercal \right) \\ &\sim N\left( V_1 V_1^\intercal \Omega(I + \Sigma^\dagger \Omega)^{-1} \Sigma^\dagger x + V_2 V_2^\intercal x, V_1 V_1^\intercal \Omega (I + \Sigma^\dagger \Omega)^{-1} V_1 V_1^\intercal \right) \end{align}\]