Show Sidebar Hide Sidebar

# Fitting data with an exponential function

Plotly offers free, online tools for analyzing data and making graphs. In this tutorial we’ll show you how to fit exponential curves to your data and explain what that means. Make sure to check out our other tutorials to learn how to fit your data with polynomials, gaussians, and logarithms.

An exponential fit is a method of modeling data with an exponential function. Exponential growth (or decay) occurs naturally in many settings–the growth of bacteria can be modeled with an exponential function, scientists study radioactive decay in order to determine how old dinosaur bones are, and money in a savings account grows exponentially.

There are many theories about the destruction of Easter Island. Dr Terry Hunt at the University of Hawaii hypothesizes that rats may be part of the explanation. His work was featured in an American Scientist article “Rethinking the Fall of Easter Island”. Under ideal conditions, a rat population can double every 47 days. The graph on the right contains data about optimal rat population growth during the first 188 days (about six months). In this tutorial we’ll estimate the population size of a colony of rats living in optimal conditions after three years assuming a single pair of rats to start.

It’s important to remember that the exponential growth model for population has limits. Eventually a population, especially in a closed environment like Easter Island, will deplete resources which will hinder growth. For this example we’re ignoring these issues. If you want to learn more, a nice article in Nature Education discusses both exponential and logistic equations for modeling population growth.

Exponential data falls into two categories: growth and decay. Learn to recognize the shape of these two types of exponential functions and you’ll be analyzing your data in no time!

 Exponential growth is characterized by slow initial growth that becomes rapidly faster as time progresses. Exponential decay begins with a fast (and negative) rate of change, which decreases (in magnitude) with time.

In Plotly, our predefined exponential functions take the form \$a+be^{cx}\$. If you want to fit your curve with another base, you can use the Define your own fit function option. If you need help, our tutorial on custom fit functions will help. Plotly finds the best exponential fit by choosing coefficients \$a\$, \$b\$ and \$c\$ that minimize the mean squared error. The closer the \$R^2\$ value is to 1, the better the fit.

### Step 1: Make a plot

We have a collection of great tutorials to help you make line graphs, scatter plots, histograms, bar charts, and more. If you need help, you’ll find everything you need on our tutorials page.

 You can import files from Google Drive, Dropbox, or Excel for your graphs. You’ll find more details in our “How to Enter Data in the Grid” tutorial. In an optimal world (for rodents), a rat population can double in size every 47 days. Starting with two rats on day zero, we’ll have four rats on day 47, 8 rats on day 94, and so on.You can enter this data in Plotly’s grid directly, or you can Fork & edit it fromhttps://plot.ly/~mariahh/63 To make a scatter plot, choose Scatter plots from the MAKE A PLOT menu.Plotly will automatically select the first column of data to be \$x\$ values, and the second column to be \$y\$ values. In our case, this is exactly what we want.Click on the blue Scatter plot button in the sidebar to make your scatter plot. Your plot will open in a new tab.