When the line bends
Missed appointments don't rise in a straight line as waits grow, and waiting times aren't normal. Amara learns two tools for data that doesn't fit the usual mould.
- 09:00Missed appointments by days booked ahead, with Astrid (Data Analyst)
- 11:00Fit a curve with Augustin (Black Belt)
- 15:00Box-Cox with Augustin (Black Belt)
Situation 1 of 2
09:00 · Missed appointments by days booked ahead, with Astrid (Data Analyst)What else do you look at?
A curve, not a line
Astrid (Data Analyst) plots the share of appointments missed against how many days ahead they were booked, in 2-day groups.
| Days booked ahead | Missed (%) |
|---|---|
| 1 | 7.5 |
| 3 | 6.4 |
| 5 | 13 |
| 7 | 14.8 |
| 9 | 17.3 |
| 11 | 19.6 |
| 13 | 19.3 |
| 15 | 22.7 |
| 17 | 23.3 |
| 19 | 28.9 |
| 21 | 26.4 |
| 23 | 26.5 |
| 25 | 27.2 |
| 27 | 27.3 |
- Straight line
missed = 8.3 + 0.837 × days; R² 0.896 - Check the residuals
negative at both ends, positive in the middle: a curve the line misses= pattern - Quadratic
missed = 4.18 + 1.717 × days − 0.0314 × days² - Compare fits
adjusted R² 0.954 against 0.896 for the line= curve fits better - Predict at 4 days
4.18 + 1.717 × 4 − 0.0314 × 16= 10.5% - Predict at 10 days
= 18.2%
Try it yourself in a spreadsheet
| Quadratic fit | =LINEST(B2:B15,A2:A15^{1,2}) |
| Chart | scatter chart, then Add trendline, Polynomial, order 2, show equation and R² |
| Prediction | =b0 + b1*4 + b2*4^2 |
Why not use the curve to predict the missed rate for appointments booked 60 days ahead?
Show the answer
The data only goes to 27 days. Outside the data a quadratic can bend in ways reality doesn't (here it would start to fall). Never extrapolate a fitted curve.
Situation 2 of 2
11:00 · Fit a curve with Augustin (Black Belt)What does that mean?
Box-Cox: making skewed data usable
The 60 waits are skewed. Augustin (Black Belt) shows how a Box-Cox transformation finds the power that makes them most symmetrical.
| Request | Wait (days) |
|---|---|
| R01 | 12 |
| R02 | 13 |
| R03 | 12 |
| R04 | 28 |
| R05 | 11 |
| R06 | 12 |
| R07 | 16 |
| R08 | 7 |
| R09 | 3 |
| R10 | 4 |
| R11 | 4 |
| R12 | 10 |
| R13 | 4 |
| R14 | 17 |
| R15 | 5 |
| R16 | 8 |
| R17 | 5 |
| R18 | 5 |
| R19 | 5 |
| R20 | 20 |
| R21 | 3 |
| R22 | 15 |
| R23 | 5 |
| R24 | 9 |
| R25 | 5 |
| R26 | 5 |
| R27 | 15 |
| R28 | 15 |
| R29 | 14 |
| R30 | 13 |
| R31 | 18 |
| R32 | 16 |
| R33 | 3 |
| R34 | 5 |
| R35 | 10 |
| R36 | 7 |
| R37 | 6 |
| R38 | 10 |
| R39 | 10 |
| R40 | 5 |
| R41 | 5 |
| R42 | 4 |
| R43 | 5 |
| R44 | 6 |
| R45 | 7 |
| R46 | 11 |
| R47 | 11 |
| R48 | 3 |
| R49 | 13 |
| R50 | 26 |
| R51 | 12 |
| R52 | 22 |
| R53 | 27 |
| R54 | 18 |
| R55 | 4 |
| R56 | 14 |
| R57 | 20 |
| R58 | 3 |
| R59 | 6 |
| R60 | 19 |
- Box-Cox
tries powers λ of the data (y to the power λ; λ = 0 means the logarithm) and picks the most normal - Best λ
found by the method= 0.015, so a log - Transform
log of each wait - Shape after
skewness 0.91 before, −0.02 after= tail gone - Normality after
Anderson-Darling p about 0.01: whole-day values create ties= much closer, not perfect - Use it: capability
log mean 2.152, log s 0.639; share over 7 = share of logs over ln 7 = 1.946= 63% predicted, 55% observed
Try it yourself in a spreadsheet
| Log | =LN(B2) |
| Skewness after | =SKEW(C2:C61) |
| Share over 7 from the log model | =1-NORM.DIST(LN(7),AVERAGE(C2:C61),STDEV.S(C2:C61),TRUE) |
What does λ = 0.5 mean, and when would Box-Cox choose it?
Show the answer
The square root. Box-Cox picks it when the data is moderately skewed, such as counts; λ = 1 means no change is needed.
Key concepts
The ideas behind today. Concept how the work is done, in our own words · Common practice widely used ways of working.
Curved relationships
- When residuals show a curve, add a squared term or transform the input. Compare the fits on adjusted R² and the residuals.
Where you will meet this: Non-linear (polynomial) regression
Transforming data
- Box-Cox finds the power λ that makes data most normal: 1 no change, 0.5 square root, 0 logarithm, −1 reciprocal. Transform limits too, and check results against the real data.
Where you will meet this: Box-Cox transformation · data transformation
Never extrapolate
- A model describes the range of its data. Outside it, especially for curves, predictions can be badly wrong.
Explained in our own words. This helps you understand the concepts behind the certifications; it does not reproduce or replace any official guide. Sources
Day 40 complete
2 situations today.
- A pattern in the residuals means the model has the wrong shape. Try a curve, and compare adjusted R².
- Box-Cox finds the power transformation that makes data most normal (λ = 0 is a log). Always check the results against the real data.