You are on page 1of 15

EXCEL EXERCISE #11: Bivariate Regression

1. Enter the data on the attached page for STATE, ROBBERY (robberies per million
residents), and POLICE (police employees per 100,000 population) into cells
A1:C52.
A B C

1 State Crime Data Set

2 STATE POLICE (X) ROBBERY (Y)

3 AL 230 1321

4 AK 350 900

5 AZ 310 1936

6 AR 190 809

7 CA 270 3842

8 CO 270 1601

9 CT 260 2180

10 DE 280 1370

11 FL 300 3555

12 GA 240 1976

13 HI 290 1902

14 ID 240 468

15 IL 320 2170

16 IN 210 1414

17 IA 200 549

18 KS 230 1131

19 KY 200 952

20 LA 290 1970

21 ME 200 308

22 MD 310 3927

23 MA 290 2355

24 MI 250 2440

25 MN 190 991

26 MS 200 810

27 MO 280 2236

28 MT 240 340

29 NE 220 822
30 NV 360 4606

31 NH 240 420

32 NJ 350 3037

33 NM 280 1279

34 NY 370 6413

35 NC 220 823

36 ND 180 77

37 OH 210 2237

38 OK 230 1049

39 OR 240 1524

40 PA 240 1779

41 RI 280 1186

42 SC 240 1181

43 SD 200 201

44 TN 210 1806

45 TX 240 2085

46 UT 240 802

47 VT 200 389

48 VA 230 1201

49 WA 210 1351

50 WV 180 485

51 WI 240 707

52 WY 310 444

Regression Coefficients

1
2. Regress ROBBERY (Y) on POLICE (X). Enter the following labels.
A54: Sum =
A55: N =
A56: Mean =
E2: (Yi-Ybar)
F2: (Xi-Xbar)
G2: (Yi-Ybar)(Xi-Xbar)
H2: (Xi-Xbar)2
I2: (Xi-Xbar)2
F54: Sum =
3. Enter the following formulas.
B54: =sum(b3:b52)
C54: =sum(c3:c52)
B55: =count(b3:b52)
C55: =count(c3:c52)
B56: =average(b3:b52)
C56: =average(c3:c52)

4. Enter the following formula.


E3: =c3-c$56

5. Copy the formula in cell E3 to cells E4 to E52.

6. Enter the following formula.


F3: =b3-b$56

7. Copy the formula in cell F3 to cells F4 to F52.

8. Enter the following formula.


G3: =f3*e3

9. Copy the formula in cell G3 to cells G4 to G52.

10. Enter the following formula.


H3: =f3^2

11. Copy the formula in cell H3 to cells H4 to H52.

12. Enter the following formula.


I3: =e3^2

13. Copy the formula in cell I3 to cells I4 to I52.

2
14. Enter the following formulas.
G54: =sum(g3:g52)
H54: =sum(h3:h52)
I54: =sum(i3:i52)

15. Enter the following labels.


A60: Slope =
A61: Intercept =
B59: Coefficient

16. Enter the following formulas.


B60: =g54/h54
B61: =c56-b60*b56
Your spreadsheet should look similar to the one below.

3
A B C D E F G H I

1 State Crime Data Set

2 STATE POLICE ROBBERY (Yi-Ybar) (Xi-Xbar) (Xi-Xbar)(Yi- (Xi-Xbar)2 (Yi-Ybar)2


(X) (Y)
Ybar)

3 AL 230 1321 -266.14 -21.2 5642.168 449.44 70830.4996

4 AK 350 900 -687.14 98.8 -67889.432 9761.44 472161.379


6

5 AZ 310 1936 348.86 58.8 20512.968 3457.44 121703.299


6

6 AR 190 809 -778.14 -61.2 47622.168 3745.44 605501.859


6

7 CA 270 3842 2254.86 18.8 42391.368 353.44 5084393.62


8 CO 270 1601 13.86 18.8 260.568 353.44 192.0996

9 CT 260 2180 592.86 8.8 5217.168 77.44 351482.979


6

1 DE 280 1370 -217.14 28.8 -6253.632 829.44 47149.7796


0

1 FL 300 3555 1967.86 48.8 96031.568 2381.44 3872472.98


1

1 GA 240 1976 388.86 -11.2 -4355.232 125.44 151212.099


2 6

1 HI 290 1902 314.86 38.8 12216.568 1505.44 99136.8196


3

1 ID 240 468 - -11.2 12534.368 125.44 1252474.34


4 1119.14

1 IL 320 2170 582.86 68.8 40100.768 4733.44 339725.779


5 6

1 IN 210 1414 -173.14 -41.2 7133.368 1697.44 29977.4596


6

1 IA 200 549 - -51.2 53152.768 2621.44 1077734.66


7 1038.14

1 KS 230 1131 -456.14 -21.2 9670.168 449.44 208063.699


8 6

1 KY 200 952 -635.14 -51.2 32519.168 2621.44 403402.819


9 6

2 LA 290 1970 382.86 38.8 14854.968 1505.44 146581.779


0 6

2 ME 200 308 - -51.2 65491.968 2621.44 1636199.14


1 1279.14

2 MD 310 3927 2339.86 58.8 137583.768 3457.44 5474944.82


2

2 MA 290 2355 767.86 38.8 29792.968 1505.44 589608.979


3 6

2 MI 250 2440 852.86 -1.2 -1023.432 1.44 727370.179


4 6

2 MN 190 991 -596.14 -61.2 36483.768 3745.44 355382.899


5 6

2 MS 200 810 -777.14 -51.2 39789.568 2621.44 603946.579


6 6

2 MO 280 2236 648.86 28.8 18687.168 829.44 421019.299


7 6

2 MT 240 340 - -11.2 13967.968 125.44 1555358.18


8 1247.14

2 NE 220 822 -765.14 -31.2 23872.368 973.44 585439.219


9 6

3 NV 360 4606 3018.86 108.8 328451.968 11837.4 9113515.7


0 4

3 NH 240 420 - -11.2 13071.968 125.44 1362215.78


1 1167.14
3 NJ 350 3037 1449.86 98.8 143246.168 9761.44 2102094.02
2

3 NM 280 1279 -308.14 28.8 -8874.432 829.44 94950.2596


3

3 NY 370 6413 4825.86 118.8 573312.168 14113.4 23288924.7


4 4 4

3 NC 220 823 -764.14 -31.2 23841.168 973.44 583909.939


5 6

3 ND 180 77 - -71.2 107521.968 5069.44 2280522.82


6 1510.14

3 OH 210 2237 649.86 -41.2 -26774.232 1697.44 422318.019


7 6

3 OK 230 1049 -538.14 -21.2 11408.568 449.44 289594.659


8 6

3 OR 240 1524 -63.14 -11.2 707.168 125.44 3986.6596


9

4 PA 240 1779 191.86 -11.2 -2148.832 125.44 36810.2596


0

4 RI 280 1186 -401.14 28.8 -11552.832 829.44 160913.299


1 6

4 SC 240 1181 -406.14 -11.2 4548.768 125.44 164949.699


2 6

4 SD 200 201 - -51.2 70970.368 2621.44 1921384.1


3 1386.14

4 TN 210 1806 218.86 -41.2 -9017.032 1697.44 47899.6996


4

4 TX 240 2085 497.86 -11.2 -5576.032 125.44 247864.579


5 6

4 UT 240 802 -785.14 -11.2 8793.568 125.44 616444.819


6 6

4 VT 200 389 - -51.2 61344.768 2621.44 1435539.46


7 1198.14

4 VA 230 1201 -386.14 -21.2 8186.168 449.44 149104.099


8 6

4 WA 210 1351 -236.14 -41.2 9728.968 1697.44 55762.0996


9

5 WV 180 485 - -71.2 78472.368 5069.44 1214712.58


0 1102.14

5 WI 240 707 -880.14 -11.2 9857.568 125.44 774646.419


1 6

5 WY 310 444 - 58.8 -67216.632 3457.44 1306769.06


2 1143.14

5
3

5 Sum = 12560 79357 Sum = 2008311.6 116728 73958300.0


4 2

5 N= 50 50
5
5 Mean = 251.2 1587.14
6

5
7

5
8

5 Coefficien
t
9

6 Slope = 17.2050
0 5

6 Intercept= -
1 2734.77

4
Predicted Values and Model Goodness of Fit Measures

17. Enter the following labels.


K2: Yhat
L2: (Yi-Ybar)2
M2: (Yi-Yhati)2
N2: (Yhati-Ybar)2

18. Enter the following formula.


K3: =$b$61+$b$60*b3

19. Copy the formula in cell K3 to cells K4 to K52.

20. Enter the following formula.


L3: =(c3-c$56)^2

21. Copy the formula in cell L3 to cells L4 to L52.

22. Enter the following formula.


M3: =(c3-k3)^2

23. Copy the formula in cell M3 to cells M4 to M52.

24. Enter the following formula.


N3: =(k3-c$56)^2

25. Copy the formula in cell N3 to cells N4 to N52.

26. Enter the following formulas.


L54: =sum(l3:l52)
M54: =sum(m3:m52)
N54: =sum(n3:n52)
This portion of your spreadsheet should look similar to what is below.

5
K L M N

2 Yhat (Yi-Ybar)2 (Yi-Yhati)2 (Yhati-Ybar)2

3 1222.39 70830.5 9723.37 133040.4


3 1 9

4 3286.99 472161. 5697766 2889521.


9 4 9

5 2598.79 121703. 439300. 1023450.


7 3 1 3

6 534.190 605501. 75520.1 1108702.


7 9 7 3

7 1910.59 5084394 3730325 104623.1


5 5

8 1910.59 192.099 95849.0 104623.1


5 6 8 5

9 1738.54 351483 194883 22923.31


4 6

1 2082.64 47149.7 507863. 245525.7


0 6 8 7 7

1 2426.74 3872473 1272956 704939.3


1 7 4

1 1394.44 151212. 338208. 37131.98


2 3 1 1 4

1 2254.69 99136.8 124394. 445631.1


3 6 2 5 7

1 1394.44 1252474 858297. 37131.98


4 3 4 4

1 2770.84 339725. 361018 1401164


5 8 8
1 878.291 29977.4 286983. 502465.8
6 8 6 3 3

1 706.241 1077735 24724.8 775982.6


7 2 8

1 1222.39 208063. 8352.65 133040.4


8 3 7 2 9

1 706.241 403402. 60397.3 775982.6


9 2 8 8 8

2 2254.69 146581. 81051.8 445631.1


0 6 8 8 7

2 706.241 1636199 158596. 775982.6


1 2 1 8

2 2598.79 5474945 1764123 1023450.


2 7 3

2 2254.69 589609 10060.8 445631.1


3 6 7 7

2 1566.49 727370. 763012. 426.2600


4 4 2 8 2

2 534.190 355382. 208674. 1108702.


5 7 9 8 3

2 706.241 603946. 10765.8 775982.6


6 2 6 9 8

2 2082.64 421019. 23517.5 245525.7


7 6 3 8 7

2 1394.44 1555358 1111851 37131.98


8 3 4

2 1050.34 585439. 52140.2 288151.7


9 2 2 1 7

3 3459.05 9113516 1315494 3504046.


0 8

3 1394.44 1362216 949539. 37131.98


1 3 9 4

3 3286.99 2102094 62499.6 2889521.


2 9 9 9

3 2082.64 94950.2 645846. 245525.7


3 6 6 2 7

3 3631.1 2328892 7738965 4177774.


4 5 4

3 1050.34 583909. 51684.5 288151.7


5 2 9 2 7

3 362.140 2280523 81304.8 1500624.


6 1 9 7

3 878.291 422318 1846088 502465.8


7 8 3
3 1222.39 289594. 30065.0 133040.4
8 3 7 8 9

3 1394.44 3986.66 16784.9 37131.98


9 3 2 4

4 1394.44 36810.2 147883. 37131.98


0 3 6 8 4

4 2082.64 160913. 803973. 245525.7


1 6 3 3 7

4 1394.44 164949. 45558.0 37131.98


2 3 7 8 4

4 706.241 1921384 255268. 775982.6


3 2 7 8

4 878.291 47899.7 860642. 502465.8


4 8 6 3

4 1394.44 247864. 476868. 37131.98


5 3 6 4 4

4 1394.44 616444. 350989. 37131.98


6 3 8 2 4

4 706.241 1435539 100642 775982.6


7 2 8

4 1222.39 149104. 457.653 133040.4


8 3 1 8 9

4 878.291 55762.1 223453. 502465.8


9 8 1 3

5 362.140 1214713 15094.5 1500624.


0 1 5 7

5 1394.44 774646. 472578. 37131.98


1 3 4 4 4

5 2598.79 1306769 4643151 1023450.


2 7 3

5
3

5 7395830 3940519 34553111


4 0 0

6
27. Enter the following labels.
A65: Error =
A66: Regression=
A67: Total =
A68: F =
A69: Prob F =
A70: R2 =
B64: df
C64: Sum Square
D64: Mean Square
E64: Sigma

28. Enter the following formulas.


B65: =b55-2
B66: 1
B67: =b65+b66
C65: =m54
C66: =n54
C67: =l54

29. Enter the following formulas.


D65: =c65/(b55-2)
D66: =c66
E65: =sqrt(d65)
B68: =d66/d65
B69: =fdist(b68,b66,b65)
B70: =(l54-m54)/l54

This portion of your spreadsheet should look like below.


A B C D E

6 df Sum Square Mean Square Sigma


4

6 Error = 48 39405190 820941.44 906.058


5 8 2

6 Regression 1 34553111 34553110.


6 = 5

6 Total = 49 73958300
7

6 F= 42.0896
8 2

6 Prob F = 4.49E-
9 08

7 R2 = 0.46719
0 7

7
Tests of Statistical Significance for Coefficients

30. Enter the following label.


D2: Xi2
31. Enter the following formula.
D3: =b3^2

32. Copy the formula in cell D3 to cells D4 to D52.

33. Enter the following formula.


D54: =sum(d3:d52)

34. Enter the following labels.


C59: Std Error
D59: t
E69: df
F59: Prob 1-tail
G59: Prob 2-tail

35. Enter the following formulas.


C60: =sqrt(d65/h54)
C61: =(sqrt(d54/(b55*h54)))*e65
D60: =b60/c60
D61: =b61/c61
E60: =b55-2
E61: =b55-2
F60: =tdist(abs(d60),e60,1)
F61: =tdist(abs(d61),e61,1)
G60: =tdist(abs(d60),e60,2)
G61: =tdist(abs(d61),e61,2)

This portion of your spreadsheet should look similar to what is below.


A B C D E F G

5 Coefficient Std Error t df Prob 1-tail Prob 2-tail


9

6 Slope = 17.2050 2.6519698 6.4876510 48 2.25E-08 4.4925E-08


0 5 6

6 Intercept= -2734.77 678.3861 -4.0312879 48 9.87E-05 0.000197435


1

Your completed spreadsheet should look similar the one below.

8
A B C D E F G H I J K L M N
1 State Crime Data Set

2 STATE POLICE ROBBERY Xi2 (Yi- (Xi-Xbar) (Xi-Xbar)(Yi- (Xi- (Yi-Ybar)2 Yhat (Yi- (Yi- (Yhati-
(X) (Y)
Ybar) Ybar) Xbar)2 Ybar)2 Yhati)2 Ybar)2

3 AL 230 1321 52900 - -21.2 5642.168 449.44 70830.499 1222.3 70830. 9723.3 133040.
266.14 6 93 5 71 49

4 AK 350 900 122500 - 98.8 -67889.432 9761.4 472161.37 3286.9 47216 56977 2889521
687.14 4 96 99 1.4 66 .9

5 AZ 310 1936 96100 348.86 58.8 20512.968 3457.4 121703.29 2598.7 12170 439300 1023450
4 96 97 3.3 .1 .3

6 AR 190 809 36100 - -61.2 47622.168 3745.4 605501.85 534.19 60550 75520. 1108702
778.14 4 96 07 1.9 17 .3

7 CA 270 3842 72900 2254.8 18.8 42391.368 353.44 5084393.6 1910.5 50843 37303 104623.
6 2 95 94 25 15

8 CO 270 1601 72900 13.86 18.8 260.568 353.44 192.0996 1910.5 192.09 95849. 104623.
95 96 08 15

9 CT 260 2180 67600 592.86 8.8 5217.168 77.44 351482.97 1738.5 35148 19488 22923.3
96 44 3 3 16

1 DE 280 1370 78400 - 28.8 -6253.632 829.44 47149.779 2082.6 47149. 507863 245525.
0 217.14 6 46 78 .7 77

1 FL 300 3555 90000 1967.8 48.8 96031.568 2381.4 3872472.9 2426.7 38724 12729 704939.
1 6 4 8 47 73 56 34

1 GA 240 1976 57600 388.86 -11.2 -4355.232 125.44 151212.09 1394.4 15121 338208 37131.9
2 96 43 2.1 .1 84

1 HI 290 1902 84100 314.86 38.8 12216.568 1505.4 99136.819 2254.6 99136. 124394 445631.
3 4 6 96 82 .5 17

1 ID 240 468 57600 - -11.2 12534.368 125.44 1252474.3 1394.4 12524 858297 37131.9
4 1119.1 4 43 74 .4 84
4

1 IL 320 2170 102400 582.86 68.8 40100.768 4733.4 339725.77 2770.8 33972 36101 140116
5 4 96 48 5.8 8 4

1 IN 210 1414 44100 - -41.2 7133.368 1697.4 29977.459 878.29 29977. 286983 502465.
6 173.14 4 6 18 46 .3 83

1 IA 200 549 40000 - -51.2 53152.768 2621.4 1077734.6 706.24 10777 24724. 775982.
7 1038.1 4 6 12 35 8 68
4

1 KS 230 1131 52900 - -21.2 9670.168 449.44 208063.69 1222.3 20806 8352.6 133040.
8 456.14 96 93 3.7 52 49

1 KY 200 952 40000 - -51.2 32519.168 2621.4 403402.81 706.24 40340 60397. 775982.
9 635.14 4 96 12 2.8 38 68

2 LA 290 1970 84100 382.86 38.8 14854.968 1505.4 146581.77 2254.6 14658 81051. 445631.
0 4 96 96 1.8 88 17

2 ME 200 308 40000 - -51.2 65491.968 2621.4 1636199.1 706.24 16361 158596 775982.
1 1279.1 4 4 12 99 .1 68
4

2 MD 310 3927 96100 2339.8 58.8 137583.768 3457.4 5474944.8 2598.7 54749 17641 1023450
2 6 4 2 97 45 23 .3

2 MA 290 2355 84100 767.86 38.8 29792.968 1505.4 589608.97 2254.6 58960 10060. 445631.
3 4 96 96 9 87 17

2 MI 250 2440 62500 852.86 -1.2 -1023.432 1.44 727370.17 1566.4 72737 763012 426.260
4 96 94 0.2 .8 02

2 MN 190 991 36100 - -61.2 36483.768 3745.4 355382.89 534.19 35538 208674 1108702
5 596.14 4 96 07 2.9 .8 .3

2 MS 200 810 40000 - -51.2 39789.568 2621.4 603946.57 706.24 60394 10765. 775982.
6 777.14 4 96 12 6.6 89 68

2 MO 280 2236 78400 648.86 28.8 18687.168 829.44 421019.29 2082.6 42101 23517. 245525.
7 96 46 9.3 58 77

2 MT 240 340 57600 - -11.2 13967.968 125.44 1555358.1 1394.4 15553 11118 37131.9
8 1247.1 8 43 58 51 84
4

2 NE 220 822 48400 - -31.2 23872.368 973.44 585439.21 1050.3 58543 52140. 288151.
9 765.14 96 42 9.2 21 77
3 NV 360 4606 129600 3018.8 108.8 328451.968 11837. 9113515.7 3459.0 91135 13154 3504046
0 6 44 5 16 94 .8

3 NH 240 420 57600 - -11.2 13071.968 125.44 1362215.7 1394.4 13622 949539 37131.9
1 1167.1 8 43 16 .9 84
4

3 NJ 350 3037 122500 1449.8 98.8 143246.168 9761.4 2102094.0 3286.9 21020 62499. 2889521
2 6 4 2 99 94 69 .9

3 NM 280 1279 78400 - 28.8 -8874.432 829.44 94950.259 2082.6 94950. 645846 245525.
3 308.14 6 46 26 .2 77

3 NY 370 6413 136900 4825.8 118.8 573312.168 14113. 23288924. 3631.1 77389 4177774
4 6 44 74 23288925 65 .4

3 NC 220 823 48400 - -31.2 23841.168 973.44 583909.93 1050.3 58390 51684. 288151.
5 764.14 96 42 9.9 52 77

3 ND 180 77 32400 - -71.2 107521.968 5069.4 2280522.8 362.14 22805 81304. 1500624
6 1510.1 4 2 01 23 89 .7
4

3 OH 210 2237 44100 649.86 -41.2 -26774.232 1697.4 422318.01 878.29 42231 18460 502465.
7 4 96 18 8 88 83

3 OK 230 1049 52900 - -21.2 11408.568 449.44 289594.65 1222.3 28959 30065. 133040.
8 538.14 96 93 4.7 08 49

3 OR 240 1524 57600 -63.14 -11.2 707.168 125.44 3986.6596 1394.4 3986.6 16784. 37131.9
9 43 6 92 84

4 PA 240 1779 57600 191.86 -11.2 -2148.832 125.44 36810.259 1394.4 36810. 147883 37131.9
0 6 43 26 .8 84

4 RI 280 1186 78400 - 28.8 -11552.832 829.44 160913.29 2082.6 16091 803973 245525.
1 401.14 96 46 3.3 .3 77

4 SC 240 1181 57600 - -11.2 4548.768 125.44 164949.69 1394.4 16494 45558. 37131.9
2 406.14 96 43 9.7 08 84

4 SD 200 201 40000 - -51.2 70970.368 2621.4 1921384.1 706.24 19213 255268 775982.
3 1386.1 4 12 84 .7 68
4

4 TN 210 1806 44100 218.86 -41.2 -9017.032 1697.4 47899.699 878.29 47899. 860642 502465.
4 4 6 18 7 .6 83

4 TX 240 2085 57600 497.86 -11.2 -5576.032 125.44 247864.57 1394.4 24786 476868 37131.9
5 96 43 4.6 .4 84

4 UT 240 802 57600 - -11.2 8793.568 125.44 616444.81 1394.4 61644 350989 37131.9
6 785.14 96 43 4.8 .2 84

4 VT 200 389 40000 - -51.2 61344.768 2621.4 1435539.4 706.24 14355 10064 775982.
7 1198.1 4 6 12 39 2 68
4

4 VA 230 1201 52900 - -21.2 8186.168 449.44 149104.09 1222.3 14910 457.65 133040.
8 386.14 96 93 4.1 38 49

4 WA 210 1351 44100 - -41.2 9728.968 1697.4 55762.099 878.29 55762. 223453 502465.
9 236.14 4 6 18 1 .1 83

5 WV 180 485 32400 - -71.2 78472.368 5069.4 1214712.5 362.14 12147 15094. 1500624
0 1102.1 4 8 01 13 55 .7
4

5 WI 240 707 57600 - -11.2 9857.568 125.44 774646.41 1394.4 77464 472578 37131.9
1 880.14 96 43 6.4 .4 84

5 WY 310 444 96100 - 58.8 -67216.632 3457.4 1306769.0 2598.7 13067 46431 1023450
2 1143.1 4 6 97 69 51 .3
4

5
3

5 Sum = 12560 79357 3271800 Sum = 2008311.6 11672 73958300. 73958300 345531
4 8 02 39405190 11

5 N= 50 50
5

5 Mean = 251.2 1587.14


6

5
7
5
8

5 Coefficie Std Error t df Prob 1- Prob 2-tail


nt tail
9

6 Slope = 17.205 2.65196 6.487651 48 2.25E- 4.4925E-08


0 05 98 06 08

6 Intercept - 678.386 - 48 9.87E- 0.000197435


1 = 2734.7 1 4.031287 05
7 9

6
2

6
3

6 df Sum Mean Sigma


Square Square
4

6 Error = 48 3940519 820941.4 906.05


5 0 48 82

6 Regressio 1 3455311 34553110


6 n= 1 .5

6 Total = 49 7395830
7 0

6 F= 42.089
8 62

6 Prob F = 4.49E-
9 08

You might also like