How Well Does a Polynomial Model Predict Used‑Car Prices?
Data Sources
Used‑car dataset with price (€), age, and mileage. Nested CV with 50 ShuffleSplits per degree on the 80% outer‑train (n=245). Final evaluation on the 20% outer‑test (n=62).

Executive Summary
We modeled used‑car prices (€) for the Toyota Ayogo model based on maarktplaats listings from July 2025 using age and mileage with polynomial features and nested cross‑validation. Trying degrees 1–3, the 2nd‑degree model generalized best and, when refit on the full training fold and tested once on the untouched outer test set, achieved R² = 0.9359 (adjusted 0.9302).
📊 The cover chart (Predicted vs Actual) shows tight clustering around the ideal 45° line on the outer test set, with slightly wider spread at the highest prices — consistent with strong but not perfect calibration.
Key Findings
Model selection (inner CV, 50 ShuffleSplits):
- Degree 1: mean R² 0.8791 ± 0.0207 (min 0.8353, max 0.9259)
- Degree 2: mean R² 0.9150 ± 0.0168 (min 0.8679, max 0.9489) ← selected
- Degree 3: mean R² 0.8840 ± 0.0342 (min 0.7612, max 0.9322)
Interpretation: Moving from linear (deg‑1) to deg‑2 adds useful curvature/interaction and raises mean R² by ~0.036 while keeping variance modest. Deg‑3 increases variance and reduces mean performance — a sign of overfitting on these features.
Outer split & generalization:
- Outer‑train n = 245 (80%) | Outer‑test n = 62 (20%).
- Final outer‑test R² = 0.9359 (adjusted 0.9302), indicating excellent out‑of‑sample fit.
Term significance (final deg‑2 model):
- Age (β ≈ −872.8, p < 0.001) and Mileage (β ≈ −0.05 per km, p < 0.001) have strong negative main effects.
- Age × Mileage interaction is positive and significant (β ≈ 0.001979, p < 0.001), implying the price impact of mileage depends on vehicle age.
- Quadratic terms Age²(β ≈ 7.30) and Mileage²(β ≈ 0) are not significant at 5% (p = 0.16 and 0.15), suggesting limited pure curvature beyond the interaction.
How the Degree Was Chosen (Nested CV)
- Outer split: Data was split 80/20 once. The 20% (62 cars) was locked away for a single, final evaluation.
- Inner CV on the 80% (245 cars): For each candidate degree (1, 2, 3), we ran 50 ShuffleSplits with an inner train of 64% and inner validation of 16% of the total data per split.
- A model is trained on the inner‑train (64%).
- It’s evaluated by R² on the inner‑validation (16%).
- The score is recorded; after 50 repeats we compare the average R² across degrees.
- Select degree: Degree 2 had the highest mean inner‑CV R² (0.9150) and reasonable variability, so it was chosen.
- Final refit & test: We refit degree‑2 on the full outer‑train (245) and evaluated once on the untouched outer‑test (62).
Reading the Scatter Plot
- Points fall close to the dashed ideal line, confirming low bias and good calibration.
- The spread grows mildly at higher prices (~€10k–€12k), with a few under‑predicted high‑price cars — typical when data is sparser at the top end.
Practical Takeaways
- Second‑degree with interaction is the sweet spot here: it captures the joint effect of age and mileage without the noise introduced by cubic terms.
- The non‑significance of pure quadratic terms suggests the interaction is doing the heavy lifting, while extra curvature offers little benefit.
- With R² ≈ 0.94 on truly unseen data, the model is reliable for valuation within the observed age/mileage ranges, though caution is warranted for very high‑priced outliers.
Disclaimer
These results reflect the available sample (n = 307 total) and the specified features (age, mileage). Real‑world transaction prices can vary with condition, trim, options, and market dynamics not included in this model.