Regression and Correlation Analysis & ANOVA

profiletututt
Week6-ChisquaredGoodness-of-Fit1.xlsx

Regression-Residuals

Regression Model: Predicted y = b0 x + b1 x Observed y Predicted y Residual=Observed - Predicted Residual=Observed - Predicted Bin Frequency Normal Probability Plot of Residuals Residual=Observed - Predicted Standardized Residual ranks i (i - 0.5) / n Standard Z values
χ2 16 37.1 38.2 -1.1 Residuals have to be: -1.1 -3.03 1 -3.0 -2.80 1 0.0078125 -2.42
14 33.5 33.1 0.4 1. Normally distributed For Homoscedasticity, plot the resiuals For independency, plot the residuals vs 0.4 -2.38 1 -2.5 -2.31 2 0.0234375 -1.99
13 30.3 30.6 -0.3 2. Have a zero mean vs the predicted Y values. the independent variable (or vs time if possible). -0.3 -1.74 2 -2.3 -2.15 3 0.0390625 -1.76
SLOPE 2.53 19 46.7 45.8 0.9 3. Have a constant variance There should not exist and pattern in the plot There should be any distinguishing pattern 0.9 -1.10 4 Standardizing: -2.2 -2.06 4 0.0546875 -1.60
INTERCEPT -2.26 9 20.2 20.5 -0.3 they are Homoscedastic -0.3 -0.45 12 Z = (x - mean(s))/ (SD(x)) -1.6 -1.46 5 0.0703125 -1.47
Correlation R 0.9953 9 20.3 20.5 -0.2 4. Are independent -0.2 0.19 14 -1.5 -1.40 6 0.0859375 -1.37
Determination R2 0.9907 17 40.1 40.7 -0.6 -0.6 0.84 16 -1.1 -1.02 7 0.1015625 -1.27
16 38 38.2 -0.2 -0.2 1.48 11 -1.1 -1.02 8 0.1171875 -1.19
16 38.7 38.2 0.5 0.5 More 3 -1.0 -0.96 9 0.1328125 -1.11
Residual Mean 0.00 8 18.4 18.0 0.4 0.4 -1.0 -0.95 10 0.1484375 -1.04
Residual standard dev 1.08 15 35.3 35.7 -0.4 -0.4 -1.0 -0.94 11 0.1640625 -0.98
11 26.3 25.6 0.7 0.7 -1.0 -0.92 12 0.1796875 -0.92
3 5.93 5.3 0.6 0.6 -0.8 -0.75 13 0.1953125 -0.86
5 8.81 10.4 -1.6 -1.6 -0.7 -0.68 14 0.2109375 -0.80
15 36.1 35.7 0.4 0.4 -0.7 -0.63 15 0.2265625 -0.75
11 25.5 25.6 -0.1 -0.1 -0.7 -0.61 16 0.2421875 -0.70
14 33 33.1 -0.1 -0.1 -0.6 -0.59 17 0.2578125 -0.65
8 17.5 18.0 -0.5 -0.5 -0.6 -0.58 18 0.2734375 -0.60
17 40.5 40.7 -0.2 -0.2 -0.6 -0.58 19 0.2890625 -0.56
15 35.3 35.7 -0.4 -0.4 -0.5 -0.44 20 0.3046875 -0.51
6 13.2 12.9 0.3 0.3 -0.4 -0.34 21 0.3203125 -0.47
6 14.1 12.9 1.2 1.2 -0.4 -0.34 22 0.3359375 -0.42
10 24.3 23.0 1.3 1.3 -0.3 -0.31 23 0.3515625 -0.38
4 7.12 7.9 -0.7 -0.7 -0.3 -0.29 24 0.3671875 -0.34
17 40.1 40.7 -0.6 -0.6 -0.3 -0.28 25 0.3828125 -0.30
4 9.33 7.9 1.5 1.5 -0.2 -0.21 26 0.3984375 -0.26
9 18 20.5 -2.5 -2.5 -0.2 -0.19 27 0.4140625 -0.22
10 20.7 23.0 -2.3 -2.3 -0.2 -0.19 28 0.4296875 -0.18
12 28.3 28.1 0.2 0.2 -0.1 -0.13 29 0.4453125 -0.14
8 19 18.0 1.0 1.0 -0.1 -0.05 30 0.4609375 -0.10
17 39.7 40.7 -1.0 -1.0 0.0 0.03 31 0.4765625 -0.06
19 46.6 45.8 0.8 0.8 0.0 0.03 32 0.4921875 -0.02
14 32.1 33.1 -1.0 -1.0 0.1 0.05 33 0.5078125 0.02
14 33.9 33.1 0.8 0.8 0.1 0.07 34 0.5234375 0.06
5 11.3 10.4 0.9 0.9 0.2 0.20 35 0.5390625 0.10
16 39.3 38.2 1.1 1.1 0.3 0.26 36 0.5546875 0.14
14 33.2 33.1 0.1 0.1 0.3 0.28 37 0.5703125 0.18
8 18 18.0 0.0 0.0 0.4 0.33 38 0.5859375 0.22
12 27.4 28.1 -0.7 -0.7 0.4 0.34 39 0.6015625 0.26
8 18 18.0 0.0 0.0 0.4 0.40 40 0.6171875 0.30
16 39.1 38.2 0.9 0.9 0.4 0.40 41 0.6328125 0.34
10 20.8 23.0 -2.2 -2.2 0.4 0.40 42 0.6484375 0.38
13 29.6 30.6 -1.0 -1.0 0.5 0.46 43 0.6640625 0.42
15 36.1 35.7 0.4 0.4 0.5 0.47 44 0.6796875 0.47
13 29.1 30.6 -1.5 -1.5 0.6 0.55 45 0.6953125 0.51
19 46.3 45.8 0.5 0.5 0.6 0.58 46 0.7109375 0.56
10 24.5 23.0 1.5 1.5 0.7 0.66 47 0.7265625 0.60
19 46.5 45.8 0.7 0.7 0.7 0.69 48 0.7421875 0.65
9 19.5 20.5 -1.0 -1.0 0.8 0.70 49 0.7578125 0.70
17 40.8 40.7 0.1 0.1 0.8 0.75 50 0.7734375 0.75
9 20.8 20.5 0.3 0.3 0.9 0.83 51 0.7890625 0.80
10 20 23.0 -3.0 -3.0 0.9 0.84 52 0.8046875 0.86
6 12.1 12.9 -0.8 -0.8 0.9 0.84 53 0.8203125 0.92
4 9.32 7.9 1.5 1.5 1.0 0.95 54 0.8359375 0.98
14 32.5 33.1 -0.6 -0.6 1.1 1.02 55 0.8515625 1.04
8 20.1 18.0 2.1 2.1 1.2 1.09 56 0.8671875 1.11
9 19.4 20.5 -1.1 -1.1 1.3 1.17 57 0.8828125 1.19
11 27 25.6 1.4 1.4 1.4 1.33 58 0.8984375 1.27
11 24.9 25.6 -0.7 -0.7 1.5 1.35 59 0.9140625 1.37
17 42.5 40.7 1.8 1.8 1.5 1.36 60 0.9296875 1.47
15 36.3 35.7 0.6 0.6 1.5 1.36 61 0.9453125 1.60
7 17.4 15.4 2.0 2.0 1.8 1.63 62 0.9609375 1.76
10 23.4 23.0 0.4 0.4 2.0 1.81 63 0.9765625 1.99
4 7.52 7.9 -0.3 -0.3 2.1 1.96 64 0.9921875 2.42

y = 2.5286 x - 2.2566 R² = 0.9907

16 14 13 19 9 9 17 16 16 8 15 11 3 5 15 11 14 8 17 15 6 6 10 4 17 4 9 10 12 8 17 19 14 14 5 16 14 8 12 8 16 10 13 15 13 19 10 19 9 17 9 10 6 4 14 8 9 11 11 17 15 7 10 4 37.1 33.5 30.3 46.7 20.2 20.3 40.1 38 38.700000000000003 18.399999999999999 35.299999999999997 26.3 5.93 8.81 36.1 25.5 33 17.5 40.5 35.299999999999997 13.2 14.1 24.3 7.12 40.1 9.33 18 20.7 28.3 19 39.700000000000003 46.6 32.1 33.9 11.3 39.299999999999997 33.200000000000003 18 27.4 18 39.1 20.8 29.6 36.1 29.1 46.3 24.5 46.5 19.5 40.799999999999997 20.8 20 12.1 9.32 32.5 20.100000000000001 19.399999999999999 27 24.9 42.5 36.299999999999997 17.399999999999999 23.4 7.52

Residuals vs Predicted Y for Homoscedasticity

38.200751471483656 33.143581794195242 30.614996955551042 45.78650598741627 20.500657600974218 20.500657600974218 40.729336310127863 38.200751471483656 38.200751471483656 17.972072762330011 35.672166632839449 25.557827278262629 5.3291485691089839 10.386318246397394 35.672166632839449 25.557827278262629 33.143581794195242 17.972072762330011 40.729336310127863 35.672166632839449 12.914903085041601 12.914903085041601 23.029242439618422 7.8577334077531891 40.729336310127863 7.8577334077531891 20.500657600974218 23.029242439618422 28.086412116906835 17.972072762330011 40.729336310127863 45.78650598741627 33.143581794195242 33.143581794195242 10.386318246397394 38.200751471483656 33.143581794195242 17.972072762330011 28.086412116906835 17.972072762330011 38.200751471483656 23.029242439618422 30.614996955551042 35.672166632839449 30.614996955551042 45.78650598741627 23.029242439618422 45.78650598741627 20.500657600974218 40.729336310127863 20.500657600974218 23.029242439618422 12.914903085041601 7.8577334077531891 33.143581794195242 17.972072762330011 20.500657600974218 25.557827278262629 25.557827278262629 40.729336310127863 35.672166632839449 15.443487923685804 23.029242439618422 7.8577334077531891 -1.1007514714836546 0.3564182058047578 -0.31499695555104168 0.91349401258373319 -0.30065760097421901 -0.20065760097421759 -0.62933631012786151 -0.20075147148365602 0.49924852851634682 0.42792723766998719 -0.37216663283945195 0.74217272173737214 0.60085143089101578 -1.5763182463973937 0.42783336716055231 -5.7827278262628568E-2 -0.1435817941952422 -0.47207276233001139 -0.22933631012786293 -0.37216663283945195 0.28509691495839817 1.1850969149583985 1.2707575603815791 -0.73773340775318896 -0.62933631012786151 1.472266592246811 -2.5006576009742183 -2.3292424396184224 0.21358788309316523 1.0279272376699886 -1.0293363101278601 0.81349401258373177 -1.0435817941952408 0.75641820580475638 0.91368175360260651 1.0992485285163411 5.6418205804760646E-2 2.7927237669988614E-2 -0.6864121169068369 2.7927237669988614E-2 0.8992485285163454 -2.2292424396184209 -1.014996955551041 0.42783336716055231 -1.514996955551041 0.51349401258372751 1.4707575603815783 0.71349401258373035 -1.0006576009742183 7.0663689872134228E-2 0.29934239902578241 -3.0292424396184217 -0.81490308504160147 1.4622665922468112 -0.6435817941952422 2.12792723766999 -1.1006576009742197 1.4421727217373714 -0.65782727826262999 1.7706636898721371 0.62783336716054805 1.9565120763141941 0.37075756038157692 -0.3377334077531895

Residuals vs x for Independency

16 14 13 19 9 9 17 16 16 8 15 11 3 5 15 11 14 8 17 15 6 6 10 4 17 4 9 10 12 8 17 19 14 14 5 16 14 8 12 8 16 10 13 15 13 19 10 19 9 17 9 10 6 4 14 8 9 11 11 17 15 7 10 4 -1.1007514714836546 0.3564182058047578 -0.31499695555104168 0.91349401258373319 -0.30065760097421901 -0.20065760097421759 -0.62933631012786151 -0.20075147148365602 0.49924852851634682 0.42792723766998719 -0.37216663283945195 0.74217272173737214 0.60085143089101578 -1.5763182463973937 0.42783336716055231 -5.7827278262628568E-2 -0.1435817941952422 -0.47207276233001139 -0.22933631012786293 -0.37216663283945195 0.28509691495839817 1.1850969149583985 1.2707575603815791 -0.73773340775318896 -0.62933631012786151 1.472266592246811 -2.5006576009742183 -2.3292424396184224 0.21358788309316523 1.0279272376699886 -1.0293363101278601 0.81349401258373177 -1.0435817941952408 0.75641820580475638 0.91368175360260651 1.0992485285163411 5.6418205804760646E-2 2.7927237669988614E-2 -0.6864121169068369 2.7927237669988614E-2 0.8992485285163454 -2.2292424396184209 -1.014996955551041 0.42783336716055231 -1.514996955551041 0.51349401258372751 1.4707575603815783 0.71349401258373035 -1.0006576009742183 7.0663689872134228E-2 0.29934239902578241 -3.0292424396184217 -0.81490308504160147 1.4622665922468112 -0.6435817941952422 2.12792723766999 -1.1006576009742197 1.4421727217373714 -0.65782727826262999 1.7706636898721371 0.62783336716054805 1.9565120763141941 0.37075756038157692 -0.3377334077531895

Distribution of Residuals

-3.03 -2.38 -1.74 -1.10 -0.45 0.19 0.84 1.48 More 1 1 2 4 12 14 16 11 3

Normal Probability Plot of Residuals

-2.4175590162365048 -1.9874278859298957 -1.7616704103630663 -1.6010086648860757 -1.4734675779471014 -1.3662038163720986 -1.2726986411905357 -1.1891643501993372 -1.1131942771609289 -1.043158263318454 -0.97789754394054018 -0.91655666753311338 -0.85848447414183249 -0.8031725655979175 -0.75021537546794015 -0.69928330238321956 -0.65010407064799569 -0.60244945316442367 -0.55612559361869141 -0.51096580673824743 -0.4668251228525897 -0.42357608420119958 -0.38110545476355656 -0.33931160653881726 -0.29810241293048689 -0.25739352610093835 -0.21710694721012977 -0.17716982099173983 -0.13751340214433597 -9.807215248866108E-2 -5.8782936068943067E-2 -1.9584285230126924E-2 1.9584285230126924E-2 5.8782936068943067E-2 9.807215248866108E-2 0.13751340214433597 0.17716982099173983 0.21710694721012977 0.25739352610093835 0.29810241293048689 0.33931160653881726 0.38110545476355656 0.42357608420119958 0.4668251228525897 0.51096580673824743 0.55612559361869141 0.60244945316442367 0.65010407064799569 0.69928330238321956 0.75021537546794015 0.8031725655979175 0.85848447414183249 0.91655666753311338 0.97789754394054018 1.043158263318454 1.1131942771609289 1.1891643501993372 1.2726986411905357 1.3662038163720986 1.4734675779471014 1.6010086648860757 1.7616704103630663 1.9874278859298957 2.4175590162365048 -2.7971021827827709 -2.3090244420840711 -2.1507453569505772 -2.0584086675459767 -1. 4555200832039918 -1.3988980333363044 -1.0163974673404232 -1.016310790419684 -0.9636088799890089 -0.95045507161152998 -0.93721458631330834 -0.92397410101508337 -0.75245453058336631 -0.68119860535103327 -0.63381022442380619 -0.60741593074809908 -0.59426212237061349 -0.58110831399313456 -0.58110831399313456 -0.43589636031638029 -0.34364634783252573 -0.34364634783252573 -0.31185184773263702 -0.29085776048111467 -0.27761727518288976 -0.21176155637473909 -0.18536726269903192 -0.18528058577828924 -0.13257867534761755 -5.3395794320502586E-2 2.5787086706615663E-2 2.5787086706615663E-2 5.2094703461583444E-2 6.5248511839055848E-2 0.19721998021758846 0.26324905286722444 0.2764028612447067 0.32910477167537838 0.34234525697360002 0.3950471674042717 0.3950471674042717 0.39513384432501109 0.46098956313316503 0.47414337151064401 0.55480631952492121 0.57972054621346614 0.65881675031984499 0.6852977209162916 0.69845152929377385 0.75115343972444548 0.8303363207515605 0.84349012912904597 0.84366348297052807 0.9491539807526076 1.0150096995607549 1.0942792575086175 1.1733754616149947 1.3316545467484853 1.3502085615501491 1.3580488404241924 1.3594422304906086 1.6349722317172446 1.8065784790697061 1.9648575642032002 -2.4175590162365048 -1.9874278859298957 -1.7616704103630663 -1.6010086648860757 -1.4734675779471014 -1.3662038163720986 -1.2726986411905357 -1.1891643501993372 -1.1131942771609289 -1.043158263318454 -0.97789754394054018 -0.91655666753311338 -0.85848447414183249 -0.8031725655979175 -0.75021537546794015 -0.69928330238321956 -0.65010407064799569 -0.60244945316442367 -0.55612559361869141 -0.51096580673824743 -0.4668251228525897 -0.42357608420119958 -0.38110545476355656 -0.33931160653881726 -0.29810241293048689 -0.25739352610093835 -0.21710694721012977 -0.17716982099173983 -0.13751340214433597 -9.807215248866108E-2 -5.8782936068943067E-2 -1.9584285230126924E-2 1.9584285230126924E-2 5.8782936068943067E-2 9.807215248866108E-2 0.13751340214433597 0.17716982099173983 0.21710694721012977 0.25739352610093835 0.29810241293048689 0.33931160653881726 0.38110545476355656 0.42357608420119958 0.4668251228525 897 0.51096580673824743 0.55612559361869141 0.60244945316442367 0.65010407064799569 0.69928330238321956 0.75021537546794015 0.8031725655979175 0.85848447414183249 0.91655666753311338 0.97789754394054018 1.043158263318454 1.1131942771609289 1.1891643501993372 1.2726986411905357 1.3662038163720986 1.4734675779471014 1.6010086648860757 1.7616704103630663 1.9874278859298957 2.4175590162365048 -2.4175590162365048 -1.9874278859298957 -1.7616704103630663 -1.6010086648860757 -1.4734675779471014 -1.3662038163720986 -1.2726986411905357 -1.1891643501993372 -1.1131942771609289 -1.043158263318454 -0.97789754394054018 -0.91655666753311338 -0.85848447414183249 -0.8031725655979175 -0.75021537546794015 -0.69928330238321956 -0.65010407064799569 -0.60244945316442367 -0.55612559361869141 -0.51096580673824743 -0.4668251228525897 -0.42357608420119958 -0.38110545476355656 -0.33931160653881726 -0.29810241293048689 -0.25739352610093835 -0.21710694721012977 -0.17716982099173983 -0.13751340214433597 -9.807215248866108E-2 -5.8782936068943067E-2 -1.9584285230126924E-2 1.9584285230126924E-2 5.8782936068943067E-2 9.807215248866108E-2 0.13751340214433597 0.17716982099173983 0.21710694721012977 0.25739352610093835 0.29810241293048689 0.33931160653881726 0.38110545476355656 0.42357608420119958 0.4668251228525897 0.51096580673824743 0.55612559361869141 0.60244945316442367 0.65010407064799569 0.69928330238321956 0.75021537546794015 0.8031725655979175 0.85848447414183249 0.91655666753311338 0.97789754394054018 1.043158263318454 1.1131942771609289 1.1891643501993372 1.2726986411905357 1.3662038163720986 1.4734675779471014 1.6010086648860757 1.7616704103630663 1.9874278859298957 2.4175590162365048

Chi-squared Goodness of Fit

Regression Model: Predicted y = b0 x + b1 x Observed y Predicted y Residual Step1 Bin Left End Right End Observed Frequency Step2 Normal probabilities Expected Frequencies Chi-squared
Chi - squared Goodness of Fit Test χ2 16 37.1 38.2 -1.1 Construct a Frequency Distribution of residuals: -3.03 -3.35 -2.71 1 Calculate the normal probabilities 0.0062187913 0.40 0.91
14 33.5 33.1 0.4 We wish to check whether -2.38 -2.71 -2.06 1 0.0222210189670425 1.42 0.13
This test is used to verify whether a sample distributiuion 13 30.3 30.6 -0.3 the residuals belong to -1.74 -2.06 -1.42 2 0.0668290991724769 4.28 1.21
belongs to a particular probability distribution. SLOPE 2.53 19 46.7 45.8 0.9 the normal distribution: -1.10 -1.42 -0.77 4 0.1424235918849700 9.12 2.87
This test can be used for both discrete and continuous distributions. INTERCEPT -2.26 9 20.2 20.5 -0.3 -0.45 -0.77 -0.13 12 0.2151433155506750 13.77 0.23
Correlation R 0.9953 9 20.3 20.5 -0.2 0.19 -0.13 0.52 14 0.2303923768108150 14.75 0.04
In this example, wewill test whether the residuals of a regression Determination R2 0.9907 17 40.1 40.7 -0.6 0.84 0.52 1.16 16 0.1749095695626240 11.19 2.06
model are normally distributed. 16 38 38.2 -0.2 1.48 1.16 1.81 11 0.0941284018752701 6.02 4.11
16 38.7 38.2 0.5 2.13 1.81 2.45 3 0.0477338349174006 3.05 0.00
1. Create a frequency distribution of the variable of interest (residuals) Residual Mean 0.00 8 18.4 18.0 0.4 64 1 64 Test Statistic
2. For each Bin, determine its left end and its right end. Residual standard dev 1.08 15 35.3 35.7 -0.4 χ2
Calculate the normal probabilities for each class 11 26.3 25.6 0.7 11.56
3. For each class use the normal probabilities to calculate the Expected 3 5.93 5.3 0.6
frequencies (Expected if the distribution were normal) 5 8.81 10.4 -1.6 Ho: Data belongs to the specified distribution
4. For each class, Calculate the Chi-squared metric by the following formula: 15 36.1 35.7 0.4 Ha: Data does not belong to the specified distribution
χ2 = ∑ (Observed f - Expected f)2 / Expected f 11 25.5 25.6 -0.1 This is a right-tailed test
14 33 33.1 -0.1 P-Value = area under the Chi-squared distribution and on the right of test statistic
5. Add up all the above values to obtain the Chi-squared test statistic 8 17.5 18.0 -0.5
This quantity is a measure describing how much difference exists between the 17 40.5 40.7 -0.2 DF 7
distribution of resuduals and a normal distribution 15 35.3 35.7 -0.4 P-value 0.1161
6. Calculate the P-value of the test by the following formula: 6 13.2 12.9 0.3 Since P-value is not less than 0.05, we do not reject Ho.
= 1 - CHISQ.DIST (χ2 , DF , 1) 6 14.1 12.9 1.2 There is not sufficient evidence to reject the fact that the residuals belong to the Normal distribution.
The degress of freddom DF is give by: 10 24.3 23.0 1.3
DF = n - K - 1 4 7.12 7.9 -0.7
n = the number of classes in the distribution 17 40.1 40.7 -0.6
K= the number of parameter estimates used to calculate the normal probabilities 4 9.33 7.9 1.5
9 18 20.5 -2.5
10 20.7 23.0 -2.3
12 28.3 28.1 0.2
8 19 18.0 1.0
17 39.7 40.7 -1.0
19 46.6 45.8 0.8
14 32.1 33.1 -1.0
14 33.9 33.1 0.8
5 11.3 10.4 0.9
16 39.3 38.2 1.1
14 33.2 33.1 0.1
8 18 18.0 0.0
12 27.4 28.1 -0.7
8 18 18.0 0.0
16 39.1 38.2 0.9
10 20.8 23.0 -2.2
13 29.6 30.6 -1.0
15 36.1 35.7 0.4
13 29.1 30.6 -1.5
19 46.3 45.8 0.5
10 24.5 23.0 1.5
19 46.5 45.8 0.7
9 19.5 20.5 -1.0
17 40.8 40.7 0.1
9 20.8 20.5 0.3
10 20 23.0 -3.0
6 12.1 12.9 -0.8
4 9.32 7.9 1.5
14 32.5 33.1 -0.6
8 20.1 18.0 2.1
9 19.4 20.5 -1.1
11 27 25.6 1.4
11 24.9 25.6 -0.7
17 42.5 40.7 1.8
15 36.3 35.7 0.6
7 17.4 15.4 2.0
10 23.4 23.0 0.4
4 7.52 7.9 -0.3

Histogram

Frequency -3.0292424396184217 -2.3845962299573702 -1.7399500202963187 -1.0953038106352673 -0.45065760097421581 0.19398860868683565 0.83863481834788711 1.483281028008939 2.1279272376699909 1 1 2 4 12 14 16 11 3

Bin

Frequency

Sheet2