Session Ready
Exercise

Visually Estimating the Slope & Intercept

Building linear models is an automated way of doing something we can roughly do "manually" with data visualization and a lot of trial-and-error. The visual method is not the most efficient or precise method, but it does illustrate the concepts very well, so let's try it!

Given some measured data, your goal is to guess values for slope and intercept, pass them into the model, and adjust your guess until the resulting model fits the data. Use the provided data xd, yd, and the provided function model() to create model predictions. Compare the predictions and data using the provided plot_data_and_model().

Instructions
100 XP
  • Inspect the chart above, and provide preliminary estimates of trial_slope and trial_intercept. These can be adjusted later in the exercise.
  • Use the predefined function xm, ym = model(intercept, slope) to generate model predictions.
  • Use the provided function fig = plot_data_and_model(xd, yd, xm, ym) to plot the measured data (xd, yd) and the modeled predictions (xm, ym) together.
  • If the model does not fit the data, try different values for trial_slope and trial_intercept and rerun your code.
  • Repeat until you believe you have the best values, and then assign them to final_slope and final_intercept and submit your answer.