Today's lesson
Six questions were put to our 168 ZIP codes before class. You are not going to run anything. You are going to read what came back, and write down what each table does and does not show.
1 Where these came from
The tables you are about to read were made in Google Colab, which has Gemini built into it. You type what you want in ordinary words and it runs the analysis for you.
Here is the exact prompt that produced the first table:
Load ph320.vercel.app/data/nyc_mental_health_by_zip.csv. Run a simple linear regression with distress_pct as the outcome and short_sleep_pct as the predictor. Show the full regression output table.
To get the other five tables, swap short_sleep_pct for another column name. Nothing else changes.
Anyone can get one of these tables in thirty seconds now. Almost nobody can tell you whether it says what they think it says.
It looks at the relationship between two variables — a predictor and an outcome. It draws one straight line to show whether the outcome goes up or down as the predictor goes up, and by how much. Straight line, so: linear.
The thing that might explain the change
also called: independent variable
Today, things like short sleep, smoking, no insurance.
The thing we are trying to understand
also called: dependent variable
Today it is always frequent mental distress.
When you have two things measured as numbers and you want to know whether one predicts the other. Ours: does more short sleep in a ZIP code go with more mental distress?
Almost every public health study you will ever read has a table like this in it. If you can read it, you can say what a study actually found, instead of trusting the headline somebody wrote about it. We will be doing this for the next few classes, and it goes in your portfolio.
2 The line
Put every ZIP code on a chart as a dot — its short sleep across the bottom, its distress up the side. The regression is the single straight line that comes closest to all of them at once.
The computer finds that line. Nobody draws it by hand.
All 168 ZIP codes. Each dot is one. The red line is the regression — the one straight line that comes closest to all of them at once.
Everything else today is two questions about it: which way does it tilt, and how much should we believe it.
3 Direction
This is the part people overthink. It is only about direction.
Same direction
Positive
Both go up together — or both go down together. Either way, they move the same way.
Opposite directions
Negative
One goes up while the other goes down. They move against each other.
Nine dots each, drawn to show the shape. Left: as one rises the other rises. Middle: as one rises the other falls. Right: nothing.
Same direction is positive. Opposite directions is negative. The sign tells you which way — it tells you nothing about how strong.
4 Strength
The term
Correlation coefficient (r)
One number, from −1 to +1, for how closely two things move together.
Ignore the sign and sort by size: 0 to 0.3 is weak · 0.3 to 0.7 is moderate · 0.7 to 1 is strong. If decimals tangle you up, read them like money — 0.30 is thirty cents, 0.10 is ten cents, so 0.3 is the bigger one.
Today's six answers, on one line. Two strong, two moderate, two close to zero — and one of those on the negative side.
Where r lives: it is not in the output table. The table gives the slope and the p-value. The correlation is reported separately, which is why it is printed above every table today.
5 The two roles
Every regression has one of each, and they are not interchangeable.
The one doing the predicting
also called: independent variable
In our tables, this is the row name. It is the thing we are using to explain something else.
The one being explained
also called: dependent variable
In our tables, this is at the top next to Dep. Variable. Today it is distress_pct every single time.
The predictor does the predicting. The outcome is the one that moves. We are asking what happens to distress — never the other way around.
The coef number says how far the outcome moves when the predictor goes up by one. Say it the same way every time, and always start with "increase" — even when the number is negative. Only the ending changes.
Positive coefficient → goes up. Negative coefficient → goes down. That is the only choice you make.
6 Belief
In one line
P-value
The chance we would see a pattern this strong if nothing were really going on.
What a court does
Assume innocent. Look at the evidence. Ask: if this person really were innocent, how likely is evidence this strong? Very unlikely — under 5% — and you convict.
What we do
Assume no relationship. Look at the 168 ZIP codes. Ask: if there really were no relationship, how likely is a pattern this strong? Under 5%, we call it real.
Another way to picture it. Imagine a hundred innocent people. If fewer than five of them would have evidence this strong against them by sheer bad luck, that is p < 0.05.
"Not guilty" is not the same as "innocent." A p-value above 0.05 does not show there is no relationship. It shows we did not find enough evidence for one.
p runs backwards from r. For r, bigger is stronger. For p, smaller is stronger evidence. And 0.000 in the output does not mean zero — it means less than 0.001.
7 Our file
Our dataset is 168 New York City ZIP codes from CDC PLACES. One row is one ZIP code.
The outcome every time is distress_pct — the share of adults reporting fourteen or more days of poor mental health in the past month. Six separate questions were put to it before class, one per table:
short_sleep_pct — adults sleeping less than seven hoursno_insurance_pct — adults without health insurancesmoking_pct — adults who smokeinactive_pct — adults doing no physical activitybinge_pct — adults who binge drinkno_checkup_pct — adults with no routine checkupEach one asks the same thing: do ZIP codes with more of this also have more frequent mental distress?
A row here is a ZIP code, not a person. Nothing in these tables is about individuals — and our file is cross-sectional, measured once, so nothing here says which came first.
8 Together
We read this one together. r = +0.79.
coef — the slopeP>|t| — the p-valuenot today
=============================================================================
Dep. Variable: distress_pct No. Observations: 168
Model: OLS R-squared: 0.617
-----------------------------------------------------------------------------
coef std err t P>|t| [0.025 0.975]
-----------------------------------------------------------------------------
Intercept 2.0454 0.812 2.520 0.013 0.443 3.648
short_sleep_pct 0.3397 0.021 16.351 0.000 0.299 0.381
=============================================================================Everything greyed out is real and matters — just not today. That is the last two columns, R-squared, and the whole Intercept row. The Intercept is where the line starts, the distress you would predict if the predictor were zero. No ZIP code in our file has 0% short sleep, so that number describes a place that does not exist. Read the row with the variable name on it. That is the only row we use.
In plain words: neighborhoods where more people sleep badly also have more people struggling with their mental health. Take two neighborhoods 10 points apart on short sleep — the one with worse sleep has about 3.4 points more distress. The pattern holds across nearly all 168 ZIP codes, and it is very unlikely to be an accident. What it does not tell us is whether bad sleep is what is causing the distress.
Where each number came from: the correlation is printed above the table, the 0.3397 is the coef column on the short_sleep_pct row, and the p-value is the P>|t| column on that same row. Never the Intercept row.
Use this as your frame for the other five
The correlation is ______ , which is ______ and ______ .
For every 1 percentage point increase in ______ , distress_pct goes ______ about ______ percentage points.
The p-value is ______ , which is ______ than 0.05, so this relationship ______ statistically significant.
Then one sentence in plain words: what would you say to someone who does not know what a p-value is?
9 Your turn
Same three readings for each, written out in full sentences. Two of the five come out differently from the rest. When you hit one, say so out loud.
==============================================================================
Dep. Variable: distress_pct No. Observations: 168
Model: OLS R-squared: 0.427
------------------------------------------------------------------------------
coef std err t P>|t| [0.025 0.975]
------------------------------------------------------------------------------
Intercept 12.4530 0.275 45.290 0.000 11.910 12.996
no_insurance_pct 0.2768 0.025 11.126 0.000 0.228 0.326
===========================================================================================================================================================
Dep. Variable: distress_pct No. Observations: 168
Model: OLS R-squared: 0.586
-----------------------------------------------------------------------------
coef std err t P>|t| [0.025 0.975]
-----------------------------------------------------------------------------
Intercept 9.7599 0.370 26.356 0.000 9.029 10.491
smoking_pct 0.4912 0.032 15.315 0.000 0.428 0.555
==========================================================================================================================================================
Dep. Variable: distress_pct No. Observations: 168
Model: OLS R-squared: 0.345
-----------------------------------------------------------------------------
coef std err t P>|t| [0.025 0.975]
-----------------------------------------------------------------------------
Intercept 11.2315 0.445 25.247 0.000 10.353 12.110
inactive_pct 0.1453 0.016 9.351 0.000 0.115 0.176
==========================================================================================================================================================
Dep. Variable: distress_pct No. Observations: 168
Model: OLS R-squared: 0.011
-----------------------------------------------------------------------------
coef std err t P>|t| [0.025 0.975]
-----------------------------------------------------------------------------
Intercept 16.1055 0.667 24.134 0.000 14.788 17.423
binge_pct -0.0520 0.038 -1.353 0.178 -0.128 0.024
==========================================================================================================================================================
Dep. Variable: distress_pct No. Observations: 168
Model: OLS R-squared: 0.019
-----------------------------------------------------------------------------
coef std err t P>|t| [0.025 0.975]
-----------------------------------------------------------------------------
Intercept 12.8690 1.324 9.723 0.000 10.256 15.482
no_checkup_pct 0.1169 0.065 1.793 0.075 -0.012 0.246
=============================================================================10 Your portfolio piece
Show that you can read one of these tables and explain it to a regular person. This is the second piece in your portfolio, and it is built the same way as the first.
Use one of the five tables you worked on — not the short sleep demo we did together.
Do not say one thing causes the other. Our file is cross-sectional, measured once. You can say what goes together. You cannot say what caused what.
Take a screenshot of your table and save it as table.png. Then in your repository: Add file → Upload files, drag it in, commit. It has to sit in the same place as index.html, and the name has to match exactly — lowercase, no spaces.
All three sentences and the plain-language part, finished, before you open any AI. That writing is the assignment. The page around it is not.
I am a public health student. I am adding a page to my portfolio website. I do not write code. Give me exactly two things, clearly labeled, and nothing else: THING 1 - the file. Start by writing the line: "Save this as: regression.html" Then give me one complete HTML file in a single code block, from <!DOCTYPE html> to </html>. Do not shorten it or leave anything out. THING 2 - the link. Give me one line of HTML, in its own code block, that I can paste into my homepage so people can reach this page: <a href="regression.html">MY TITLE HERE</a> Rules for the file: - Use my words below exactly. Do not rewrite my sentences to sound better, do not add an introduction or a conclusion, do not invent any numbers. You may fix spelling, grammar and punctuation. - Show my screenshot using this exact line, where it belongs in the page: <img src="table.png" alt="Regression output table"> Make it scale to fit the page on a phone. - Match the look of a simple professional portfolio page: one column, no wider than about 700px, centered, generous line height, all CSS inside a <style> tag in the same file. No frameworks, no JavaScript. - Put a link at the bottom back to my homepage: <a href="index.html">Home</a> - At the very bottom in small text: my name and "PH 320 · Applied Biostatistics in Public Health". Do not explain anything. Do not give me instructions. MY TITLE: [e.g. No Health Insurance and Mental Distress in NYC ZIP Codes] MY THREE SENTENCES: [paste your correlation, slope and p-value sentences here] WHAT IT MEANS FOR PEOPLE: [paste your 2-3 plain-language sentences here]
Create the file
In your repository: Add file → Create new file, name it exactly regression.html, paste in everything under “Thing 1,” commit.
Link it from your homepage
Edit index.html, find the next portfolio card that says “Coming soon,” and replace it with the link from “Thing 2.” Commit that too.
Check it is really live
Open your Vercel address followed by /regression.html. Then go to your homepage and click through to it the way a stranger would. If the screenshot is missing, the file name does not match.
11 Leaving with this
r says which way and how tightly. The coefficient says how far. The p-value says whether to believe there is anything there at all.