Menu

Exponential Regression Calculator

The curve y = a·bˣ that fits growth or decay data, with the rate per step.

By Nethanel Bar, Co-founder & CEO

Last updated

Want to solve these without the calculator?

The Coddy math course teaches the method itself - you work each step on an interactive board and get told exactly where a move went wrong.

Exponential regression fits growth that multiplies instead of adds

A straight line adds the same amount for every step of x. Many things multiply by the same factor instead: money at compound interest, a bacteria culture, the charge left on a battery, the temperature gap between a cooling drink and the room. That pattern is y = a·bˣ, where a is the value at x = 0 and b is the factor applied at each step. If b is above 1 the quantity grows, if b is between 0 and 1 it decays, and (b minus 1) as a percentage is the rate per step.

The standard way to fit it is to take the natural logarithm of every y. If y = a·bˣ, then ln y = ln a + x·ln b, which is a straight line in x. So the method fits an ordinary least squares line to the points (x, ln y), reads ln b off its slope and ln a off its intercept, and undoes the logarithms. This is what the ExpReg command on a TI-84 and the exponential trendline in Excel do, and this page shows every stage: the ln y column, the fitted line, and the two exponentials that bring a and b back.

Because logarithms are irrational, this is the one regression calculator in the set whose answers are rounded decimals rather than exact fractions, and it says so beside the result. It also needs every y to be above 0, since the logarithm of 0 or of a negative number does not exist. The r² shown is the r² of the straight-line fit to ln y, which is the figure a graphing calculator reports.

What to notice about the curve

  • b is the factor per step and (b minus 1) is the rate. b ≈ 0.8195 means each step keeps about 81.95% of the previous value, a decay of about 18.05% per step.
  • a is the fitted value at x = 0, not necessarily the first data point. For y = 100, 82, 67, 55, 45, 37 at x = 0 to 5 the fit gives a ≈ 99.9517.
  • The same curve can be written y = a·eᵏˣ with k = ln b. Positive k is growth, negative k is decay, and ln 2 / |k| is the doubling time or the half-life.
  • The fit is least squares on ln y, not on y. It weighs a miss of 10% the same whether y is 5 or 5000, which suits data that grows by percentages.
  • A high r² on the log scale does not prove the growth is exponential. Straight-line data 5, 4, 3, 2, 1 still gives r² ≈ 0.9473 for an exponential fit.

How to do exponential regression by hand

  1. Take the log of every y

    Replace each y with ln y. For x = 0, 1, 2, 3, 4 and y = 3, 6, 12, 24, 48 the new column is about 1.0986, 1.7918, 2.4849, 3.1781 and 3.8712.

  2. Fit a straight line to (x, ln y)

    Use the ordinary least squares formulas for the slope and intercept on the points (x, ln y). Here the slope is about 0.6931 and the intercept about 1.0986.

  3. Undo the logarithms

    The slope is ln b and the intercept is ln a, so b = e to the slope and a = e to the intercept. Here b ≈ e^0.6931 = 2 and a ≈ e^1.0986 = 3.

  4. Write the curve and read the rate

    y ≈ 3·2ˣ, or y ≈ 3e^(0.6931x) in base e. b = 2 means each step multiplies y by 2: growth of 100% per step, and a doubling time of exactly one step.

Exponential fits for small data sets

Each row is one data set typed into the calculator above. All values are rounded to four decimal places.

x valuesy valuesCurve of best fitChange per stepr² of ln y
0, 1, 2, 3, 43, 6, 12, 24, 48y ≈ 3 · 2ˣ+100%1
0, 1, 2, 3, 4, 5100, 82, 67, 55, 45, 37y ≈ 99.9517 · 0.8195ˣ-18.05%1.0000
1, 2, 3, 4, 52.1, 4.3, 8.9, 17.5, 36y ≈ 1.0413 · 2.0313ˣ+103.13%0.9999
0, 1, 2, 3, 41000, 1050, 1102.5, 1157.625, 1215.50625y ≈ 1000 · 1.05ˣ+5%1
0, 1, 2, 3, 45, 4, 3, 2, 1y ≈ 5.6968 · 0.6762ˣ-32.38%0.9473

Worked examples

Doubling every step

plain
x: 0, 1, 2, 3, 4; y: 3, 6, 12, 24, 48

Each y is twice the one before, so the points lie exactly on y = 3·2ˣ and the calculator returns a ≈ 3 and b ≈ 2, a growth of 100% per step, with r² = 1. In base e the same curve is y ≈ 3e^(0.6931x), and 0.6931 is ln 2. Carried on to x = 6 it predicts 3·2⁶ = 192.

Decay: a cooling cup of coffee

plain
x: 0, 1, 2, 3, 4, 5; y: 100, 82, 67, 55, 45, 37

Read y as the temperature gap to the room, measured every five minutes. The fit is y ≈ 99.9517 · 0.8195ˣ, or y ≈ 99.9517e^(-0.1991x): about 18.05% of the gap disappears each step, and the half-life is ln 2 / 0.1991, about 3.48 steps. The log fit is almost perfect: r² is 0.99999 to five places, which the calculator rounds to 1.

Noisy growth

plain
x: 1, 2, 3, 4, 5; y: 2.1, 4.3, 8.9, 17.5, 36

The values roughly double each step without doing so exactly. The fit is y ≈ 1.0413 · 2.0313ˣ, a growth of about 103.13% per step, with r² ≈ 0.9999 on the log scale. In base e, k ≈ 0.7087, so the doubling time is ln 2 / 0.7087, about 0.98 steps.

Compound interest

plain
x: 0, 1, 2, 3, 4; y: 1000, 1050, 1102.5, 1157.625, 1215.50625

A balance of 1000 earning 5% a year. The calculator recovers y ≈ 1000 · 1.05ˣ, a change of +5% per step, with r² = 1. Reading the interest rate back from a list of balances is exactly what this fit is for.

When the data is not exponential

plain
x: 0, 1, 2, 3, 4; y: 5, 4, 3, 2, 1

These points fall by the same amount each step, so they lie on a straight line, y = -x + 5. An exponential fit still returns y ≈ 5.6968 · 0.6762ˣ with r² ≈ 0.9473 on the log scale, which looks respectable. Plot the curve against the points and it misses at both ends: a straight line is the right model here, and linear regression fits it exactly.

Common mistakes

  • Including a y of 0 or below. The logarithm is undefined there, so the method cannot run. If the data really reaches 0, it is not exponential.
  • Reading b as the percentage. b = 1.05 means growth of 5% per step, and b = 0.82 means a decay of 18% per step, not 82%.
  • Mixing up a and the first y value. a is the fitted value at x = 0; it matches the first data point only when the fit is exact and the data starts at x = 0.
  • Using log base 10 for one step and e for the other. Any base works as long as the same base is used to take the logs and to undo them.
  • Trusting r² on the log scale as proof of exponential growth. Straight-line data can score above 0.9; plot the curve against the points.
  • Extrapolating far ahead. Exponential growth always runs out of room eventually, and a fitted curve has no way of knowing when.

Exponential regression FAQ

How do I do exponential regression by hand?
Take the natural log of every y, fit an ordinary least squares line to the points (x, ln y), then undo the logs: b is e raised to the slope and a is e raised to the intercept. For y = 3, 6, 12, 24, 48 at x = 0 to 4 the line has slope 0.6931 and intercept 1.0986, which give b = 2 and a = 3, so y = 3·2ˣ.
What do a and b mean in y = a·bˣ?
a is the value of y when x = 0, and b is the factor y is multiplied by for each increase of 1 in x. b above 1 is growth and b between 0 and 1 is decay. The rate per step is (b minus 1) as a percentage: b = 1.05 is +5%, b = 0.8195 is about -18.05%.
How do I find the growth rate from data?
Fit the curve and read b. The calculator prints the change per step of x as a percentage: +103.13% for the noisy doubling example on this page, -18.05% for the cooling coffee. If x is measured in years, that is the annual rate.
What is the difference between y = a·bˣ and y = a·eᵏˣ?
Nothing but notation. They are the same curve with k = ln b, so b = eᵏ. The base e form is common in science because k is the continuous rate, and ln 2 / |k| gives the doubling time or half-life directly.
Why does the calculator give decimals instead of fractions?
Because the method takes logarithms, and the logarithm of a whole number is almost always irrational. The linear and quadratic calculators in this set give exact fractions; this one gives values rounded to four decimals and marks them as approximate.
Why is my answer slightly different from Excel or my graphing calculator?
It should match the TI-84's ExpReg and Excel's exponential trendline, which both fit ln y by least squares, up to rounding. Software that fits y directly with nonlinear least squares minimises a different quantity and gives slightly different a and b, because it weighs misses at the largest values most.
Can y be negative or zero in exponential regression?
No. The method takes the logarithm of every y, and ln 0 and the logarithm of a negative number do not exist. A curve y = a·bˣ with positive a is always above 0 anyway, so data that reaches 0 is not following one.

More math tools

Coddy programming languages illustration

Learn math with Coddy

GET STARTED