Kelola estimasi dan ketidakpastian dengan interval dotplot

6.7.21

Kelola estimasi dan ketidakpastian dengan interval dotplot

Diperbarui 2020-01-21 Baca 1 menit

Pada A/B test atau regresi, menampilkan interval kepercayaan bersama estimasi titik membuat hasil lebih meyakinkan. Interval dotplot adalah format yang bersih dan mudah dibaca.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import numpy as np
import matplotlib.pyplot as plt

segments = ["Gratis", "Light", "Standard", "Premium"]
effect = np.array([0.12, 0.18, 0.27, 0.35])
low = effect - np.array([0.05, 0.06, 0.07, 0.08])
high = effect + np.array([0.05, 0.06, 0.07, 0.09])

fig, ax = plt.subplots(figsize=(6.4, 3.6))
ax.hlines(range(len(segments)), low, high, color="#94a3b8", linewidth=3)
ax.scatter(effect, range(len(segments)), color="#0ea5e9", s=90, zorder=3)

ax.axvline(0, color="#475569", linestyle="--", linewidth=1)
ax.set_yticks(range(len(segments)), labels=segments)
ax.set_xlabel("Kenaikan vs kontrol")
ax.set_title("Estimasi efek dengan CI 90%")
ax.set_xlim(-0.05, 0.45)
ax.grid(axis="x", alpha=0.2)

for idx, (eff, lo, hi) in enumerate(zip(effect, low, high)):
    ax.text(hi + 0.01, idx, f"{eff*100:.1f}% (+{(hi - eff)*100:.1f}/-{(eff - lo)*100:.1f})", va="center")

fig.tight_layout()

plt.show()

Interval dotplot memudahkan membaca ketidakpastian.

Kiat membaca #

  • Panjang garis menunjukkan ketidakpastian; garis lebih pendek berarti estimasi lebih stabil.
  • Garis nol membantu menilai apakah efek melewati titik netral.
  • Ubah ukuran titik untuk menggambarkan bobot atau ukuran sampel.