Files

55 lines
3.7 KiB
XML
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<svg width="700" height="300" xmlns="http://www.w3.org/2000/svg">
<text x="350" y="22" fill="#333" font-size="14" font-weight="bold" text-anchor="middle">MLE vs MAP Estimation</text>
<!-- Left: MLE -->
<text x="175" y="50" fill="#3498db" font-size="12" font-weight="bold" text-anchor="middle">MLE: maximise likelihood</text>
<!-- Axes -->
<line x1="40" y1="220" x2="310" y2="220" stroke="#333" stroke-width="1.2"/>
<line x1="40" y1="220" x2="40" y2="55" stroke="#333" stroke-width="1.2"/>
<text x="175" y="245" fill="#666" font-size="10" text-anchor="middle">parameter θ</text>
<text x="20" y="140" fill="#666" font-size="10" text-anchor="middle" transform="rotate(-90,20,140)">value</text>
<!-- Likelihood curve -->
<path d="M 55,218 C 80,215 100,200 120,170 C 140,130 160,85 185,70 C 200,65 210,68 225,85 C 245,115 265,170 285,210 C 295,216 300,218 305,219" fill="none" stroke="#3498db" stroke-width="2.5"/>
<path d="M 55,218 C 80,215 100,200 120,170 C 140,130 160,85 185,70 C 200,65 210,68 225,85 C 245,115 265,170 285,210 C 295,216 300,218 305,219 L 305,220 L 55,220 Z" fill="#3498db" opacity="0.1"/>
<!-- MLE peak marker -->
<line x1="190" y1="68" x2="190" y2="220" stroke="#3498db" stroke-width="1.5" stroke-dasharray="4,3"/>
<circle cx="190" cy="68" r="5" fill="#3498db"/>
<text x="190" y="232" fill="#3498db" font-size="10" text-anchor="middle">θ_MLE</text>
<text x="120" y="120" fill="#3498db" font-size="10">L(θ|data)</text>
<!-- Divider -->
<line x1="350" y1="40" x2="350" y2="260" stroke="#ccc" stroke-width="1" stroke-dasharray="4,4"/>
<!-- Right: MAP -->
<text x="525" y="50" fill="#e74c3c" font-size="12" font-weight="bold" text-anchor="middle">MAP: likelihood × prior</text>
<!-- Axes -->
<line x1="380" y1="220" x2="660" y2="220" stroke="#333" stroke-width="1.2"/>
<line x1="380" y1="220" x2="380" y2="55" stroke="#333" stroke-width="1.2"/>
<text x="520" y="245" fill="#666" font-size="10" text-anchor="middle">parameter θ</text>
<!-- Likelihood (same shape, lighter) -->
<path d="M 395,218 C 420,215 440,200 460,170 C 480,130 500,85 525,70 C 540,65 550,68 565,85 C 585,115 605,170 625,210 C 635,216 640,218 645,219" fill="none" stroke="#3498db" stroke-width="1.5" opacity="0.4"/>
<text x="470" y="120" fill="#3498db" font-size="9" opacity="0.6">likelihood</text>
<!-- Prior (shifted left) -->
<path d="M 395,218 C 410,210 420,185 435,145 C 445,115 455,90 470,80 C 480,76 490,80 500,95 C 515,120 530,160 545,190 C 560,210 570,216 580,218" fill="none" stroke="#27ae60" stroke-width="1.5" stroke-dasharray="5,3"/>
<text x="440" y="95" fill="#27ae60" font-size="9">prior</text>
<!-- Posterior (product, shifted) -->
<path d="M 410,218 C 425,215 440,200 455,175 C 470,145 480,110 495,88 C 505,80 510,78 515,80 C 525,85 535,100 545,125 C 560,165 575,200 595,215 C 600,217 605,218 610,219" fill="none" stroke="#e74c3c" stroke-width="2.5"/>
<path d="M 410,218 C 425,215 440,200 455,175 C 470,145 480,110 495,88 C 505,80 510,78 515,80 C 525,85 535,100 545,125 C 560,165 575,200 595,215 C 600,217 605,218 610,219 L 610,220 L 410,220 Z" fill="#e74c3c" opacity="0.1"/>
<!-- MAP peak marker -->
<line x1="512" y1="78" x2="512" y2="220" stroke="#e74c3c" stroke-width="1.5" stroke-dasharray="4,3"/>
<circle cx="512" cy="78" r="5" fill="#e74c3c"/>
<text x="512" y="232" fill="#e74c3c" font-size="10" text-anchor="middle">θ_MAP</text>
<text x="555" y="105" fill="#e74c3c" font-size="9">posterior</text>
<!-- Bottom note -->
<text x="350" y="275" fill="#666" font-size="11" text-anchor="middle">The prior pulls the MAP estimate away from the MLE toward the prior's peak.</text>
<text x="350" y="292" fill="#666" font-size="11" text-anchor="middle">With more data, the likelihood dominates and MAP converges to MLE.</text>
</svg>