Copyright © Had2Know 2010-2024. All Rights Reserved.

Terms of Use | Privacy Policy | Contact

Site Design by E. Emerson

# Regression Calculator

### Linear, Exponential, Power, Logarithmic

#### How to Fit Lines and Curves to Data: Least Squares Regression

The method of least squares regression allows you to fit an equation through set of data points. In linear regression, the "best fit" line y = mx + b satisfies the condition that the sum of the squared vertical distances between the points and the line is minimized, hence the name least squares. You can adapt the method of linear least squares regression to find an exponential regression curve y = ac^{x}, power regression curve y = ax

^{c}, or logarithmic regression curve y = a + cLn(x).

#### Step 1

To find the regression line y = mx + b, you must compute the following quantities from the paired x and y data:x, y, ∑(x

^{2}), ∑(xy), ∑(y

^{2})

#### Step 2

The slope of the regression line, m, is given by the formulam = [∑(xy) - n(x)(y)]/[∑(x

^{2}) - n(x)

^{2}],

where n is the number of data points. Once you calculate m, the formula for b is

b = y - mx

#### Step 3

You can compute the correlation coefficient which indicates how closely the line fits. The correlation coefficient ranges from -1 to 1, with -1 meaning perfect negative correlation (negative slope) and 1 meaning perfect positive correlation. When the coefficient is close to zero, data does not exhibit a linear relation. The correlation coefficient equation is[∑(xy) - n(x)(y)]/sqrt[(∑(x

^{2}) - n(x)

^{2})(∑(y

^{2}) - n(y)

^{2})]

#### Step 4

You can obtain the equations for exponential, power, and logarithmic regression curves by linearizing the functions. For example, the equation y = ac^{x}can be linearized by taking the natural logarithm of both sides. Doing this yields Ln(y) = Ln(a) + Ln(c)x. This is now linear in the variables Ln(y) and x. You can solve for Ln(c) and Ln(a) by using the formulas for straight line regression, just replace the y data with Ln(y).

Similarly, the equation y = ax

^{c}can be linearized to Ln(y) = Ln(a) + cLn(x). This is now linear in the variables Ln(y) and Ln(x).

The equation y = a + cLn(x) is already linear in the variables y and Ln(x).

The regression calculator above will compute all four types of simple regression along with the correlation coefficients of each curve so that you can see which line or curve fits best.

© *Had2Know 2010
*