Chapter 10 * Residual Sum of Squares: Improving a Model’s Fit to Data
***This chapter is under construction.***
Section 10.1 Residual Sum of Squares: An Introduction
One way to compare data with the output of a model is by computing the Residual Sum of Squares, often abbreviated to RSS. When we work with a single model to try to improve the fit of the model to a data set, RSS is a good option.
Activity 10.2 shows the process of computing RSS for a model with one choice for a value of
\(\beta\text{.}\) Later, we show how to compare RSS for different values of
\(\beta\) used in the same model.
Section 10.2 Residual Sum of Squares: Quickly Comparing Multiple Parameter Values
As we saw in
Section 10.1, we can compare a model with data by trying different parameter values, such as by allowing
\(\beta\) to take on different values. In the Python code block within
Activity 10.2, for every value of
\(\beta\) we wanted to try, we had to change the value of
\(\beta\) within the code and run the code again. Next, we wrap another
for
loop around the RSS
for
loop, so that we can test multiple values of
\(\beta\) with one click of the
Evaluate
button.
Section 10.3 Influenza Data and RSS
Now try computing RSS using the influenza prevalence data. The data are already written into the code block below. Time 0 is the same as October 6.