Goal
Fit an ordinary least-squares polynomial of degree 1 to 5 to paired observations and report the equation, R², and RMSE.
Worldwide context
Saved once here, used across the site.
Currency changes display only. Country selection guides tax input; no tax rate is guessed.
Fit an ordinary least-squares polynomial of degree 1 to 5 to paired observations and report the equation, R², and RMSE.
Choose coefficients β that minimize Σ(yᵢ − f(xᵢ))² for f(x)=β₀+β₁x+…+βₖxᵏ; solve the normal equations (XᵀX)β=Xᵀy.A clearer path to an answer
This page keeps the calculation transparent: define the goal, enter the matching values, inspect the method, and decide what the result means in your situation.
Fit an ordinary least-squares polynomial of degree 1 to 5 to paired observations and report the equation, R², and RMSE.
X values · Y values · Polynomial degree
Choose coefficients β that minimize Σ(yᵢ − f(xᵢ))² for f(x)=β₀+β₁x+…+βₖxᵏ; solve the normal equations (XᵀX)β=Xᵀy.
Calculate, review the assumptions below, then compare a related tool when the decision needs more context.
Fit an ordinary least-squares polynomial of degree 1 to 5 to paired observations and report the equation, R², and RMSE.
Open the Polynomial Regression Calculator pageMore statistics tools
Download PDFDownload Word (.doc)
Enter your values above and choose Calculate to see the result here.
Calculation map
Choose coefficients β that minimize Σ(yᵢ − f(xᵢ))² for f(x)=β₀+β₁x+…+βₖxᵏ; solve the normal equations (XᵀX)β=Xᵀy.
Bounded, transparent calculation
Your recent runs stay in this browser session only.
Formula: Choose coefficients β that minimize Σ(yᵢ − f(xᵢ))² for f(x)=β₀+β₁x+…+βₖxᵏ; solve the normal equations (XᵀX)β=Xᵀy.
This calculator fits a one-variable polynomial by ordinary least squares, then reports the fitted equation, coefficient of determination, root mean square error, and observation count.
Worked example: The exact quadratic fit is y = 1 + 1x + 1x² with R² = 1 and RMSE = 0.
The displayed limits are checked before the handler runs. Model-specific domain checks may also reject impossible or non-finite inputs.
Methodology: This calculator follows the WorldCalculate input, formula, precision, and boundary policy. Read the official methodology.
Calculator usage statistics
This section counts anonymous successful Calculate submissions, not unique visitors. Counts and top tools appear only when trusted aggregate data is available; country analysis is shown only under the same condition and reporting threshold.
Answer-first guide
Fit an ordinary least-squares polynomial of degree 1 to 5 to paired observations and report the equation, R², and RMSE. Start with one clearly defined goal, enter values in the units shown, and keep the result attached to the assumptions below.
This tool is useful when your question includes polynomial regression calculator, polynomial fit, least squares polynomial. It returns the outputs declared in the calculator contract rather than a live quote, approval, diagnosis, or professional sign-off.
X values · Y values · Polynomial degree. Keep the same time period, unit system, and currency wherever the form requires comparable values.
Run the worked example first, compare its output with the page's example, then change one input at a time. This makes an unexpected result easier to trace to a unit, boundary, or assumption.
Need a wider view? Browse Statistics Calculators or compare the related tools below. The WorldCalculate methodology explains how formulas, examples, limits, and revisions are reviewed.
Choose coefficients β that minimize Σ(yᵢ − f(xᵢ))² for f(x)=β₀+β₁x+…+βₖxᵏ; solve the normal equations (XᵀX)β=Xᵀy.
This calculator fits a one-variable polynomial by ordinary least squares, then reports the fitted equation, coefficient of determination, root mean square error, and observation count.
The exact quadratic fit is y = 1 + 1x + 1x² with R² = 1 and RMSE = 0.
Context and background
Statistics tools describe data or evaluate a stated probability model. They do not turn an observed summary into causation, certainty, or a forecast without additional evidence.
Data analysis developed from summaries of observations into probability, estimation, and decision measures. The essential habit remains the same: define the population, sample, variable, and convention before calculating.
Research and review
Researched by Hassan ALRowaie, Founder and editorial researcher at WorldCalculate.
This guide follows the live calculator's declared inputs, formula, worked example, assumptions, validation boundaries, and source-backed methodology. The review date describes editorial review of the calculator explanation; it is not a promise that external facts or rates remain current.
Polynomial regression is a flexible way to describe a curved relationship between one numeric input and one numeric response. This page shows the selected degree and the fitted equation alongside R² and RMSE, making the model easier to inspect and question.
A polynomial fit combines a constant, x, x², and higher powers of x. The coefficients are selected so the squared differences between observed and fitted Y values are as small as possible.
Ordinary least squares minimizes the residual sum of squares Σ(yᵢ − f(xᵢ))². The calculator solves the corresponding normal equations for degrees one through five.
Enter X and Y as paired lists. The first X and Y belong together, and the lists must be the same length. A degree k model needs at least k + 1 observations and enough independent X information.
For X = 0, 1, 2, 3, 4 and Y = 1, 3, 7, 13, 21, a degree-two fit returns y = 1 + x + x². Every listed point lies on the curve, so R² is 1 and RMSE is 0.
R² compares residual variation with the variation around the mean response. RMSE is in Y units and represents the square root of the average squared residual. Neither statistic proves the model will predict new data well.
Increasing degree can reduce training residuals while making the curve unstable outside the observed range. Choose a degree for the measurement problem and validate it with diagnostics or held-out data when decisions matter.
Very large or tightly clustered X values can make the normal equations ill-conditioned. Outliers and unequal measurement precision can also distort an ordinary fit; a specialist may need scaled, weighted, or more stable methods.
Polynomial regression is a way to describe how a numeric response changes with one numeric predictor over the observed range. It does not automatically reveal the physical law, prove causation, or justify extending a curve beyond the data. Before entering the lists, name X and Y, record their units, and explain why a polynomial is a reasonable exploratory model.
The selected degree is part of the question. A line describes a constant rate of change, a quadratic permits one bend in the slope, and higher degrees permit more curvature. More flexibility can reduce residuals on the entered points while making the result harder to interpret or less stable outside the measured range. Choose the degree for the task, not only for the best in-sample score.
For degree k, each observation contributes a row containing 1, x, x², and successive powers through xᵏ. The coefficient vector contains the intercept and the coefficients for those powers. The calculator solves the ordinary least-squares problem that minimizes the sum of squared residuals between observed Y and fitted Y.
This structure explains why a degree-two model has three coefficients and why it needs enough independent X information. Repeated X values are allowed when their Y values represent repeated observations, but the overall design must contain sufficient variation for the selected degree. The page reports the fitted equation so the model is not hidden behind one score.
For X = 0, 1, 2, 3, 4 and Y = 1, 3, 7, 13, 21, a degree-two model returns y = 1 + x + x². At x = 0 the fitted value is 1; at x = 1 it is 3; at x = 2 it is 7; at x = 3 it is 13; and at x = 4 it is 21. Every residual is zero, so the in-sample RMSE is zero.
The perfect fit is useful for checking the implementation, but it is not evidence that every future observation follows the same curve. A dataset constructed from a quadratic will naturally produce this result. Real measurements usually contain noise, and a perfect fit can also signal too much flexibility or data leakage when the model was selected after seeing the result.
The intercept is the fitted value at x = 0, which may be outside the measured range and therefore may have little practical meaning. The coefficient of x is the linear contribution, while the coefficient of x² and higher powers shape the curvature. Individual coefficients can change substantially when the degree or the X scale changes.
Do not compare a coefficient from a quadratic with the slope of a line as though they answered the same question. In a curved model, the local rate of change depends on x. If the purpose is interpretation rather than interpolation, calculate or inspect the fitted slope at the relevant X values and keep the units visible.
A residual is observed Y minus fitted Y. Inspecting residuals can show curvature left unexplained by a lower-degree model, a funnel pattern suggesting changing variance, clusters, or a single point with unusual influence. R² and RMSE summarize error but cannot reveal the shape of the errors by themselves.
Create a residual table with X, observed Y, fitted Y, and residual for important analyses. A residual that is small in absolute value may still be large relative to measurement precision, while a larger residual may be expected in a noisy observation. The calculator reports summary metrics; the analyst must decide whether the residual pattern is acceptable.
R² compares the residual sum of squares with variation around the mean response under the fitted model. RMSE is expressed in Y units and summarizes the square-root average squared residual. A high R² does not guarantee good prediction, and a low RMSE is meaningful only relative to the scale and measurement purpose of Y.
When comparing degrees on the same dataset, a higher degree can improve or preserve in-sample R² by construction. That does not prove that the higher-degree model will generalize. Compare held-out error, residual structure, domain plausibility, and the intended range before selecting a model for use.
Interpolation estimates within the span of observed X values. Extrapolation evaluates the equation beyond that span, where a polynomial can turn sharply, cross a physical boundary, or grow without representing the process. The calculator can evaluate the fitted equation, but it does not know whether a requested X is inside the supported measurement range.
Record the minimum and maximum observed X beside the model. Mark predictions outside that interval as extrapolations and test their sensitivity to degree and data changes. If a decision depends on the extrapolated result, collect observations in that region or choose a model with a domain-specific basis and documented behavior.
Degree one is easier to explain and often a useful baseline. Degree two or three can capture a deliberate bend, while degrees four and five may require much more data and careful validation. There is no universal best degree; the choice depends on noise, sample size, measurement range, and the cost of a wrong prediction.
Fit a small set of plausible degrees and compare out-of-sample error or cross-validation when the data support it. Keep a lower-degree baseline in the report. If a higher-degree model wins only on training error but changes wildly under a small perturbation, prefer the stable model or collect more data rather than presenting the flexible curve as a discovery.
Powers of a large or offset X can differ by many orders of magnitude, making the normal-equation system numerically ill-conditioned. Centering X around a meaningful reference and scaling it can improve numerical behavior, although it changes how coefficients are expressed. The underlying fitted predictions can remain comparable when the transformation is recorded correctly.
This calculator accepts the values as entered and reports the ordinary fit under its implementation. If X is a timestamp, currency in large units, or a measurement clustered around a large baseline, consider transforming the predictor before fitting and document that transformation. Do not interpret an unstable coefficient as a physical constant merely because it has many digits.
A degree-k polynomial has k + 1 coefficients, so at least k + 1 paired observations are required, and those observations must provide enough independent X information. Meeting the minimum is not the same as having enough data for a reliable model. With a small sample, one observation can determine a large portion of the curve.
Aim for a sample that covers the relevant X range and reflects the process you want to describe. Repeated measurements can help estimate noise, but they do not automatically replace coverage at new X values. State the observation count, range, collection conditions, and any repeated-row structure when reporting the fit.
A point with an unusual Y value can pull the coefficients, while a point far from the center of X can have high leverage and shape the curve even when its residual is small. Polynomial terms can amplify these effects. The calculator does not automatically flag influence or decide whether a point is an error.
Inspect the original measurement and run a documented sensitivity comparison if a point is influential. Do not remove it solely because the curve looks nicer without it. If the point represents a real subpopulation or boundary condition, model that context or collect more data; if it is a confirmed recording error, document the correction and retain the original record.
Ordinary least squares gives each entered observation equal weight. If one measurement is much more precise than another, or if the variance changes across X, an unweighted fit may not reflect the intended error model. The reported R² and RMSE then describe the ordinary fit, not a weighted scientific estimate.
A specialist may use weighted least squares, robust regression, splines, or another model when the data require it. Do not simulate weights by duplicating rows without documenting the reason; duplication changes the objective and can distort the apparent sample size. This worksheet is a transparent baseline for equal-weight fitting.
The entered observations are the training data for the fit. To assess prediction, reserve observations, use cross-validation where appropriate, or collect a future validation set. Compare the predicted error and residual behavior, not just training R². A model that memorizes a small list can score perfectly and still fail on the next measurement.
Keep the validation design independent of the choice of degree when possible. If the same points are used to choose and judge every candidate, the reported performance can be optimistic. Record the split, transformation, degree, and metric so another analyst can reproduce the comparison.
The fitted equation’s coefficients carry units that depend on the units of X and Y and the power of X. Changing X from metres to centimetres changes the coefficient values even when the fitted physical relationship is equivalent. Changing Y units rescales the intercept, coefficients, RMSE, and predictions.
Write the units beside the equation and state any logarithm, centering, or scaling transformation. Do not compare coefficient magnitudes across differently scaled models without converting them. R² is unit-free, but it still belongs to a particular dataset, model form, and evaluation setting.
A useful report names the response and predictor, units, observation count, degree, fitted equation, R², RMSE, observed X range, fitting method, and validation or diagnostic checks. Include a plot of observations and the fitted curve when the audience needs to see curvature. State whether any prediction is interpolation or extrapolation.
For the exact worked data, report the quadratic equation y = 1 + x + x², R² = 1, and RMSE = 0 for the five entered observations. Add that this is an in-sample exact example. The qualification keeps a correct arithmetic check from becoming an unjustified claim about a broader process.
The calculator cannot prove causation, choose a scientific mechanism, provide confidence or prediction intervals, diagnose heteroscedasticity, identify influential points, select a degree for every dataset, or guarantee behavior outside the observed range. It also does not know whether the measurements were sampled fairly or recorded accurately.
Those questions require data design, domain knowledge, diagnostics, and often specialist software. Use the calculator to make a one-variable ordinary least-squares fit visible and reproducible. When a decision is high stakes, treat its output as one model comparison step rather than the final evidence.
Define X and Y and their units, inspect a scatter plot, preserve row pairing, choose a baseline degree, and enter the lists without hidden transformations. Check that the selected degree has enough independent observations. Review the equation, fitted values, R², RMSE, and observed range.
Then compare plausible degrees with residual diagnostics and held-out evidence. Record data cleaning, transformations, outliers, validation design, calculator version, and the final reason for the selected model. If the relationship is not well described by a polynomial, switch methods or collect better data instead of increasing the degree until the training score looks impressive.
For each X value at which the equation will be used, record whether it is inside the observed range and list the fitted Y. A small table can include the baseline degree and one alternative degree so a reader sees whether the practical conclusion is stable. The equation alone does not show how quickly two curves diverge near a boundary.
If the table contains values outside the observations, mark them as extrapolations in the heading or note. Avoid presenting a long list of predicted values without the original range and units. The table’s job is to make the model’s operating boundary visible, not to create an impression of measured data where none exists.
A training R² of 1 and RMSE of 0 can be a useful regression test, as in the exact quadratic example, but it can also indicate too few observations, a degree chosen to memorize the sample, duplicated information, or leakage from the response into the predictor. The score should trigger a validation question rather than automatic celebration.
Add new observations or hold out existing ones when possible. If the curve fails outside the training points, lower the degree, collect more data, or use a model supported by the subject. A perfect in-sample fit is a statement about those rows under that equation, not a guarantee about the process.
A reader may understand an equation more easily when the article says what can change the answer: a new observation, a different degree, an outlier, a unit conversion, or an extrapolated X. Pair R² and RMSE with the data range and a validation note. Avoid translating R² into a universal percentage of truth.
For engineering or laboratory work, include the measurement resolution and the permitted operating range. For education, show the residual arithmetic and explain why the curve is descriptive. Different audiences can use the same calculator when the page makes the model boundary explicit instead of using one vague confidence statement.
If a line explains the observed trend adequately, a higher-degree polynomial may add complexity without adding useful information. If a curve is necessary, choose the lowest degree that fits the purpose and remains stable under reasonable data checks. A simpler equation is easier to communicate, reproduce, validate, and maintain when new observations arrive.
The final choice should be justified by the question, residual behavior, validation evidence, and operating range. Do not choose degree five because it produces the largest R² on the training rows. The reader needs a defensible model decision, not a competition for the most impressive in-sample statistic.
A future reader should be able to distinguish the original observations from fitted values and predictions. Store the input lists, units, date, selected degree, transformations, equation, metrics, and validation notes together. If the model is refreshed with new data, retain the prior version so a changed curve can be explained rather than silently replacing the earlier evidence.
After reading the fitted equation, the next useful action is usually to inspect a plot and residual table, compare a lower-degree baseline, or collect a validation observation in the intended operating range. If the question concerns a known physical or business mechanism, connect the fitted curve to that domain model before using it. A regression result should lead to a better measurement or decision question, not end the investigation at the score.
Before using the curve, confirm the pairs, units, degree, sample size, X range, and equal-weight assumption. Check the residuals and plot, distinguish interpolation from extrapolation, and compare a lower-degree baseline. Treat a high R² or zero training error as a description of the entered sample, not proof of future accuracy.
Save the exact lists, transformations, fitted equation, metrics, source context, and validation notes. If a coefficient or prediction drives a practical decision, obtain an appropriate statistical or domain review. The strongest result is not the most flexible curve; it is the simplest defensible model that answers the defined question.
Before using the curve, confirm the pairs, units, degree, sample size, X range, and equal-weight assumption. Check the residuals and plot, distinguish interpolation from extrapolation, and compare a lower-degree baseline. Treat a high R² or zero training error as a description of the entered sample, not proof of future accuracy.
Save the exact lists, transformations, fitted equation, metrics, source context, and validation notes. If a coefficient or prediction drives a practical decision, obtain an appropriate statistical or domain review. The strongest result is not the most flexible curve; it is the simplest defensible model that answers the defined question.
Is a polynomial degree the same as the number of points? No; degree controls the highest power and the number of coefficients is degree plus one. Can R² be negative? Yes for a fit evaluated against a chosen baseline in some settings, although ordinary in-sample fits with an intercept commonly produce a nonnegative value. Does the tool prove a curve is real? No; it provides a descriptive fit to the entered sample.
Fit an ordinary least-squares polynomial of degree 1 to 5 to paired observations and report the equation, R², and RMSE.
Choose coefficients β that minimize Σ(yᵢ − f(xᵢ))² for f(x)=β₀+β₁x+…+βₖxᵏ; solve the normal equations (XᵀX)β=Xᵀy. This calculator fits a one-variable polynomial by ordinary least squares, then reports the fitted equation, coefficient of determination, root mean square error, and observation count.
Enter X values, Y values, Polynomial degree, then choose Calculate.
X and Y contain the same number of finite numeric observations. There are at least degree plus one paired observations. The entered design has enough independent information for the chosen degree. The fit uses ordinary unweighted least squares and gives each observation equal weight. R² summarizes fit to these observations and is not a causal measure. High-degree fits can be sensitive to outliers, scaling, and extrapolation. The calculator does not provide confidence intervals, prediction intervals, diagnostics, or a model-selection test.
This calculator is part of the WorldCalculate library. Its formula, example, assumptions, input bounds, and output formatting follow the official methodology.
These WorldCalculate collections connect this tool with related questions while keeping each calculation separate and transparent.