For this page, you’ll need to have Slide 5: Wealth-v-Health (Logarithmic) of Fitting Wealth-v-Health and Exploring Logarithmic Models (Desmos) and Countries of the World Starter File open on your computer.

Fitting a Logarithmic Model f(x) = a logb x + k

Open the Data Table folder by clicking on the triangle ()

  • x1 is the per-capita income for each country in thousands of $US, and y1 is the median lifespan.

  • Next to y1 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. (You may have to scroll down to see the bottom of the table!) Clicking on the magnifying glass resizes/rescales the graph to fit all the points in the table.

1 Write the numbers you see along the x-axis, from left to right:
Continue this pattern - what would the next three numbers be?

2 Circle the type of function that describes this pattern: Linear Quadratic Exponential

3 Move the sliders for a and c to create the best-fitting logarithmic model you can find, and write it below.

Note: The Bootstrap Pyret function log always uses b = 10.

logarithmic(x) = log coefficient (a)log10(x) + vertical shift (k) fun logarithmic​(​x​): (​  ​* log​(​x​)​) +   end

Definitions will vary as students will be fitting the curve by eye! Numbers below are provided as a reference.

4 Modify logarithmic(x) in Countries of the World Starter File to define this model, and fit it using fit-model.

The error in the model is described by an S - value of about S units, which is insignificant / reasonable / significant / extreme considering y-variable in this dataset ranges from lowest y-value to highest y-value.

Scaling the x-Axis

  • Click on the wrench button () in the top-right corner of the Desmos graph to Open the "Graph Settings" window.

  • Expand the "More Options" section by clicking the triangle ().

  • Change the x-axis scale from Linear to Logarithmic.

  • Adjust the view by zooming and dragging the graph to get all of the points in view on the screen and filling most of it.

5 What is the shape of the point cloud now, after changing the scale? Linear Quadratic Exponential

6 Write the numbers you see along the x-axis, from left to right:
Continue this pattern - what would the next three numbers be?

7 Circle the type of function that describes this pattern: Linear Quadratic Exponential

8 Adjust the sliders for a and c to improve the model. Toggle back and forth between logarithmic and linear x-axis scales as you work.
When you are satisfied with your model, record both forms of the definition below.

logarithmic2(x) = log coefficient (b)log10(x) + vertical shift (k) fun logarithmic2​(​x​): (​  ​* log​(​x​)​) +   end

9 Modify the definition of logarithmic2(x) in Pyret to match this model. Use the fit-model function to find its S-value:

10 Why do you think transforming the x-axis makes our data look linear?

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.