# Linear Regression Calculator

The Linear Regression Calculator can be used to derive the linear regression equation. Example is included to demonstrate how to use the calculator.

Please enter your values in the Calculator. Each value should be separated by a comma.

X Values (Each Value Separated by Comma): Y Values (Each Value Separated by Comma):

Enter Value (X) to Make an Estimation:

## How to use the Linear Regression Calculator

Let's now review a simple example to see how to use the Linear Regression Calculator. Suppose that you have the following dataset:

• The X values are: 2, 7, 12
• The Y values are: 4, 11, 15

Plug the above values in the calculator. Each value should be separated by a comma:

Once you're done entering the numbers, click on the Get Linear Regression Equation button, and you'll see the Linear Regression equation, as well as the R-squared and the Adjusted R-squared:

To make an estimation, type your value in the third entry box. For example, type the value of 9 in the entry box:

Now, click on the Estimate button and you'll get the estimation of 12.2:

## How to Manually Derive the Linear Regression Equation

The equation of a Simple Linear Regression is:

```Y = a + bX
```

Where:

• Y = Dependent variable
• a = Y-Intercept
• b = Slope of the regression line
• X = Independent variable

Let's now review an example to demonstrate how to derive the Linear Regression equation for the following data:

• The X values are: 2, 7, 12
• The Y values are: 4, 11, 15

To start, use the following equation to get the Y-Intercept:

```             (Σy)*(Σx2) - (Σx)*(Σxy)
a =              n*(Σx2) - (Σx)2
```

For our example:

• Σy = 4+11+15 = 30
• Σx2 = (22) + (72) + (122) = 197
• Σx = 2+7+12 = 21
• Σxy = (2*4) + (7*11) + (12*15) = 265
• n = 3

Plug the above results in the equation to get the Y-Intercept:

```          (Σy)*(Σx2) - (Σx)*(Σxy)           (30)*(197) - (21)*(265)
a =            n*(Σx2) - (Σx)2     =          3*(197) - (21)2    =  2.3
```

So the Y-Intercept is 2.3.

Now let's get the Slope of the regression line using this equation:

```          n*(Σxy) - (Σx)*(Σy)
b =        n*(Σx2) - (Σx)2
```

Plug the values into the equation:

```          n*(Σxy) - (Σx)*(Σy)           3*(265) - (21)*(30)
b =        n*(Σx2) - (Σx)2   =      3*(197) - (21)2    =  1.1
```

You'll then get the slope of 1.1.

For the final part, let's construct the Linear Regression equation:

```Y = a + bX = 2.3 + 1.1X
```

### Make an Estimation

Let's now make an estimation, where X = 9:

```Y = 2.3 + 1.1X = 2.3 + 1.1*9 = 12.2
```

The estimated value is therefore 12.2.