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

Fit logistic regression

In this exercise, you will continue with the data from the study on the contamination of ground water with arsenic in Bangladesh where you want to model the probability of switching the current well given the level of arsenic present in the well.

Recall the dataset structure:

Dataset wells is preloaded in the workspace.

Bu egzersiz

Generalized Linear Models in Python

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

Egzersiz talimatları

  • Import statsmodels and glm.
  • Using glm() fit a logistic regression model where switch is predicted by arsenic.
  • Print model summary using .summary().

Uygulamalı interaktif egzersiz

Bu örnek kodu tamamlayarak bu egzersizi bitirin.

# Load libraries and functions
import ____.api as sm
from ____.____.api import glm

# Fit logistic regression model
model_GLM = ____(formula = ____,
                data = ____,
                family = ____.____.____).____ 

# Print model summary
print(____.____)
Kodu Düzenle ve Çalıştır