Analytics Modeling From Scratch
Formula-first walkthroughs for building intuition, code, and judgment
Every walkthrough builds a modeling idea from the ground up. You see the question the method answers, the formula it relies on, the R code that makes it concrete, and the judgment calls that matter when the math meets messy data.
Get Started
Choose the path that matches how you want to learn today.
The Modeling Loop
Each page follows the same rhythm so you can move from intuition to implementation without losing the thread.
Question
What job is the method trying to do?
Formula
Which mathematical object carries the idea?
Code
How does the formula become executable R?
Judgment
Where can the model mislead you?
Choose by Goal
Pick the job you are trying to do, then jump straight into the walkthrough that matches the modeling problem.
Check model performance
Estimate how well a model handles data it did not see while training.
Predict or explain outcomes
Connect variables to outcomes with linear and logistic relationships.
Design data collection
Compare treatments intentionally with tests, factors, and adaptive choices.
Handle missing values
Reason about missingness mechanisms before choosing an imputation strategy.
Recognize advanced families
Build a practical map of methods you will see beyond the basics.
Topic Map
Use the full topic map when you want the complete formula-first walkthrough for a method.
Classification
- SVM From Scratch — Maximum-margin hyperplanes and the kernel trick
- KNN From Scratch — Majority vote among nearest neighbors
Validation
- Cross-Validation From Scratch — Why testing on training data is cheating
Clustering
- K-Means From Scratch — Finding groups nobody told you about
Change Detection
- CUSUM From Scratch — Catching the moment everything changed
Time Series
- Time Series From Scratch — Exponential smoothing, ARIMA, GARCH
Regression
- Regression From Scratch — Linear & logistic regression
Transformations
- PCA & Box-Cox From Scratch — Fixing your data before modeling
Trees
- CART From Scratch — If-then rules that think like humans
Variable Selection
- Variable Selection From Scratch — LASSO, ridge, stepwise, and bias-variance tradeoff
Design of Experiments
- DOE From Scratch — A/B testing, factorial designs, multi-armed bandits
Simulation & Markov
- Simulation & Markov From Scratch — Distributions, QQ plots, M/M/1 queues, steady states
Missing Data
- Missing Data From Scratch — MCAR/MAR/MNAR, indicators, imputation strategies
Optimization
- Optimization From Scratch — LP, binary variables, and why formulation is the hard part
Advanced Topics
- Advanced Topics From Scratch — Nonparametric, Bayesian, neural nets, game theory, survival, gradient boosting
Featured Practice
Confusion Matrix Cost Drill
Calculate decision costs from false positives and false negatives.