Open your copy of the State Demographics Starter File.
Adjusting Models through Trial and Error
In the Definitions Area, find the section titled Define some other models by modifying mi-ca.
For now, all three definitions in this section are exactly the same as mi-ca
. You will be changing them according to the directions below.
1 less-steep
-
If you wanted the model to be less steep, what slope could you use?
Change the definition forless-steep
to use the slope you wrote above and click "Run" to load your new definition. -
Type
fit-model(states-table, "state", "pct-college-or-higher", "median-income", less-steep)
-
What is the S value of
less-steep
?
-
-
Identify a y-intercept that would make the model fit the data better:
-
Adjust the definition to use the new y-intercept, click "Run" and refit the model.
Hint: You can click in the Interactions Area and hit the up arrow to bring back the last line of code you used. -
What is the S value of
less-steep
now?
-
2 negative
-
If wanted your model to have a negative slope, what slope could you use?
Change the definition ofnegative
to use the slope you wrote above and click "Run" to load your new definition. Then fit the model. -
What is the S value of
negative
?
3 horizontal
-
If you wanted your model to be horizontal, what would you have to change?
Change the definition ofhorizontal
so that it draws a horizontal model. Click "Run" and fit this model.-
What is the S value of
horizontal
?
-
-
Change the y-intercept so that the horizontal line passes through more of the data points. Click "Run" and fit this model.
-
What y-intercept did you use? What is the S value of
horizontal
now?
-
The ma-nv
Model
In the Definitions Area, find the section titled Define some rows.
4 Add two new definitions for MA
(row 21) and NV
(row 28), using the definitions for alaska
and alabama
as a model.
5 Record the college-or-higher
and median-income
values for MA
and NV
, as (x,y) pairs below:
(MA college-or-higher, MA median-income) (NV college-or-higher, NV median-income)
6 Derive the MA-NV model
(using the same steps you followed to derive the AL-AK model
on Fitting Models: College Degrees v. Income) and write it below (in both Function and Pyret notation), then fit the model and record the S-value:
ma-nv(x) = slope (m)x + y-intercept / vertical shift fun ma-nv(x): ( * x) + end S:
These materials were developed partly through support of the National Science Foundation, (awards 1042210, 1535276, 1648684, 1738598, 2031479, and 1501927).
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.