Sie sind auf Seite 1von 4

Linear Regression

linear regression is an approach to modeling the relationship between a scalar variable y and one or
more variables denoted X. In linear regression, models of the unknown parameters are estimated from
the data using linear functions. Such models are called linear models

Y = a1*x1 +a2*x2+ an*xn


Say we have a data set

x1
1.1
1.2
1.3
1.4
1.5
1.6
1.7
1.8
1.9

x2
6.9
7.2
7.8
8.2
8.7
9.1
9.6
10.0
10.5

x3
2.2
2.6
2.9
3.3
3.6
4.0
4.3
4.7
5.0

Y
13.9
14.7
16.0
16.9
17.9
18.9
19.9
21.0
22.0

Yactual
25
20
15
Yactual

10
5
0
0

10

We can set up an Excel sheet to calculate residuals

Residual, Sum-of-Squares Error (SSE)


A residual is the difference between an observed and predicted value of a function. (A predicted
value means a value given by some mathematical model.)
Residal = Observed value - Predicted value
The sum-of-squares error (SSE) when observed data are approximated by a function is given
by
SSE = Sum of squares of residual
= Sum of (yobserved - ypredicted)2
The smaller SSE, the better the approximating function fits the data.

Linear Regression
Coefficients

a1
1
x1
1.1
1.2
1.3
1.4
1.5
1.6
1.7
1.8
1.9

a2
a3
By Changing the coefficient Cells
1
1
x2
x3
ypred
Yactual
6.89
2.2
=$B$3*B5+$C$3*C5+$D$3*D5
13.913
7.2
2.6
=$B$3*B6+$C$3*C6+$D$3*D6
14.7
7.8
2.9
=$B$3*B7+$C$3*C7+$D$3*D7
15.95
8.20666666666667
3.26666666666667
=$B$3*B8+$C$3*C8+$D$3*D8
16.8913333333333
8.66166666666667
3.61666666666667
=$B$3*B9+$C$3*C9+$D$3*D9
17.9098333333333
9.11666666666667
3.96666666666667
=$B$3*B10+$C$3*C10+$D$3*D10
18.9283333333333
9.57166666666667
4.31666666666667
=$B$3*B11+$C$3*C11+$D$3*D11
19.9468333333333
10.0266666666667
4.66666666666667
=$B$3*B12+$C$3*C12+$D$3*D12
20.9653333333334
10.4816666666667
5.01666666666667
=$B$3*B13+$C$3*C13+$D$3*D13
21.9838333333334

Set up a solver with the following parameters

error
=(E5-F5)^2
=(E6-F6)^2
=(E7-F7)^2
=(E8-F8)^2
=(E9-F9)^2
=(E10-F10)^2
=(E11-F11)^2
=(E12-F12)^2
=(E13-F13)^2
=SUM(G5:G13)

After the solver completes its run it asks if you want to keep the solver results.

Linear Regression
Coefficients

a1

a2
1.4

x1

a3
1.7

x2
1.1
1.2
1.3
1.4
1.5
1.6
1.7
1.8
1.9

6.89
7.2
7.8
8.206667
8.661667
9.116667
9.571667
10.02667
10.48167

So the equation is:

Y = 1.4*x1 + 1.7*x2 + 0.3*x3

0.3
x3
2.2
2.6
2.9
3.266667
3.616667
3.966667
4.316667
4.666667
5.016667

By Changing the coefficient Cells


ypred
Yactual error
13.913
13.913 4.77E-26
14.7
14.7 2.42E-25
15.95
15.95 5.09E-26
16.89133 16.89133 5.05E-29
17.90983 17.90983
0
18.92833 18.92833
0
19.94683 19.94683 1.26E-29
20.96533 20.96533 5.05E-29
21.98383 21.98383 1.14E-28
3.41E-25

Goal Seek

Das könnte Ihnen auch gefallen