Skip to content

Instantly share code, notes, and snippets.

@zinzinzibidi
Created March 17, 2024 14:42
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/2b290414adf1078b1fc4fd3c2d1a33ca to your computer and use it in GitHub Desktop.
Save zinzinzibidi/2b290414adf1078b1fc4fd3c2d1a33ca to your computer and use it in GitHub Desktop.
Python ile t-Dağılımı için Güven Aralığı
from scipy.stats import t
# Verilen değerler
n = 19 # örneklem büyüklüğü
x_bar = 64 # örneklem ortalaması
s = 12 # örneklem standart sapması
confidence_level = 0.95
# Serbestlik derecesi
df = n - 1
# Güven aralığının hesaplanması için t kritik değerini bulma
t_critical = t.ppf((1 + confidence_level) / 2, df)
# Hata payını hesaplama
margin_of_error = t_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