For this page, you’ll need to load Fitting Wealth-v-Health, Part 2 (Desmos).
Fitting a Logarithmic Model
Open the Data Table
folder by clicking on the triangle ( )
-
𝑥1 is the per-capita income for each country, and 𝑦1 is the median lifespan.
-
Next to 𝑦1 you’ll see a dark circle with spots ( ) inside. If the circle is dark, that means that those points are visible on our graph. Click the circle to "turn off" those dots, then click it again to turn them back on.
-
Move the graph by clicking and dragging the background.
-
Notice that a magnifying glass (
) appears to the bottom left of the table. Clicking on the magnifying glass resizes/rescales the graph to fit all the points in the table.
Look at the numbers along the x-axis, which increase as they go from left to right.
1 What would the next number be, if you were to add one at the far right: Describe the pattern you used to find it:
2 Move the sliders for 𝑎 and 𝑐 to create the best-fitting logarithmic model you can find, and write it below.
𝑓(𝑥) =log coefficient (a)log10(𝑥) +vertical shift (c) |
3 In Pyret, modify f(x)
to define this model, and fit it using the fit-model
function. What is your 𝑅2?
Scaling the x-Axis
Open the "Graph Settings" window in Desmos by clicking on the wrench button (
) in the top-right corner of the graph.-
Expand the "More Options" section by clicking the triangle (
). -
Change the x-axis scale from
Linear
toLogarithmic
. -
Zoom out or Zoom fit by click the magnifying glass beneath the table
to put all of the points back into view.
Look at the numbers along the x-axis, which increase as they go from left to right.
4 What would the next number be, if you were to add one at the far right: Describe the pattern you used to find it:
5 What is the shape of the point cloud now? Is it linear? Quadratic? Exponential? Something else?
6 Adjust the sliders for 𝑎 and 𝑐 to create the best-fitting model you can find, and write it below.
𝑓(𝑥) =log coefficient (b)log10(𝑥) +vertical shift (c) |
7 In Pyret, modify f(x)
to define this model, and fit it using the fit-model
function. What is your 𝑅2?
8 Why did transforming the x-axis make our data look linear?
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.