Regression Analysis: When Unusual Traffic Deserves a Closer Look
Forty gigabytes of network traffic in an hour could be routine or surprising. The number becomes more useful when you know what was happening during that hour. Regression analysis helps put an observation in that kind of context.
Regression analysis is a statistical method for estimating how an outcome relates to one or more inputs. It can describe a pattern in recorded data or use that pattern to make a prediction. It doesn't, by itself, explain what caused the pattern.
A model might flag traffic that differs sharply from its estimate. The difference is a clue to examine, not proof of an attack.
Machine Learning in 100 Seconds
Fitting a Line to Five Readings
Suppose we want to estimate hourly network traffic from the number of active devices. A variable is something we measure that can change, such as device count or traffic volume.
Traffic volume is the outcome, also called the dependent variable. Active-device count is a predictor, sometimes called an independent variable. “Independent” doesn't mean we've proved that it independently causes the outcome.
Here are five invented readings for explaining the arithmetic. GB stands for gigabytes, a unit for measuring data. These made-up numbers illustrate fitting a line; they aren't evidence that this model would work on a real network.
| Active devices | Traffic during the hour |
|---|---|
| 100 | 13 GB |
| 200 | 12 GB |
| 300 | 18 GB |
| 400 | 16 GB |
| 500 | 21 GB |
A model describes a relationship mathematically. Fitting a straight line to these readings gives:
Estimated traffic in GB = 10 + 0.02 × active devices
The line doesn't pass through every reading. Least squares chooses the fit with the smallest total squared error. Each error is multiplied by itself before the results are added, so positive and negative errors can't cancel out.
Regression can also describe relationships that don't follow a straight line. NIST's regression guide explains the fitting method and its limitations.
The Extra 24 GB
For an hour with 300 active devices, the model predicts 10 + 0.02 × 300, or 16 GB.
- Run AI models on hardware you own instead of renting time in the cloud.
- Build an AI-powered robot or smart camera with NVIDIA's own software stack.
- Learn the tools working AI engineers use, on a board that fits in your hand.
Now suppose a new hour has 300 active devices and 40 GB of traffic. The residual, the observed value minus the predicted value, is 40 − 16, or 24 GB.
That tells us the observation sits well above this model's estimate. It doesn't tell us why. Perhaps a scheduled backup ran, software was distributed to computers, or a measurement was wrong. Unauthorized data transfers are another possible explanation to investigate.
Residuals can also expose weaknesses in the model. If it repeatedly underestimates traffic at a certain time of day, device count alone may leave out something important. NIST's model-validation guidance recommends examining these errors rather than trusting a single fit score.
Even a high R-squared value, a measure of how much variation a model explains in the fitted data, doesn't establish that the model is suitable.
Why Does It Take 200 Days to Spot a Breach?
Putting a Range Around the Estimate
A single estimate such as 16 GB can sound more certain than it is. Real observations vary, and the fitted relationship is itself uncertain.
A prediction interval gives a range for a new observation under the model's assumptions. It accounts for both sources of uncertainty. That differs from a confidence interval for the average response, which estimates the average outcome at given inputs. Predicting one particular hour allows for additional variation.
NIST's explanation of prediction intervals sets out this distinction. Calculating such a range for real traffic requires checking the model's assumptions. The toy example supplies no tested alarm threshold.
Be cautious about extrapolation, too: predicting beyond the conditions represented in the data. A pattern fitted to hundreds of devices may not describe a network with tens of thousands.
- Run a test server or a home lab without giving up desk space.
- Start right away with 16GB of memory and a 500GB SSD already inside.
- Drive two 4K screens when it doubles as an everyday desktop.
Trying the Model on Later Hours
A model can fit its existing data closely and perform poorly on new observations. This is overfitting: learning details of the fitted sample that don't carry over reliably.
Test predictions against data kept separate from the fitting process. For a forecast, keep time in order: use earlier observations to predict later ones. Randomly mixing past and future observations can give a misleading evaluation. The scikit-learn evaluation guide covers these testing choices.
The errors on those later hours show how well the model handles new observations. Large misses during ordinary work would make it a poor basis for interrupting a service, even if the original fit looked impressive.
More Incidents, or Better Detection?
Prediction leaves a separate question: what caused the pattern? Correlation means variables vary together. Causation means a change in one produces a change in the other.
Imagine organizations with larger security budgets also report more incidents. That relationship could reflect larger organizations having more systems, or better detection finding more incidents. It wouldn't, on its own, show that spending money caused the attacks.
Regression can include additional predictors, but adding inputs doesn't automatically settle alternative explanations. The EPA's causal-assessment guidance explains why statistical relationships need other evidence before they establish cause.
Machine Learning and Evolution: When 98 Percent Is a Failure

Data Mining: How Patterns Become Useful—and Misleading

Behavior Monitoring: What Software Does Can Give It Away

QUOTE:
"Amateurs hack systems, professionals hack people."

