Bayesian Statistics
These notes come from the aforementioned handbook.
Basic basics
Definition: Bayesian Statistics is a statistical inference system (or philosphy depending on how you look at it) that uses prior knowledge to predict some posterior knowledge
- This new posterior knowledge can then be used to make predictions and serve as the next prior
Bayes Theorem: The foundation of Bayesian statistics which states that for events A and B
or in other words, the probability of A occuring given B has occured is the fraction as stated.
Applied to data, the formula is
where
Lastly,
Note: the potation switches from
Mathematics of Bayesian Updating
With these distributions in mind, updating the prior is basically just using Bayes' Theorem after defining the initial prior (with something like a Beta distribution). The actual update is still a PDF, but when using software like JASP, the yielded output is the expectation of posterior.
This isn't part of the book, but in general for bernoulli trials, you calculate the posterior as
with the numerator being the unnormalized posterior. It becomes normalized by dividing by the definite integral from 0 to 1.
Bayesian Hypothesis Testing
Neatly, you can use Bayes' Theorem for hypothesis testing. The framework is essentially
- null
- alternative
or more properly, - Get the Bayes Factor
by taking the ratio of marginal likelihoods where if the null is in the numerator, it tells us how many more times the null is likely than the alternative.
From this, we see that posterior odds = prior odds where
Bayesian Correlation
Recall the frequentest Pearson correlation coefficient
- Note: The prior is called the stretched beta distribution which is a beta distribution measured from
.
Also, we can apply the Bayesian hypothesis testing from the last section where
Communicating Bayesian Results
Basically we want to include 1. Model Definitions, 2. Model Comparison and Parameter Estimation, 3. Sensitivity Analysis. These are loosely described as
- Our hypothesis like in frequentist statistics, and the prior distribution under
. - Interpretation of the Bayes Factor and/or posterior model probability.
- Discussion of how the choice of prior affects the overall results.
Bayesian t-test
The Bayesian t-test revolves around effect size (also called Cohen's
where
The concept of "one-tailed" or "two-tailed" tests is expressed in the form of hypothesis surrounding
The prior distribution is a scaled Cauchy distribution with continuous scaling parameter
Bayesian Regression
Recall the frequentist for of linear regression where coefficients
where
Predictably, we can apply Bayes Theorem by using
E.g. Predicting Test Scores from Study Hours Suppose we want to predict test scores (
| Hours ( | Score ( |
|---|---|
| 1 | 50 |
| 2 | 55 |
| 3 | 65 |
| 4 | 70 |
| 5 | 80 |
Step 1: Define the prior
We set
Step 2: Compute the likelihood
Using the regression model
Step 3: Obtain the posterior
After applying Bayes' Theorem (often via MCMC sampling in software like JASP or R's brms), we get:
This tells us the posterior mean for the slope is approximately 7.5 points per hour studied, with a 95% credible interval of roughly
Step 4: Hypothesis testing
We can test
- Note: The credible interval not containing 0 aligns with the Bayes Factor favoring
, but these are conceptually different—the interval describes parameter uncertainty while the Bayes Factor compares model fit.