Exercise

# Extrapolation: Going Over the Edge

In this exercise, we consider the perils of extrapolation. Shown here is the profile of a hiking trail on a mountain. One portion of the trail, marked in black, looks linear, and was used to build a model. But we see that the best fit line, shown in red, does not fit outside the original "domain", as it extends into this new outside data, marked in blue.

If we want use the model to make predictions for the altitude, but still be accurate to within some tolerance, what are the smallest and largest values of independent variable `x`

that we can allow ourselves to apply the model to?"

Here, use the preloaded `x_data`

, `y_data`

, `y_model`

, and `plot_data_model_tolerance()`

to complete your solution.

Instructions

**100 XP**

- Use
`np.abs()`

to compute the residuals as the differences`y_data - y_model`

- Find the
`.min()`

and`.max()`

values of`x`

at which the`residuals`

are less than a`tolerance = 100`

meters. - Use
`np.min() and`

np.max()`to print the range (the largest and smallest) of`

x_good` values. - Use the predefined
`plot_data_model_tolerance()`

to compare the data, model, and range of`x_good`

values where the`residuals < tolerance`

is`True`

.