Loading the data

Where a p-value comes from

Week 10 · shuffle one column, refit, and watch the p-value appear · then the formula Excel uses
Built-in AI tutor. Not sure why the red line sits where it does, or what the share of shuffles has to do with the P-value column in Excel? Ask the helper on this page. It coaches toward the answer, it does not just hand it over.

A regression table prints a p-value next to every coefficient. Most people read the column without knowing what it is. This page builds one from scratch on the Summit Gear table (2,200 customers, target days_to_pay, the deck's full model with ten predictors), then shows the formula that gets the same number in one step.

1 · The question

What a p-value asks

If prior_late_count had no real effect on days_to_pay, how far from zero could its fitted coefficient land just by chance?

The coefficient you fit is never exactly zero, even for a column of random numbers. Noise alone pushes it around. The p-value answers one question: is the coefficient you got the kind of number noise alone produces, or is it too far from zero for that?

Presets:
Predictors in the model (click to add or drop one; the tested predictor stays in)
2 · The shuffle route

Build the no-effect world and see where the coefficient lands

One shuffle: take the prior_late_count column, scramble it across customers so each one gets someone else's value, leave every other column alone, refit the regression, and write down the coefficient. In that world the column has no real link to days_to_pay, so whatever coefficient comes back is pure chance. Do it 200 times and the histogram is what chance alone produces. The red line is the coefficient from the real, unshuffled data.

The fine print on the shuffle (it matters for the collinear preset)

Only the part of the column that the other predictors cannot already explain gets scrambled. The explained part stays put. For prior_late_count that leftover is 100% of the column, so this is the plain shuffle. For credit_limit with avg_balance and annual_spend in the model the leftover is a sliver. Those two already explain most of it. Scrambling the whole column would also break its ties to them. That asks a different question, and it gives a narrower pile than the table's standard error. This way the column keeps its ties to the other predictors and loses only its tie to days_to_pay. That is what the P-value column tests.

shuffled coefficients, closer to zero than the real one at least as far from zero as the real one the real coefficient
0 shuffles so far
Simulated p-value (share of shuffles at least as far from zero)
?
run the shuffles
Exact p-value, from the t distribution
?
Read the picture, not the number. If the red line sits inside the pile, chance alone produces coefficients like this one all the time, and the p-value is large. If the red line sits far outside the pile, chance alone almost never gets there, and the p-value is small. The exact p-value comes from a formula, not from shuffling, but it is answering the same question, which is why the two numbers agree. 200 shuffles cannot resolve a p-value below 1 in 200. The formula can.
3 · The formula route

The same answer in one step: how many standard errors from zero

Excel's Analysis ToolPak and Python's statsmodels do not shuffle anything. They estimate the width of that pile directly. The standard error is the typical distance a coefficient wanders from its true value, so the width of the no-effect pile above is about one standard error. Divide the coefficient by it and you get t, the distance from zero in standard-error units. The p-value is the area in both tails beyond that distance.

t Stat
t = coefficient / standard error
P-value
two-tailed area beyond |t|

Where it sits in the Excel output

Data, Data Analysis, Regression. The lower table of the ToolPak output has these columns, in this order (it adds confidence-interval columns to the right). statsmodels prints the same four as coef, std err, t and P>|t|. The highlighted row is the predictor you picked.

One sentence of caution

A p-value is not the chance the effect is real. It is the chance of a coefficient at least this far from zero if there were no effect and the model's assumptions hold. And a small p says nothing about whether the effect is big enough to matter. With 2,200 rows a tiny effect can post a tiny p-value. Size is a separate question, answered in days and dollars, not in p-values.

4 · Your reading

Read the p-value for the predictor you picked

One sentence, in your own words, for prior_late_count. Say what the p-value means, and keep the size of the effect separate from whether it is distinguishable from chance. The check below is a fixed set of rules, not a grade, and the tutor will ask you to try before it confirms a reading.

Checks the framing, not the wording.