Calculator Inputs
Example data table
| # | x | y |
|---|---|---|
| 1 | 0 | 1.2 |
| 2 | 1 | 2.1 |
| 3 | 2 | 2.9 |
| 4 | 3 | 3.8 |
| 5 | 4 | 5.2 |
| 6 | 5 | 5.9 |
Formula used
We fit a straight line with Gaussian noise: y = a + b·x + e, where e ~ N(0, σ²).
The prior over parameters is Gaussian: [a, b]ᵀ ~ N(μ₀, Σ₀). Here Σ₀ is diagonal using your prior SD inputs.
With design matrix X = [1, x] and observations y, the posterior is:
- Σₙ = (Σ₀⁻¹ + (1/σ²) XᵀX)⁻¹
- μₙ = Σₙ (Σ₀⁻¹ μ₀ + (1/σ²) Xᵀy)
For prediction at x*, the predictive distribution is Normal with: mean = [1, x*] μₙ and variance = σ² + [1, x*] Σₙ [1, x*]ᵀ.
How to use this calculator
- Paste your data pairs (x and y) into the input box, one pair per line.
- Set prior means and SDs to reflect what you believe before data.
- Enter sigma as the expected noise level around the line.
- Choose alpha for your credible interval width (0.05 gives 95%).
- Add a prediction x value to get a credible prediction interval.
- Press Calculate and review results above the form.