Skip to content

Instantly share code, notes, and snippets.

@zinzinzibidi
Created March 17, 2024 14:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zinzinzibidi/f22c40814838f6c3a5f6ecd598856b6e to your computer and use it in GitHub Desktop.
Save zinzinzibidi/f22c40814838f6c3a5f6ecd598856b6e to your computer and use it in GitHub Desktop.
Python ile z-Dağılımı için Güven Aralığı
from scipy.stats import norm
# Verilen değerler
n = 100 # örneklem büyüklüğü
x_bar = 36 # örneklem ortalaması
s = 8 # örneklem standart sapması
confidence_level = 0.95
# %95 güven düzeyi için Z skoru
z_critical = norm.ppf((1 + confidence_level) / 2)
# Hata payını hesaplama
margin_of_error = z_critical * (s / (n ** 0.5))
# Güven aralığının alt ve üst sınırlarını hesaplama
lower_bound = x_bar - margin_of_error
upper_bound = x_bar + margin_of_error
# Sonuçları yazdırma
print(f"%95 güven düzeyinde güven aralığı: ({lower_bound:.2f}, {upper_bound:.2f})")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment