Introduction
This polynomial regression calculator is designed to analyse non-linear relationships between two numeric datasets, and . By fitting a polynomial of degree to the observations, it allows researchers to model complex trends that simple linear models cannot capture, facilitating a deeper understanding of variable interactions within a scientific or academic framework.
What this calculator does
The tool performs a least-squares polynomial fit by constructing a Vandermonde matrix from the input coordinates. It requires two equal-length datasets and a specified polynomial degree. The process generates a regression equation, calculates the coefficients for each power of , and determines the coefficient of determination to evaluate the model fit. It also identifies potential outliers using modified Z-scores based on the median absolute deviation.
Formula used
The calculation utilises the normal equation to find the coefficient vector . This involves the transpose of the design matrix , its inverse, and the dependent variable vector . The model quality is assessed via the coefficient of determination , which compares the residual sum of squares to the total sum of squares .
Normal Equation (Coefficients Vector a):
Coefficient of Determination (R²):
How to use this calculator
- Enter the independent values for Dataset as comma-separated digits.
- Enter the dependent values for Dataset , ensuring the count matches Dataset .
- Select the desired polynomial degree, outlier sensitivity, and decimal precision.
- Execute the calculation to view the regression equation, coefficients, and statistical fit analysis.
Example Calculation: Polynomial Regression
Scenario: A technical analysis maps a curved relationship between a specific independent variable and its output performance across five distinct testing intervals.
Inputs:
- Dataset : 1, 2, 3, 4, 5
- Dataset : 2.1, 3.9, 9.2, 15.8, 25.1
- Polynomial Degree (): 2 (Quadratic)
Step 1 - Construct Vandermonde Matrix:
The system analyses 5 data points to construct the Vandermonde design matrix , where each row represents :
- Row 1 (x=1.000): [1.000, 1.000, 1.000]
- Row 2 (x=2.000): [1.000, 2.000, 4.000]
- Row 3 (x=3.000): [1.000, 3.000, 9.000]
- Row 4 (x=4.000): [1.000, 4.000, 16.000]
- Row 5 (x=5.000): [1.000, 5.000, 25.000]
Step 2 - Solve Normal Equations:
The model computes the normal equation:
Coefficients are calculated by inverting the matrix and solving for the vector:
Point-by-Point Predictions and Residuals:
X = 1 - , Residual = 2.1000 - 1.9686 = 0.1314
X = 2 - , Residual = 3.9000 - 4.2657 = -0.3657
X = 3 - , Residual = 9.2000 - 8.8914 = 0.3086
X = 4 - , Residual = 15.8000 - 15.8457 = -0.0457
X = 5 - , Residual = 25.1000 - 25.1286 = -0.0286
Step 3 - Variance and Goodness-of-Fit:
Total Sum of Squares () = 354.468
Residual Sum of Squares () = 0.249
Fit Calculation:
Results:
Intercept () = 2.000
Linear Term () = -1.196
Quadratic Term () = 1.164
Regression Equation:
Interpretation: The quadratic model demonstrates a strong, non-linear positive acceleration. The negative linear coefficient () initially dampens the output, but the dominant positive quadratic coefficient () ensures that as grows larger, the value of increases at an accelerating rate.
Conclusion: With an value of 0.999, the 2nd-degree polynomial regression equation model accounts for 99.9% of the variance within this 5-point dataset, providing an exceptionally precise mathematical fit for the trend.
Understanding the result
The resulting regression equation provides the mathematical model for the data. The value indicates the proportion of variance in explained by ; a value closer to 1.0 suggests a superior fit, while residuals help identify where the model deviates from actual observations.
Assumptions and limitations
The model assumes a non-linear relationship exists and that the number of unique data points exceeds the polynomial degree. High-degree polynomials may lead to overfitting, where the model describes noise rather than the underlying trend.
Common mistakes to avoid
Typical errors include using a polynomial degree that is too high for the sample size, which reduces the model's predictive reliability. Additionally, entering datasets of unequal lengths or including non-numeric characters will result in calculation failures.
Sensitivity and robustness
Polynomial regression is sensitive to outliers, as squared or higher-power terms can amplify the influence of extreme values. The tool provides sensitivity settings to identify these points, ensuring that researchers can assess whether specific data points are disproportionately affecting the calculated coefficients.
Troubleshooting
If the calculator reports a singular matrix, it indicates that the data points may be perfectly correlated or insufficient for the chosen degree. Ensure that the input contains distinct numeric values and that the degree is appropriate for the number of observations provided.
Frequently asked questions
What is the maximum number of data points?
The calculator accepts up to 1000 data points for processing.
What does a singular matrix error mean?
This occurs when the matrix cannot be inverted, often due to redundant data or a lack of unique values required for the selected polynomial degree.
How is the model fit evaluated?
The fit is evaluated using the R-squared value, which measures how well the regression line approximates the real data points.
Where this calculation is used
Polynomial regression is widely applied in educational and research settings to model phenomena that do not follow a straight line. In social research, it may be used to analyse population growth trends. In sports analysis, it helps in modelling projectile trajectories or athlete performance curves. Environmental studies often employ it to track fluctuations in chemical concentrations or temperature changes over time, providing a more nuanced descriptive statistics tool than standard linear models.
Results are based on standard mathematical and statistical methods and may involve rounding or approximation. If precise accuracy is required, please verify results independently. See full disclaimer.