import Pkg
Pkg.activate(@__DIR__)
Pkg.instantiate()Mini Project 1: Regression and Simulation
BEE 4850/5850, Spring 2027
If you are enrolled in the course, fork the project repository (linked on Ed Discussion) to your own GitHub account and clone your fork. That gives you the package environment and a repository you can use to share code if you need help. Otherwise you are responsible for setting up an equivalent environment in the language of your choosing. Make sure to include your name and NetID on your solution.
Overview
Instructions
This is the first of two mini projects, and your first complete pass through the four-step loop: why that distribution and link, simulate, fit, test. You may work individually or in pairs.
You are given fourteen years of daily mortality and air quality data from Chicago. The question is whether temperature explains daily deaths, and what a model that says so is actually claiming.
Unlike the homework, this is not a set of numbered problems. You are given a question and a required method, and you decide how to build and present the argument.
The point is not to arrive at the right model. It is to make every choice explicit, and then to find out what those choices bought you and what they cost.
Load Environment
The following code loads the environment and makes sure all needed packages are installed. This should be at the start of most Julia scripts.
The following packages are included in the environment (to help you find other similar packages in other languages). The code below loads these packages for use in the subsequent notebook (the desired functionality for each package is commented next to the package).
using Random # random number generation and seed-setting
using DataFrames # tabular data structure
using CSV # reads/writes .csv files
using Distributions # interface to work with probability distributions
using Optim # numerical optimization, for maximum likelihood
using StatsBase # summary statistics
using Plots # plotting library
using LaTeXStrings # nicer LaTeX labels for plotsThe Data
data/chicago.csv holds daily records for Chicago from 1987 through 2000. The columns you will need:
| Column | Meaning |
|---|---|
death |
Daily non-accidental deaths |
tmpd |
Daily mean temperature, °F |
pm10median |
Median PM10 concentration |
time |
Days from the middle of the record |
The file uses NA for missing values, so read it with:
chicago = CSV.read("data/chicago.csv", DataFrame; missingstring="NA")Some columns have missing values and some do not. Whatever you do about them is a modelling decision, not a data-cleaning chore — report what you did and why. Dropping rows is a defensible choice; dropping them silently is not.
What You Are Asked To Do
Does temperature explain daily deaths in Chicago, and what would a model that says so actually be claiming?
That is the question. Answer it by running the four-step loop end to end: specify a generative model, simulate from it, fit it, and test whether you should believe the fit. All four steps are required.
How you organize the writeup is up to you. There are no numbered problems to work through in order. You are writing a short report that makes one argument and shows the evidence behind it, and deciding what to lead with, how much space each piece deserves, and what belongs in a figure rather than a paragraph is part of the work.
What your report must contain
Your report is graded on whether these are present and convincing, not on whether they appear in this order or under these headings.
- A specification (10 points — Specifying a Model). In mathematical notation, with the distribution justified from a constraint you are willing to state about the process, and every assumption named.
- Evidence you checked the specification before trusting it (8 points — Simulating From a Model). Simulate from it, with parameters you chose, and compare against the real data.
- A fit (10 points — Fitting and Recovery). By a method you can justify, with each parameter interpreted in the context of deaths and degrees.
- A test of whether your fitting procedure recovers parameters you know (10 points — Fitting and Recovery). Simulate from the fit, refit, and compare against what you put in.
- Honest uncertainty (7 points — Interpretation). On the one quantity that matters most for the question, with a statement of what that interval is an interval on.
- An argument about what your model cannot do (5 points — Interpretation). What it assumes that you do not believe, where it does worst, and what you would change first.
50 points total. The point value beside each element is what it is worth; the standard rubrics describe how each kind of element is marked.
Form
No more than four pages excluding figures and references. You do not need to include code, but your notebook or scripts must be in your repository. Raw program output is not an answer to anything — write in sentences.
A specification with no assumptions stated earns nothing for that element, whatever else the report does. This is the single thing the course most wants you to stop doing.
Simulating from a specification you have not yet fitted is the cheapest check in the loop and the one most often skipped. Fitting only finds the best parameters within a model you have already committed to — if the specification cannot produce data resembling these observations, a good fit will not tell you so.
A recovery test that fails, honestly reported and diagnosed, earns full credit. A recovery test that fails and is not noticed earns none.
This project is built so that a careful specification still leaves things on the table, and several of them are things we return to later in the semester. Finding them yourself and saying so is worth more than a model that appears to have no flaws.
Students in BEE 5850 must also fit the model with a Bayesian treatment: state your priors and justify each one, sample the posterior, and report posterior summaries alongside the maximum likelihood estimates. Say where the two agree, where they do not, and what the prior is doing at this sample size.
References
List any external references consulted, including classmates, LLMs, and any sources beyond the course materials.