How to Calculate Regression Coefficient

How to Calculate Regression Coefficient
••• seb_ra/iStock/GettyImages

One the most basic tools for engineering or scientific analysis is linear regression. This technique starts with a data set in two variables. The independent variable is usually called "x" and the dependent variable is usually called "y." The goal of the technique is to identify the line, y = mx + b, that approximates the data set. This trend line can show, graphically and numerically, relationships between the dependent and independent variables. From this regression analysis, a value for correlation is also calculated.

    Identify and separate the x and y values of your data points. If you are using a spreadsheet, enter them into adjacent columns. There should be the same number of x and y values. If not, the calculation will be inaccurate, or the spreadsheet function will return an error. x = (6, 5, 11, 7, 5, 4, 4) y = (2, 3, 9, 1, 8, 7, 5)

    Calculate the average value for the x values and the y values by dividing the sum of all the values by the total number of values in the set. These averages will be referred to as "x_avg" and y_avg." x_avg = (6 + 5 + 11 + 7 + 5 + 4 + 4) / 7 = 6 y_avg = (2 + 3 + 9 + 1 + 8 + 7 + 5) / 7 = 5

    Create two new data sets by subtracting the x_avg value from each x value and the y_avg value from each y value. x1 = (6 - 6, 5 - 6, 11 - 6, 7 - 6 ... ) x1 = (0, -1, 5, 1, -1, -2, -2) y1 = (2 - 5, 3 - 5, 9 - 5, 1 - 5, ... ) y1 = (-3, -2, 4, -4, 3, 2, 0)

    Multiply each x1 value by each y1 value, in order. x1y1 = (0 * -3, -1 * -2, 5 * 4, ... ) x1y1 = (0, 2, 20, -4, -3, -4, 0)

    Square each x1 value. x1^2 = (0^2, 1^2, -5^2, ... ) x1^2 = (0, 1, 25, 1, 1, 4, 4)

    Calculate the sums of the x1y1 values and x1^2 values. sum_x1y1 = 0 + 2 + 20 - 4 - 3 - 4 + 0 = 11 sum_x1^2 = 0 + 1+ 25 + 1 + 1 + 4 + 4 = 36

    Divide "sum_x1y1" by "sum_x1^2" to get the regression coefficient. sum_x1y1 / sum_x1^2 = 11 / 36 = 0.306

    Things You'll Need

    • Spreadsheet software (optional)
    • Calculator

    Tips

    • For those who prefer to work directly with the equation, it is m = sum[(x_i - x_avg)(y_i - y_avg)] / sum[(x_i - x_avg)^2].

      Many spreadsheets will have a variety of linear regression functions. In Microsoft Excel, you can use the "Slope" function to take the average of the x and y columns, and the spreadsheet will automatically perform all the remaining calculations.

Related Articles

How to Plot a Lognormal Curve
How to Calculate Linearity
How to Calculate the RMSE or Root Mean Squared Error
How to Find a Z Score
How to Solve a Parabola
How to Find Correlation Coefficient & Coefficient of...
How to Find the Angle of a Curve
How to Calculate a Temperature Range
How to Calculate a Sigma Value
How to Find Y Value for the Slope of a Line
How to Calculate CV Values
How to Determine the Y-Intercept of a Trend Line
How to Calculate Correlation
How to Find The Slope of a Line Given Two Points
How to Calculate SSE
How to Write a Linear Regression Equation
How to Type a Mixed Fraction in a TI-83 Plus
How to Calculate Arctan
How to Calculate Slope Ratio
How to Calculate Correlation Coefficient Between Two...