You are on page 1of 25

Excel Regression Tools

ProcessTrends.Com
D. Kelly O'Day

Manual Calculations
Add Trendline to Chart
Slope and Intercept Functions
LINEST Function
Analysis Toolpak Regression
Interactive Regression

Manual Calculations: We can calculate a, b, r and r2 by using standard regression equations

Y a bx
b
a

n ( xy )

x
n x x
y b x

Year

n x

Statistic
b
a
r

y
2

r2

xy

x y

n y

Annual Avg
Temp - oC

1918
1919
1920

xy
6.26 12015.0877
5.16 9904.14301
6.54 12558.6885

x2
3678724
3682561
3686400

1921

7.32 14059.6148

1922

39.24
26.64
42.78

Par
Sx
Sy
S(xy)

3690241

53.57

S(x2)

5.47 10506.2312

3694084

29.88

S(x)2

1923

5.75 11059.6208

3697929

33.08

S(y2)

1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949

5.84
6.80
6.64
6.09
6.02
5.88
7.32
5.62
7.14
6.65
8.32
7.02
6.97
7.31
8.51
7.41
4.41
4.89
4.38
7.42
6.88
6.95
5.66
5.73
6.80
7.78

3701776
3705625
3709476
3713329
3717184
3721041
3724900
3728761
3732624
3736489
3740356
3744225
3748096
3751969
3755844
3759721
3763600
3767481
3771364
3775249
3779136
3783025
3786916
3790809
3794704
3798601

34.15
46.22
44.14
37.07
36.21
34.61
53.65
31.56
50.97
44.18
69.20
49.28
48.58
53.42
72.44
54.97
19.47
23.94
19.16
55.02
47.37
48.27
32.02
32.81
46.20
60.60

S(y)2
n

11243.3093
13087.363
12796.0274
11733.0542
11602.2404
11348.3334
14137.1178
10848.5167
13793.741
12847.8301
16087.7008
13584.2301
13493.8142
14157.6126
16494.2384
14376.2241
8559.85246
9497.0737
8500.63945
14411.7367
13379.0754
13513.2205
11011.2138
11151.7759
13240.0131
15172.2975

y2

1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998

6.67
6.61
5.25
7.42
6.07
5.69
5.35
6.87
5.97
7.55
6.35
7.36
5.51
5.59
6.42
5.57
5.85
7.06
6.67
6.25
5.46
6.96
7.15
6.99
7.42
8.00
5.96
6.54
6.12
5.76
5.81
5.97
6.93
7.45
7.28
5.19
6.01
5.14
7.15
8.16
8.24
7.09
7.58
6.64
7.47
6.96
5.61
7.16
6.86

13007.3014
12902.257
10239.4667
14492.8652
11852.4822
11127.4315
10465.1344
13447.0027
11683.091
14782.131
12441.1803
14431.8855
10809.8137
10982.0438
12607.1628
10939.3973
11507.2942
13881.0921
13125.9148
12312.9932
10756.2
13719.24
14090.6404
13788.297
14637.3452
15795.6712
11786.3541
12937.163
12096.1474
11408.7995
11505.6393
11820.3285
13727.9293
14768.1888
14440.376
10304.0534
11929.0586
10214.8132
14209.3115
16236.7792
16405.2329
14121.9175
15103.823
13229.6978
14889.9901
13878.0945
11205.4131
14302.3499
13706.28

3802500
3806401
3810304
3814209
3818116
3822025
3825936
3829849
3833764
3837681
3841600
3845521
3849444
3853369
3857296
3861225
3865156
3869089
3873024
3876961
3880900
3884841
3888784
3892729
3896676
3900625
3904576
3908529
3912484
3916441
3920400
3924361
3928324
3932289
3936256
3940225
3944196
3948169
3952144
3956121
3960100
3964081
3968064
3972049
3976036
3980025
3984016
3988009
3992004

44.49
43.73
27.52
55.07
36.79
32.40
28.63
47.21
35.60
56.94
40.29
54.16
30.36
31.30
41.21
30.99
34.26
49.80
44.48
39.11
29.81
48.45
51.06
48.84
54.98
63.96
35.58
42.82
37.40
33.23
33.77
35.60
47.97
55.46
52.98
26.95
36.08
26.43
51.09
66.64
67.96
50.31
57.49
44.06
55.76
48.39
31.52
51.29
47.06

1999
2000
2001

7.64 15272.9077
8.12 16230.6011
6.91 13829.4387

3996001
4000000
4004001

58.37
65.86
47.77

ion equations
Value
0.00780
-8.72635
0.20850
0.04347

Range
Name
Value
164598 sum_x
550.74 sum_y
1079557.661 sum_xy
322579166 sum_x2
27092501604 sum_x_squ
3679.97 sum_y2
303313 sum_y_squ
84 n

adj

(1 r 2 )( n 1)
1
( n k 1)

r 2 )( n 1)
( n k 1)

Add Trendline to Chart: We can calculate a, b and r by making a chart and adding a simple linear
with options to display equations and r value

9
y = 0.0078x - 8.7264
R = 0.0435

8
7
6
5
4
1910

1920

1930

1940

1950

1960

1970

1980

nd adding a simple linear trendline

1980

1990

2000

2010

Use Slope, Intercept and rsqu Functions: We can have Excel calculate a, b and r2 directly by using t
from Excel standard function list
9
y = 0.0078x - 8.7264
R = 0.0435

8
7
6
5
4
1910

1920

Intercept
Slope
r2

1930

1940

-8.726350705
0.007799318
0.043471312

1950

#NAME?
#NAME?
#NAME?

1960

1970

calculate a, b and r2 directly by using these functions

1980

1990

2000

#NAME?
a1
SE a1

Linest
0.00779932 -8.7263507
0.00404015 7.91727716

a0
SEa0

r2
F
SS regr

0.04347131 0.89783155
3.72664996
82
3.0040581 66.1003225

SE Y
df
SS resid

P critical

5%

Interactive Linear Regression With Excel Func

Regression Statistics
r2

0.043471312

r adjusted
Standard Error
Observations
ANOVA
Regression
Residuals
Total
Intercept
X Variable

Move Slider to Adj Regr Start Yr

0.032
0.897832
84

Regr Start
SS
3.004
66.100
69.104
Standard Error
7.9172772
0.0040401

1
82
83
Coefficients
-8.7263507
0.0077993

1918

MS
F
3.004058098 3.726649957
0.806101494
t Stat
-1.102191
1.930453

P-value
0.274
0.057

9
8

y = 0.0078x - 8.7264
R = 0.0435

7
6
5
4
1910

1920

1930

1940

1950

1960

1970

SUMMARY OUTPUT
Regression Statistics
Multiple R
0.148303216
R Square
0.021993844
Adjusted R Square
0.007175569
Standard Error
0.950853194
Observations
68
ANOVA
df
Regression
Residual
Total

Intercept
X Variable 1

SS
1.341931742
59.67203852
61.01397026

MS
1.341931742
0.904121796

F
1.484237797

Coefficients
Standard Error
-7.460628096
11.55910051
0.007157139
0.005874727

t Stat
-0.645433275
1.218292985

P-value
0.520884036
0.227449831

1
66
67

Regression With Excel Functions

Significance of F
0.0570

Lower 95%
-24.476
-0.00024

1980

1990

Upper 95%
7.02364
0.01584

2000

Significance F
0.227449831

Lower 95%
-30.53911663
-0.004572132

Upper 95%
Lower 95.0% Upper 95.0%
15.61786043 -30.539117 15.6178604
0.018886409 -0.0045721 0.01888641

St
End

St Yr Offset
0
Full Data
Regr Data Data Rows
1918
1918
2
2001

2001

85

Analysis Tookpak Results


SUMMARY OUTPUT
Regression Statistics
Multiple R
0.208497751
R Square
0.043471312
Adjusted R Square
0.031806328
Standard Error
0.897831551
Observations
84
ANOVA
df
Regression
Residual
Total

Intercept
X Variable 1

SS
3.004058098
66.1003225
69.10438059

MS
3.004058098
0.806101494

F
3.726649957

Significance F
0.05700736

Coefficients
Standard Error
-8.726350705
7.917277155
0.007799318
0.004040149

t Stat
-1.102190884
1.930453304

P-value
0.273603214
0.05700736

Lower 95%
-24.47633678
-0.000237824

1
82
83

Upper 95%
7.023635374
0.01583646

Year
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965

Mean
6.26
5.16
6.54
7.32
5.47
5.75
5.84
6.80
6.64
6.09
6.02
5.88
7.32
5.62
7.14
6.65
8.32
7.02
6.97
7.31
8.51
7.41
4.41
4.89
4.38
7.42
6.88
6.95
5.66
5.73
6.80
7.78
6.67
6.61
5.25
7.42
6.07
5.69
5.35
6.87
5.97
7.55
6.35
7.36
5.51
5.59
6.42
5.57

No obs
365
365
366
365
365
365
366
365
365
365
366
365
365
365
366
365
365
365
366
365
365
365
366
365
365
365
366
365
334
365
366
365
365
365
366
365
365
365
366
365
365
365
366
365
365
365
366
365

1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001

5.85
7.06
6.67
6.25
5.46
6.96
7.15
6.99
7.42
8.00
5.96
6.54
6.12
5.76
5.81
5.97
6.93
7.45
7.28
5.19
6.01
5.14
7.15
8.16
8.24
7.09
7.58
6.64
7.47
6.96
5.61
7.16
6.86
7.64
8.12
6.91

365
365
366
365
365
365
366
365
365
365
366
365
365
365
366
365
365
365
366
365
365
365
366
365
365
365
366
365
365
365
366
365
365
365
366
364

adj

(1 r 2 )( n 1)
1
( n k 1)
0.7
1

0.66250
0.68333
0.69375
0.69694
0.69848
0.69940
0.69970
0.69985
0.69994
0.69997
0.69998

0.61429
0.66471
0.68723
0.69381
0.69695
0.69879
0.69940
0.69970
0.69988
0.69994
0.69997

0.55000
0.64375
0.68043
0.69063
0.69541
0.69819
0.69910
0.69955
0.69982
0.69991
0.69995

0.46000
0.62000
0.67333
0.68737
0.69385
0.69758
0.69879
0.69940
0.69976
0.69988
0.69994

0.32500
0.59286
0.66591
0.68404
0.69227
0.69696
0.69849
0.69925
0.69970
0.69985
0.69992

r2adj

n
10
20
50
100
200
500
1000
2000
5000
10000
20000

0.70
0.68
0.66
0.64
0.62
0.60
0.58
0.56
0.54
0.52
0.50
0

100

200

300

400

500

A
1
2
3
4

Experimental data
x
y
0.0
8.98
12.0
8.14

29.5

6.67

6
7
8

43.0
53.0
62.5
75.5
85.0
93.0

6.08
5.90
5.83
4.68
4.20
3.72

9
10
11
12
13 =t*SYX*SQRT(1/n+(A18-XAVG)^2/SSX)
14
=(m*A18+b)+B18
15
Regression line confidence interval
16
17
x
CI
y+CI
y-CI
18
0
0.45
9.16
8.25
19
10
0.39
8.56
7.78
20
20
0.33
7.97
7.31
21
30
0.28
7.39
6.83
22
40
0.25
6.82
6.33
23
50
0.23
6.28
5.81
24
60
0.25
5.76
5.27
25
70
0.28
5.26
4.70
26
80
0.33
4.77
4.12
27
90
0.38
4.30
3.53
28
100
0.45
3.83
2.93
29

Slope, m
Intercept, b
Observations, n
Std error in estimate, Syx
Average x
SSX
t(a,df)

Derived values
m
-0.053 SLOPE(y,x)
b
8.704 INTERCEPT(y,x)
n
9.000 COUNT(x)
SYX

0.297 STEYX(y,x)

XAVG
SSX
t

50.389 AVERAGE(x)
8301.389 DEVSQ(x)
2.365 TINV(0.05,n-2)

10

y = -0.0532x + 8.704

3
0

10

20

30

40

50

60

70

80

90

100

50

74

3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31

52
55
55
58
60
63
64
65
68
70
70

77
76
85
82
78
87
92
90
91
87
98

Slope
Std err in slope, Sb

0.925206875

=SLOPE(y,x)

0.175878591

=INDEX(LINEST(Y,X,1,1),2,1)

degrees freedom
Confidence level
Student t
Confidence interval

10
95%
2.228138852
0.392

=COUNT(X)-2
user selected value
=TINV(1-E4,E3)
=E5*E2

slope
lower
upper

Confidence interval of slope


t(a , df ) S b

0.925 0.392
0.533
1.317

=ROUND(E1,3)&" "&ROUND(E6,3)
=E1-E6
=E1+E6

100

95

y = 0.9252x + 28.467

90
85
80
75
70

40

50

60

70

80

You might also like