Open your copy of the State Demographics Starter File.

Build a Model through Trial & Error

In the # Define some rows section, look closely at the definitions for alaska and alabama.

Add two new definitions for MA (row 21) and NV (row 28).

1 Record the college-or-higher and median-income values for MA and NV, as (𝑥,𝑦) pairs below:

(MA college-or-higher, MA median-income) (NV college-or-higher, NV median-income)

2 Derive the MA-NV model (using the same steps you followed to derive the AL-AK model on Fit a Model: College Degrees v. Income) and write it below (in both Function and Pyret notation), then fit the model and record the 𝑅2:

𝑔(𝑥) = slopex + y-intercept fun g​(​x​): (​  ​* x​) +   end 𝑅2:

3 Identify two other states that you think would make a better model: and .

4 Record the college-or-higher and median-income values for these states, as (x,y) pairs below:

(college-or-higher, median-income) (college-or-higher, median-income)

5 Derive your model and write it below (in both Function and Pyret notation), then fit the model and record the 𝑅2:

ℎ(𝑥) = slopex + y-intercept fun h​(​x​): (​  ​* x​) +   end 𝑅2:

6 Adjust the slope and y-intercept of your model to get the best 𝑅2 possible. Write the best model (and 𝑅2) below:

𝑏𝑒𝑠𝑡(𝑥) = slopex + y-intercept fun best​(​x​): (​  ​* x​) +   end 𝑅2:

Build a Model Computationally

lr-plot computes the optimal linear model using all of the data points.

7 Evaluate lr-plot​(​states-table, "state", "college-or-higher", "median-income"​). What is 𝑅2?

8 On the line below, write the optimal linear model that was computed through linear regression:

o𝑝𝑡𝑖𝑚𝑎𝑙(𝑥) = slopex + y-intercept fun optimal​(​x​): (​  ​* x​) +   end

These materials were developed partly through support of the National Science Foundation, (awards 1042210, 1535276, 1648684, 1738598, 2031479, and 1501927). CCbadge Bootstrap by the Bootstrap Community is licensed under a Creative Commons 4.0 Unported License. This license does not grant permission to run training or professional development. Offering training or professional development with materials substantially derived from Bootstrap must be approved in writing by a Bootstrap Director. Permissions beyond the scope of this license, such as to run training, may be available by contacting contact@BootstrapWorld.org.