Last updated: 2019-03-31
Checks: 2 0
Knit directory: fiveMinuteStats/analysis/
This reproducible R Markdown analysis was created with workflowr (version 1.2.0). The Report 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: .Rhistory
Ignored: .Rproj.user/
Ignored: analysis/.Rhistory
Ignored: analysis/bernoulli_poisson_process_cache/
Untracked files:
Untracked: _workflowr.yml
Untracked: analysis/CI.Rmd
Untracked: analysis/gibbs_structure.Rmd
Untracked: analysis/libs/
Untracked: analysis/results.Rmd
Untracked: analysis/shiny/tester/
Untracked: docs/MH_intro_files/
Untracked: docs/citations.bib
Untracked: docs/figure/MH_intro.Rmd/
Untracked: docs/figure/hmm.Rmd/
Untracked: docs/hmm_files/
Untracked: docs/libs/
Untracked: docs/shiny/tester/
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 | 34bcc51 | John Blischak | 2017-03-06 | Build site. |
Rmd | 5fbc8b5 | John Blischak | 2017-03-06 | Update workflowr project with wflow_update (version 0.4.0). |
Rmd | 391ba3c | John Blischak | 2017-03-06 | Remove front and end matter of non-standard templates. |
html | fb0f6e3 | stephens999 | 2017-03-03 | Merge pull request #33 from mdavy86/f/review |
html | c3b365a | John Blischak | 2017-01-02 | Build site. |
Rmd | 67a8575 | John Blischak | 2017-01-02 | Use external chunk to set knitr chunk options. |
Rmd | 5ec12c7 | John Blischak | 2017-01-02 | Use session-info chunk. |
Rmd | a72861e | stephens999 | 2016-05-02 | add integral |
Be familiar with basic probability and Bayesian calculations.
The goal here is simply to point out that everything you want to compute in Bayesian calculations is an integral.
Consider inference for a parameter \(\theta\) from data \(D\).
The posterior distribution of \(\theta\) is given by Bayes Theorem
\[p(\theta | D) = p(\theta) p(D | \theta)/ p(D)\]
First note that the denominator \(p(D)\) is an integral: \[p(D) = \int p(D | \theta) p(\theta) d\theta\].
Now suppose we want to estimate \(\theta\) by its posterior mean. This is \[E(\theta | D) = \int \theta p(\theta |D ) d\theta.\]
And if we want to find a 90% posterior credible interval for \(\theta\) then we want to find \(A\) and \(B\) such that \(\Pr(\theta \in [A,B] | D) = 0.9\). Note that the LHS of this is \[\Pr(\theta \in [A,B]|D) = \int I(\theta \in [A,B]) p(\theta | D) d\theta,\] where \(I(E)\) denotes the indicator function for the event \(E\), which takes the value 1 if \(E\) is true and \(0\) otherwise.
Of course, if \(\theta\) is discrete then the integrals above all become sums.
For example \[E(\theta | D) = \sum_n \theta_n \Pr(\theta=\theta_n | D)\] where \(\theta_1,\theta_2,\dots\) are the possible values for \(\theta\).
Pretty much all the things you want to compute when doing Bayesian inference are integrals (or sums) of one kind or another…
If you are computing 1-dimensional integrals then numerical methods are often useful. For example, Simpsons Rule, Gaussian Quadrature. These can also work in 2-dimensions, and maybe even 3 or 4.
Other simple methods that can work for low dimensions: naive Monte Carlo, and Importance Sampling. Also Laplace approximation.
For higher dimensions we usually resort to Markov Chain Monte Carlo.
This site was created with R Markdown