Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

1) Load the data

Estimated time: 45–75 minutes

Learning goals:

  • Understand the MRSA dataset and key variables (counts, county, year, population).

  • Use Python (pandas, numpy) to explore and visualize health data.

  • Apply simple mathematical models (exponential and logistic) to infection counts and interpret parameters in a public health context.

  • Use interactive widgets to explore how models and data change by county and year.

1) Load the data

Run the cell below to load the provided CSV files. If a file is missing, update the path to where the data files are stored on your machine.

2) Quick data checks (helpful hints)

  • County, Year, and Infections (or a similar count column) are the key columns used below. If your dataset uses different column names, rename them accordingly before proceeding.

  • If population is provided, we will calculate rates per 100,000 people for fair comparisons between counties.

3) Mathematical modeling — why and what

In public health, simple models help summarize how infections grow and what controls them. Two common, easy‑to‑understand models are:

  • Exponential growth: early outbreaks often look exponential when unconstrained. Parameters: initial scale and growth rate.

  • Logistic growth: growth that saturates because of limited susceptible population or interventions. Parameters: carrying capacity, growth rate, and midpoint.

Below we define both models and provide code to fit them to county‑level yearly MRSA counts. Interpretation tips are included in the markdown cells that follow the fits.

3) Fit models interactively

Use the widget below to select a county and fit both exponential and logistic models. Click the “Run” button after choosing a county. Interpretations of parameters are provided after the output.

4) Data analysis with interactive regression (population vs infections)

We often compare infection counts to population size to compute per‑capita rates. The widget below shows a scatter plot for a selected year with a linear best fit line. Use the slider to change the year and inspect how the relationship evolves.

5) Exercises (short) — tailored for pre‑nursing students

  • Exercise 1: Select an urban county and a rural county. Use the model widget to fit both counties. Which model (exponential or logistic) seems to describe each county better? What do the parameter values suggest about control of MRSA in each county?

  • Exercise 2: Using the population vs infection widget, pick two years and compare the slope of the population–infections regression. How did the per‑capita infection trend change?

  • Exercise 3 (optional, challenge): Modify the fit_and_plot_models function to fit only the years 2013–2016 and compare parameters to the full time range. What changed?

Write short answers in new markdown cells below each question.


If you’d like, I can also:

  • Add more step‑by‑step explanations for the code cells for students newer to programming, or

  • Export a PDF copy of this adjusted notebook for distribution.

Tell me which you’d prefer next.