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 ec4fd2d Xiao Nan 2016-04-13 add shiny example for conjugate normal

This illustrates how the prior, likelihood, and posterior behave for inference for a normal mean ($$\mu$$) from normal-distributed data, with a conjugate prior on $$\mu$$.

Specifically the prior on $$\mu$$ is N($$\mu_0$$, $$\tau_0^2$$) [dotted line] and the data is sampled from a normal distribution N($$\mu$$, $$\sigma^2$$), which gives the likelihood [black line]. Note that the likelihood is scaled so it fits nicely on the graph (remember, likelihoods only matter up to a constant, so you can scale them however is convenient).

Because the normal distribution is the conjugate prior for normal sampling, the posterior distribution is also a normal distribution, and is shown in red.

By Bayes theorem:

$\text{Pr}(\mu \, | \, \mathbf{y}, \sigma^2) \propto \text{Pr}(\mathbf{y} \, | \, \mu, \sigma^2) \text{Pr}(\mu)$

$\text{N}(\mu_1, \tau_1^2) = \text{N}(\mu, \sigma^2) \text{N}(\mu_0, \tau_0^2)$

where the posterior mean:

$\mu_1 = \frac{\frac{\mu_0}{\tau_0^2} + \frac{n \bar{y}}{\sigma^2}}{\frac{1}{\tau_0^2} + \frac{n}{\sigma^2}}$

and the posterior variance:

$\tau_1^2 = (\frac{1}{\tau_0^2} + \frac{n}{\sigma^2})^{-1}$

An interactive app that shows how the posterior distribution will change when the prior and the (scaled) data likelihood changes:

The source code of the app can be found here.

This site was created with R Markdown