Residual Analysis of Regression of Argentine Wheat Yields Rainfall and Temperature (WORD)

advertisement
Residual Analysis – Argentine Wheat Yield, Rain and Temperature 1890-1919



Dependent Variable: Annual Wheat Yield (100kgs/hectare)
Independent Variables: Rainfall (June-November in mms), Temperature (centered, Aug-Nov), R*T
Data: Annual for years 1890-1919 (n=30)
year
whtyld
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
703
742
996
1216
835
559
344
559
893
851
602
466
764
817
837
647
746
909
701
611
635
656
737
434
735
692
333
883
714
991
whtyldc rainyr
tempyr
rntmpyr
Y-hat
e
r
e^2
7.03
180
0
0 7.689243 -0.65924 -0.65223 0.434601
7.42
333
0.3
99.9 6.635427 0.784573 0.776226 0.615554
9.96
263
-0.525 -138.075 8.485658 1.474342 1.458656 2.173683
12.16
182
-1.525
-277.55 11.45959 0.700414 0.692962 0.490579
8.35
284
-0.625
-177.5 8.553522 -0.20352 -0.20136 0.041421
5.59
420
0.25
105 6.524806 -0.93481 -0.92486 0.873862
3.44
360
2.025
729 3.84328 -0.40328 -0.39899 0.162635
5.59
230
0.275
63.25 6.898516 -1.30852 -1.29459 1.712213
8.93
252
-1.6
-403.2 10.83971 -1.90971
-1.8894 3.647003
8.51
273
-0.375 -102.375 8.120995 0.389005 0.384866 0.151325
6.02
431
0.375 161.625 6.345903
-0.3259 -0.32244 0.106213
4.66
270
1.25
337.5 4.826935 -0.16693 -0.16516 0.027867
7.64
226
-0.425
-96.05 8.486967 -0.84697 -0.83796 0.717353
8.17
303
0.275
83.325 6.742568 1.427432 1.412245 2.037561
8.37
390
-0.275
-107.25 7.347167 1.022833 1.011951 1.046188
6.47
324
0.125
40.5 6.962774 -0.49277 -0.48753 0.242826
7.46
304
0.375
114 6.553723 0.906277 0.896635 0.821338
9.09
267
-0.9
-240.3 9.230637 -0.14064 -0.13914 0.019779
7.01
347
-0.175
-60.725 7.392036 -0.38204 -0.37797 0.145952
6.11
362
0.175
63.35 6.774245 -0.66424 -0.65718 0.441221
6.35
197
0.8
157.6 5.707974 0.642026 0.635195 0.412197
6.56
447
-1.2
-536.4 8.134515 -1.57451 -1.55776 2.479097
7.37
387
-0.025
-9.675 6.998778 0.371222 0.367273 0.137806
4.34
358
1.075
384.85 5.347352 -1.00735 -0.99663 1.014757
7.35
436
-0.7
-305.2 7.635502
-0.2855 -0.28246 0.081511
6.92
222
0.8
177.6 5.720178 1.199822 1.187057 1.439572
3.33
98
1.225
120.05 4.428477 -1.09848 -1.08679 1.206651
8.83
226
0.125
28.25 7.245612 1.584388 1.567532 2.510285
7.14
385
-0.25
-96.25 7.33504 -0.19504 -0.19297 0.038041
9.91
444
-0.9
-399.6 7.81287 2.09713 2.074819 4.397955
ANOVA
df
Regression
Residual
Total
SS
MS
F
Significance F
3 78.18974 26.06325 22.87249 1.84E-07
26 29.62705 1.139502
29 107.8168
Coefficients
Standard Error t Stat
Intercept 8.321216 0.705271 11.79861
rainyr
-0.00351 0.00221 -1.58851
tempyr
-3.38676 0.750833 -4.51068
rntmpyr
0.004999 0.002444 2.045335
P-value Lower 95% Upper 95%
6.09E-12 6.871511 9.770921
0.124259 -0.00805 0.001032
0.000122 -4.93012
-1.8434
0.051065 -2.5E-05 0.010023
Residuals vs Predicted Values
3
Residual
2
1
0
-1
0
2
4
6
8
10
12
14
-2
-3
Predicted
Residuals vs Rainfall
3
Residual
2
1
0
-1
-2
-3
0
100
200
300
400
500
Rainfall
Residuals vs Temp Dev
3
Residual
2
1
0
-1
-2
-3
-2
-1.5
-1
-0.5
0
0.5
1
1.5
2
2.5
TempDev
Residual
Residuals vs Time Order
2.5
2
1.5
1
0.5
0
-0.5
-1
-1.5
-2
-2.5
1
3
5
7
9
11
13
15
17
19
21
23
25
27
29
Residual Tests (n= # observations, p = # predictor variables)

Normality – Shapiro-Francia Statistic (modification of Shapiro-Wilk Statistic used by SAS & R)
1. Order Residuals from smallest to largest, preserving sign and rank (R) from 1 to n
2. Assign percentiles to ranks, common method (Blom): p* = (r-3/8)/(n+1/4)
3. Obtain normal scores for each percentile: z = (p*) where P(Z≤(p*))=p*
4. Obtain squared correlation between ordered residuals and their corresponding normal scores
5. Reject H0: Errors are normal if result from 4) is less than P(0.05,n) from Table A.8, p.632

Equal Variances (Homogeneity) – Brown-Forsyth and Breusch-Pagan Tests (White’s also popular)
1. Brown-Forsyth Test (Tests whether mean absolute error differs between small/large means)
a) Separate data into 2 groups based on predicted values
b) Obtain median(e) for each group, compute d = abs(e-median(e)) for each observation
c) Compute mean and variance of ds for each group
d) Apply independent-sample t-test on ds for the 2 groups (df = n1+n2-2)
e) Reject H0: Variances are equal if |Test Stat| from d) is greater than t(.025,df)
2. Breusch-Pagan-Test (Tests whether V(e) is linearly related to predictor variables)
a) Compute the squared residual for each observation, and fit regression on predictors
b) Obtain SS(Reg*) from regression of e2 on predictors and SSE = sum(e2) from original
regression (p = # of predictor variables)
c) Compute test statistic: X2obs = ((SS(Reg*)/2)/((SSE/n)2)
d) Reject H0: V(e) not related to predictors if Test Stat from c) is greater than 2(.05,p)

Independent (Uncorrelated) Errors over time – Durbin-Watson Test
1. Obtain residuals from regression model and SSE = sum(e2)
2. Obtain the sum of squared differences from each residual to the previous residual: (e(t)-e(t-1))2
where t = 2,…,n
3. Durbin-Watson Statistic = DW = result(2)/result(1) (Under H0: Errors are uncorrelated), DW ≈ 2
4. Reject H0: errors are independent if DW <dL(.05,p,n) Accept H0 if DW > dU(.05,p,n) withhold
judgment otherwise
Residual Tests
rank
1
2
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
p(Blom) ord(e)
z(p)
ord(Yhat) e(ord(Yh)) group
0.021
-1.910
-2.040
3.843
-0.403
0.054
-1.575
-1.610
4.428
-1.098
0.087
-1.309
-1.361
4.827
-0.167
0.120
-1.098
-1.176
5.347
-1.007
0.153
-1.007
-1.024
5.708
0.642
0.186
-0.935
-0.893
5.720
1.200
0.219
-0.847
-0.776
6.346
-0.326
0.252
-0.664
-0.668
6.525
-0.935
0.285
-0.659
-0.568
6.554
0.906
0.318
-0.493
-0.473
6.635
0.785
0.351
-0.403
-0.382
6.743
1.427
0.384
-0.382
-0.294
6.774
-0.664
0.417
-0.326
-0.209
6.899
-1.309
0.450
-0.286
-0.125
6.963
-0.493
0.483
-0.204
-0.041
6.999
0.371
0.517
-0.195
0.041
7.246
1.584
0.550
-0.167
0.125
7.335
-0.195
0.583
-0.141
0.209
7.347
1.023
0.616
0.371
0.294
7.392
-0.382
0.649
0.389
0.382
7.636
-0.286
0.682
0.642
0.473
7.689
-0.659
0.715
0.700
0.568
7.813
2.097
0.748
0.785
0.668
8.121
0.389
0.781
0.906
0.776
8.135
-1.575
0.814
1.023
0.893
8.486
1.474
0.847
1.200
1.024
8.487
-0.847
0.880
1.427
1.176
8.554
-0.204
0.913
1.474
1.361
9.231
-0.141
0.946
1.584
1.610
10.840
-1.910
0.979
2.097
2.040
11.460
0.700
BF Test
Group
SF Stat
W1
W2
W'
W(.05,35)
W(.05,50)
BP1
BP2
BP
df
X2(.05,df)
P-value
797.4862
813.0621
0.980843
0.943
0.963
3.513274
0.975291
3.602283
3
7.814728
0.307737
Mean
Variance n
1 0.738258 0.283719
2 0.865931 0.579684
Num
Denom
t_obs
df
t(.025,28)
P-value
-0.12767
0.239917
-0.53216
28
2.048407
0.598814
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
grpmed
BF_d
year
e
-0.326
0.077
1890
-0.326
0.773
1891
-0.326
0.159
1892
-0.326
0.681
1893
-0.326
0.968
1894
-0.326
1.526
1895
-0.326
0.000
1896
-0.326
0.609
1897
-0.326
1.232
1898
-0.326
1.110
1899
-0.326
1.753
1900
-0.326
0.338
1901
-0.326
0.983
1902
-0.326
0.167
1903
-0.326
0.697
1904
-0.195
1.779
1905
-0.195
0.000
1906
-0.195
1.218
1907
-0.195
0.187
1908
-0.195
0.090
1909
-0.195
0.464
1910
-0.195
2.292
1911
-0.195
0.584
1912
-0.195
1.379
1913
-0.195
1.669
1914
-0.195
0.652
1915
-0.195
0.008
1916
-0.195
0.054
1917
-0.195
1.715
1918
-0.195
0.895
1919
e(t)-e(t-1)
-0.659
0.785
1.474
0.700
-0.204
-0.935
-0.403
-1.309
-1.910
0.389
-0.326
-0.167
-0.847
1.427
1.023
-0.493
0.906
-0.141
-0.382
-0.664
0.642
-1.575
0.371
-1.007
-0.286
1.200
-1.098
1.584
-0.195
2.097
1.444
0.690
-0.774
-0.904
-0.731
0.532
-0.905
-0.601
2.299
-0.715
0.159
-0.680
2.274
-0.405
-1.516
1.399
-1.047
-0.241
-0.282
1.306
-2.217
1.946
-1.379
0.722
1.485
-2.298
2.683
-1.779
2.292
15
15
ANOVA (BP Test)
df
SS
MS
F
Significance F
Regression
3 7.026549 2.342183 2.059941 0.130085
Residual
26 29.56238 1.137015
Total
29 36.58893
DW1
DW2
DW
59.01584
29.62705
1.991958
Shapiro-Francia Test: Test Stat: _________ Rejection Region: ___________ Conclude: ______________
Brown-Forsyth Test: Test Stat: _________ Rejection Region: ___________ Conclude: ______________
Breusch-Pagan Test: Test Stat: _________ Rejection Region: ___________ Conclude: ______________
Durbin-Watson Test: Test Stat: _________ Rejection Region: ___________ Conclude: ______________
Download