Open your copy of State Demographics Starter File. If you haven’t already, Save a Copy now.
We’ve already built models for pct-college-or-higher
and median-income
, but that’s not the only relationship in this dataset!
1 What other relationship are you curious about?
explanatory variable (x) and response variable (y)
2 Fill in the code to make a scatter plot exploring the relationship between those columns:
scatter-plot(states-table, "state", , )
3 Pick two states that you think would generate a good first model: and
4 Calculate the slope and y-intercept for a line passing through these two point and use them to define your model. Then type this model into Pyret, and fit it to your data use fit-model
.
fun my-new(x): ( * x) + end S-value
5 Use lr-plot
to build the optimal linear model for this relationship.
fun best-new(x): ( * x) + end S-value
6 Based on these S-values, we would expect predictions made with this best possible model to have percent less error than predictions made with the linear model I generated from two points.
7 What does this model actually mean? Try completing the sentences below:
This model predicts that a 1
percentx-axis units increase in
explanatory variable (x) is associated with a
rate of change in y-units
increaseincrease / decrease in
response variable (y).
Based on the S of
S and
response variable (y) ranging from
lowest y-value to
highest y-value,
I
strongly agree, agree, disagree, strongly disagree that this model is a good fit.
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.