Q:

# How do you do linear regression?

A:

Linear regression is a curve-fitting strategy that approximates a function from given data. It plots a straight line through a curve without necessarily touching the data points. Since the approximated function is linear, it follows the formula: y = mx + b.

## Keep Learning

1. Calculate the mean of both x and y

It is necessary to first find the averages, or means, of both sets of data points. In order to do this, add the value of all the data points under x together, then divide the result by the actual number of data points. The same is done for the y data points.

2. Find the slope

To find the slope, employ the following equation: m = ((n * sum(x, y)) - (sum(x) * sum(y))) / ((n * sum(x^2)) - (sum(x))^2). N is the actual number of plotted coordinates on the curve.

3. Find the y intercept

The following equation determines the y-intercept: b = y_bar - m * x_bar. M is the calculated slope, x_bar is the average of the x coordinates and y_bar is the average of the y coordinates.

4. Determine the approximated function

Use the calculated values to determine the function obtained by linear regression: f(x) = mx + b.

Sources:

## Related Questions

• A: According to the University of Connecticut, the criterion variable is the dependent variable, or Y hat, in a regression analysis. The criterion variable is... Full Answer >
Filed Under:
• A: A regression coefficient, commonly represented by an "m," is the slope of a straight line. This slope is obtained by fitting a linear equation to a data se... Full Answer >
Filed Under:
• A: The cumulative distribution function for a binomial distribution is f(k; n, p) = (p^i)(1 - p)^(n - i) between the limits of i and k. K is defined as the to... Full Answer >
Filed Under:
• A: The power property of logarithms states that any exponent in the argument of a logarithmic function can be brought out as a multiplier to the rest of the e... Full Answer >
Filed Under:
PEOPLE SEARCH FOR