ForHosting KIT · Math

Power regression calculator

The points (1, 3), (2, 12), (4, 48) and (8, 192) follow the power curve 3·x² exactly: a is 3, b is 2 and the log-space R² is 1. Enter positive x and y pairs to get the coefficient, the exponent and fit quality. Free in your browser.

  • Free
  • Runs in your browser
  • No sign-up
  • Your data stays on your device
Use it from WebAPIEmailTelegramApp soon
If you enter
X
1, 2, 4, 8
Y
3, 12, 48, 192
You get
N
4
A
3
B
2
R squared log
1

Power regression finds the curve y equals a times x to the power b that best explains how a strictly positive response grows or decays with a strictly positive predictor under ordinary least squares in log space. Taking natural logs turns the power model into a straight line: the log of y equals the log of a plus b times the log of x. Fitting that line by least squares and exponentiating the intercept recovers the coefficient a, while the slope is the exponent b. Students meet power laws in algebra, physics, and biology when they plot log-log charts and look for a straight trend; analysts use the same closed form for allometric scaling, intensity-duration curves, and quick magnitude estimates without opening a full statistics package.

How log least-squares power regression works

Begin with at least two paired observations where every x and every y is strictly greater than zero. The target model is y equals a times x raised to b. Taking the natural logarithm of both sides yields ln y equals ln a plus b times ln x, which is an ordinary linear equation in the transformed variables.

Ordinary least squares then chooses the unique line in log-log space that minimizes the sum of squared vertical residuals between each observed ln y and the value predicted on that line.

Algebraically the minimum is closed form: compute the sample means of ln x and of ln y, form the centered sums Sxx of squared deviations of ln x from its mean and Sxy of products of centered ln x and centered ln y, set the exponent b equal to Sxy divided by Sxx, set ln a equal to mean ln y minus b times mean ln x, and recover a by exponentiating.

Predicted values on the original scale are a times each x to the power b; log-space residual sum of squares is the sum of squared differences between ln y and the log-line predictions; log-space total sum of squares is the sum of squared deviations of ln y from its own mean; log-space R-squared is one minus residual over total. Non-finite numbers, empty series, a single point, mismatched lengths, zeros, and negative values are likewise rejected before any fit is attempted.

Homework and exam answer keys

Generate a, b, log-space R-squared, and residual tables for textbook positive paired data so teachers and auto-graders share one ground truth.

Allometric and scaling fits

Fit body size versus rate, intensity versus duration, or similar positive power-law pairs and export the equation for later prediction.

Engineering magnitude trends

Approximate cost, wear, or signal strength as a times x to the b and report coefficients without a full analytics stack.

What method does this power regression calculator use?

Log least squares: transform to ln y = ln a + b·ln x, fit ordinary least squares in log space, then set a = exp(A). No iterative nonlinear solvers and no machine-learning libraries.

Why must all values be positive?

The model uses natural logarithms of both x and y.

How many points do I need?

At least two finite positive pairs. One point cannot determine a unique power curve under least squares; two or more with spread in x are required.

What does it cost?

The browser tool is free and runs locally.

What does the log-space R² tell me?

How closely the points line up on a log-log chart. A value of 1 means they sit exactly on the power curve; lower values mean more scatter around it once both axes are on a logarithmic scale.

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.

POSThttps://api.kit.forhosting.com/stat/power-regression

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.

curl -X POST https://api.kit.forhosting.com/stat/power-regression \
  -H "Authorization: Bearer $KIT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"x":"1, 2, 4, 8","y":"3, 12, 48, 192"}'
{
  "x": "1, 2, 4, 8",
  "y": "3, 12, 48, 192"
}
{
  "task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
  "type": "stat.power_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.

Per request$0.002

Published price — no tokens, no invented credits. A failed task is never charged.

HTTPCodeMeaning
401unauthorizedMissing or invalid API key.
402insufficient_balanceYour balance doesn't cover the task price.
404unknown_typeThat task type doesn't exist.
429rate_limitedToo many requests. Use the webhook instead of polling.

This calculator accepts paired points as parallel x and y lists or as a JSON array of pairs, rejects any non-positive value because logarithms are undefined there, and returns cleaned series, a, b, log-space R-squared, residual diagnostics, and a printable equation string.

How log least-squares power 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 Sxx is zero because every x value is the same, the denominator vanishes and no finite exponent exists, so the request is rejected with invalid input rather than returning Infinity or NaN.

What you send and what you get back

Send paired positive data in one of two shapes. Do not mix points with separate x and y in the same request. At least two pairs are required, and every coordinate must be strictly positive so that natural logarithms are defined. Classic textbook checks include x equals one, two, four, eight with y equals three, twelve, forty-eight, one hundred ninety-two, which is exactly y equals three times x squared and should return a three, b two, and log-space R-squared one. Either provide both x and y as JSON arrays of finite positive numbers or as comma, space, or semicolon separated strings of equal length, or provide a single points field as a JSON array of two-element [x, y] pairs or objects with numeric x and y fields. Missing fields, empty lists, non-numeric tokens, NaN, Infinity, length mismatch, non-positive values, and constant x all fail with invalid_input and are not charged. On success the response includes n, cleaned x and y arrays, coefficient a, exponent b, r_squared_log, mean_ln_x and mean_ln_y, sxx_log and sxy_log, ss_res_log and ss_tot_log, predicted values and residuals on the original scale, a printable equation string such as y equals a times x to the b, the method label log_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 power regression calculators show up in real work

Laboratory and field studies fit allometric relationships such as metabolic rate versus body mass, intensity versus duration, or count versus magnitude, and need the same coefficient and exponent every lab section sees. Engineering teams approximate wear curves, scaling of cost with size, or signal strength with distance using a simple power model without spinning up a notebook stack, then export the equation string into reports. If you later need ordinary linear regression on the original scale, polynomial fits, exponential models with a base-e time trend, correlation-only summaries, or residual hypothesis tests, treat those as separate search intents and landings rather than overloading this power regression calculator page. Secondary-school and college courses constantly assign power-law word problems, log-log scatterplots, and interpret-the-exponent drills; a single trusted oracle that returns a, b, and log-space R-squared 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.

What does r_squared_log mean?

It is the fraction of variance in ln y explained by the fitted log-line. It equals one for a perfect power-law fit on the transformed scale.

Read the full KIT documentation →