Python ile Genelleştirilmiş Doğrusal Modeller
Ita Cirovic Donev
Data Science Consultant





# Varyans-kovaryans matrisini çıkar
print(model_GLM.cov_params())
Intercept weight
Intercept 0.774762 -0.325087
weight -0.325087 0.141903
# weight için standart hatayı hesapla
std_error = np.sqrt(0.141903)
0.3767
Varyans-kovaryans matrisi

z-istatistiği $$ \color{#2485F2}{z=\hat\beta/SE} $$
$\color{#2485F2}{z}$ büyükse $\Rightarrow$ katsayı $\ne0$ $\Rightarrow$ değişken anlamlı
Örnek: nal kabuklu yengeç modeliy ~ weight
$z = 1.8151/0.377 = 4.819$
$$ [\color{#5A5AF3}{alt},\color{#D8498E}{üst}] $$
$$ [\color{#5A5AF3}{\hat\beta - 1.96 \times SE},\color{#D8498E}{\hat\beta+1.96 \times SE}] $$
Örnek: nal kabuklu yengeç modeli
coef std err
<hr />-------------------------------
Intercept -3.6947 0.880
weight 1.8151 0.377

print(model_GLM.conf_int())
0 1
Intercept -5.419897 -1.969555
weight 1.076826 2.553463
print(model_GLM.conf_int())
lower 1
Intercept -5.419897 -1.969555
weight 1.076826 2.553463
print(model_GLM.conf_int())
0 upper
Intercept -5.419897 -1.969555
weight 1.076826 2.553463
$\beta$ için güven aralıklarını çıkarın
Uç noktaları üstel alın
print(np.exp(model_GLM.conf_int()))
0 1
Intercept 0.004428 0.139519
weight 2.935348 12.851533
Python ile Genelleştirilmiş Doğrusal Modeller