Skip to main content

Section 2.1 Modeling a Sprint with Insightmaker

In this section we will follow the example given in the first section [3] and [2] to show the full workflow of modeling a real-world scenario with Insightmaker. You are encouraged to build your own Insights as you work through this section. However, if you get stuck, links to three Insights are provided at the end of this section. Each one illustrates a different approach to parameter estimation.
We consider the problem of creating an ODE model for the velocity of a sprinter based on the following data from the 2008 Olympic 100m dash:
Table 2.1.1. Usain Bolt’s Position Data from the 2008 Olympic 100m Dash
Time (s) 0.165 1.85 2.87 3.78 4.65 5.50 6.32 7.14 7.96 8.79 9.69
Position (m) 0 10 20 30 40 50 60 70 80 90 100
Observe that the data we are presented with is position, while we are attemting to model velocity. This turns out to be a common situation as velocity is easier to model with a differential equation using Newton’s Second Law (\(F = ma\) has the derivative of velocity on the right-hand side), whereas position is easier to measure for data collection. However, since we can numerically integrate using Insightmaker we just need to create a model for velocity, then make the velocity stock equal to the inflow rate of the position stock via a link. This idea is illustrated with the following basic diagram, which we may refer to as an idiom since it describes a very common modeling situation (this is the velocity-to-position idiom).
Figure 2.1.2. The basic velocity to position diagram.
Creating this basic diagram for the modeling scenario, while it may seem intuitive, is the first step in the process of modeling using Insightmaker. We will now carry out the rest of the modeling process explicitly.

Subsection 2.1.1 Creating the Model Diagram

It is also good practice to establish units on all the stocks and flows of the model at this stage. In this case we will establish meters as the units of position, m/s as the units of velocity (the stock and the flow into position) and m/s\(^2\) as the units of both flows into velocity.

Subsection 2.1.2 Establish Settings and Create Formulas

For the model of a sprint we will follow the Hill-Keller model as in [2]. In this model we have one term for propulsive force, \(F_p\text{,}\) which is assumed to be proportional to the mass of the sprinter. Thus,
\begin{equation*} F_p = mP. \end{equation*}
Here \(F\) will be in units of m/s\(^2\) and \(m\) will be in units of kilograms. We will see that only one of them (\(F\)) must be added as a variable in the model.

Checkpoint 2.1.5.

How realistic does it seem that the propulsive force generated by a sprinter is
  1. proportional to their mass and
  2. constant with respect to time?
There is also a resistive force, \(F_r\text{,}\) that is assumed to be proportional to the velocity and the mass of the sprinter. This assumption is based on the idea that this resistive force accounts for air resistance and internal resistance of the runner’s body. Thus,
\begin{equation*} F_r = -kmv. \end{equation*}
Here \(k\) has units of \(1/\)s. We will add \(k\) as a variable to our insight.
Using Newton’s Second Law, we have
\begin{equation*} mv' = mF-kmv. \end{equation*}
Dividing everything by \(m\text{,}\) we now have formulas for our flows for the velocity position stocks:
Table 2.1.6. Flow Formulas for Sprint Model
Flow Formula into/out of what
acceleration terms P into velocity
deceleration terms kv out of velocity
velocity v into position
Our Insight so far should look like the figure below with the flows describe above.
Figure 2.1.7. The basic Hill-Keller Insight.
Simulation settings will be as follows:
Simulation Start:
\(0.165\text{.}\) This is the first time value in our data. It isn’t zero because reaction time was nonzero.
Simulation End:
\(9.525\text{.}\) This is the difference between \(9.69\) and \(0.165\)
Time Units:
Seconds
Simulation Time Step:
\(0.005\text{.}\) This is a very small time step, but it is (sort of) necessary because of the initial point and wanting \(9.69\) to be an exact time step. (We could use a larger time step by investigating factors of \(9525\text{.}\))
Simulation Algorithm:
Euler’s Method. Since the time step is very small, Euler’s Method will be accurate enough.
At this point we have the Insight. Following [3], we will let \(P = 11\) and make \(k\) have a slider to adjust it in small steps (of size \(.001\)) between \(0\) and \(1\) (arrived at by running the model to see what works).

Subsection 2.1.3 Using Data

In order of increasing complexity we can
  1. adjust sliders to make the data match at one or more points by inspection,
  2. use the built-in optimization algorithm in Insightmaker to minimize the absolute value of the difference between one data point and the simulation, or
  3. use the built-in optimization algorithm in Insightmaker to minimize the sum of squared errors between the collection of data points and the simulation.
We will now demonstrate each of these for our sprint model and see how much variation we get in our value of \(k\) depending on the method.
  1. Adjust Paramteters with Sliders: This is the most intuitive method. In this case, Bolt ran \(100\) meters in \(9.69\) seconds. Thus, we can run the simulation set to display time and position in the table display. Then, with sliders linked, we can adjust \(k\) to make the position as close as we can to \(100\) as possible when \(t=9.69\text{.}\) The result is shown below:
    Figure 2.1.9. The slider of \(0.929\) for \(k\) yields a position very close to \(100\) meters.
  2. Use the Optimizer (Version 1): As an alternative to using a slider, we can use the built in optimization algorithm to minimize \(|\text{position}-100|\) when \(t=9.69\text{.}\) First, we create a variable for \(|\text{position}-100|\) (it will need a link from position). Then we proceed as follows:
    • Choose "Optimization and Goal Seeking" from the "Tools" (toolbox next to the "Simulate" button).
    • Choose \(k\) as the "primitive to adjust".
    • Highlight "minimize" and "final value".
    • Choose \(|\text{position}-100|\) as the primitive and accuracy of \(0.001\) along with a guess range for \(k\text{.}\)
    Running the optimization, we find the \(k\) is about what we found using the slider method. Notice we get a range of values and the value of the minimized variable. This is a numerical optimization algorithm, hence may not arrive at exact values even if you can find them by hand. The output is shown below.
    Figure 2.1.10. The optimizer finds \(k\approx 0.9296875\text{.}\)
  3. Use the Optimizer (Version 2): Minimizing the difference between \(100\) and the model’s predictied position at \(t=9.69\) does not account for any other time-position pairs. To obtain a more global fit to the data, we will use a converter with the entire dataset. Then we will minimize the sum of squared errors from the data to the model outputs.
    To proceed, click to add a primitive and choose "Add Converter". Call your converter "data".
    From here, insert the time and position values from Table 2.1.1 with time as input source, meters as units, and linear interpolation. (Linear interpolation builds additional data points for comparison to the simulation by drawing straight lines through the data points.)
    Now create a new variable called \(SE\) (for "squared error") that has \(\text({position}-\text{data})^2\) as its formula and m\(^2\) as units.
    Now open the optimization menu and choose to adjust \(k\) to minimize the integral of \(SE\text{.}\) (The integral will be the sum of the squared errors.)
    Running the optimization, we find that this method gives \(k\approx 0.956\text{.}\)
    Figure 2.1.11. The optimizer now finds \(k\approx 0.9277\) with the sum (integral) of the squared errors equal to \(1382.47.05\text{.}\)

Checkpoint 2.1.12.

Create a new stock whose flow rate is \(SE/\text{TimeStep()}\) (dividing by \(\text{TimeStep()}\) will make this into a sum rather than an integral, which is what the optimizer does, really). Use this to compare the \(SSE\) (sum of squared errors) for \(k=0.929\) and \(k=0.9277\) to verify that the latter gives a better global fit to the data.

Subsection 2.1.4 Sprint Insights

For comparison to your Insights, see below: