Last updated: 2019-08-01

Checks: 2 0

Knit directory: susie-mixture/analysis/

This reproducible R Markdown analysis was created with workflowr (version 1.4.0). 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 version displayed above was the version of the Git repository at the time these results were generated.

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:    .RData
    Ignored:    .Rhistory
    Ignored:    .Rproj.user/
    Ignored:    analysis/.RData
    Ignored:    analysis/.Rhistory

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 R Markdown and HTML files. If you’ve configured a remote Git repository (see ?wflow_git_remote), click on the hyperlinks in the table below to view them.

File Version Author Date Message
html 034283b Zhengyang Fang 2019-07-22 Build site.
html 6d9cbaa Zhengyang Fang 2019-07-22 Build site.
html 2a474f9 Zhengyang Fang 2019-07-22 Build site.
html c72a707 Zhengyang Fang 2019-07-22 Build site.
html 8092e5a Zhengyang Fang 2019-07-19 Build site.
html 5d3e3ef Zhengyang Fang 2019-07-11 Build site.
html 3eee187 Zhengyang Fang 2019-07-03 Build site.
html f303e14 Zhengyang Fang 2019-07-01 Build site.
html def2b27 Zhengyang Fang 2019-06-28 Build site.
Rmd 54b89f6 Zhengyang Fang 2019-06-28 wflow_publish(c(dir()))
html 05f778b Zhengyang Fang 2019-06-28 Build site.
html 05968fa Zhengyang Fang 2019-06-27 Build site.
html 41cbfc7 Zhengyang Fang 2019-06-27 Update Further_analysis_of_mean_field_method.html
html 26e947f Zhengyang Fang 2019-06-27 Build site.
html 46d8a4a Zhengyang Fang 2019-06-27 Build site.
html 1245c35 Zhengyang Fang 2019-06-27 Build site.
Rmd b045eb2 Zhengyang Fang 2019-06-27 wflow_publish(“further_analysis_of_mean_field_method.Rmd”)

Here we analyze the performance of the mean field method. Specifically, we are interested in when the mean field method gives the exact solution, and when it yields a terrible estimate.

In mean field method, we approximate the posterior probability \(p(\beta|\textbf y,\textbf X)\) using family of functions \(q(\beta)\) s.t. \[ q(\beta)=\prod_{j=1}^pq(\beta_j). \]

In ridge regression, where we assume the prior

\[ \beta\sim N(0,\sigma^2\sigma_b^2I), \]

and the likelihood

\[ L(\beta;\textbf X,\textbf y)\propto N(\textbf y-\textbf X\beta;0,\sigma^2I), \]

where \(N(u;\mu,\Sigma)\) denotes the density at point \(U=u\) for random variable \(U\sim N(\mu,\Sigma)\).

Then we can solve the posterior probability \(p(\beta|\textbf y,\textbf X)\) analytically as follows

\[ \begin{aligned} p(\beta|y,X)\propto &N(\beta;0,\sigma^2\sigma_b^2I)\cdot N(\textbf y-\textbf X\beta;0,\sigma^2I)\\ \propto&\exp\left\{-\frac1{2\sigma^2\sigma^2_b}\|\beta\|^2_2\right\}\cdot \exp\left\{-\frac1{2\sigma^2}\|\textbf y-\textbf X\beta\|^2_2\right\}\\ \propto &\exp\left\{-\frac1{2\sigma^2}[\beta^T(\textbf X^T\textbf X+I/\sigma^2_b)\beta-2\textbf y^T\textbf X\beta]\right\}\\ \propto&\exp\left\{-\frac1{2\sigma^2}(\beta-\hat\beta_{ridge})^T\left(\textbf X^T\textbf X+I/\sigma_b^2\right)(\beta-\hat\beta_{ridge})\right\}, \end{aligned} \]

where \(\hat\beta_{ridge}=(\textbf X^T\textbf X+I/\sigma^2_\beta)^{-1}\textbf X^T \textbf y\).

Thus \[ \beta|\textbf y,\textbf X\sim N\left(\hat\beta_{ridge},\sigma^2\left(\textbf X^T\textbf X+I/\sigma_b^2\right)^{-1}\right). \]

If the mean field approximation is exact, i.e. this Gaussian distribution is in the mean field function family, then the covariance matrix \(\sigma^2\left(\textbf X^T\textbf X+I/\sigma_b^2\right)^{-1}\) should be diagonal. It is equivalent to \((\textbf X^T\textbf X)\) is diagonal, i.e. the columns of \(\textbf X\) are orthogonal.

In the opposite, we expect the performance of the mean field method to be really bad if the directions of columns of \(\textbf X\) are very close to each other. We demonstrate this with some simulation. See the last part of simulation result.