Study Cases

Tugas Week 13 ~ Confidence Interval

Paskalis Farelnata Zamasi

NIM : 52250043

Student Major in Data Science at
Institut Teknologi Sains Bandung

R Programming
Data Science
Statistics
Dosen Pembimbing
Bakti Siregar, M.Sc., CDS.

Case Study 1

Confidence Interval for Mean, \(\sigma\) Known: An e-commerce platform wants to estimate the average number of daily transactions per user after launching a new feature. Based on large-scale historical data, the population standard deviation is known.

\[ \begin{eqnarray*} \sigma &=& 3.2 \quad \text{(population standard deviation)} \\ n &=& 100 \quad \text{(sample size)} \\ \bar{x} &=& 12.6 \quad \text{(sample mean)} \end{eqnarray*} \]

Tasks

  1. Identify the appropriate statistical test and justify your choice.
  2. Compute the Confidence Intervals for:
    • \(90\%\)
    • \(95\%\)
    • \(99\%\)
  3. Create a comparison visualization of the three confidence intervals.
  4. Interpret the results in a business analytics context.

Answer

1. Identify the appropriate statistical test and justify your choice.

Tes statistik yang tepat adalah interval kepercayaan untuk rata-rata populasi (confidence interval for population mean) dengan deviasi standar populasi (σ) diketahui, menggunakan distribusi normal (z-score).

Justifikasi:

  • Deviasi standar populasi (σ = 3.2) diketahui dari data historis skala besar, sehingga tidak perlu estimasi dari sampel (yang akan memerlukan t-distribution).
  • Ukuran sampel n = 100 besar (>30), memenuhi asumsi Central Limit Theorem (CLT) untuk mendekati distribusi normal meskipun distribusi populasi asli tidak diketahui secara pasti.
  • Tujuannya adalah estimasi rata-rata populasi (μ) berdasarkan rata-rata sampel (x̄ = 12.6), bukan pengujian hipotesis atau perbandingan kelompok.

2. Perhitungan Interval Kepercayaan

Deviasi standar populasi \(\sigma = 3.2\), ukuran sampel \(n = 100\), rata-rata sampel \(\bar{x} = 12.6\). Ini menggunakan distribusi normal (z-score) karena \(\sigma\) diketahui dan \(n > 30\) (memenuhi Central Limit Theorem).

Rumus Umum: \[ \bar{x} \pm z_{\alpha/2} \cdot \frac{\sigma}{\sqrt{n}} \] Di mana

  • \(\bar{x}\) = rata-rata sampel = 12.6
  • \(\sigma\) = deviasi standar populasi = 3.2
  • \(n\) = ukuran sampel = 100
  • \(z_{\alpha/2}\) = nilai kritis z untuk tingkat kepercayaan (1 - α)

Hitung Standar Error

SE mengukur variabilitas estimasi rata-rata sampel terhadap populasi.

Rumus: \(\frac{\sigma}{\sqrt{n}}\)

  • \(\sigma = 3.2\)
  • \(n = 100\), jadi \(\sqrt{n} = 10\)
  • SE = \(3.2 / 10 = 0.32\)

Ini adalah dasar untuk semua CI—semakin besar n, semakin kecil SE, artinya estimasi lebih presisi.

Tentukan Nilai Kritis z untuk Setiap Tingkat Kepercayaan

Nilai z diambil dari tabel distribusi normal standar. Ini mewakili jarak dari mean dalam satuan deviasi standar untuk menangkap proporsi distribusi yang diinginkan.

  • Untuk 90% (\(\alpha = 0.10\), \(\alpha/2 = 0.05\)): \(z_{0.05} = 1.645\) (area kumulatif 0.95)

  • Untuk 95% (\(\alpha = 0.05\), \(\alpha/2 = 0.025\)): \(z_{0.025} = 1.960\) (area kumulatif 0.975)

  • Untuk 99% (\(\alpha = 0.01\), \(\alpha/2 = 0.005\)): \(z_{0.005} = 2.576\) (area kumulatif 0.995)

Tabel Distribusi Z untuk Tingkat Kepercayaan pada Case Study 1
Confidence.Level Alpha Alpha.2 Cumulative.Probability Z.Score
90% 0.10 0.050 0.950 1.645
95% 0.05 0.025 0.975 1.960
99% 0.01 0.005 0.995 2.576

Hitung Margin of Error (MoE) untuk Setiap CI

MoE = \(z_{\alpha/2} \times SE\). Ini adalah “ketidakpastian” di sekitar \(\bar{x}\)

  • 90%: MoE = \(1.645 \times 0.32 = 0.5264\)

  • 95%: MoE = \(1.960 \times 0.32 = 0.6272\)

  • 99%: MoE = \(2.576 \times 0.32 = 0.82432\)

Semakin tinggi kepercayaan, semakin besar MoE (interval lebih lebar) — ini trade-off inheren.

Hitung Batas Bawah dan Atas untuk Setiap CI

Batas bawah = \(\bar{x} - MoE\)

Batas atas = \(\bar{x} + MoE\)

  • 90% CL
    • Bawah: \(12.6 - 0.5264 = 12.0736\)
    • Atas: \(12.6 + 0.5264 = 13.1264\)
    • Interval: (12.0736, 13.1264)
  • 95% CL
    • Bawah: \(12.6 - 0.6272 = 11.9728\)
    • Atas: \(12.6 + 0.6272 = 13.2272\)
    • Interval: (11.9728, 13.2272)
  • 99% CL
    • Bawah: \(12.6 - 0.82432 = 11.77568\)
    • Atas: \(12.6 + 0.82432 = 13.42432\)
    • Interval: (11.7757, 13.4243) (dibulatkan ke 4 desimal untuk konsistensi)

3. Visualisasi Perbandingan Interval Kepercayaan

4. Interpretasi Hasil Dalam Konteks Analisis Bisnis

Dalam konteks e-commerce, interval ini mengestimasi rata-rata transaksi harian per pengguna pasca-peluncuran fitur baru.

  • 90% CI (12.07, 13.13) : Dengan kepercayaan 90%, rata-rata populasi antara 12.07-13.13. Lebar sempit (1.05) menunjukkan estimasi presisi tinggi, cocok untuk keputusan cepat seperti alokasi server minimal—tapi risiko 10% salah estimasi bisa underestimated, terutama jika fitur memengaruhi variabilitas pengguna.

  • 95% CI (11.97, 13.23) : Standar industri; lebar 1.25. Ini menyiratkan potensi peningkatan transaksi ~12-13, tapi bandingkan dengan baseline historis (tidak diberi); jika baseline <12, fitur sukses—jika tidak, evaluasi ulang untuk menghindari kerugian investasi.

  • 99% CI (11.78, 13.42) : Paling konservatif, lebar 1.65. Gunakan untuk skenario risiko tinggi seperti prediksi revenue jangka panjang; interval lebih lebar mencerminkan ketidakpastian lebih tinggi, tapi mengurangi kemungkinan overconfidence dalam proyeksi.

Secara keseluruhan, semakin tinggi kepercayaan, semakin lebar interval—trade-off antara presisi dan keamanan. Di bisnis, pilih 95% untuk keseimbangan; interpretasi ini menyoroti potensi underestimation risiko jika n kecil atau data bias. Contoh relevan: Mirip estimasi churn rate di platform seperti Amazon, di mana CI membantu alokasi budget marketing.

Case Study 2

Confidence Interval for Mean, \(\sigma\) Unknown: A UX Research team analyzes task completion time (in minutes) for a new mobile application. The data are collected from 12 users:

\[ 8.4,\; 7.9,\; 9.1,\; 8.7,\; 8.2,\; 9.0,\; 7.8,\; 8.5,\; 8.9,\; 8.1,\; 8.6,\; 8.3 \]

Tasks:

  1. Identify the appropriate statistical test and explain why.
  2. Compute the Confidence Intervals for:
    • \(90\%\)
    • \(95\%\)
    • \(99\%\)
  3. Visualize the three intervals on a single plot.
  4. Explain how sample size and confidence level influence the interval width.

Answer

1. Identifikasi Statistical Test yang Tepat dan Penjelasan

Tes statistik yang tepat adalah confidence interval menggunakan t-distribution (t-interval untuk mean). Alasan: Populasi standard deviation (σ) tidak diketahui, sample size kecil (n=12 < 30), dan data diasumsikan berasal dari populasi normal (atau setidaknya tidak skewed ekstrem berdasarkan inspeksi awal). Jika menggunakan z-interval, estimasi akan salah karena mengasumsikan σ known, yang meningkatkan risiko underestimation interval width. Asumsi normality bisa divalidasi dengan QQ-plot atau Shapiro-Wilk test, tapi untuk n kecil, t-distribution lebih robust terhadap deviasi minor.

2. Perhitungan Confidence Interval

Rumus umum untuk confidence interval mean dengan σ unknown:

\[ \bar{x} \pm t_{\alpha/2, n-1} \cdot \frac{s}{\sqrt{n}} \] Di mana:

  • \(\bar{x}\) = sample mean
  • \(s\) = sample standard deviation (dengan ddof=1)
  • \(n\) = sample size = 12
  • \(t_{\alpha/2, n-1}\) = critical value dari t-distribution dengan degrees of freedom (df) = 11
  • \(\alpha\) = 1 - confidence level (misalnya, untuk 90%, \(\alpha=0.1\))

Hitung Sample Mean (\(\bar{x}\))

Rumus:

\[\bar{x} = \frac{\sum x_i}{n}\]

  • Jumlahkan data: 8.4 + 7.9 + 9.1 + 8.7 + 8.2 + 9.0 + 7.8 + 8.5 + 8.9 + 8.1 + 8.6 + 8.3 = 101.5
  • n = 12
  • \(\bar{x} = 101.5 / 12 = 8.458\) (dibulatkan ke 3 desimal; presisi penuh: 8.45833)

Hitung Sample Standar Deviation (s)

Rumus:

\[s = \sqrt{\frac{\sum (x_i - \bar{x})^2}{n-1}}\] (gunakan n-1 untuk unbiased estimator)

  • Hitung Deviasi Kuadrat:
    • (8.4 - 8.458)^2 ≈ (-0.058)^2 ≈ 0.0034
    • (7.9 - 8.458)^2 ≈ (-0.558)^2 ≈ 0.3114
    • (9.1 - 8.458)^2 ≈ (0.642)^2 ≈ 0.4122
    • (8.7 - 8.458)^2 ≈ (0.242)^2 ≈ 0.0586
    • (8.2 - 8.458)^2 ≈ (-0.258)^2 ≈ 0.0666
    • (9.0 - 8.458)^2 ≈ (0.542)^2 ≈ 0.2938
    • (7.8 - 8.458)^2 ≈ (-0.658)^2 ≈ 0.4330
    • (8.5 - 8.458)^2 ≈ (0.042)^2 ≈ 0.0018
    • (8.9 - 8.458)^2 ≈ (0.442)^2 ≈ 0.1954
    • (8.1 - 8.458)^2 ≈ (-0.358)^2 ≈ 0.1282
    • (8.6 - 8.458)^2 ≈ (0.142)^2 ≈ 0.0202
    • (8.3 - 8.458)^2 ≈ (-0.158)^2 ≈ 0.0250
  • Jumlah deviasi kuadrat: ≈ 1.9495
  • Variance: 1.9495 / 11 ≈ 0.1772
  • s = √0.1772 ≈ 0.421 (presisi penuh: 0.42115)

Hitung Standard Error (SE)

Rumus:

\[SE = \frac{s}{\sqrt{n}}\]

  • √n = √12 ≈ 3.464

  • SE = 0.421 / 3.464 ≈ 0.122 (presisi: 0.12157)

Tentukan Degrees of Freedom (df) dan t-Critical Value

df = n - 1 = 11

  • Untuk 90% (α=0.10, α/2=0.05): t = 1.796 (P(T > t) = 0.05)
  • Untuk 95% (α=0.05, α/2=0.025): t = 2.201
  • Untuk 99% (α=0.01, α/2=0.005): t = 3.106
T-Table Khusus untuk df=11 dan Confidence Levels Tertentu
Confidence.Level alpha alpha.2 t.value P.T…t.
90% 0.10 0.050 1.796 0.050
95% 0.05 0.025 2.201 0.025
99% 0.01 0.005 3.106 0.005

Hitung Margin of Error (ME) dan CI

Rumus umum:

\[\bar{x} \pm t \cdot SE\]

  • 90% CI
    • ME = 1.796 × 0.122 ≈ 0.219
    • Lower: 8.458 - 0.219 = 8.239
    • Upper: 8.458 + 0.219 = 8.677
    • CI: (8.239, 8.677) [Dengan presisi komputasi: (8.240, 8.677)]
  • 95% CI
    • ME = 2.201 × 0.122 ≈ 0.268
    • Lower: 8.458 - 0.268 = 8.190
    • Upper: 8.458 + 0.268 = 8.726
    • CI: (8.190, 8.726) [Presisi: (8.191, 8.726)]
  • 99% CI
    • ME = 3.106 × 0.122 ≈ 0.379
    • Lower: 8.458 - 0.379 = 8.079
    • Upper: 8.458 + 0.379 = 8.837
    • CI: (8.079, 8.837) [Presisi: (8.081, 8.836)]

3. Visualisasi Ketiga Interval pada Single Plot

4. Penjelasan Pengaruh Sample Size dan Confidence Level terhadap Interval Width

Width interval =

\[2 \cdot t_{\alpha/2, n-1} \cdot \frac{s}{\sqrt{n}}\]

  • Sample size (n) : Meningkatkan n menurunkan SE (\(\frac{s}{\sqrt{n}}\)) dan t-value (karena df naik, t mendekati z). Hasil: Width menyempit, estimasi lebih presisi. Contoh: Jika n=100, width 95% CI ≈ 0.17 (vs. 0.63 sekarang), tapi butuh lebih banyak data.

  • Confidence level : Level lebih tinggi (misalnya 99% vs. 90%) meningkatkan t-value (3.106 vs. 1.796), sehingga width lebih lebar. Ini trade-off: Lebih “yakin” tapi kurang spesifik. Di UX, 95% sering optimal; 99% overkill jika risiko rendah, bisa delay keputusan.

Case Study 3

Confidence Interval for a Proportion, A/B Testing: A data science team runs an A/B test on a new Call-To-Action (CTA) button design. The experiment yields:

\[ \begin{eqnarray*} n &=& 400 \quad \text{(total users)} \\ x &=& 156 \quad \text{(users who clicked the CTA)} \end{eqnarray*} \]

Tasks:

  1. Compute the sample proportion \(\hat{p}\).
  2. Compute Confidence Intervals for the proportion at:
    • \(90\%\)
    • \(95\%\)
    • \(99\%\)
  3. Visualize and compare the three intervals.
  4. Explain how confidence level affects decision-making in product experiments.

Answer

1. Compute the Sample Proportion (p̂)

Identifikasi Data Masukan

  • Total pengguna (n) = 400 (ukuran sample).

  • Pengguna yang mengklik CTA (x) = 156 (jumlah success dalam binomial setup).

Hitung Proportion

Rumus:

\[\hat{p} = \frac{x}{n}\]

Substitusi:

\[\hat{p} = \frac{156}{400} = 0.39\] (atau 39% untuk interpretasi, tapi gunakan desimal untuk presisi di CI selanjutnya).

Verifikasi Kondisi untuk CI Selanjutnya

Periksa normal approximation:

\[n \hat{p} \geq 5\]

\[ dan \]

\[n (1 - \hat{p}) \geq 5\]

Hitung:

\[400 \times 0.39 = 156 \geq 5\] \[400 \times 0.61 = 244 \geq 5\] ### 2. Compute Confidence Intervals

Gunakan normal approximation (z-interval)

Rumus umum:

\[\hat{p} \pm z_{\alpha/2} \sqrt{\frac{\hat{p}(1-\hat{p})}{n}}\]

Hitung Standar Error (SE)

Rumus:

\[\sqrt{\frac{\hat{p}(1-\hat{p})}{n}}\]

Substitusi:

\[1 - 0.39 = 0.61\]

\[0.39 \times 0.61 = 0.2379\]

\[0.2379 / 400 = 0.00059475\]

\[\sqrt{0.00059475} \approx 0.02438\]

Tentukan z-Critical Values

Dari tabel z

  • 90% (α=0.10, α/2=0.05): z = 1.645

  • 95% (α=0.05, α/2=0.025): z = 1.960

  • 99% (α=0.01, α/2=0.005): z = 2.576

Tabel Z Khusus untuk Confidence Levels Tertentu
Confidence.Level alpha alpha.2 z.value P.Z…z.
90% 0.10 0.050 1.645 0.050
95% 0.05 0.025 1.960 0.025
99% 0.01 0.005 2.576 0.005

Hitung Margin of Error (ME) untuk Setiap Level

Rumus:

\[z × SE\]

  • 90%: 1.645 × 0.02438 ≈ 0.0401

  • 95%: 1.960 × 0.02438 ≈ 0.0478

  • 99%: 2.576 × 0.02438 ≈ 0.0628

Hitung Bounds CI

Rumus:

\[\hat{p} \pm ME\]

(pastikan lower ≥0, upper ≤1)

  • 90%: 0.39 - 0.0401 = 0.3499, 0.39 + 0.0401 = 0.4301 → (0.350, 0.430)

  • 95%: 0.39 - 0.0478 = 0.3422, 0.39 + 0.0478 = 0.4378 → (0.342, 0.438)

  • 99%: 0.39 - 0.0628 = 0.3272, 0.39 + 0.0628 = 0.4528 → (0.327, 0.453)

3. Visualize and Compare the Three Intervals

4. Explain How Confidence Level Affects Decision-Making in Product Experiments

Confidence level dalam CI memengaruhi keputusan di eksperimen produk seperti A/B testing dengan trade-off antara certainty dan presisi—level lebih tinggi widen interval, kurangi risiko kesalahan tapi tingkatkan ambiguitas, sementara level rendah narrow interval, percepat keputusan tapi tingkatkan risiko implementasi suboptimal. Berikut strukturnya:

  • Mekanisme Pengaruh Utama : Confidence level (e.g., 90%, 95%, 99%) menentukan z-value (atau t-value jika n kecil), yang mengalikan SE untuk ME. Level naik → z naik → ME naik → CI lebar. Di A/B test CTA ini (p̂=0.39), CI 90% (0.350-0.430) sempit, sugestif untuk keputusan cepat; CI 99% (0.327-0.453) lebar, potensi overlap dengan baseline CTR (misalnya 35%), force retest atau delay rollout—ini cegah false positive (Type I error) tapi inflate cost eksperimen.
  • Dampak pada Keputusan :
    • Level Rendah (90%): Narrow CI → lebih spesifik, dorong keputusan agresif seperti rollout variant baru jika CI tak overlap baseline. Contoh: Jika CI 90% di atas baseline, approve CTA redesign untuk quick win, tapi risiko ~10% true p sebenarnya di luar CI, berujung churn user jika variant underperform.
    • Level Standar (95%): Balance optimal untuk kebanyakan product experiments—CI (0.342-0.438) beri certainty cukup tanpa overcautious. Jika overlap baseline, reject variant; jika tidak, rollout dengan confidence moderat. Ini minimalkan regret tapi abaikan bisa delay inovasi jika tim risk-averse.
    • Level Tinggi (99%): Wide CI → conservative, lindungi dari kesalahan mahal (e.g., deploy fitur buruk ke jutaan user). Contoh: CI 99% overlap baseline → tunda keputusan, jalankan test tambahan; ini tingkatkan akurasi tapi potensi kompetitor overtake karena delay (e.g., lost revenue 5-10% per minggu).
  • Konsekuensi Strategis di Product Experiments : Level tinggi kurangi Type I error tapi tingkatkan Type II (miss opportunity), ideal untuk high-stakes (e.g., health apps); level rendah sebaliknya, cocok untuk low-risk iteration (e.g., UI tweaks). Di kasus ini, tanpa baseline eksplisit, pilih 95% sebagai default—abaikan konteks bisnis (e.g., scale user) bisa salah pilih level, berujung keputusan subpar.

Case Study 4

Precision Comparison (Z-Test vs t-Test): Two data teams measure API latency (in milliseconds) under different conditions.

\[\begin{eqnarray*} \text{Team A:} \\ n &=& 36 \quad \text{(sample size)} \\ \bar{x} &=& 210 \quad \text{(sample mean)} \\ \sigma &=& 24 \quad \text{(known population standard deviation)} \\[6pt] \text{Team B:} \\ n &=& 36 \quad \text{(sample size)} \\ \bar{x} &=& 210 \quad \text{(sample mean)} \\ s &=& 24 \quad \text{(sample standard deviation)} \end{eqnarray*}\]

Tasks

  1. Identify the statistical test used by each team.
  2. Compute Confidence Intervals for 90%, 95%, and 99%.
  3. Create a visualization comparing all intervals.
  4. Explain why the interval widths differ, even with similar data.

Answer

1. Identify the statistical test used by each team.

  • Team A: Z-Test (atau Z-Interval untuk CI Mean)

Team A menggunakan Z-test karena diberikan population standard deviation (\(\sigma = 24\)), yang mengasumsikan variansi populasi diketahui. Ini cocok untuk sample besar (n=36 >30) di mana distribusi normal dapat diterapkan langsung.

  • Team B: T-Test (atau T-Interval untuk CI Mean)

Team B menggunakan t-test karena hanya diberikan sample standard deviation (s=24), yang menunjukkan variansi populasi tidak diketahui dan harus diestimasi dari sample. Degrees of freedom (df) = n-1 = 35, yang memperhitungkan ketidakpastian estimasi ini.

Dalam konteks API latency, Z-test (Team A) memberikan presisi lebih tinggi jika \(\sigma\) benar-benar diketahui dari data historis; t-test (Team B) lebih konservatif, menghindari underestimation risiko jika SD sample bervariasi.

2. Compute Confidence Intervals for 90%, 95%, and 99%.

  • Sample size \(n = 36\), mean \(\bar{x} = 210\)

  • Standard error (SE) :

  • Untuk Team A

\[SE = \frac{\sigma}{\sqrt{n}} = \frac{24}{\sqrt{36}} = \frac{24}{6} = 4\]

  • Untuk Team B

\[SE = \frac{s}{\sqrt{n}} = \frac{24}{\sqrt{36}} = 4\] (sama nilai, tapi interpretasi berbeda karena estimasi)

Team A (Z-Test)

Rumus: \[\bar{x} \pm z_{\alpha/2} \cdot \frac{\sigma}{\sqrt{n}}\] di mana \(z_{\alpha/2}\) dari distribusi normal standar

  • Untuk 90% CI (\(\alpha = 0.10\), \(\alpha/2 = 0.05\), \(z_{0.05} = 1.645\)) :

    • Hitung margin of error (ME): \(1.645 \times 4 = 6.58\)

    • Lower bound: \(210 - 6.58 = 203.42\)

    • Upper bound: \(210 + 6.58 = 216.58\)

      CI: (203.42, 216.58)

  • Untuk 95% CI (\(\alpha = 0.05\), \(\alpha/2 = 0.025\), \(z_{0.025} = 1.96\)) :

    • ME: \(1.96 \times 4 = 7.84\)

    • Lower: \(210 - 7.84 = 202.16\)

    • Upper: \(210 + 7.84 = 217.84\)

      CI: (202.16, 217.84)

  • Untuk 99% CI (\(\alpha = 0.01\), \(\alpha/2 = 0.005\), \(z_{0.005} = 2.576\)) :

    • ME: \(2.576 \times 4 = 10.304\)

    • Lower: \(210 - 10.304 = 199.696\)

    • Upper: \(210 + 10.304 = 220.304\)

      CI: (199.70, 220.30)

Tabel Distribusi Z untuk Confidence Intervals (Z-Test)
Confidence Level Alpha Alpha/2 Z-Value
90% 0.10 0.050 1.645
95% 0.05 0.025 1.960
99% 0.01 0.005 2.576

Team B (t-Test)

Rumus: \[\bar{x} \pm t_{\alpha/2, df} \cdot \frac{s}{\sqrt{n}}\] di mana \(t_{\alpha/2, df=35}\) dari distribusi t

  • Untuk 90% CI (\(t_{0.05,35} = 1.690\)) :
    • ME: \(1.690 \times 4 = 6.76\)

    • Lower: \(210 - 6.76 = 203.24\)

    • Upper: \(210 + 6.76 = 216.76\)

      CI: (203.24, 216.76)

  • Untuk 95% CI (\(t_{0.025,35} = 2.030\)) :
    • ME: \(2.030 \times 4 = 8.12\)

    • Lower: \(210 - 8.12 = 201.88\)

    • Upper: \(210 + 8.12 = 218.12\)

      CI: (201.88, 218.12)

  • Untuk 99% CI (\(t_{0.005,35} = 2.724\)) :
    • ME: \(2.724 \times 4 = 10.896\)

    • Lower: \(210 - 10.896 = 199.104\)

    • Upper: \(210 + 10.896 = 220.896\)

      CI: (199.10, 220.90)

Tabel Distribusi t untuk Confidence Intervals (t-Test, df=35)
Confidence Level Alpha Alpha/2 t-Value
90% 0.10 0.050 1.690
95% 0.05 0.025 2.030
99% 0.01 0.005 2.724

CI ini estimasi range true mean latency dengan confidence tertentu. Misalnya, untuk 95% Team A, kita 95% yakin mean populasi antara 202.16-217.84 ms. Team B lebih lebar, mencerminkan ketidakpastian ekstra.

3. Create a visualization comparing all intervals

4. Explain Why the Interval Widths Differ, Even with Similar Data

Meski n, \(\bar{x}\), dan nilai SD sama (24), width CI Team B lebih lebar (misalnya, 95%: 16.24 vs 15.68 untuk A) karena:

  1. Distribusi Berbeda: Z-test gunakan normal distribution (critical values: 1.645, 1.96, 2.576). t-test gunakan t-distribution dengan df=35, yang punya tails lebih tebal (critical values: 1.690, 2.030, 2.724) untuk akomodasi ketidakpastian estimasi s dari sample kecil-relatif.

  2. Ketidakpastian Estimasi: \(\sigma\) diketahui di A, jadi SE presisi. Di B, s estimasi, tambah variabilitas—t-value lebih besar untuk compensate, lebar interval naik ~3-5% di sini.

  3. Implikasi Praktis: Dalam API latency, ini berarti Team B risiko overestimation range (lebar lebih), potensi delay keputusan optimasi. Jika asumsikan \(\sigma\) salah, A bisa underestimate risiko downtime.

Case Study 5

One-Sided Confidence Interval: A Software as a Service (SaaS) company wants to ensure that at least 70% of weekly active users utilize a premium feature.

From the experiment:

\[ \begin{eqnarray*} n &=& 250 \quad \text{(total users)} \\ x &=& 185 \quad \text{(active premium users)} \end{eqnarray*} \]

Management is only interested in the lower bound of the estimate.

Tasks:

  1. Identify the type of Confidence Interval and the appropriate test.
  2. Compute the one-sided lower Confidence Interval at:
    • \(90\%\)
    • \(95\%\)
    • \(99\%\)
  3. Visualize the lower bounds for all confidence levels.
  4. Determine whether the 70% target is statistically satisfied.

Answer

1. Identify the type of Confidence Interval and the appropriate test.

Ini adalah one-sided lower confidence interval untuk proporsi populasi (population proportion), spesifik untuk estimasi batas bawah minimal dari proporsi users yang menggunakan premium feature. “One-sided” berarti kita hanya fokus pada lower bound (batas bawah), bukan interval simetris dua sisi, karena tujuannya verifikasi bahwa proporsi true setidaknya 70%—management hanya peduli apakah estimasi paling konservatif masih di atas target, bukan upper bound yang tak relevan.

  • Type of Confidence Interval: Binomial proportion confidence interval, varian one-sided lower bound. Data bersifat binomial (sukses/gagal: premium atau tidak), dengan sukses x=185 dari n=250 trials. Kita estimasi p (true proportion) dari \(\hat{p}\) = x/n = 185/250 = 0.74. Interval ini beri rentang di mana p kemungkinan berada dengan confidence tertentu, tapi hanya lower bound karena query “at least 70%” implikasikan tes satu arah (H0: p < 0.7 vs Ha: p >= 0.7, tapi ini CI, bukan hypothesis test langsung).

  • Appropriate Test: Z-test untuk large-sample normal approximation to binomial distribution. Alasannya: n=250 besar, np=185 >5, n(1-p)=65 >5, jadi distribusi sampling \(\hat{p}\) approx normal dengan mean p dan variance p(1-p)/n. Jika n kecil atau p ekstrem, gunakan exact binomial CI (via binom.test di R), tapi di sini approx valid dan efisien. Bukan t-test karena data bukan mean kontinu, tapi count biner—t-test untuk variabel numerik, bukan proporsi.

2. Compute the One-Sided Lower Confidence Interval at 90%, 95%, and 99%

Rumus Umum One-Sided Lower CI untuk Proporsi:

\[\text{Lower Bound} = \hat{p} - z_{\alpha} \sqrt{\frac{\hat{p}(1 - \hat{p})}{n}}\]

di mana:

  • \(\hat{p} = \frac{x}{n}\) (estimasi proporsi sample),
  • \(z_{\alpha} = qnorm(1 - \alpha)\) (critical value normal satu arah),
  • \(n\) = ukuran sample

Langkah Umum:

  1. Hitung \(\hat{p}\) :

\[\hat{p} = \frac{x}{n} = \frac{185}{250} = 0.74\]

  1. Hitung varians :

\[\hat{p}(1 - \hat{p}) = 0.74 \times 0.26 = 0.1924\]

  1. Hitung SE :

\[\sqrt{\frac{0.1924}{250}} = \sqrt{0.0007696} \approx 0.02774\]

Untuk 90% CI (\(\alpha = 0.10\)):

  • Tentukan \(z_{\alpha}\); \(z_{0.10}\)

\[z_{\alpha} = qnorm(1 - \alpha)\] \[z_{0.10} \approx 1.282\]

  • Hitung margin of error (ME): \(z_{\alpha} \times SE\)

\[ME = z_{\alpha} \times \sqrt{\frac{\hat{p}(1 - \hat{p})}{n}}\] ME:

\[1.645 \times 0.02774 \approx 0.04564\]

  • Hitung lower bound: \(\hat{p} - ME\)

\[\text{Lower Bound} = \hat{p} - ME\] Lower Bound:

\[0.74 - 0.03555 = 0.70445\]

Untuk 95% CI (\(\alpha = 0.05\)):

  • Tentukan \(z_{\alpha}\); \(z_{0.05}\)

\[z_{\alpha} = qnorm(1 - \alpha)\] \[z_{0.05} \approx 1.645\]

  • Hitung margin of error (ME): \(z_{\alpha} \times SE\)

\[ME = z_{\alpha} \times \sqrt{\frac{\hat{p}(1 - \hat{p})}{n}}\] ME:

\[1.645 \times 0.02774 \approx 0.04564\]

  • Hitung lower bound: \(\hat{p} - ME\)

\[\text{Lower Bound} = \hat{p} - ME\] Lower Bound:

\[0.74 - 0.04564 = 0.69436\]

Untuk 99% CI (\(\alpha = 0.01\)):

  • Tentukan \(z_{\alpha}\); \(z_{0.01}\)

\[z_{\alpha} = qnorm(1 - \alpha)\] \[z_{0.01} \approx 2.326\]

  • Hitung margin of error (ME): \(z_{\alpha} \times SE\)

\[ME = z_{\alpha} \times \sqrt{\frac{\hat{p}(1 - \hat{p})}{n}}\] ME:

\[2.326 \times 0.02774 \approx 0.06455\]

  • Hitung lower bound: \(\hat{p} - ME\)

\[\text{Lower Bound} = \hat{p} - ME\] Lower Bound:

\[0.74 - 0.06455 = 0.67545\]

Tabel Distribusi Z untuk One-Sided Lower Confidence Intervals
Confidence Level Alpha Z-Value
90% 0.10 1.282
95% 0.05 1.645
99% 0.01 2.326

3. Visualize the Lower Bounds for All Confidence Levels

4. Determine Whether the 70% Target is Statistically Satisfied

Tugas ini mengevaluasi apakah proporsi true premium users (\(p\)) setidaknya 70% (0.7) berdasarkan one-sided lower CI—yaitu, jika lower bound > 0.7, target satisfied statistically di level confidence tersebut, artinya kita punya bukti cukup (dengan confidence itu) bahwa \(p \geq 0.7\). Ini bukan hitam-putih; “satisfied” probabilistik, tergantung level confidence dan asumsi model (normal approx untuk binomial).

  • Dasar Evaluasi: Bandingkan lower bound dari tugas 2 dengan target 0.7. Lower bound adalah estimasi konservatif minimal \(p\); jika >0.7, kita (confidence level)% yakin \(p \geq 0.7\). Ini mirip hypothesis test satu sisi (\(H_0: p < 0.7\) vs \(H_a: p \geq 0.7\)), di mana CI gagal tolak \(H_0\) jika lower bound <0.7.

  • Untuk 90% CI (lower bound ≈0.70445 atau 70.445%): Lower bound >0.7, jadi target satisfied di 90%. Interpretasi: Kita 90% yakin \(p \geq 70.445\% >70\%\)—cukup untuk skenario low-risk, tapi lemah karena confidence rendah (10% risiko salah klaim). Di bisnis, ini bisa dukung “go-ahead” sementara, tapi underestimates ketidakpastian jika sample tak representatif (e.g., users aktif mingguan mungkin bias musiman).

  • Untuk 95% CI (lower bound ≈0.69436 atau 69.436%): Lower bound <0.7, jadi target tidak satisfied di 95%. Interpretasi: Kita hanya 95% yakin \(p \geq 69.436\% <70\%\)—ada 5% risiko \(p\) sebenarnya <70%, cukup tinggi untuk standar bisnis (e.g., investor butuh confidence lebih). Ini tunjukkan sample evidence tak kuat; potensi overestimation \(\hat{p}=74\%\) karena variance sampling.

  • Untuk 99% CI (lower bound ≈0.67545 atau 67.545%): Lower bound <<0.7, jadi target tidak satisfied di 99%. Interpretasi: Kita 99% yakin \(p \geq 67.545\% <70\%\)—risiko sangat rendah (1%) tapi bound terlalu longgar, highlight ketidakpastian ekstrim. Di worst-case, ini sinyal perlu redesign feature atau sample lebih besar untuk presisi.

Kesimpulan: Target satisfied hanya di 90% (lemah), gagal di 95% dan 99% (standar ketat).

Reference

[1] Roscoe, J.T. (1975). Fundamental Research Statistics for the Behavioral Sciences.

[2] Field, A. (2013). Discovering Statistics Using R.

[3] Agresti, A. (2013). Categorical Data Analysis.

[4] Montgomery, D.C. (2017). Introduction to Statistical Quality Control

[5] Agresti, A. (2007). An Introduction to Categorical Data Analysis