Today's lesson

Reading a regression table

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

Somebody asked a computer, in plain English

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:

The prompt
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.

Which is exactly why today matters

Anyone can get one of these tables in thirty seconds now. Almost nobody can tell you whether it says what they think it says.

What a linear regression is

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

Predictor

also called: independent variable

Today, things like short sleep, smoking, no insurance.

The thing we are trying to understand

Outcome

also called: dependent variable

Today it is always frequent mental distress.

When you would use one

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?

Why it matters

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

Picture 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.

3035404550101214161820 short_sleep_pct — % of adults sleeping less than 7 hours distress_pct

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

Positive and negative

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.

Positiveboth go up togetherNegativeone up, one downAbout zerono pattern

Nine dots each, drawn to show the shape. Left: as one rises the other rises. Middle: as one rises the other falls. Right: nothing.

Try these before we touch the data

Hours spent studying&Exam scorePOSITIVE
Temperature outside&Hot chocolate soldNEGATIVE
Height&Shoe sizePOSITIVE
Age of a car&What you can sell it forNEGATIVE
Shoe size&Exam scoreABOUT ZERO
The sentence to hold

Same direction is positive. Opposite directions is negative. The sign tells you which way — it tells you nothing about how strong.

4 Strength

The correlation coefficient, r

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.

THE SIX CORRELATIONS, ON ONE LINE short_sleep +0.79smoking +0.77no_insurance +0.65inactive +0.59no_checkup +0.14binge -0.10 -1-0.7-0.300.30.71 strongmoderateweakweakmoderatestrong ← negative no relationship positive →

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

Predictor and outcome

Every regression has one of each, and they are not interchangeable.

The one doing the predicting

Predictor

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

Outcome

also called: dependent variable

In our tables, this is at the top next to Dep. Variable. Today it is distress_pct every single time.

Which way round

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 slope, in the coef column

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.

Fill this in For every 1 percentage point increase in [row name], distress_pct goes [up / down] about [coef] percentage points.

Positive coefficient → goes up. Negative coefficient → goes down. That is the only choice you make.

6 Belief

The p-value

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.

The part people get wrong

"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.

If it is below 0.05 The p-value is [p], which is less than 0.05, so the relationship between [row name] and distress_pct is statistically significant.
If it is 0.05 or above The p-value is [p], which is greater than 0.05, so the relationship between [row name] and distress_pct is not statistically significant. It could be due to chance.

7 Our file

What was actually asked

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:

Each one asks the same thing: do ZIP codes with more of this also have more frequent mental distress?

Before we read a single number

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

Table 1 · short_sleep_pct

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.

The three sentences, filled in

Table 1 · short_sleep_pct The correlation is +0.79, which is positive and strong.
For every 1 percentage point increase in short_sleep_pct, distress_pct goes up about 0.3397 percentage points.
The p-value is less than 0.001, which is less than 0.05, so this relationship is statistically significant.

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

Five tables

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.

Table 2 · no_insurance_pct

r = +0.65
==============================================================================
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
==============================================================================

Table 3 · smoking_pct

r = +0.77
=============================================================================
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
=============================================================================

Table 4 · inactive_pct

r = +0.59
=============================================================================
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
=============================================================================

Table 5 · binge_pct

r = -0.10
=============================================================================
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
=============================================================================

Table 6 · no_checkup_pct

r = +0.14
=============================================================================
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

regression.html

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.

What goes on the page

The one rule on that last part

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.

Step 1 — the screenshot

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.

Step 2 — write your own words first

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.

Step 3 — build the page

Prompt · builds regression.html
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]

Step 4 — publish it

  1. Create the file

    In your repository: Add file → Create new file, name it exactly regression.html, paste in everything under “Thing 1,” commit.

  2. 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.

  3. 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

One line

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.