σμimplied vol · KKmax(S−K,0)udβρᵢⱼfat tailsPnL · drawdownyield · TdSₜ = μSₜ dt + σSₜ dWₜC = S·N(d₁) − K·e⁻ʳᵀ·N(d₂)σₚ² = wᵀΣwd₁ = [ln(S/K) + (r + σ²⁄2)T] ⁄ σ√T∂V/∂t + ½σ²S²·∂²V/∂S² + rS·∂V/∂S − rV = 0Sharpe = (Rₚ − R_f) ⁄ σₚVaR₉₉ = μ − 2.33σρ = Cov(X,Y) ⁄ σₓσᵧE[Rₚ] = Σ wᵢ·E[Rᵢ]φ(x) = e^(−x²/2) ⁄ √2πE[Rᵢ] = R_f + βᵢ(E[Rₘ] − R_f)dXₜ = θ(μ − Xₜ)dt + σ dWₜσ²ₜ = ω + α·ε²ₜ₋₁ + β·σ²ₜ₋₁C − P = S − K·e⁻ʳᵀΔ = ∂V/∂S Γ = ∂²V/∂S²p = (e^(rΔt) − d) ⁄ (u − d)rₜ = ln(Pₜ ⁄ Pₜ₋₁)E[Xₜ₊₁ | ℱₜ] = Xₜf* = (bp − q) ⁄ bz = (x − μ) ⁄ σP(N=k) = λᵏe^(−λ) ⁄ k!Θ = −∂V/∂Tν = S·φ(d₁)·√Tmin wᵀΣw s.t. wᵀμ = μ*∫Σ∂∞λ
uantCraft AcademyRoadmapsSkills
Ctrl K
AO
+1.2k Learners
LoginJoin ↗
RoadmapsSkills
AO
+1.2k Learners
Login
  • English
  • Français
  • Español
  • العربية
  • Português
  • Deutsch
  • 日本語
  • 中文
σμimplied vol · KKmax(S−K,0)udβρᵢⱼfat tailsPnL · drawdownyield · TdSₜ = μSₜ dt + σSₜ dWₜC = S·N(d₁) − K·e⁻ʳᵀ·N(d₂)σₚ² = wᵀΣwd₁ = [ln(S/K) + (r + σ²⁄2)T] ⁄ σ√T∂V/∂t + ½σ²S²·∂²V/∂S² + rS·∂V/∂S − rV = 0Sharpe = (Rₚ − R_f) ⁄ σₚVaR₉₉ = μ − 2.33σρ = Cov(X,Y) ⁄ σₓσᵧE[Rₚ] = Σ wᵢ·E[Rᵢ]φ(x) = e^(−x²/2) ⁄ √2πE[Rᵢ] = R_f + βᵢ(E[Rₘ] − R_f)dXₜ = θ(μ − Xₜ)dt + σ dWₜσ²ₜ = ω + α·ε²ₜ₋₁ + β·σ²ₜ₋₁C − P = S − K·e⁻ʳᵀΔ = ∂V/∂S Γ = ∂²V/∂S²p = (e^(rΔt) − d) ⁄ (u − d)rₜ = ln(Pₜ ⁄ Pₜ₋₁)E[Xₜ₊₁ | ℱₜ] = Xₜf* = (bp − q) ⁄ bz = (x − μ) ⁄ σP(N=k) = λᵏe^(−λ) ⁄ k!Θ = −∂V/∂Tν = S·φ(d₁)·√Tmin wᵀΣw s.t. wᵀμ = μ*∫Σ∂∞λ
uantCraft AcademyRoadmapsSkills
Ctrl K
AO
+1.2k Learners
LoginJoin ↗
RoadmapsSkills
AO
+1.2k Learners
Login
  • English
  • Français
  • Español
  • العربية
  • Português
  • Deutsch
  • 日本語
  • 中文
Bayesian Inference skill›Module 1 · Beliefs and evidence›Topic 1.2·~50 minIntermediate

Conjugate models: beta-binomial and normal

Skill positionModule 1 of 3 · Topic 2 of 4
1.2 Conjugate models: beta-binomial and normal
—Lab score— / 100Total XP—Streak—

Updates that have a formula

Usually a posterior needs a computer. For a few pairs of prior and likelihood, though, the answer is a neat formula, because the posterior stays in the same family as the prior. Such a pair is called conjugate. The best known is for a win rate θ\thetaθ: a Beta prior with win-or-lose data. A Beta(a,b)\mathrm{Beta}(a,b)Beta(a,b) prior acts as if you had already seen aaa wins and bbb losses. Each new win adds 111 to aaa, each new loss adds 111 to bbb. The mean is a/(a+b)a/(a+b)a/(a+b).

Beta(a,b)→Beta(a+k, b+n−k),m=a/(a+b)\mathrm{Beta}(a,b)\to\mathrm{Beta}(a+k,\,b+n-k),\qquad m=a/(a+b)Beta(a,b)→Beta(a+k,b+n−k),m=a/(a+b)(1)

The second pair is for an unknown average, such as a mean return, when the noise is known. The prior is N(μ0,τ02)N(\mu_0,\tau_0^{2})N(μ0​,τ02​) and the data give a sample mean xˉ\bar xxˉ with standard error sss. Think of precision, 1/variance1/\mathrm{variance}1/variance, as how much you trust something. The posterior precision is the sum of the two precisions. The posterior mean is the precision-weighted average of the prior mean and the sample mean, so the more precise source gets more weight.

1τn2=1τ02+1s2,μn=μ0/τ02+xˉ/s21/τ02+1/s2\frac{1}{\tau_n^{2}}=\frac{1}{\tau_0^{2}}+\frac{1}{s^{2}},\qquad \mu_n=\frac{\mu_0/\tau_0^{2}+\bar x/s^{2}}{1/\tau_0^{2}+1/s^{2}}τn2​1​=τ02​1​+s21​,μn​=1/τ02​+1/s2μ0​/τ02​+xˉ/s2​(2)
A win rate and a mean returnStart with Beta(5,5)\mathrm{Beta}(5,5)Beta(5,5), mean 0.50.50.5, and see 141414 wins in 202020 days. The posterior is Beta(19,11)\mathrm{Beta}(19,11)Beta(19,11) with mean 19/30=0.63319/30=0.63319/30=0.633: the data alone say 0.700.700.70, and the prior pulls it back toward 0.50.50.5. Now a mean return with prior 6%±5%6\%\pm5\%6%±5% and data 12%±4%12\%\pm4\%12%±4%. The precisions are 1/0.052=4001/0.05^{2}=4001/0.052=400 and 1/0.042=6251/0.04^{2}=6251/0.042=625. The posterior precision is 102510251025, the mean is (400⋅6+625⋅12)/1025=9.66%(400\cdot6+625\cdot12)/1025=9.66\%(400⋅6+625⋅12)/1025=9.66% and the standard deviation is 1/1025=3.12%1/\sqrt{1025}=3.12\%1/1025​=3.12%. The result is nearer to the data because the data are more precise.
  • Conjugate: the posterior is in the same family as the prior, so the update is a formula.
  • Beta prior: counts of wins and losses already seen. Add the new counts to get the posterior.
  • Normal case: add the precisions and average the means with precision weights.

Lab · what's graded

  • The posterior win rate15 pts
  • The spread of the win rate15 pts
  • The posterior mean return15 pts
  • The posterior spread15 pts
  • A flat Beta prior10 pts
  • Match the vocabulary15 pts
  • Between the prior and the data15 pts
0/ 7 answered
Tasks
1Numeric answer15 ptsNot answered

The prior is Beta(5,5)\mathrm{Beta}(5,5)Beta(5,5) and the strategy wins 141414 of 202020 days. What is the mean a/(a+b)a/(a+b)a/(a+b) of the posterior Beta(19,11)\mathrm{Beta}(19,11)Beta(19,11)? Give four decimals.

m=m =m=accepted: ± 0.0005
2Numeric answer15 ptsNot answered

The standard deviation of Beta(a,b)\mathrm{Beta}(a,b)Beta(a,b) is ab(a+b)2(a+b+1)\sqrt{\dfrac{ab}{(a+b)^{2}(a+b+1)}}(a+b)2(a+b+1)ab​​. What is it for Beta(19,11)\mathrm{Beta}(19,11)Beta(19,11)? Give four decimals.

s=s =s=accepted: ± 0.0005
3Numeric answer15 ptsNot answered

The prior for a mean return is 6%±5%6\%\pm5\%6%±5% and the data say 12%±4%12\%\pm4\%12%±4%. The precisions are 400400400 and 625625625. What is the posterior mean, in percent, (400⋅6+625⋅12)/1025(400\cdot6+625\cdot12)/1025(400⋅6+625⋅12)/1025? Give two decimals.

m=m =m=accepted: ± 0.02
4Numeric answer15 ptsNot answered

The posterior precision is 102510251025. What is the posterior standard deviation 1/10251/\sqrt{1025}1/1025​, in percent? Give two decimals.

s=s =s=accepted: ± 0.02
5Choice10 ptsNot answered

What does the prior Beta(1,1)\mathrm{Beta}(1,1)Beta(1,1) say about the win rate?

6Match15 ptsNot answered

Match each term with its meaning.

Pick the partner of each item on the left.

Beta(a,b)\mathrm{Beta}(a,b)Beta(a,b)
Precision
Conjugate pair
Posterior mean (normal case)
7Explain in words15 ptsNot answered

In one or two sentences, explain why the posterior mean of a normal mean lies between the prior mean and the sample mean, and which one it is closer to.

Math modeKeyboard or LaTeX inputTask 1 of 7 · Ctrl ⏎ to check

Log in to run your code.

Every lecture is free to read. Create an account or log in to run code, run tests and submit this lab.

  • In-browser IDE with a bash terminal — nothing to install
  • Instant grading, XP and your place on the skill
Create an accountLog in
OR
Continue with GitHub