Open your copy of the Countries of the World Starter File and click "Run".
Transforming: From Logarithmic Plots to Linear Ones
1 Find the definition of g(r)
. What does this function do?
2 Find the Contract for build-column
on the Contracts Page.
What is its Range? What is its Domain?
3 At the end of the program, you’ll find this code:
countries-transformed = build-column(countries-table, "log(pc-gdp)", g)
What do you think it does?
4 Click "Run", and evaluate countries-transformed
in the Interactions Area on the right to test it out!
a. What is different about this Table? Hint: Find the last column!
b. Where did the column on the right come from?
5 Use this new table to make an lr-plot
comparing log(pc-gdp)
and median-lifespan
, with country
as the label. Record the regression line and S value below:
y = slope x + vertical shift S:
Inverting: From Linear Models to Logarithmic Ones
6 Use the coefficients of the linear model you just made to complete the logarithmic model below:
logarithmic3(x) =
log coefficient (a) log10(x) + vertical shift (k)
fun logarithmic3(x): (
* log(x)) +
end
7 Let’s interpret this model:
A country where the x-axis is base (b) times higher than another is also
predicted to have a y-axis that is log coefficient (a) y-axis units longer.
8 Add the definition of logarithmic3
to your starter file, and use it with fit-model
to calculate the value of S:
9 Complete the table below, copying your S values from the previous models:
Linear | Quadratic | Exponential | Logarithmic |
---|---|---|---|
|
10 Compare the two smallest S values using percent change. How much better is the logarithmic model?
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.