Can chemistry help explain wine quality?
The original project asked which measurable wine characteristics showed the strongest relationship with quality. We narrowed a combined red-and-white dataset to white wine and used multiple linear regression, correlation analysis, model selection, transformations, diagnostics and regression trees.
4,898 white wines. 11 measured attributes.
Measures included acidity, sugar, chlorides, sulfur dioxide, density, pH, sulphates and alcohol. Quality was a discrete expert score, making the project suitable for both regression-style and classification-style thinking.
Alcohol up. Volatile acidity down.
Positive relationship with quality in the regression model and the first split in the regression tree.
Negative relationship with quality. The original analysis applied a log transformation to better handle its skew.
Also emerged as an important splitter in the full regression tree and showed a strong negative correlation with quality.
The fun takeaway from 2022: if I was choosing only from the variables in this dataset, higher alcohol and lower volatile acidity were two of the clearest signals associated with higher quality.
Four versions, one modest ceiling
The original analysis progressively simplified and transformed the model. Adjusted R² improved only slightly, which is an important result itself: chemistry alone leaves a lot of human taste unexplained.
Bars are normalized to the best adjusted R² among the four reported models, so the small differences are visible.
How to read the original coefficients
log(volatile acidity) carried a negative coefficient: holding the other variables constant, higher logged volatile acidity was associated with lower quality.
Alcohol carried a positive coefficient: holding the other variables constant, higher alcohol was associated with higher quality.
What the R² is telling us
Even the best reported version explained only about 29% of the variation in quality. That is not a failure; it is evidence that sensory ratings contain information the lab measurements do not capture — including human preference, context and possibly omitted production variables.
Where would your wine land?
Move the sliders to explore the simplified alcohol + volatile-acidity rules reported in the 2022 regression tree.
If volatile acidity ≥ 0.25 → reported node quality ≈ 5.4.
Lower volatile acidity (< 0.47) → reported node quality ≈ 6.2.
Reported high-quality node ≈ 6.5.
If I rebuilt this analysis today…
01 · Respect the outcome
Quality is ordered and discrete. Compare ordinary regression with ordinal logistic regression instead of treating the score as purely continuous.
ordinal regressionmodel fit02 · Predict out of sample
Add a train/test split and repeated cross-validation. Report MAE/RMSE and compare models based on how well they generalize.
cross-validationRMSE03 · Test nonlinearity
Compare the interpretable linear model to random forest, gradient boosting and generalized additive models.
random forestGAM04 · Bring red wine back
Model wine type explicitly and test whether alcohol, acidity or sulfur behave differently for red vs. white wines.
interactionssegmentation05 · Explain predictions
Add permutation importance or SHAP-style explanations so a visitor can see why a model scores a particular wine higher or lower.
interpretabilityfeature importance06 · Go beyond chemistry
If new data were available, add producer, vintage, region, fermentation/aging variables and sensory-panel information — the missing 70% is the interesting part.
feature engineeringdomain data