Exponential Regression Calculator
Fit an exponential curve y = a·b^x to paired X and Y data by least squares on ln y. The calculator returns the equation (also written y = a·e^(kx)), the initial value a, the growth factor b, the percentage change per unit of x, the doubling time or half-life, R² on the log scale and on the original scale, a prediction for any X, the working, every residual and a scatter plot with the fitted curve.
For a straight line use the line of best fit calculator; for a curve with one bend use the quadratic regression calculator. This is not the exponential distribution of waiting times, which has its own exponential distribution calculator. Related guides: linear regression explained and how to interpret R².
Enter numbers separated by commas, spaces or new lines
One positive Y for every X, in the same order
Related Calculators
Linear Regression Calculator
Fit a least-squares line and get the equation, R², coefficient tests, ANOVA table, confidence and prediction intervals, residuals and a plot.
Quadratic Regression Calculator
Fit a least-squares parabola y = ax² + bx + c to X–Y data with R², the vertex, predictions, the normal equations, residuals and a plot.
R-Squared Calculator
Get R², adjusted R², r, and the SSR/SSE/SST breakdown from X–Y data or observed vs predicted values.
What exponential regression does
Exponential regression finds the curve ŷ = a·b^x that lies closest to your points when Y grows or shrinks by a constant percentage for every step in X. It is the standard model for a bacteria culture, a population, compound interest, the spread of an outbreak in its early days, the value of an asset that loses a fixed share each year, or radioactive decay.
The trick is to take logarithms. If y = a·b^x then ln y = ln a + x·ln b, which is a straight line in x. The calculator fits that line to the pairs (x, ln y) with ordinary least squares, then turns the intercept and slope back into a = e^(ln a) and b = e^k, where k = ln b is the continuous growth rate. Growth means b above 1 and a positive k; decay means b below 1 and a negative k.
Formulas
Model: ŷ = a·b^x = a·e^(k·x), k = ln b
Straight line on the log scale: ln ŷ = ln a + k·x
k = Σ(x − x̄)(ln y − mean of ln y) / Σ(x − x̄)²
ln a = mean of ln y − k·x̄, a = e^(ln a), b = e^k
Change per unit of x = (b − 1) × 100%
Doubling time = ln 2 / k for growth, half-life = ln 2 / |k| for decay
R² (log scale) = 1 − Σ(ln y − ln ŷ)² / Σ(ln y − mean of ln y)²
R² (original scale) = 1 − Σ(y − ŷ)² / Σ(y − ȳ)²
What is minimised is the squared error of ln y, not of y. A 10% miss on a small value therefore counts as much as a 10% miss on a large one: the fit works with relative errors. The TI-84 ExpReg command, the Excel LOGEST function and exponential trendline, and R's lm(log(y) ~ x) all fit this same log-linear model, so they agree with this calculator.
Fitting y directly, as scipy.optimize.curve_fit or Desmos do, minimises a different quantity, the absolute error, and needs an iterative search from a starting guess. Its a and b differ somewhat from the log-linear ones unless the points lie exactly on an exponential curve.
How to read the results
| Output | What it tells you |
|---|---|
| Exponential Equation | The fitted curve y = a·b^x with a and b to four decimals. |
| Equation with base e | The same curve written y = a·e^(kx), the form used for continuous growth: populations, decay and continuously compounded interest. |
| a (initial value) | The height of the curve at x = 0. It is only a real starting value if x = 0 is in or near your data. |
| b (growth factor) | The multiplier that Y receives for each increase of 1 in x. Above 1 is growth, below 1 is decay, exactly 1 is no change. |
| k = ln b (continuous rate) | The growth rate per unit of x under continuous compounding. Positive for growth, negative for decay. |
| Change per unit of x | (b − 1) × 100%: the percentage by which Y grows or shrinks for each increase of 1 in x. |
| Doubling time / Half-life | How far x must increase for Y to double (growth) or halve (decay): ln 2 / |k|. It is shown in the units of X. |
| R² (log scale) | The share of the variation of ln y explained by x. This is the R² that the TI-84 and the LOGEST statistics report. |
| R² (original scale) | 1 − SSE / SST measured on Y itself, so it says how close the curve comes to the actual values. It can be lower than the log-scale R², and negative when the curve is worse than the mean. |
| Predicted Y | The curve evaluated at the X value you enter. |
Worked example: a bacteria culture
A culture is counted every hour: X = 0, 1, 2, 3, 4, 5 hours and Y = 100, 150, 230, 340, 520, 780 cells. Load example fills in these numbers and asks for the count at x = 6.
- Take logs: ln y = 4.6052, 5.0106, 5.4381, 5.8289, 6.2538, 6.6593.
- Fit a line to (x, ln y): x̄ = 2.5, the mean of ln y is 5.6327, Sxx = 17.5 and Sxy = 7.1955, so the slope is k = 7.1955 ÷ 17.5 = 0.4112 and the intercept is ln a = 5.6327 − 0.4112 × 2.5 ≈ 4.6047.
- Back-transform: a = e^(ln a) = 99.9556 and b = e^k = 1.5086, so ŷ = 99.9556 × 1.5086^x, which is also ŷ = 99.9556 × e^(0.4112x).
- Growth: b = 1.5086 means the count rises by 50.8587% every hour, and it doubles every ln 2 ÷ k = 1.6858 hours, about 1 hour 41 minutes.
- Fit: the fitted counts are 99.9556, 150.7916, 227.4822, 343.1767, 517.7118 and 781.0132. R² is 0.9999 on both scales; on the original scale SSE = 23.3215 and SST = 330733.3333.
- Prediction: at x = 6 the curve gives 1178.2263 cells (computed from the unrounded a and b; the rounded values above give about 1178.3). Since 6 is outside the data, treat it as a forecast, not a measurement.
You can see the constant percentage in the raw data: each count divided by the one before is 1.5, 1.5333, 1.4783, 1.5294 and 1.5, all close to b = 1.5086.
Exponential, linear or quadratic?
- Divide each Y by the one before it. If the ratios stay roughly constant while X moves in equal steps, the growth is exponential. If the differences stay roughly constant, a straight line is the better model.
- Look at ln y against x: if it is a straight line the exponential fits. If it still bends, growth is speeding up faster than exponentially or slowing down towards a ceiling, as in an S-shaped logistic curve. The residuals of a line fitted to ln y, plotted with the residual calculator, show such a bend clearly.
- Data that rise and then fall, or fall and then rise, need a parabola, since an exponential curve never turns.
- Compare models on the original scale: use the R² (original scale) here, or score each model's fitted values against your data with the mean squared error calculator.
Assumptions and pitfalls
- Every Y must be positive. The logarithm of zero or a negative number does not exist, so the calculator names the first offending value instead of dropping it. If your data reach zero, an exponential model with no floor is the wrong shape.
- Errors are treated as proportional to Y. That suits counts and money, where a 10% swing is normal at any size. If the scatter is the same in absolute terms at every size, minimising the error on Y itself is the better criterion and gives somewhat different constants.
- Exponential growth does not last. Populations run out of food, markets saturate and epidemics run out of susceptible people. The calculator flags any prediction outside your X values.
- Large X values. With calendar years the initial value a is the size of the curve in year 0 and can be astronomically small or large. Subtract a base year from every X: b, R² and predictions are unchanged and a becomes the value in the base year.
- Independent observations. Repeated measurements of one process, such as a counter read every minute, are correlated, so treat R² as a description and not as a test.
Exponential regression in other software
| Tool | Command |
|---|---|
| TI-84 | STAT > CALC > 0:ExpReg fits y = a·b^x to x and ln y; with DiagnosticOn it also shows r² and r |
| Excel / Google Sheets | =LOGEST(y, x, TRUE, TRUE) returns the base m (b here) and the constant b (a here) in its first row; =GROWTH(y, x, new_x) predicts |
| Excel chart | Add Trendline > Exponential, then tick Display Equation on chart: y = c·e^(bx) with c = a and b = k |
| R | fit <- lm(log(y) ~ x); exp(coef(fit)) returns a, then b |
| Python | k, ln_a = numpy.polyfit(x, numpy.log(y), 1); a = numpy.exp(ln_a); b = numpy.exp(k) |
| Fit on the original scale | scipy.optimize.curve_fit(lambda x, a, k: a * numpy.exp(k * x), x, y, p0=(a0, k0)) minimises the error on Y and gives different constants |
The first five rows minimise the squared error of ln y, so they agree with this calculator to rounding error. The last row is a different criterion and only matches when the data are exactly exponential.
Frequently Asked Questions
What is exponential regression?
Exponential regression fits the curve y = a·b^x to paired data, the model for quantities that grow or shrink by a constant percentage per step. It is done by taking the natural logarithm of Y, fitting a straight line ln y = ln a + k·x by least squares and converting back with a = e^(ln a) and b = e^k.
How do I get the growth rate and the doubling time from the result?
The change per unit of x is (b − 1) × 100%: for b = 1.5086 that is +50.86% per step. The doubling time of growing data is ln 2 / k with k = ln b, which is about 1.69 steps for k = 0.4112. For decay the half-life is ln 2 / |k|. The calculator shows the change per unit of x and the doubling time or half-life directly, in the units of your X values.
Why can I not use zero or negative Y values?
The fit works on ln y, and the logarithm of zero or a negative number is undefined. The calculator reports which Y value is not positive rather than dropping it silently. If your quantity can reach zero, an exponential curve with no floor does not describe it; consider a straight line or a quadratic instead.
What is the difference between the two R² values?
R² (log scale) measures how well a straight line explains ln y against x, which is the R² the TI-84 and the LOGEST statistics report. R² (original scale) is 1 − SSE / SST calculated on Y itself from the actual residuals, so it reflects how close the curve is to your real values. The two are usually close for a good fit, and the original-scale value can be lower or even negative.
Why does Python curve_fit or Desmos give different a and b?
They minimise the squared error of Y, while this calculator, the TI-84, Excel and R lm(log(y) ~ x) minimise the squared error of ln y. The two criteria weigh points differently, the log version treating relative errors equally, so the constants differ unless the data lie exactly on an exponential curve. Neither is wrong; choose the one that matches how your errors behave.
Can I use calendar years as the X values?
Yes, the fit itself stays accurate, but a is then the value of the curve in year 0 and can be astronomically small, while b, R² and predictions are unaffected. Subtract a base year from your X values, for example use 0, 5, 10, 15, 20 for 2000, 2005, 2010, 2015, 2020, to get an a that is the value in the base year.
How many data points do I need?
At least two points with different X values, but two points always give R² = 1 and say nothing about whether the data are exponential. Use five or more points that span at least a doubling or a halving of Y, so that the curvature on the original scale is clear.
How do I know if an exponential curve fits better than a straight line?
Look at the ratio of each Y to the previous one: roughly constant ratios mean exponential, roughly constant differences mean linear. Then compare the R² on the original scale with that of the line of best fit, and inspect the residuals for a systematic pattern.
Embed This Calculator
Add this free calculator to your course page or LMS.
Adjust the height value to fit your page.