StatsCalculators.com

Exponential Regression

Created:April 6, 2025

This Exponential Regression Calculator helps you analyze data that follows exponential growth or decay patterns. It fits data to the modely=aebxy=a \cdot e^{bx}, providing comprehensive analysis including model coefficients, goodness-of-fit statistics, and diagnostic plots. This is particularly useful for modeling population growth, compound interest, radioactive decay, and other phenomena showing exponential behavior. To learn about the data format required and test this calculator, click here to populate the sample data.

Calculator

1. Load Your Data

Note: Column names will be converted to snake_case (e.g., "Product ID" → "product_id") for processing.

2. Select Columns & Options

Related Calculators

Learn More

Exponential Regression

Definition

Exponential Regression models the relationship between a predictor variable (X) and a response variable (Y) where the dependent variable changes at a rate proportional to its current value. The model has the form y=aebxy=a \cdot e^{bx}, where aa and bb are constants determined by the regression.

Key Formulas

Exponential Model:

y=aebxy = a \cdot e^{bx}

Log-Transformation:

ln(y)=ln(a)+bx\ln(y) = \ln(a) + bx

Coefficient a (initial value):

a=eln(a)=eintercepta = e^{\ln(a)} = e^{\text{intercept}}

Coefficient b (growth/decay rate):

b=slopeb = \text{slope}

Doubling/Half-life Time:

t=ln(2)bt = \frac{\ln(2)}{|b|}

Key Assumptions

Exponential relationship: The relationship between X and Y follows an exponential pattern
Positive Y values: Dependent variable values must be positive (for log transformation)
Independence: Observations are independent
Homoscedasticity: After log transformation, residuals should have constant variance

Practical Example

Step 1: Data
Year (X)Population (Y)ln(Y)
11254.83
21505.01
31795.19
105806.36
Step 2: Log-Transform Data

Transform the dependent variable by taking the natural logarithm of each Y value. Then fit a linear regression to X vs. ln(Y).

Step 3: Fit Linear Regression to Transformed Data

After linear regression on the transformed data, we get:

ln(y)=4.78+0.17x\ln(y) = 4.78 + 0.17x
Step 4: Convert Back to Exponential Form

Calculate a = e^(intercept) = e^4.78 ≈ 119.18

The growth rate b = 0.17

y=119.18e0.17xy = 119.18 \cdot e^{0.17x}
Step 5: Interpret Results

This population grows by approximately 17% per year (b = 0.17).

The doubling time is ln(2)/0.17 ≈ 4.08 years.

Code Examples

R
library(tidyverse)

data <- tibble(
  Years =  c(1, 2, 3, 4, 5, 6, 7, 8, 9, 10),
  Population = c(125, 150, 179, 213, 252, 301, 350, 418, 489, 580)
)

model <- lm(log(Population) ~ Years, data = data)
summary(model)

a <- exp(coef(model)[1])  # Intercept
b <- coef(model)[2]       # Growth rate

str_glue("Exponential function: y = {round(a, 2)} * e^({round(b, 2)} * x)")
str_glue("Doubling time = {round(log(2)/b, 2)} years")

fitted_exp <- exp(predict(model))
SSE <- sum((data$Population - fitted_exp)^2)
SST <- sum((data$Population - mean(data$Population))^2)
R_squared_exp <- 1 - SSE/SST
print(str_glue("R-squared (exponential scale): {round(R_squared_exp, 4)}"))


data$Fitted <- exp(predict(model))

ggplot(data, aes(x = Years)) +
  geom_point(aes(y = Population), color="blue", size = 3) +
  geom_line(aes(y = Fitted), color = "red", linewidth = 1) +
  labs(title = "Exponential Growth Model",
       subtitle = paste0("y = ", round(a, 2), " * e^(", round(b, 3), "x)"),
       x = "Years",
       y = "Population") +
  theme_minimal()
Python
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from scipy.optimize import curve_fit
import statsmodels.api as sm

# Sample data
years = np.array([1, 2, 3, 4, 5, 6, 7, 8, 9, 10])
population = np.array([125, 150, 179, 213, 252, 301, 350, 418, 489, 580])

# Method 1: Linear regression on log-transformed data
X = sm.add_constant(years)
model = sm.OLS(np.log(population), X).fit()
print(model.summary())

# Extract coefficients
a = np.exp(model.params[0])  # Intercept
b = model.params[1]          # Growth rate

print(f"Exponential function: y = {a:.2f} * e^({b:.2f} * x)")

# Calculate fitted values
fitted_values = np.exp(model.predict())

# Method 2: Direct curve fitting
def exp_func(x, a, b):
    return a * np.exp(b * x)

# Fit curve
params, covariance = curve_fit(exp_func, years, population)
a_direct, b_direct = params

print(f"Direct curve fitting: y = {a_direct:.2f} * e^({b_direct:.2f} * x)")

# Plot results
plt.figure(figsize=(10, 6))
plt.scatter(years, population, label='Observed data')
plt.plot(years, fitted_values, 'r-', label=f'Fitted: {a:.2f} * e^({b:.2f} * x)')
plt.plot(years, exp_func(years, a_direct, b_direct), 'g--', 
         label=f'Direct fit: {a_direct:.2f} * e^({b_direct:.2f} * x)')
plt.xlabel('Years')
plt.ylabel('Population')
plt.title('Exponential Regression')
plt.legend()
plt.grid(True)
plt.show()

Verification