ℹ️ Skipped - page is already crawled
| Filter | Status | Condition | Details |
|---|---|---|---|
| HTTP status | PASS | download_http_code = 200 | HTTP 200 |
| Age cutoff | PASS | download_stamp > now() - 6 MONTH | 0.8 months ago |
| History drop | PASS | isNull(history_drop_reason) | No drop reason |
| Spam/ban | PASS | fh_dont_index != 1 AND ml_spam_score = 0 | ml_spam_score=0 |
| Canonical | PASS | meta_canonical IS NULL OR = '' OR = src_unparsed | Not set |
| Property | Value |
|---|---|
| URL | https://statswithr.github.io/book/ |
| Last Crawled | 2026-03-25 14:47:18 (23 days ago) |
| First Indexed | 2018-05-12 11:22:00 (7 years ago) |
| HTTP Status Code | 200 |
| Meta Title | An Introduction to Bayesian Thinking |
| Meta Description | An Introduction to Bayesian Thinking |
| Meta Canonical | null |
| Boilerpipe Text | Preface
This book was written as a companion for the Course
Bayesian Statistics
from the Statistics with
R
specialization available on Coursera. Our goal in developing the course was to provide an introduction to Bayesian inference in decision making without requiring calculus, with the book providing more details and background on Bayesian Inference. In writing this, we hope that it may be used on its own as an open-access introduction to Bayesian inference using
R
for anyone interested in learning about Bayesian statistics. Materials and examples from the course are discussed more extensively and extra examples and exercises are provided. While learners are not expected to have any background in calculus or linear algebra, for those who do have this background and are interested in diving deeper, we have included optional sub-sections in each Chapter to provide additional mathematical details and some derivations of key results.
This book is written using the
R
package
bookdown
; any interested learners are welcome to download the source code from
github
to see the code that was used to create all of the examples and figures within the book. Learners should have a current version of
R
(3.5.0 at the time of this version of the book) and will need to install
Rstudio
in order to use any of the
shiny
apps.
Those that are interested in running all of the code in the book or building the book locally, should download all of the following packages from
CRAN
:
# R packages used to create the book
library
(statsr)
library
(BAS)
library
(ggplot2)
library
(dplyr)
library
(BayesFactor)
library
(knitr)
library
(rjags)
library
(coda)
library
(latex2exp)
library
(foreign)
library
(BHH2)
library
(scales)
library
(logspline)
library
(cowplot)
library
(ggthemes)
We thank Amy Kenyon and Kun Li for all of their support in launching the course on Coursera and Kyle Burris for contributions to lab exercises and quizzes in earlier versions of the course. |
| Markdown | Type to search
- [Bayesian Statistics](https://statswithr.github.io/book/)
- [Preface](https://statswithr.github.io/book/index.html)
- [**1** The Basics of Bayesian Statistics](https://statswithr.github.io/book/the-basics-of-bayesian-statistics.html)
- [**1\.1** Bayes’ Rule](https://statswithr.github.io/book/the-basics-of-bayesian-statistics.html#bayes-rule)
- [**1\.1.1** Conditional Probabilities & Bayes’ Rule](https://statswithr.github.io/book/the-basics-of-bayesian-statistics.html#sec:bayes-rule)
- [**1\.1.2** Bayes’ Rule and Diagnostic Testing](https://statswithr.github.io/book/the-basics-of-bayesian-statistics.html#sec:diagnostic-testing)
- [**1\.1.3** Bayes Updating](https://statswithr.github.io/book/the-basics-of-bayesian-statistics.html#bayes-updating)
- [**1\.1.4** Bayesian vs. Frequentist Definitions of Probability](https://statswithr.github.io/book/the-basics-of-bayesian-statistics.html#bayesian-vs.-frequentist-definitions-of-probability)
- [**1\.2** Inference for a Proportion](https://statswithr.github.io/book/the-basics-of-bayesian-statistics.html#inference-for-a-proportion)
- [**1\.2.1** Inference for a Proportion: Frequentist Approach](https://statswithr.github.io/book/the-basics-of-bayesian-statistics.html#inference-for-a-proportion-frequentist-approach)
- [**1\.2.2** Inference for a Proportion: Bayesian Approach](https://statswithr.github.io/book/the-basics-of-bayesian-statistics.html#inference-for-a-proportion-bayesian-approach)
- [**1\.2.3** Effect of Sample Size on the Posterior](https://statswithr.github.io/book/the-basics-of-bayesian-statistics.html#effect-of-sample-size-on-the-posterior)
- [**1\.3** Frequentist vs. Bayesian Inference](https://statswithr.github.io/book/the-basics-of-bayesian-statistics.html#frequentist-vs.-bayesian-inference "1.3 Frequentist vs. Bayesian Inference")
- [**1\.3.1** Frequentist vs. Bayesian Inference](https://statswithr.github.io/book/the-basics-of-bayesian-statistics.html#frequentist-vs.-bayesian-inference-1)
- [**1\.4** Exercises](https://statswithr.github.io/book/the-basics-of-bayesian-statistics.html#exercises)
- [**2** Bayesian Inference](https://statswithr.github.io/book/bayesian-inference.html)
- [**2\.1** Continuous Variables and Eliciting Probability Distributions](https://statswithr.github.io/book/bayesian-inference.html#continuous-variables-and-eliciting-probability-distributions "2.1 Continuous Variables and Eliciting Probability Distributions")
- [**2\.1.1** From the Discrete to the Continuous](https://statswithr.github.io/book/bayesian-inference.html#from-the-discrete-to-the-continuous)
- [**2\.1.2** Elicitation](https://statswithr.github.io/book/bayesian-inference.html#elicitation)
- [**2\.1.3** Conjugacy](https://statswithr.github.io/book/bayesian-inference.html#conjugacy)
- [**2\.2** Three Conjugate Families](https://statswithr.github.io/book/bayesian-inference.html#three-conjugate-families)
- [**2\.2.1** Inference on a Binomial Proportion](https://statswithr.github.io/book/bayesian-inference.html#inference-on-a-binomial-proportion)
- [**2\.2.2** The Gamma-Poisson Conjugate Families](https://statswithr.github.io/book/bayesian-inference.html#the-gamma-poisson-conjugate-families)
- [**2\.2.3** The Normal-Normal Conjugate Families](https://statswithr.github.io/book/bayesian-inference.html#sec:normal-normal)
- [**2\.3** Credible Intervals and Predictive Inference](https://statswithr.github.io/book/bayesian-inference.html#credible-intervals-and-predictive-inference "2.3 Credible Intervals and Predictive Inference")
- [**2\.3.1** Non-Conjugate Priors](https://statswithr.github.io/book/bayesian-inference.html#non-conjugate-priors)
- [**2\.3.2** Credible Intervals](https://statswithr.github.io/book/bayesian-inference.html#credible-intervals)
- [**2\.3.3** Predictive Inference](https://statswithr.github.io/book/bayesian-inference.html#predictive-inference)
- [**3** Losses and Decision Making](https://statswithr.github.io/book/losses-and-decision-making.html)
- [**3\.1** Bayesian Decision Making](https://statswithr.github.io/book/losses-and-decision-making.html#bayesian-decision-making)
- [**3\.2** Loss Functions](https://statswithr.github.io/book/losses-and-decision-making.html#loss-functions)
- [**3\.3** Working with Loss Functions](https://statswithr.github.io/book/losses-and-decision-making.html#working-with-loss-functions)
- [**3\.4** Minimizing Expected Loss for Hypothesis Testing](https://statswithr.github.io/book/losses-and-decision-making.html#minimizing-expected-loss-for-hypothesis-testing "3.4 Minimizing Expected Loss for Hypothesis Testing")
- [**3\.5** Posterior Probabilities of Hypotheses and Bayes Factors](https://statswithr.github.io/book/losses-and-decision-making.html#sec:bayes-factors "3.5 Posterior Probabilities of Hypotheses and Bayes Factors")
- [**4** Inference and Decision-Making with Multiple Parameters](https://statswithr.github.io/book/inference-and-decision-making-with-multiple-parameters.html "4 Inference and Decision-Making with Multiple Parameters")
- [**4\.1** The Normal-Gamma Conjugate Family](https://statswithr.github.io/book/inference-and-decision-making-with-multiple-parameters.html#sec:normal-gamma "4.1 The Normal-Gamma Conjugate Family")
- [**4\.1.1** Conjugate Prior for μ μ and σ2 σ 2](https://statswithr.github.io/book/inference-and-decision-making-with-multiple-parameters.html#conjugate-prior-for-mu-and-sigma2)
- [**4\.1.2** Conjugate Posterior Distribution](https://statswithr.github.io/book/inference-and-decision-making-with-multiple-parameters.html#conjugate-posterior-distribution)
- [**4\.1.3** Marginal Distribution for μ μ: Student t t](https://statswithr.github.io/book/inference-and-decision-making-with-multiple-parameters.html#marginal-distribution-for-mu-student-t)
- [**4\.1.4** Credible Intervals for μ μ](https://statswithr.github.io/book/inference-and-decision-making-with-multiple-parameters.html#credible-intervals-for-mu)
- [**4\.1.5** Example: TTHM in Tapwater](https://statswithr.github.io/book/inference-and-decision-making-with-multiple-parameters.html#sec:tapwater)
- [**4\.1.6** Section Summary](https://statswithr.github.io/book/inference-and-decision-making-with-multiple-parameters.html#section-summary)
- [**4\.1.7** (Optional) Derivations](https://statswithr.github.io/book/inference-and-decision-making-with-multiple-parameters.html#optional-derivations)
- [**4\.2** Monte Carlo Inference](https://statswithr.github.io/book/inference-and-decision-making-with-multiple-parameters.html#sec:NG-MC)
- [**4\.2.1** Monte Carlo Sampling](https://statswithr.github.io/book/inference-and-decision-making-with-multiple-parameters.html#monte-carlo-sampling)
- [**4\.2.2** Monte Carlo Inference: Tap Water Example](https://statswithr.github.io/book/inference-and-decision-making-with-multiple-parameters.html#monte-carlo-inference-tap-water-example)
- [**4\.2.3** Monte Carlo Inference for Functions of Parameters](https://statswithr.github.io/book/inference-and-decision-making-with-multiple-parameters.html#monte-carlo-inference-for-functions-of-parameters)
- [**4\.2.4** Summary](https://statswithr.github.io/book/inference-and-decision-making-with-multiple-parameters.html#summary)
- [**4\.3** Predictive Distributions](https://statswithr.github.io/book/inference-and-decision-making-with-multiple-parameters.html#sec:NG-predictive)
- [**4\.3.1** Prior Predictive Distribution](https://statswithr.github.io/book/inference-and-decision-making-with-multiple-parameters.html#prior-predictive-distribution)
- [**4\.3.2** Tap Water Example (continued)](https://statswithr.github.io/book/inference-and-decision-making-with-multiple-parameters.html#tap-water-example-continued)
- [**4\.3.3** Sampling from the Prior Predictive in `R`](https://statswithr.github.io/book/inference-and-decision-making-with-multiple-parameters.html#sampling-from-the-prior-predictive-in-r)
- [**4\.3.4** Posterior Predictive](https://statswithr.github.io/book/inference-and-decision-making-with-multiple-parameters.html#posterior-predictive)
- [**4\.3.5** Summary](https://statswithr.github.io/book/inference-and-decision-making-with-multiple-parameters.html#summary-1)
- [**4\.4** Reference Priors](https://statswithr.github.io/book/inference-and-decision-making-with-multiple-parameters.html#sec:NG-reference)
- [**4\.5** Mixtures of Conjugate Priors](https://statswithr.github.io/book/inference-and-decision-making-with-multiple-parameters.html#sec:NG-Cauchy)
- [**4\.6** Markov Chain Monte Carlo (MCMC)](https://statswithr.github.io/book/inference-and-decision-making-with-multiple-parameters.html#sec:NG-MCMC "4.6 Markov Chain Monte Carlo (MCMC)")
- [**5** Hypothesis Testing with Normal Populations](https://statswithr.github.io/book/hypothesis-testing-with-normal-populations.html "5 Hypothesis Testing with Normal Populations")
- [**5\.1** Bayes Factors for Testing a Normal Mean: variance known](https://statswithr.github.io/book/hypothesis-testing-with-normal-populations.html#sec:known-var "5.1 Bayes Factors for Testing a Normal Mean: variance known")
- [**5\.2** Comparing Two Paired Means using Bayes Factors](https://statswithr.github.io/book/hypothesis-testing-with-normal-populations.html#comparing-two-paired-means-using-bayes-factors "5.2 Comparing Two Paired Means using Bayes Factors")
- [**5\.3** Comparing Independent Means: Hypothesis Testing](https://statswithr.github.io/book/hypothesis-testing-with-normal-populations.html#sec:indep-means "5.3 Comparing Independent Means: Hypothesis Testing")
- [**5\.4** Inference after Testing](https://statswithr.github.io/book/hypothesis-testing-with-normal-populations.html#inference-after-testing)
- [**6** Introduction to Bayesian Regression](https://statswithr.github.io/book/introduction-to-bayesian-regression.html)
- [**6\.1** Bayesian Simple Linear Regression](https://statswithr.github.io/book/introduction-to-bayesian-regression.html#sec:simple-linear "6.1 Bayesian Simple Linear Regression")
- [**6\.1.1** Frequentist Ordinary Least Square (OLS) Simple Linear Regression](https://statswithr.github.io/book/introduction-to-bayesian-regression.html#frequentist-ordinary-least-square-ols-simple-linear-regression)
- [**6\.1.2** Bayesian Simple Linear Regression Using the Reference Prior](https://statswithr.github.io/book/introduction-to-bayesian-regression.html#bayesian-simple-linear-regression-using-the-reference-prior)
- [**6\.1.3** Informative Priors](https://statswithr.github.io/book/introduction-to-bayesian-regression.html#sec:informative-prior)
- [**6\.1.4** (Optional) Derivations of Marginal Posterior Distributions of α α, β β, σ2 σ 2](https://statswithr.github.io/book/introduction-to-bayesian-regression.html#sec:derivations)
- [**6\.1.5** Marginal Posterior Distribution of β β](https://statswithr.github.io/book/introduction-to-bayesian-regression.html#marginal-posterior-distribution-of-beta)
- [**6\.1.6** Marginal Posterior Distribution of α α](https://statswithr.github.io/book/introduction-to-bayesian-regression.html#marginal-posterior-distribution-of-alpha)
- [**6\.1.7** Marginal Posterior Distribution of σ2 σ 2](https://statswithr.github.io/book/introduction-to-bayesian-regression.html#marginal-posterior-distribution-of-sigma2)
- [**6\.1.8** Joint Normal-Gamma Posterior Distributions](https://statswithr.github.io/book/introduction-to-bayesian-regression.html#joint-normal-gamma-posterior-distributions)
- [**6\.2** Checking Outliers](https://statswithr.github.io/book/introduction-to-bayesian-regression.html#sec:Checking-outliers)
- [**6\.2.1** Posterior Distribution of ϵj ϵ j Conditioning On σ2 σ 2](https://statswithr.github.io/book/introduction-to-bayesian-regression.html#posterior-distribution-of-epsilon_j-conditioning-on-sigma2)
- [**6\.2.2** Implementation Using `BAS` Package](https://statswithr.github.io/book/introduction-to-bayesian-regression.html#implementation-using-bas-package)
- [**6\.3** Bayesian Multiple Linear Regression](https://statswithr.github.io/book/introduction-to-bayesian-regression.html#sec:Bayes-multiple-regression "6.3 Bayesian Multiple Linear Regression")
- [**6\.3.1** The Model](https://statswithr.github.io/book/introduction-to-bayesian-regression.html#the-model)
- [**6\.3.2** Data Pre-processing](https://statswithr.github.io/book/introduction-to-bayesian-regression.html#data-pre-processing)
- [**6\.3.3** Specify Bayesian Prior Distributions](https://statswithr.github.io/book/introduction-to-bayesian-regression.html#specify-bayesian-prior-distributions)
- [**6\.3.4** Fitting the Bayesian Model](https://statswithr.github.io/book/introduction-to-bayesian-regression.html#fitting-the-bayesian-model)
- [**6\.3.5** Posterior Means and Posterior Standard Deviations](https://statswithr.github.io/book/introduction-to-bayesian-regression.html#posterior-means-and-posterior-standard-deviations)
- [**6\.3.6** Credible Intervals Summary](https://statswithr.github.io/book/introduction-to-bayesian-regression.html#credible-intervals-summary)
- [**6\.4** Summary](https://statswithr.github.io/book/introduction-to-bayesian-regression.html#summary-2)
- [**7** Bayesian Model Choice](https://statswithr.github.io/book/bayesian-model-choice.html)
- [**7\.1** Bayesian Information Criterion (BIC)](https://statswithr.github.io/book/bayesian-model-choice.html#sec:BIC "7.1 Bayesian Information Criterion (BIC)")
- [**7\.1.1** Definition of BIC](https://statswithr.github.io/book/bayesian-model-choice.html#definition-of-bic)
- [**7\.1.2** Backward Elimination with BIC](https://statswithr.github.io/book/bayesian-model-choice.html#backward-elimination-with-bic)
- [**7\.1.3** Coefficient Estimates Under Reference Prior for Best BIC Model](https://statswithr.github.io/book/bayesian-model-choice.html#coefficient-estimates-under-reference-prior-for-best-bic-model)
- [**7\.1.4** Other Criteria](https://statswithr.github.io/book/bayesian-model-choice.html#other-criteria)
- [**7\.2** Bayesian Model Uncertainty](https://statswithr.github.io/book/bayesian-model-choice.html#sec:BMU)
- [**7\.2.1** Model Uncertainty](https://statswithr.github.io/book/bayesian-model-choice.html#model-uncertainty)
- [**7\.2.2** Calculating Posterior Probability in R](https://statswithr.github.io/book/bayesian-model-choice.html#calculating-posterior-probability-in-r)
- [**7\.3** Bayesian Model Averaging](https://statswithr.github.io/book/bayesian-model-choice.html#bayesian-model-averaging)
- [**7\.3.1** Visualizing Model Uncertainty](https://statswithr.github.io/book/bayesian-model-choice.html#visualizing-model-uncertainty)
- [**7\.3.2** Bayesian Model Averaging Using Posterior Probability](https://statswithr.github.io/book/bayesian-model-choice.html#bayesian-model-averaging-using-posterior-probability)
- [**7\.3.3** Coefficient Summary under BMA](https://statswithr.github.io/book/bayesian-model-choice.html#coefficient-summary-under-bma)
- [**7\.4** Summary](https://statswithr.github.io/book/bayesian-model-choice.html#summary-3)
- [**8** Stochastic Explorations Using MCMC](https://statswithr.github.io/book/stochastic-explorations-using-mcmc.html)
- [**8\.1** Stochastic Exploration](https://statswithr.github.io/book/stochastic-explorations-using-mcmc.html#stochastic-exploration)
- [**8\.1.1** Markov Chain Monte Carlo Exploration](https://statswithr.github.io/book/stochastic-explorations-using-mcmc.html#markov-chain-monte-carlo-exploration)
- [**8\.2** Other Priors for Bayesian Model Uncertainty](https://statswithr.github.io/book/stochastic-explorations-using-mcmc.html#other-priors-for-bayesian-model-uncertainty "8.2 Other Priors for Bayesian Model Uncertainty")
- [**8\.2.1** Zellner’s g g-Prior](https://statswithr.github.io/book/stochastic-explorations-using-mcmc.html#zellners-g-prior)
- [**8\.2.2** Bayes Factor of Zellner’s g g-Prior](https://statswithr.github.io/book/stochastic-explorations-using-mcmc.html#bayes-factor-of-zellners-g-prior)
- [**8\.2.3** Kid’s Cognitive Score Example](https://statswithr.github.io/book/stochastic-explorations-using-mcmc.html#kids-cognitive-score-example)
- [**8\.3** R Demo on `BAS` Package](https://statswithr.github.io/book/stochastic-explorations-using-mcmc.html#r-demo-on-bas-package)
- [**8\.3.1** The `UScrime` Data Set and Data Processing](https://statswithr.github.io/book/stochastic-explorations-using-mcmc.html#the-uscrime-data-set-and-data-processing)
- [**8\.3.2** Bayesian Models and Diagnostics](https://statswithr.github.io/book/stochastic-explorations-using-mcmc.html#bayesian-models-and-diagnostics)
- [**8\.3.3** Posterior Uncertainty in Coefficients](https://statswithr.github.io/book/stochastic-explorations-using-mcmc.html#posterior-uncertainty-in-coefficients)
- [**8\.3.4** Prediction](https://statswithr.github.io/book/stochastic-explorations-using-mcmc.html#prediction)
- [**8\.4** Decision Making Under Model Uncertainty](https://statswithr.github.io/book/stochastic-explorations-using-mcmc.html#decision-making-under-model-uncertainty "8.4 Decision Making Under Model Uncertainty")
- [**8\.4.1** Model Choice](https://statswithr.github.io/book/stochastic-explorations-using-mcmc.html#model-choice)
- [**8\.4.2** Prediction with New Data](https://statswithr.github.io/book/stochastic-explorations-using-mcmc.html#prediction-with-new-data)
- [**8\.5** Summary](https://statswithr.github.io/book/stochastic-explorations-using-mcmc.html#summary-4)
- [Published with bookdown](https://github.com/rstudio/bookdown)
Facebook
Twitter
LinkedIn
Weibo
Instapaper
A
A
Serif
Sans
White
Sepia
Night
# [An Introduction to Bayesian Thinking](https://statswithr.github.io/book/)
# An Introduction to Bayesian Thinking
## *A Companion to the Statistics with R Course*
*Merlise Clyde*
*Mine Çetinkaya-Rundel*
*Colin Rundel*
*David Banks*
*Christine Chai*
*Lizzy Huang*
*Last built on 2022-06-15*
# Preface
This book was written as a companion for the Course *Bayesian Statistics* from the Statistics with `R` specialization available on Coursera. Our goal in developing the course was to provide an introduction to Bayesian inference in decision making without requiring calculus, with the book providing more details and background on Bayesian Inference. In writing this, we hope that it may be used on its own as an open-access introduction to Bayesian inference using `R` for anyone interested in learning about Bayesian statistics. Materials and examples from the course are discussed more extensively and extra examples and exercises are provided. While learners are not expected to have any background in calculus or linear algebra, for those who do have this background and are interested in diving deeper, we have included optional sub-sections in each Chapter to provide additional mathematical details and some derivations of key results.
This book is written using the `R` package `bookdown`; any interested learners are welcome to download the source code from [github](http://github.com/StatsWithR/book) to see the code that was used to create all of the examples and figures within the book. Learners should have a current version of `R` (3.5.0 at the time of this version of the book) and will need to install `Rstudio` in order to use any of the `shiny` apps.
Those that are interested in running all of the code in the book or building the book locally, should download all of the following packages from `CRAN`:
```
# R packages used to create the book
library(statsr)
library(BAS)
library(ggplot2)
library(dplyr)
library(BayesFactor)
library(knitr)
library(rjags)
library(coda)
library(latex2exp)
library(foreign)
library(BHH2)
library(scales)
library(logspline)
library(cowplot)
library(ggthemes)
```
We thank Amy Kenyon and Kun Li for all of their support in launching the course on Coursera and Kyle Burris for contributions to lab exercises and quizzes in earlier versions of the course. |
| Readable Markdown | null |
| Shard | 143 (laksa) |
| Root Hash | 2566890010099092343 |
| Unparsed URL | io,github!statswithr,/book/ s443 |