BaşlayınÜcretsiz Başlayın

Confidence interval by hand

There are two common ways that interviewers will touch on confidence intervals; they will either ask you to explain it in simple terms, or elaborate on how they are calculated, possibly having you implement one. In this exercise, you'll practice the latter by producing a confidence interval by hand, using no packages other than those imported for you.

We have gone ahead and assigned the appropriate z-score for a 95% confidence interval and sample mean to the z_score and sample_mean variables to simplify things a bit.

Bu egzersiz

Practicing Statistics Interview Questions in Python

kursunun bir parçasıdır
Kursu Görüntüle

Egzersiz talimatları

  • Compute the standard error and the margin of error using the sem() function and z_score variable imported for you.
  • Compute and print the lower boundary of our confidence interval using the sample_mean variable imported for you.
  • Compute and print the upper boundary of our confidence interval using the sample_mean variable imported for you.

Uygulamalı interaktif egzersiz

Bu örnek kodu tamamlayarak bu egzersizi bitirin.

from scipy.stats import sem, t
data = [1, 2, 3, 4, 5]
confidence = 0.95

# Compute the standard error and margin of error
std_err = sem(____)
margin_error = std_err * ____

# Compute and print the lower threshold
lower = sample_mean - ____
print(____)

# Compute and print the upper threshold
upper = sample_mean + ____
print(____)
Kodu Düzenle ve Çalıştır