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

Extracting parameter estimates

Coefficient estimates are generally of main interest in a regression model. In the previous exercise you learned how to view the results of the model fit and hence the coefficient values along with their corresponding statistics. In this exercise you will learn how to extract the coefficients from the model object.

The attribute .params contains the coefficients of the fitted model, starting with the intercept value. To compute a 95% confidence interval for the coefficients you can use the method .conf_int() of the fitted model wells_fit.

Recall that the model you fitted was saved as wells_fit and as such is loaded in your workspace.

Bu egzersiz

Generalized Linear Models in Python

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

Egzersiz talimatları

  • Save the coefficients as intercept and slope using the .params attribute.
  • Print the saved intercept and slope.
  • Extract and print 95% confidence intervals for the coefficients using .conf_int().

Uygulamalı interaktif egzersiz

Bu örnek kodu tamamlayarak bu egzersizi bitirin.

# Extract coefficients from the fitted model wells_fit
intercept, slope = wells_fit.____

# Print coefficients
print('Intercept =', ____)
print('Slope =', ____)

# Extract and print confidence intervals
____(____.____)
Kodu Düzenle ve Çalıştır