Quartic regression calculator
Data from x⁴+2x³−x²+3x+5 at x of 0 to 4 returns the coefficients 1, 2, −1, 3 and 5 with an R² of 1. Enter paired x and y lists with at least five different x values to get the fourth-degree fit and its equation. Free in your browser.
- Free
- Runs in your browser
- No sign-up
- Your data stays on your device
Run — free
Worked example
- X
- 0, 1, 2, 3, 4
- Y
- 5, 10, 39, 140, 385
- N
- 5
- Degree
- 4
- Distinct x
- 5
- A4
- 1
Quartic regression finds the fourth-degree polynomial that best explains how a response y changes with a predictor x under ordinary least squares. The fitted model is written y equals a4 times x to the fourth plus a3 times x cubed plus a2 times x squared plus a1 times x plus a0 — five coefficients that capture two inflections a straight line or a quadratic cannot. Students meet this tool in algebra and introductory statistics when a scatter chart bends more than once; analysts use the same closed normal-equation form for calibration curves, growth profiles, and sensor maps that are clearly not linear. This calculator accepts paired x and y lists of finite numbers, rejects series with fewer than five distinct x values because the five-parameter model would not be unique, and returns the five coefficients, a printable equation, and R-squared.
How ordinary least-squares quartic regression works
Begin with paired observations of a predictor x and a response y. A quartic model writes every fitted value as a4 times x to the fourth plus a3 times x cubed plus a2 times x squared plus a1 times x plus a0. Ordinary least squares chooses the unique five-tuple of coefficients that minimizes the sum of squared vertical residuals between each observed y and the value predicted by that polynomial.
Algebraically the minimum is a linear least-squares problem: form the Vandermonde design matrix whose columns are the successive powers of x from four down to zero, then solve A beta equals y in the least-squares sense. This implementation first centers x at its sample mean so the power columns stay better conditioned, factors the n-by-five matrix by Householder QR, back-substitutes for the five coefficients, and expands them back to the original x scale with the binomial identities for (x minus mean) to each power.
Predicted values come from Horner evaluation of the recovered polynomial; residual sum of squares is the sum of squared differences between y and those predictions; total sum of squares is the sum of squared deviations of y from its own mean; R-squared is one minus residual over total.
What you can do with it
Homework and exam answer keys
Generate the five quartic coefficients, the printable equation, and R-squared for textbook paired data so teachers and auto-graders share one ground truth.
Laboratory calibration with two bends
Fit instrument reading versus concentration when a quadratic undershoots the ends, and store a4 through a0 for later prediction steps.
FAQ
What method does this quartic regression calculator use?
Ordinary least squares: it factors the centered n-by-five Vandermonde by Householder QR and solves for y = a4 x^4 + a3 x^3 + a2 x^2 + a1 x + a0. No iterative solvers and no machine-learning libraries.
Why do I need five distinct x values?
A fourth-degree polynomial has five free coefficients. Fewer than five distinct abscissae make the design matrix rank-deficient, so no unique least-squares quartic exists.
What do the five returned coefficients mean?
They are a4, a3, a2, a1, and a0 in y = a4 x^4 + a3 x^3 + a2 x^2 + a1 x + a0, also echoed as the descending coefficients array. a4 is the leading (degree-four) term; a0 is the intercept.
Can I send more than five points?
Yes. Extra points over-determine the system and the solver still returns the unique least-squares quartic. You still need at least five distinct x values among them.
What does it cost?
The browser tool is free and runs locally.
Related tools
For developers — API access
Everything on this page is available programmatically. This section is for teams who want to wire it into their own systems; everyone else can just use the tool above.
API endpoint
Prefer to automate it? One authenticated POST creates the task; the result comes back by webhook or a signed link. The same capability also runs here on the web, by email and from Telegram — and soon from our app too.
Call it from your stack
curl -X POST https://api.kit.forhosting.com/stat/quartic-regression \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"x":[0,1,2,3,4],"y":[5,10,39,140,385]}'const res = await fetch("https://api.kit.forhosting.com/stat/quartic-regression", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"x": [
0,
1,
2,
3,
4
],
"y": [
5,
10,
39,
140,
385
]
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/stat/quartic-regression",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"x": [
0,
1,
2,
3,
4
],
"y": [
5,
10,
39,
140,
385
]
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/stat/quartic-regression", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"x":[0,1,2,3,4],"y":[5,10,39,140,385]}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"x":[0,1,2,3,4],"y":[5,10,39,140,385]}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/stat/quartic-regression", body)
req.Header.Set("Authorization", "Bearer "+os.Getenv("KIT_KEY"))
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)Example request
{
"x": [
0,
1,
2,
3,
4
],
"y": [
5,
10,
39,
140,
385
]
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "stat.quartic_regression",
"status": "queued",
"_links": {
"result": "/tasks/tsk_…/result"
}
}The API is asynchronous: the call returns a task_id immediately and the result arrives by webhook. Polling is capped at 1 req/s per task.
Pricing
Published price — no tokens, no invented credits. A failed task is never charged.
Limits
max_items | 10000 |
Errors
| HTTP | Code | Meaning |
|---|---|---|
401 | unauthorized | Missing or invalid API key. |
402 | insufficient_balance | Your balance doesn't cover the task price. |
404 | unknown_type | That task type doesn't exist. |
429 | rate_limited | Too many requests. Use the webhook instead of polling. |
Technical notes
How ordinary least-squares quartic regression works
The method is deterministic floating-point arithmetic with no random seeds, no wall-clock timestamps, and no network calls, so identical inputs always produce identical JSON. If fewer than five distinct x values are supplied, the five columns of the design matrix are linearly dependent and no unique quartic exists, so the request is rejected with invalid_input rather than returning Infinity, NaN, or an arbitrary member of an infinite family of equally fitting curves.
What you send and what you get back
Send paired data as two lists of equal length. At least five pairs are required, and among those pairs at least five x values must be distinct — five points that all share only four different abscissae still leave the quartic under-determined. A classic exact-fit check is x equals zero through four with y generated from x to the fourth plus two x cubed minus x squared plus three x plus five, which recovers a4 equals one, a3 equals two, a2 equals negative one, a1 equals three, and a0 equals five with R-squared one. Field x is the independent-variable series and field y is the dependent-variable series; each may arrive as a JSON array of finite numbers or as a comma, space, or semicolon separated string. Missing fields, empty lists, non-numeric tokens, NaN, Infinity, length mismatch, more than ten thousand points, and fewer than five distinct x values all fail with invalid_input and are not charged. On success the response includes n, degree four, the count of distinct x values, the five named coefficients a4, a3, a2, a1, and a0, the same five values as a descending coefficients array, a printable equation string such as y equals x to the fourth plus two x cubed minus x squared plus three x plus five, R-squared, the method label ordinary_least_squares, and a short formula reminder. Pricing for successful API calls is the published base of $0.002 per item; validation failures do not consume prepaid balance.
Where a quartic regression calculator shows up in real work
Laboratory calibration sometimes maps instrument reading x to concentration y with a gentle S-shaped or two-bend curve that a quadratic undershoots at the ends; the quartic coefficients become the stored calibration used by later prediction steps. Growth, dose-response, and seasonal operations series often show two turning points inside the observed window, and a degree-four least-squares curve is the smallest polynomial that can follow both. If you later need a straight line, a quadratic or cubic, multiple regression, logistic models, or residual hypothesis tests, treat those as separate search intents and landings rather than overloading this quartic regression page — people who type quartic regression calculator want the five-coefficient fourth-degree fit, not a generic polynomial toolbox. Secondary-school and college statistics courses assign polynomial trend lines once students have outgrown a straight fit, and a single trusted oracle that returns five coefficients as clean JSON speeds grading and demo setup. Because this capability is a pure parse engine, API pricing is the published base of $0.002 per successful item and failed validation does not consume balance.
Integration use cases
Synthetic fixture checks
Recover a known generating quartic from over-determined pairs and assert R-squared is one before shipping regression test fixtures.