My Long-Time Peers Told Me I Regressed (s**tpost)
They meant it as an insult. I took it as a specification, and derived the whole thing from scratch.
Talking to old colleagues sucks sometimes, especially when they're cynical.
I think they were just mad, because a rizzler like me hit the skibidi toilet scuba in Ohio 6-7 times and aura farmed on them, no cap. 🚫🧢
They said: “Thommas, you’ve really regressed.”
Of course I regressed—technically it's called Regression—a statistical analysis method used to estimate the relationship between an outcome and the predictor variables. 📈📉
You probably remember from school 🏫:
But you can go deeper 🕳️. Let's redefine these variables:
| symbol | school | description |
|---|---|---|
| the th prediction | ||
| the intercept | ||
| the slope | ||
| the th predictor variable |
Final equation for a simple linear regression:
You see 👀, the goal is to draw a line that minimises the residuals () from the data points. Some people call these errors.
In the wild, you'll see people refer to linear regression as Ordinary Least Squares (OLS). This is because we are trying to minimise the Sum of Squared Errors (SSE), to penalise the big ones more than the small ones. Since real life data is imperfect (except for Me 🧍🏻♂️), let's append to our formula to account for error:
Solving for the intercept
The goal (of OLS and of Life itself) is to find the perfect balance in the line to minimise the SSE. We take the partial derivative of the with respect to and solve for zero:
If you add up a constant () exactly times, you just get . Let's move that to the other side:
Divide the entire equation by . When you divide a sum by , you get an average (which we write as and ):
Solve for :
Once you know the slope (), you can find the intercept by plugging in the averages of your and data ( and ).
Solving for the slope
Now we do the same thing, but taking the derivative with respect to :
Substitute the formula we just found () into this equation:
Expand it out:
Group all the terms with on one side:
Finally, divide to isolate . With a bit of algebraic rearranging, this simplifies into its final form:
The slope is just the covariance (more on this another time) of and (how they move together) divided by the variance of (how spread out the values are).
Congratulations to me, I just solved Regression. 🥳🥳🥳
Well, there's actually more.
You could have more than one predictor variable. Mathematically you can have up to as many predictors () as one less than the number of data points, such that , making the following formula:
The one above has two predictor variables, and would be solved as such:
So I guess what I have to say is:
I'm not delulu, I'm in my GOAT era. 🤪⏳⌛🐐 (fr)
Yes, I've regressed. But it's Simple, it's Ordinary, it's Regression.
I ghosted them, sus and mid fr. 👻👻👻