Exercise

# Linear model, a special case of GLM

In this exercise you will fit a linear model two ways, one using the `ols()`

function and one using the `glm()`

function. This will show how a linear model is a special case of a generalized linear model (GLM).

You will use the preloaded `salary`

dataset introduced in the video.

Recall that the linear model in Python is defined as:

`ols(formula = 'y ~ X', data = my_data).fit()`

and the generalized linear model can be trained using

`glm(formula = 'y ~ X', data = my_data, family = sm.families.___).fit()`

Instructions 1/2

**undefined XP**

- Import the
`statsmodels.api`

with the common alias`sm`

, and the`ols`

and`glm`

modules from the`statsmodels.formula.api`

. - Fit a linear model by predicting
`Salary`

with`Experience`

using the`salary`

dataset.