Open your copy of the Fuel Efficiency Starter File and click "Run".
Before we try to model our fuel-efficiency data, we need to learn a new Pyret function!
1 Can you predict what the output of the following expressions will be? Enter them into the Interactions Area, and record the result.
|
|
2 What is the Contract for num-sqr
?
3 What does num-sqr
do?
Interpreting a Quadratic Model
In the Definitions Area of your Fuel Efficiency Starter File, you’ll find the definition of a quadratic model quad1
.
4 In quad1
, the value of 𝑎 is , the value of ℎ is , and the value of 𝑘 is
5 Fit this model to your dataset, using fit-model
. What 𝑅2 value did you get?
Hint: If you forgot the contract for fit-model
, look it up in the contracts pages!
6 In your own words, describe what needs to change about this model to fit the data.
Modeling Fuel Efficiency
Vertex Form: 𝑦=𝑎(𝑥 − ℎ)2 + 𝑘 |
|
7 We’ve determined that peak fuel efficiency is around 45 mph. What variable in the equation should we replace with 45?
Update the definition of quad1
, click "Run" and re-fit the model. What 𝑅2 value did you get?
8 What y-coordinate of the vertex would best match the shape of the curve?
Update the definition of quad1
, click "Run" and re-fit the model. What 𝑅2 value did you get?
9 What value of 𝑎 best matches the shape of the curve?
Update the definition of quad1
, click "Run" and re-fit the model. What 𝑅2 value did you get?
10 See any small changes you’d like to make to the definition, trying to get 𝑅2 as close to 1 as you can? Write your final definition below.
fun f(x) :
end
𝑅2:
★ What does this model actually mean? Try completing the sentence below:
After experimenting, I came up with a quadratic model showing that speed explains R-squared * 100% of the variability in gas mileage for cars in this dataset. The vertex of the parabola drawn by this model is (x, y), which means that
★ How does the fact that the value of 𝑎 is negative impact this parabola?
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.