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 model settings 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 explanatory variable (x) is base (b) times higher than another is also
predicted to have a response variable (y) that is log coefficient (a) y-axis units longer.
8 Add the definition of logarithmic3
to your starter file. Use fit-model
to calculate the S-value and complete the table below:
Linear | Quadratic | Exponential | Logarithmic | |
---|---|---|---|---|
S-value |
~5.926626 |
9 Compare the two smallest S values using percent change. $$\displaystyle \frac{ \text{Difference} \text{between} \text{the} \text{S-values} } {\text{S-value} \text{for} \text{second} \text{best} \text{model}} \times 100 = $$$$\displaystyle \frac{\qquad}{\qquad}$$
Predictions made with the logarithmic model are expected to have percent more / less error than predictions made with the 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.