Python ile Doğrusal Modellemenin Temelleri
Jason Vestuto
Data Scientist
Soru: Etkimiz bir ilişkiden mi kaynaklanıyor, yoksa rastgele şanstan mı?
Yanıt: Null Hipotezi kontrol et.



# Erken ve geç zamanlara göre grupla
group_short = sample_distances[times < 5]
group_long = sample_distances[times > 5]
# Dağılımları yeniden örnekle
resample_short = np.random.choice(group_short, size=500, replace=True)
resample_long = np.random.choice(group_long, size=500, replace=True)
# Test istatistiği
test_statistic = resample_long - resample_short
# Etki büyüklüğü: test istatistiği dağılımının ortalaması
effect_size = np.mean(test_statistic)


# Birleştir ve karıştır
shuffle_bucket = np.concatenate((group_short, group_long))
np.random.shuffle(shuffle_bucket)
# Ortadan böl
slice_index = len(shuffle_bucket)//2
shuffled_half1 = shuffle_bucket[0:slice_index]
shuffled_half2 = shuffle_bucket[slice_index+1:]
# Karıştırılmış popülasyonları yeniden örnekle
shuffled_sample1 = np.random.choice(shuffled_half1, size=500, replace=True)
shuffled_sample2 = np.random.choice(shuffled_half2, size=500, replace=True)
# Etki büyüklüğünü yeniden hesapla
shuffled_test_statistic = shuffled_sample2 - shuffled_sample1
effect_size = np.mean(shuffled_test_statistic)

Python ile Doğrusal Modellemenin Temelleri