Choose an appropriate model for data

Now that we have discussed various mathematical models, we need to learn how to choose the appropriate model for the raw data we have. Many factors influence the choice of a mathematical model, among which are experience, scientific laws, and patterns in the data itself. Not all data can be described by elementary functions. Sometimes, a function is chosen that approximates the data over a given interval. For instance, suppose data were gathered on the number of homes bought in the United States from the years 1960 to 2013. After plotting these data in a scatter plot, we notice that the shape of the data from the years 2000 to 2013 follow a logarithmic curve. We could restrict the interval from 2000 to 2010, apply regression analysis using a logarithmic model, and use it to predict the number of home buyers for the year 2015.

Three kinds of functions that are often useful in mathematical models are linear functions, exponential functions, and logarithmic functions. If the data lies on a straight line, or seems to lie approximately along a straight line, a linear model may be best. If the data is non-linear, we often consider an exponential or logarithmic model, though other models, such as quadratic models, may also be considered.

In choosing between an exponential model and a logarithmic model, we look at the way the data curves. This is called the concavity. If we draw a line between two data points, and all (or most) of the data between those two points lies above that line, we say the curve is concave down. We can think of it as a bowl that bends downward and therefore cannot hold water. If all (or most) of the data between those two points lies below the line, we say the curve is concave up. In this case, we can think of a bowl that bends upward and can therefore hold water. An exponential curve, whether rising or falling, whether representing growth or decay, is always concave up away from its horizontal asymptote. A logarithmic curve is always concave away from its vertical asymptote. In the case of positive data, which is the most common case, an exponential curve is always concave up, and a logarithmic curve always concave down.

A logistic curve changes concavity. It starts out concave up and then changes to concave down beyond a certain point, called a point of inflection.

After using the graph to help us choose a type of function to use as a model, we substitute points, and solve to find the parameters. We reduce round-off error by choosing points as far apart as possible.

Example 6: Choosing a Mathematical Model

Does a linear, exponential, logarithmic, or logistic model best fit the values listed below? Find the model, and use a graph to check your choice.

x 1 2 3 4 5 6 7 8 9
y 0 1.386 2.197 2.773 3.219 3.584 3.892 4.159 4.394

Solution

First, plot the data on a graph as in Figure 8. For the purpose of graphing, round the data to two significant digits.

Graph of the previous table’s values.

Figure 8

Clearly, the points do not lie on a straight line, so we reject a linear model. If we draw a line between any two of the points, most or all of the points between those two points lie above the line, so the graph is concave down, suggesting a logarithmic model. We can try [latex]y=a\mathrm{ln}\left(bx\right)\\[/latex]. Plugging in the first point, [latex]\left(\text{1,0}\right)\\[/latex], gives [latex]0=a\mathrm{ln}b\\[/latex]. We reject the case that = 0 (if it were, all outputs would be 0), so we know [latex]\mathrm{ln}\left(b\right)=0\\[/latex]. Thus = 1 and [latex]y=a\mathrm{ln}\left(\text{x}\right)\\[/latex]. Next we can use the point [latex]\left(\text{9,4}\text{.394}\right)\\[/latex] to solve for a:

[latex]\begin{cases}y=a\mathrm{ln}\left(x\right)\hfill \\ 4.394=a\mathrm{ln}\left(9\right)\hfill \\ a=\frac{4.394}{\mathrm{ln}\left(9\right)}\hfill \end{cases}\\[/latex]

Because [latex]a=\frac{4.394}{\mathrm{ln}\left(9\right)}\approx 2\\[/latex], an appropriate model for the data is [latex]y=2\mathrm{ln}\left(x\right)\\[/latex].

To check the accuracy of the model, we graph the function together with the given points.

Graph of previous table’s values showing that it fits the function y=2ln(x) with an asymptote at x=0.

Figure 9. The graph of [latex]y=2\mathrm{ln}x\\[/latex].

We can conclude that the model is a good fit to the data.

Compare the figure above to the graph of [latex]y=\mathrm{ln}\left({x}^{2}\right)\\[/latex] shown in Figure 10.

Graph of previous table’s values showing that it fits the function y=2ln(x) with an asymptote at x=0.

Figure 10. The graph of [latex]y=\mathrm{ln}\left({x}^{2}\right)\\[/latex]

The graphs appear to be identical when > 0. A quick check confirms this conclusion: [latex]y=\mathrm{ln}\left({x}^{2}\right)=2\mathrm{ln}\left(x\right)\\[/latex] for > 0.

However, if < 0, the graph of [latex]y=\mathrm{ln}\left({x}^{2}\right)\\[/latex] includes a “extra” branch, as shown below. This occurs because, while [latex]y=2\mathrm{ln}\left(x\right)\\[/latex] cannot have negative values in the domain (as such values would force the argument to be negative), the function [latex]y=\mathrm{ln}\left({x}^{2}\right)\\[/latex] can have negative domain values.

Graph of y=ln(x^2).

Figure 11

Try It 6

Does a linear, exponential, or logarithmic model best fit the data in the table below? Find the model.

x 1 2 3 4 5 6 7 8 9
y 3.297 5.437 8.963 14.778 24.365 40.172 66.231 109.196 180.034

Solution

Expressing an Exponential Model in Base e

While powers and logarithms of any base can be used in modeling, the two most common bases are [latex]10[/latex] and [latex]e[/latex]. In science and mathematics, the base e is often preferred. We can use laws of exponents and laws of logarithms to change any base to base e.

How To: Given a model with the form [latex]y=a{b}^{x}\\[/latex], change it to the form [latex]y={A}_{0}{e}^{kx}\\[/latex].

  1. Rewrite [latex]y=a{b}^{x}\\[/latex] as [latex]y=a{e}^{\mathrm{ln}\left({b}^{x}\right)}\\[/latex].
  2. Use the power rule of logarithms to rewrite y as [latex]y=a{e}^{x\mathrm{ln}\left(b\right)}=a{e}^{\mathrm{ln}\left(b\right)x}\\[/latex].
  3. Note that [latex]a={A}_{0}\\[/latex] and [latex]k=\mathrm{ln}\left(b\right)\\[/latex] in the equation [latex]y={A}_{0}{e}^{kx}\\[/latex].

Example 7: Changing to base e

Change the function [latex]y=2.5{\left(3.1\right)}^{x}\\[/latex] so that this same function is written in the form [latex]y={A}_{0}{e}^{kx}\\[/latex].

Solution

The formula is derived as follows

[latex]\begin{cases}y=2.5{\left(3.1\right)}^{x}\hfill & \hfill \\ =2.5{e}^{\mathrm{ln}\left({3.1}^{x}\right)}\hfill & \text{Insert exponential and its inverse}\text{.}\hfill \\ =2.5{e}^{x\mathrm{ln}3.1}\hfill & \text{Laws of logs}\text{.}\hfill \\ =2.5{e}^{\left(\mathrm{ln}3.1\right)}{}^{x}\hfill & \text{Commutative law of multiplication}\hfill \end{cases}\\[/latex]

Try It 7

Change the function [latex]y=3{\left(0.5\right)}^{x}\\[/latex] to one having e as the base.

Solution