1. Learn
  2. /
  3. Courses
  4. /
  5. Generalized Linear Models in Python

Exercise

Interaction terms

In the video you learned how to include interactions in the model structure when there is one continuous and one categorical variable. In this exercise you will analyze the effects of interaction between two continuous variables.

You will use centered variables instead of original values to be able to interpret the coefficient effects more easily, i.e. from the level of the mean values rather than 0 which may not be logical for the study at hand. In other words we don't want to interpret the model by assuming 0 for arsenic or distance100 variables.

The model 'switch ~ distance100 + arsenic' has been preloaded as model_dist_ars in the workspace.
Also wells dataset is preloaded.

Instructions 1/2

undefined XP
    1
    2
  • Fit a logistic model with switch as the response and centered distance100,arsenic and the interaction term between distance100 and arsenic as explanatory variables. Use center() to center the variables.
  • Print the model summary.