R version 2.15.2 (2012-10-26) -- "Trick or Treat"
Copyright (C) 2012 The R Foundation for Statistical Computing
ISBN 3-900051-07-0
Platform: i686-pc-linux-gnu (32-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> x <- array(list(100
+ ,100
+ ,100
+ ,100
+ ,102.815
+ ,101.542
+ ,100.254
+ ,102
+ ,104.301
+ ,102.179
+ ,102.839
+ ,103.65
+ ,104.964
+ ,105.494
+ ,104.726
+ ,104.974
+ ,104.83
+ ,106.14
+ ,103.387
+ ,104.641
+ ,105.878
+ ,106.371
+ ,101.746
+ ,104.902
+ ,107.542
+ ,107.249
+ ,100.371
+ ,105.695
+ ,107.954
+ ,109.481
+ ,101.337
+ ,106.489
+ ,108.09
+ ,111.951
+ ,102.307
+ ,107.146
+ ,109.19
+ ,111.972
+ ,101.794
+ ,107.695
+ ,110.115
+ ,110.661
+ ,100.294
+ ,107.711
+ ,110.439
+ ,113.149
+ ,100.578
+ ,108.313
+ ,111.054
+ ,113.853
+ ,97.9592
+ ,108.124
+ ,112.319
+ ,115.143
+ ,100.107
+ ,109.615
+ ,113.607
+ ,116.923
+ ,102.865
+ ,111.34
+ ,112.716
+ ,116.638
+ ,102.719
+ ,110.717
+ ,113.126
+ ,116.227
+ ,103.921
+ ,111.217
+ ,112.818
+ ,115.942
+ ,105.751
+ ,111.452
+ ,112.565
+ ,116.42
+ ,106.746
+ ,111.611
+ ,112.698
+ ,113.365
+ ,108.454
+ ,111.717
+ ,113.701
+ ,112.709
+ ,107.724
+ ,112.062
+ ,113.844
+ ,115.609
+ ,108.936
+ ,112.842
+ ,114.151
+ ,115.626
+ ,109.764
+ ,113.241
+ ,114.069
+ ,116.697
+ ,108.502
+ ,113.015
+ ,114.798
+ ,119.368
+ ,109.211
+ ,113.998
+ ,114.537
+ ,120.264
+ ,113.097
+ ,114.936
+ ,114.118
+ ,118.74
+ ,112.18
+ ,114.245
+ ,113.814
+ ,116.522
+ ,114.855
+ ,114.437
+ ,115.232
+ ,116.967
+ ,114.53
+ ,115.286
+ ,115.945
+ ,118.061
+ ,115.328
+ ,116.071
+ ,117.543
+ ,118.711
+ ,117.973
+ ,117.807
+ ,118.205
+ ,119.223
+ ,117.863
+ ,118.255
+ ,119.899
+ ,119.196
+ ,116.582
+ ,118.969
+ ,121.35
+ ,120.729
+ ,117.645
+ ,120.333
+ ,122.563
+ ,121.828
+ ,120.711
+ ,121.998
+ ,124.143
+ ,122.603
+ ,121.37
+ ,123.239
+ ,126.574
+ ,123.803
+ ,120.473
+ ,124.666
+ ,128.069
+ ,127.692
+ ,122.204
+ ,126.54
+ ,128.101
+ ,128.336
+ ,124.943
+ ,127.336
+ ,128.752
+ ,128.718
+ ,125.276
+ ,127.871
+ ,129.991
+ ,130.539
+ ,130.192
+ ,130.115
+ ,133.236
+ ,132.864
+ ,131.595
+ ,132.773
+ ,134.689
+ ,134.529
+ ,133.091
+ ,134.265
+ ,135.058
+ ,135.166
+ ,133.167
+ ,134.596
+ ,135.615
+ ,133.458
+ ,131.858
+ ,134.38
+ ,136.088
+ ,135.621
+ ,132.5
+ ,135.121
+ ,136.114
+ ,137.409
+ ,131.551
+ ,135.136
+ ,136.177
+ ,138.866
+ ,131.422
+ ,135.336
+ ,136.883
+ ,135.802
+ ,131.112
+ ,135.284
+ ,139.095
+ ,139.408
+ ,131.193
+ ,137.144
+ ,141.551
+ ,142.191
+ ,136.448
+ ,140.349
+ ,144.647
+ ,146.027
+ ,138.433
+ ,143.264
+ ,147.403
+ ,145.695
+ ,136.323
+ ,144.381
+ ,148.778
+ ,148.469
+ ,137.453
+ ,145.881
+ ,149.123
+ ,152.221
+ ,137.072
+ ,146.497
+ ,150.925
+ ,157.061
+ ,139.485
+ ,148.857
+ ,152.195
+ ,160.782
+ ,142.049
+ ,150.78
+ ,155.762
+ ,164.581
+ ,141.315
+ ,153.293
+ ,159.863
+ ,171.274
+ ,145.023
+ ,157.641
+ ,164.488
+ ,177.848
+ ,148.287
+ ,162.182
+ ,172.288
+ ,185.538
+ ,147.732
+ ,167.86
+ ,181.098
+ ,193.704
+ ,151.23
+ ,175.245
+ ,186.026
+ ,203.366
+ ,150.278
+ ,179.32
+ ,191.144
+ ,213.692
+ ,154.789
+ ,184.979
+ ,196.021
+ ,220.819
+ ,153.029
+ ,188.482
+ ,200.338
+ ,225.005
+ ,157.658
+ ,192.86
+ ,202.319
+ ,229.096
+ ,161.039
+ ,195.475
+ ,204.148
+ ,233.982
+ ,165.599
+ ,198.4
+ ,205.288
+ ,234.529
+ ,171.248
+ ,200.598
+ ,206.439
+ ,238.753
+ ,172.249
+ ,202.121
+ ,210.638
+ ,238.258
+ ,177.164
+ ,205.875
+ ,212.831
+ ,241.42
+ ,174.947
+ ,207.085
+ ,214.227
+ ,242.44
+ ,179.407
+ ,209.204
+ ,216.573
+ ,248.809
+ ,181.625
+ ,212.246
+ ,217.504
+ ,254.991
+ ,188.871
+ ,215.466
+ ,219.151
+ ,255.458
+ ,189.866
+ ,216.693
+ ,220.494
+ ,261.125
+ ,192.114
+ ,219.019
+ ,220.484
+ ,258.58
+ ,189.665
+ ,217.924
+ ,220.269
+ ,257.981
+ ,191.006
+ ,217.978
+ ,222.524
+ ,257.756
+ ,186.398
+ ,218.186
+ ,221.905
+ ,257.984
+ ,189.577
+ ,218.54
+ ,222.286
+ ,252.604
+ ,190.244
+ ,217.886
+ ,219.929
+ ,251.688
+ ,190.269
+ ,216.347
+ ,222.144
+ ,255.734
+ ,196.606
+ ,219.825
+ ,224.73
+ ,257.646
+ ,197.796
+ ,221.956
+ ,228.912
+ ,263.016
+ ,205.874
+ ,227.184
+ ,231.613
+ ,265.367
+ ,206.229
+ ,229.247
+ ,235.936
+ ,271.406
+ ,208.473
+ ,233.33
+ ,239.005
+ ,278.478
+ ,211.102
+ ,236.987
+ ,242.293
+ ,284.415
+ ,211.503
+ ,240.027
+ ,248.077
+ ,287.685
+ ,218.055
+ ,245.433
+ ,248.956
+ ,287.97
+ ,221.076
+ ,246.641
+ ,252.358
+ ,290.44
+ ,226.743
+ ,250.328
+ ,254.122
+ ,292.298
+ ,223.179
+ ,250.849
+ ,255.015
+ ,296.637
+ ,219.996
+ ,251.435
+ ,253.493
+ ,299.882
+ ,223.847
+ ,252.091
+ ,255.976
+ ,292.588
+ ,227.227
+ ,252.946
+ ,255.878
+ ,292.523
+ ,226.757
+ ,252.773
+ ,254.149
+ ,290.063
+ ,223.928
+ ,250.677
+ ,252.408
+ ,296.831
+ ,220.682
+ ,250.105
+ ,252.503
+ ,296.742
+ ,227.654
+ ,251.788
+ ,253.733
+ ,296.479
+ ,218.398
+ ,250.212
+ ,252.299
+ ,295.557
+ ,213.639
+ ,248.073
+ ,248.838
+ ,288.037
+ ,212.71
+ ,244.468
+ ,247.559
+ ,287.377
+ ,217.355
+ ,244.727
+ ,245.331
+ ,290.101
+ ,217.786
+ ,244.034
+ ,242.351
+ ,296.679
+ ,218.186
+ ,243.588
+ ,238.172
+ ,285.712
+ ,206.917
+ ,236.447
+ ,226.723
+ ,270.085
+ ,197.833
+ ,224.906
+ ,225.84
+ ,261.006
+ ,194.438
+ ,221.934
+ ,225.751
+ ,266.44
+ ,202.508
+ ,224.903
+ ,226.192
+ ,267.075
+ ,196.651
+ ,223.798
+ ,220.037
+ ,263.672
+ ,191.446
+ ,218.529
+ ,220.406
+ ,259.121
+ ,190.056
+ ,217.521
+ ,223.551
+ ,262.711
+ ,190.322
+ ,219.971
+ ,223.373
+ ,265.838
+ ,203.701
+ ,223.841
+ ,224.678
+ ,265.766
+ ,200.524
+ ,223.764
+ ,223.629
+ ,269.162
+ ,200.524
+ ,223.664
+ ,220.855
+ ,256.573
+ ,191.582
+ ,217.678
+ ,220.127
+ ,257.917
+ ,195.727
+ ,218.478
+ ,215.471
+ ,253.316
+ ,194.766
+ ,214.815
+ ,214.691
+ ,257.496
+ ,194.576
+ ,215.143
+ ,216.2
+ ,264.861
+ ,198.563
+ ,218.381
+ ,219.85
+ ,257.795
+ ,201.679
+ ,219.962
+ ,220.182
+ ,251.318
+ ,201.506
+ ,218.933
+ ,220.283
+ ,243.526
+ ,204.453
+ ,218.36
+ ,216.675
+ ,247.503
+ ,206.552
+ ,217.72
+ ,217.808
+ ,256.9
+ ,205.642
+ ,219.934
+ ,217.66
+ ,261.806
+ ,205.679
+ ,220.842
+ ,217.951
+ ,260.758
+ ,204.583
+ ,220.584
+ ,215.9
+ ,244.361
+ ,204.484
+ ,216.346
+ ,217.141
+ ,255.116
+ ,208.73
+ ,220.221
+ ,219.459
+ ,256.46
+ ,210.264
+ ,222.182
+ ,222.898
+ ,258.249
+ ,214.211
+ ,225.455
+ ,225.478
+ ,256.327
+ ,214.169
+ ,226.42
+ ,228.098
+ ,259.192
+ ,213.656
+ ,228.287
+ ,230.729
+ ,260.776
+ ,219.028
+ ,231.349
+ ,230.535
+ ,261.166
+ ,217.602
+ ,231.015
+ ,229.735
+ ,265.351
+ ,220.635
+ ,232.241
+ ,233.148
+ ,261.627
+ ,222.011
+ ,233.688
+ ,235.221
+ ,266.932
+ ,224.948
+ ,236.667
+ ,237.46
+ ,268.695
+ ,225.566
+ ,238.439
+ ,239.951
+ ,274.37
+ ,219.318
+ ,239.488
+ ,240.436
+ ,275.671
+ ,213.558
+ ,238.741
+ ,241.588
+ ,270.831
+ ,214.026
+ ,238.5
+ ,241.512
+ ,275.141
+ ,225.59
+ ,242.116
+ ,243.05
+ ,277.59
+ ,227.637
+ ,243.923
+ ,246.469
+ ,276.357
+ ,229
+ ,245.813
+ ,248.64
+ ,279.389
+ ,226.841
+ ,247.143
+ ,251.147
+ ,274.787
+ ,221.488
+ ,246.381)
+ ,dim=c(4
+ ,150)
+ ,dimnames=list(c('SMF'
+ ,'SSF'
+ ,'NS'
+ ,'TOT')
+ ,1:150))
> y <- array(NA,dim=c(4,150),dimnames=list(c('SMF','SSF','NS','TOT'),1:150))
> for (i in 1:dim(x)[1])
+ {
+ for (j in 1:dim(x)[2])
+ {
+ y[i,j] <- as.numeric(x[i,j])
+ }
+ }
> par3 = 'Linear Trend'
> par2 = 'Do not include Seasonal Dummies'
> par1 = '4'
> library(lattice)
> library(lmtest)
Loading required package: zoo
Attaching package: 'zoo'
The following object(s) are masked from 'package:base':
as.Date, as.Date.numeric
> n25 <- 25 #minimum number of obs. for Goldfeld-Quandt test
> par1 <- as.numeric(par1)
> x <- t(y)
> k <- length(x[1,])
> n <- length(x[,1])
> x1 <- cbind(x[,par1], x[,1:k!=par1])
> mycolnames <- c(colnames(x)[par1], colnames(x)[1:k!=par1])
> colnames(x1) <- mycolnames #colnames(x)[par1]
> x <- x1
> if (par3 == 'First Differences'){
+ x2 <- array(0, dim=c(n-1,k), dimnames=list(1:(n-1), paste('(1-B)',colnames(x),sep='')))
+ for (i in 1:n-1) {
+ for (j in 1:k) {
+ x2[i,j] <- x[i+1,j] - x[i,j]
+ }
+ }
+ x <- x2
+ }
> if (par2 == 'Include Monthly Dummies'){
+ x2 <- array(0, dim=c(n,11), dimnames=list(1:n, paste('M', seq(1:11), sep ='')))
+ for (i in 1:11){
+ x2[seq(i,n,12),i] <- 1
+ }
+ x <- cbind(x, x2)
+ }
> if (par2 == 'Include Quarterly Dummies'){
+ x2 <- array(0, dim=c(n,3), dimnames=list(1:n, paste('Q', seq(1:3), sep ='')))
+ for (i in 1:3){
+ x2[seq(i,n,4),i] <- 1
+ }
+ x <- cbind(x, x2)
+ }
> k <- length(x[1,])
> if (par3 == 'Linear Trend'){
+ x <- cbind(x, c(1:n))
+ colnames(x)[k+1] <- 't'
+ }
> x
TOT SMF SSF NS t
1 100.000 100.000 100.000 100.0000 1
2 102.000 102.815 101.542 100.2540 2
3 103.650 104.301 102.179 102.8390 3
4 104.974 104.964 105.494 104.7260 4
5 104.641 104.830 106.140 103.3870 5
6 104.902 105.878 106.371 101.7460 6
7 105.695 107.542 107.249 100.3710 7
8 106.489 107.954 109.481 101.3370 8
9 107.146 108.090 111.951 102.3070 9
10 107.695 109.190 111.972 101.7940 10
11 107.711 110.115 110.661 100.2940 11
12 108.313 110.439 113.149 100.5780 12
13 108.124 111.054 113.853 97.9592 13
14 109.615 112.319 115.143 100.1070 14
15 111.340 113.607 116.923 102.8650 15
16 110.717 112.716 116.638 102.7190 16
17 111.217 113.126 116.227 103.9210 17
18 111.452 112.818 115.942 105.7510 18
19 111.611 112.565 116.420 106.7460 19
20 111.717 112.698 113.365 108.4540 20
21 112.062 113.701 112.709 107.7240 21
22 112.842 113.844 115.609 108.9360 22
23 113.241 114.151 115.626 109.7640 23
24 113.015 114.069 116.697 108.5020 24
25 113.998 114.798 119.368 109.2110 25
26 114.936 114.537 120.264 113.0970 26
27 114.245 114.118 118.740 112.1800 27
28 114.437 113.814 116.522 114.8550 28
29 115.286 115.232 116.967 114.5300 29
30 116.071 115.945 118.061 115.3280 30
31 117.807 117.543 118.711 117.9730 31
32 118.255 118.205 119.223 117.8630 32
33 118.969 119.899 119.196 116.5820 33
34 120.333 121.350 120.729 117.6450 34
35 121.998 122.563 121.828 120.7110 35
36 123.239 124.143 122.603 121.3700 36
37 124.666 126.574 123.803 120.4730 37
38 126.540 128.069 127.692 122.2040 38
39 127.336 128.101 128.336 124.9430 39
40 127.871 128.752 128.718 125.2760 40
41 130.115 129.991 130.539 130.1920 41
42 132.773 133.236 132.864 131.5950 42
43 134.265 134.689 134.529 133.0910 43
44 134.596 135.058 135.166 133.1670 44
45 134.380 135.615 133.458 131.8580 45
46 135.121 136.088 135.621 132.5000 46
47 135.136 136.114 137.409 131.5510 47
48 135.336 136.177 138.866 131.4220 48
49 135.284 136.883 135.802 131.1120 49
50 137.144 139.095 139.408 131.1930 50
51 140.349 141.551 142.191 136.4480 51
52 143.264 144.647 146.027 138.4330 52
53 144.381 147.403 145.695 136.3230 53
54 145.881 148.778 148.469 137.4530 54
55 146.497 149.123 152.221 137.0720 55
56 148.857 150.925 157.061 139.4850 56
57 150.780 152.195 160.782 142.0490 57
58 153.293 155.762 164.581 141.3150 58
59 157.641 159.863 171.274 145.0230 59
60 162.182 164.488 177.848 148.2870 60
61 167.860 172.288 185.538 147.7320 61
62 175.245 181.098 193.704 151.2300 62
63 179.320 186.026 203.366 150.2780 63
64 184.979 191.144 213.692 154.7890 64
65 188.482 196.021 220.819 153.0290 65
66 192.860 200.338 225.005 157.6580 66
67 195.475 202.319 229.096 161.0390 67
68 198.400 204.148 233.982 165.5990 68
69 200.598 205.288 234.529 171.2480 69
70 202.121 206.439 238.753 172.2490 70
71 205.875 210.638 238.258 177.1640 71
72 207.085 212.831 241.420 174.9470 72
73 209.204 214.227 242.440 179.4070 73
74 212.246 216.573 248.809 181.6250 74
75 215.466 217.504 254.991 188.8710 75
76 216.693 219.151 255.458 189.8660 76
77 219.019 220.494 261.125 192.1140 77
78 217.924 220.484 258.580 189.6650 78
79 217.978 220.269 257.981 191.0060 79
80 218.186 222.524 257.756 186.3980 80
81 218.540 221.905 257.984 189.5770 81
82 217.886 222.286 252.604 190.2440 82
83 216.347 219.929 251.688 190.2690 83
84 219.825 222.144 255.734 196.6060 84
85 221.956 224.730 257.646 197.7960 85
86 227.184 228.912 263.016 205.8740 86
87 229.247 231.613 265.367 206.2290 87
88 233.330 235.936 271.406 208.4730 88
89 236.987 239.005 278.478 211.1020 89
90 240.027 242.293 284.415 211.5030 90
91 245.433 248.077 287.685 218.0550 91
92 246.641 248.956 287.970 221.0760 92
93 250.328 252.358 290.440 226.7430 93
94 250.849 254.122 292.298 223.1790 94
95 251.435 255.015 296.637 219.9960 95
96 252.091 253.493 299.882 223.8470 96
97 252.946 255.976 292.588 227.2270 97
98 252.773 255.878 292.523 226.7570 98
99 250.677 254.149 290.063 223.9280 99
100 250.105 252.408 296.831 220.6820 100
101 251.788 252.503 296.742 227.6540 101
102 250.212 253.733 296.479 218.3980 102
103 248.073 252.299 295.557 213.6390 103
104 244.468 248.838 288.037 212.7100 104
105 244.727 247.559 287.377 217.3550 105
106 244.034 245.331 290.101 217.7860 106
107 243.588 242.351 296.679 218.1860 107
108 236.447 238.172 285.712 206.9170 108
109 224.906 226.723 270.085 197.8330 109
110 221.934 225.840 261.006 194.4380 110
111 224.903 225.751 266.440 202.5080 111
112 223.798 226.192 267.075 196.6510 112
113 218.529 220.037 263.672 191.4460 113
114 217.521 220.406 259.121 190.0560 114
115 219.971 223.551 262.711 190.3220 115
116 223.841 223.373 265.838 203.7010 116
117 223.764 224.678 265.766 200.5240 117
118 223.664 223.629 269.162 200.5240 118
119 217.678 220.855 256.573 191.5820 119
120 218.478 220.127 257.917 195.7270 120
121 214.815 215.471 253.316 194.7660 121
122 215.143 214.691 257.496 194.5760 122
123 218.381 216.200 264.861 198.5630 123
124 219.962 219.850 257.795 201.6790 124
125 218.933 220.182 251.318 201.5060 125
126 218.360 220.283 243.526 204.4530 126
127 217.720 216.675 247.503 206.5520 127
128 219.934 217.808 256.900 205.6420 128
129 220.842 217.660 261.806 205.6790 129
130 220.584 217.951 260.758 204.5830 130
131 216.346 215.900 244.361 204.4840 131
132 220.221 217.141 255.116 208.7300 132
133 222.182 219.459 256.460 210.2640 133
134 225.455 222.898 258.249 214.2110 134
135 226.420 225.478 256.327 214.1690 135
136 228.287 228.098 259.192 213.6560 136
137 231.349 230.729 260.776 219.0280 137
138 231.015 230.535 261.166 217.6020 138
139 232.241 229.735 265.351 220.6350 139
140 233.688 233.148 261.627 222.0110 140
141 236.667 235.221 266.932 224.9480 141
142 238.439 237.460 268.695 225.5660 142
143 239.488 239.951 274.370 219.3180 143
144 238.741 240.436 275.671 213.5580 144
145 238.500 241.588 270.831 214.0260 145
146 242.116 241.512 275.141 225.5900 146
147 243.923 243.050 277.590 227.6370 147
148 245.813 246.469 276.357 229.0000 148
149 247.143 248.640 279.389 226.8410 149
150 246.381 251.147 274.787 221.4880 150
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) SMF SSF NS t
0.745313 0.605345 0.140579 0.247134 0.002292
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-0.78342 -0.09086 -0.01125 0.09515 0.58773
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 0.745313 0.155805 4.784 4.19e-06 ***
SMF 0.605345 0.004484 134.989 < 2e-16 ***
SSF 0.140579 0.002901 48.456 < 2e-16 ***
NS 0.247134 0.002914 84.812 < 2e-16 ***
t 0.002292 0.001204 1.904 0.0588 .
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.2029 on 145 degrees of freedom
Multiple R-squared: 1, Adjusted R-squared: 1
F-statistic: 2.583e+06 on 4 and 145 DF, p-value: < 2.2e-16
> if (n > n25) {
+ kp3 <- k + 3
+ nmkm3 <- n - k - 3
+ gqarr <- array(NA, dim=c(nmkm3-kp3+1,3))
+ numgqtests <- 0
+ numsignificant1 <- 0
+ numsignificant5 <- 0
+ numsignificant10 <- 0
+ for (mypoint in kp3:nmkm3) {
+ j <- 0
+ numgqtests <- numgqtests + 1
+ for (myalt in c('greater', 'two.sided', 'less')) {
+ j <- j + 1
+ gqarr[mypoint-kp3+1,j] <- gqtest(mylm, point=mypoint, alternative=myalt)$p.value
+ }
+ if (gqarr[mypoint-kp3+1,2] < 0.01) numsignificant1 <- numsignificant1 + 1
+ if (gqarr[mypoint-kp3+1,2] < 0.05) numsignificant5 <- numsignificant5 + 1
+ if (gqarr[mypoint-kp3+1,2] < 0.10) numsignificant10 <- numsignificant10 + 1
+ }
+ gqarr
+ }
[,1] [,2] [,3]
[1,] 7.137834e-09 1.427567e-08 1.000000e+00
[2,] 1.011745e-11 2.023490e-11 1.000000e+00
[3,] 7.800442e-14 1.560088e-13 1.000000e+00
[4,] 1.621664e-16 3.243329e-16 1.000000e+00
[5,] 2.767531e-19 5.535063e-19 1.000000e+00
[6,] 1.182673e-21 2.365345e-21 1.000000e+00
[7,] 2.181043e-24 4.362087e-24 1.000000e+00
[8,] 1.231342e-26 2.462684e-26 1.000000e+00
[9,] 2.114841e-29 4.229682e-29 1.000000e+00
[10,] 4.156016e-32 8.312032e-32 1.000000e+00
[11,] 1.965628e-34 3.931257e-34 1.000000e+00
[12,] 3.997404e-37 7.994807e-37 1.000000e+00
[13,] 7.574349e-40 1.514870e-39 1.000000e+00
[14,] 1.199916e-42 2.399832e-42 1.000000e+00
[15,] 3.286544e-45 6.573088e-45 1.000000e+00
[16,] 1.173845e-47 2.347689e-47 1.000000e+00
[17,] 2.166822e-50 4.333644e-50 1.000000e+00
[18,] 5.447037e-53 1.089407e-52 1.000000e+00
[19,] 2.731767e-55 5.463533e-55 1.000000e+00
[20,] 5.312785e-58 1.062557e-57 1.000000e+00
[21,] 1.451164e-60 2.902328e-60 1.000000e+00
[22,] 2.912659e-63 5.825317e-63 1.000000e+00
[23,] 7.291252e-66 1.458250e-65 1.000000e+00
[24,] 1.271754e-68 2.543507e-68 1.000000e+00
[25,] 4.553155e-71 9.106310e-71 1.000000e+00
[26,] 9.507279e-74 1.901456e-73 1.000000e+00
[27,] 1.920770e-76 3.841540e-76 1.000000e+00
[28,] 4.048362e-79 8.096724e-79 1.000000e+00
[29,] 6.876781e-82 1.375356e-81 1.000000e+00
[30,] 3.926463e-84 7.852927e-84 1.000000e+00
[31,] 9.113727e-87 1.822745e-86 1.000000e+00
[32,] 1.392930e-89 2.785861e-89 1.000000e+00
[33,] 2.072658e-92 4.145315e-92 1.000000e+00
[34,] 3.674262e-95 7.348524e-95 1.000000e+00
[35,] 5.841307e-98 1.168261e-97 1.000000e+00
[36,] 8.121819e-101 1.624364e-100 1.000000e+00
[37,] 1.410053e-103 2.820106e-103 1.000000e+00
[38,] 8.146655e-106 1.629331e-105 1.000000e+00
[39,] 1.210276e-108 2.420552e-108 1.000000e+00
[40,] 1.869120e-111 3.738240e-111 1.000000e+00
[41,] 2.527391e-114 5.054783e-114 1.000000e+00
[42,] 3.912437e-117 7.824875e-117 1.000000e+00
[43,] 5.061783e-120 1.012357e-119 1.000000e+00
[44,] 1.768754e-122 3.537508e-122 1.000000e+00
[45,] 2.889055e-125 5.778109e-125 1.000000e+00
[46,] 7.588138e-128 1.517628e-127 1.000000e+00
[47,] 1.092798e-130 2.185595e-130 1.000000e+00
[48,] 5.751988e-133 1.150398e-132 1.000000e+00
[49,] 8.126579e-136 1.625316e-135 1.000000e+00
[50,] 1.089545e-138 2.179090e-138 1.000000e+00
[51,] 1.381442e-141 2.762885e-141 1.000000e+00
[52,] 1.966408e-143 3.932817e-143 1.000000e+00
[53,] 2.770060e-146 5.540119e-146 1.000000e+00
[54,] 3.673114e-149 7.346227e-149 1.000000e+00
[55,] 5.734992e-152 1.146998e-151 1.000000e+00
[56,] 1.217777e-154 2.435555e-154 1.000000e+00
[57,] 1.625890e-157 3.251781e-157 1.000000e+00
[58,] 2.814661e-160 5.629322e-160 1.000000e+00
[59,] 3.926738e-163 7.853475e-163 1.000000e+00
[60,] 6.468010e-166 1.293602e-165 1.000000e+00
[61,] 8.978443e-169 1.795689e-168 1.000000e+00
[62,] 1.982093e-171 3.964187e-171 1.000000e+00
[63,] 4.075501e-174 8.151002e-174 1.000000e+00
[64,] 1.056278e-176 2.112555e-176 1.000000e+00
[65,] 2.400033e-179 4.800067e-179 1.000000e+00
[66,] 9.610815e-182 1.922163e-181 1.000000e+00
[67,] 1.042099e-56 2.084199e-56 1.000000e+00
[68,] 1.763233e-51 3.526465e-51 1.000000e+00
[69,] 8.593367e-52 1.718673e-51 1.000000e+00
[70,] 1.182800e-45 2.365599e-45 1.000000e+00
[71,] 2.407687e-45 4.815373e-45 1.000000e+00
[72,] 2.178655e-44 4.357310e-44 1.000000e+00
[73,] 3.775019e-43 7.550038e-43 1.000000e+00
[74,] 1.560131e-39 3.120261e-39 1.000000e+00
[75,] 2.263587e-22 4.527173e-22 1.000000e+00
[76,] 9.572880e-16 1.914576e-15 1.000000e+00
[77,] 1.303087e-11 2.606175e-11 1.000000e+00
[78,] 1.300251e-08 2.600503e-08 1.000000e+00
[79,] 1.456166e-06 2.912332e-06 9.999985e-01
[80,] 4.641902e-05 9.283804e-05 9.999536e-01
[81,] 5.101746e-04 1.020349e-03 9.994898e-01
[82,] 2.772357e-03 5.544714e-03 9.972276e-01
[83,] 1.913513e-02 3.827026e-02 9.808649e-01
[84,] 4.315554e-02 8.631109e-02 9.568445e-01
[85,] 6.585368e-02 1.317074e-01 9.341463e-01
[86,] 8.363543e-02 1.672709e-01 9.163646e-01
[87,] 9.632294e-02 1.926459e-01 9.036771e-01
[88,] 1.284086e-01 2.568172e-01 8.715914e-01
[89,] 1.562711e-01 3.125421e-01 8.437289e-01
[90,] 1.768818e-01 3.537636e-01 8.231182e-01
[91,] 1.936046e-01 3.872091e-01 8.063954e-01
[92,] 2.481614e-01 4.963228e-01 7.518386e-01
[93,] 2.563811e-01 5.127623e-01 7.436189e-01
[94,] 2.206234e-01 4.412469e-01 7.793766e-01
[95,] 2.379405e-01 4.758810e-01 7.620595e-01
[96,] 3.100530e-01 6.201059e-01 6.899470e-01
[97,] 5.011672e-01 9.976657e-01 4.988328e-01
[98,] 6.310636e-01 7.378728e-01 3.689364e-01
[99,] 6.495140e-01 7.009720e-01 3.504860e-01
[100,] 6.050576e-01 7.898848e-01 3.949424e-01
[101,] 6.126145e-01 7.747711e-01 3.873855e-01
[102,] 7.086441e-01 5.827118e-01 2.913559e-01
[103,] 9.119909e-01 1.760182e-01 8.800910e-02
[104,] 9.326683e-01 1.346634e-01 6.733169e-02
[105,] 9.473206e-01 1.053587e-01 5.267936e-02
[106,] 9.623385e-01 7.532305e-02 3.766152e-02
[107,] 9.781465e-01 4.370700e-02 2.185350e-02
[108,] 9.847888e-01 3.042231e-02 1.521116e-02
[109,] 9.934000e-01 1.320007e-02 6.600037e-03
[110,] 9.992670e-01 1.465977e-03 7.329883e-04
[111,] 9.994808e-01 1.038400e-03 5.191999e-04
[112,] 9.998652e-01 2.696733e-04 1.348367e-04
[113,] 9.998769e-01 2.461128e-04 1.230564e-04
[114,] 9.998004e-01 3.992131e-04 1.996065e-04
[115,] 9.998843e-01 2.314843e-04 1.157421e-04
[116,] 9.999907e-01 1.869971e-05 9.349853e-06
[117,] 9.999852e-01 2.964668e-05 1.482334e-05
[118,] 9.999832e-01 3.359645e-05 1.679823e-05
[119,] 9.999895e-01 2.095281e-05 1.047640e-05
[120,] 9.999880e-01 2.392606e-05 1.196303e-05
[121,] 9.999767e-01 4.658624e-05 2.329312e-05
[122,] 9.999855e-01 2.909722e-05 1.454861e-05
[123,] 9.999998e-01 4.660856e-07 2.330428e-07
[124,] 9.999992e-01 1.642987e-06 8.214934e-07
[125,] 9.999990e-01 2.096487e-06 1.048244e-06
[126,] 9.999982e-01 3.533235e-06 1.766617e-06
[127,] 9.999959e-01 8.124841e-06 4.062421e-06
[128,] 9.999828e-01 3.443618e-05 1.721809e-05
[129,] 9.999574e-01 8.511710e-05 4.255855e-05
[130,] 9.998518e-01 2.963528e-04 1.481764e-04
[131,] 9.998498e-01 3.004486e-04 1.502243e-04
[132,] 9.998156e-01 3.687942e-04 1.843971e-04
[133,] 9.998198e-01 3.603507e-04 1.801754e-04
[134,] 9.990542e-01 1.891598e-03 9.457988e-04
[135,] 9.944846e-01 1.103085e-02 5.515423e-03
> postscript(file="/var/wessaorg/rcomp/tmp/116ws1353429897.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> plot(x[,1], type='l', main='Actuals and Interpolation', ylab='value of Actuals and Interpolation (dots)', xlab='time or index')
> points(x[,1]-mysum$resid)
> grid()
> dev.off()
null device
1
> postscript(file="/var/wessaorg/rcomp/tmp/2xrx81353429897.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> plot(mysum$resid, type='b', pch=19, main='Residuals', ylab='value of Residuals', xlab='time or index')
> grid()
> dev.off()
null device
1
> postscript(file="/var/wessaorg/rcomp/tmp/3f2t41353429897.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> hist(mysum$resid, main='Residual Histogram', xlab='values of Residuals')
> grid()
> dev.off()
null device
1
> postscript(file="/var/wessaorg/rcomp/tmp/4lkk61353429897.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> densityplot(~mysum$resid,col='black',main='Residual Density Plot', xlab='values of Residuals')
> dev.off()
null device
1
> postscript(file="/var/wessaorg/rcomp/tmp/5w7rk1353429897.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> qqnorm(mysum$resid, main='Residual Normal Q-Q Plot')
> qqline(mysum$resid)
> grid()
> dev.off()
null device
1
> (myerror <- as.ts(mysum$resid))
Time Series:
Start = 1
End = 150
Frequency = 1
1 2 3 4 5
-0.0534689236 -0.0393532912 -0.0195795273 -0.0315776969 -0.0456550444
6 7 8 9 10
-0.0482756950 -0.0484814373 -0.0586801542 -0.0732499256 -0.0685943258
11 12 13 14 15
-0.0598304641 -0.0762015017 -0.0915536997 -0.0807496877 -0.0695536770
16 17 18 19 20
-0.0793366114 -0.0690977671 -0.0621342443 -0.0653694870 -0.0348087809
21 22 23 24 25
-0.0266345122 -0.0426971933 -0.0388474348 -0.0561781891 -0.0674720983
26 27 28 29 30
-0.0600916778 -0.0588796170 -0.0344265036 -0.0283374841 -0.0282475819
31 32 33 34 35
-0.0069280748 -0.0067506542 -0.0001232922 0.0050169759 0.0212309082
36 37 38 39 40
0.0316828103 0.0377805843 0.0299956509 0.0368987792 0.0395298200
41 42 43 44 45
0.0603083558 0.0780948497 0.0844588683 0.0814631140 0.0896013157
46 47 48 49 50
0.0792479802 0.0593917093 0.0460192796 0.0716991933 0.0634370199
51 52 53 54 55
0.0894947166 0.0982305328 0.1127320645 0.1088619272 0.0804309204
56 57 58 59 60
0.0705687163 0.0657409592 0.0645185099 0.0704355454 0.0786081428
61 62 63 64 65
0.0887286910 0.1258998174 0.0924624227 0.0845706410 0.0660583142
66 67 68 69 70
0.0960419328 0.0988907316 0.1006203896 0.1332764930 0.1160443338
71 72 73 74 75
0.1808290540 0.1644000033 0.1904363849 0.3665120670 0.3608487894
76 77 78 79 80
0.2770038177 0.4355133488 0.3072800603 0.2419369395 0.2530157991
81 82 83 84 85
0.1617405731 -0.1337112381 -0.1256124837 -0.1256171915 -0.1252093794
86 87 88 89 90
-0.1823157252 -0.1748797709 -0.1146061656 0.0384055846 0.1520190312
91 92 93 94 95
-0.0245075871 -0.1375558965 -0.2599729112 -0.1895038843 0.0302860394
96 97 98 99 100
0.1974363069 -0.2628581157 -0.2535357978 -0.2602187079 0.0701536114
101 102 103 104 105
-0.0171547032 -0.0155750230 0.0169236012 -0.2085260270 -0.2327378793
106 107 108 109 110
-0.0687730695 0.2632807475 -0.0235869430 -0.1944838872 -0.5189179364
111 112 113 114 115
-0.2566144292 -0.2726665450 -0.0533340906 -0.3037067315 -0.3302266496
116 117 118 119 120
-0.1007670260 -0.1747677909 -0.1194594094 -0.4488993124 -0.4238098277
121 122 123 124 125
-0.3863138863 -0.1291019025 0.1724505903 -0.2350904140 -0.5140722909
126 127 128 129 130
-0.7834166652 -0.3194408093 0.1102810900 0.4067549434 0.3884932071
131 132 133 134 135
-0.2806940973 0.2795200456 0.2669951554 0.2289855904 -0.0895249144
136 137 138 139 140
-0.0868011389 -0.1700392420 -0.0913069451 0.2787954500 -0.1590805015
141 142 143 144 145
0.0911411023 0.1049107993 0.3900116313 0.5877266249 0.2118205749
146 147 148 149 150
0.4077785215 0.4313032214 0.0858254181 0.2066554617 -0.1053830049
> postscript(file="/var/wessaorg/rcomp/tmp/6lsg61353429897.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> dum <- cbind(lag(myerror,k=1),myerror)
> dum
Time Series:
Start = 0
End = 150
Frequency = 1
lag(myerror, k = 1) myerror
0 -0.0534689236 NA
1 -0.0393532912 -0.0534689236
2 -0.0195795273 -0.0393532912
3 -0.0315776969 -0.0195795273
4 -0.0456550444 -0.0315776969
5 -0.0482756950 -0.0456550444
6 -0.0484814373 -0.0482756950
7 -0.0586801542 -0.0484814373
8 -0.0732499256 -0.0586801542
9 -0.0685943258 -0.0732499256
10 -0.0598304641 -0.0685943258
11 -0.0762015017 -0.0598304641
12 -0.0915536997 -0.0762015017
13 -0.0807496877 -0.0915536997
14 -0.0695536770 -0.0807496877
15 -0.0793366114 -0.0695536770
16 -0.0690977671 -0.0793366114
17 -0.0621342443 -0.0690977671
18 -0.0653694870 -0.0621342443
19 -0.0348087809 -0.0653694870
20 -0.0266345122 -0.0348087809
21 -0.0426971933 -0.0266345122
22 -0.0388474348 -0.0426971933
23 -0.0561781891 -0.0388474348
24 -0.0674720983 -0.0561781891
25 -0.0600916778 -0.0674720983
26 -0.0588796170 -0.0600916778
27 -0.0344265036 -0.0588796170
28 -0.0283374841 -0.0344265036
29 -0.0282475819 -0.0283374841
30 -0.0069280748 -0.0282475819
31 -0.0067506542 -0.0069280748
32 -0.0001232922 -0.0067506542
33 0.0050169759 -0.0001232922
34 0.0212309082 0.0050169759
35 0.0316828103 0.0212309082
36 0.0377805843 0.0316828103
37 0.0299956509 0.0377805843
38 0.0368987792 0.0299956509
39 0.0395298200 0.0368987792
40 0.0603083558 0.0395298200
41 0.0780948497 0.0603083558
42 0.0844588683 0.0780948497
43 0.0814631140 0.0844588683
44 0.0896013157 0.0814631140
45 0.0792479802 0.0896013157
46 0.0593917093 0.0792479802
47 0.0460192796 0.0593917093
48 0.0716991933 0.0460192796
49 0.0634370199 0.0716991933
50 0.0894947166 0.0634370199
51 0.0982305328 0.0894947166
52 0.1127320645 0.0982305328
53 0.1088619272 0.1127320645
54 0.0804309204 0.1088619272
55 0.0705687163 0.0804309204
56 0.0657409592 0.0705687163
57 0.0645185099 0.0657409592
58 0.0704355454 0.0645185099
59 0.0786081428 0.0704355454
60 0.0887286910 0.0786081428
61 0.1258998174 0.0887286910
62 0.0924624227 0.1258998174
63 0.0845706410 0.0924624227
64 0.0660583142 0.0845706410
65 0.0960419328 0.0660583142
66 0.0988907316 0.0960419328
67 0.1006203896 0.0988907316
68 0.1332764930 0.1006203896
69 0.1160443338 0.1332764930
70 0.1808290540 0.1160443338
71 0.1644000033 0.1808290540
72 0.1904363849 0.1644000033
73 0.3665120670 0.1904363849
74 0.3608487894 0.3665120670
75 0.2770038177 0.3608487894
76 0.4355133488 0.2770038177
77 0.3072800603 0.4355133488
78 0.2419369395 0.3072800603
79 0.2530157991 0.2419369395
80 0.1617405731 0.2530157991
81 -0.1337112381 0.1617405731
82 -0.1256124837 -0.1337112381
83 -0.1256171915 -0.1256124837
84 -0.1252093794 -0.1256171915
85 -0.1823157252 -0.1252093794
86 -0.1748797709 -0.1823157252
87 -0.1146061656 -0.1748797709
88 0.0384055846 -0.1146061656
89 0.1520190312 0.0384055846
90 -0.0245075871 0.1520190312
91 -0.1375558965 -0.0245075871
92 -0.2599729112 -0.1375558965
93 -0.1895038843 -0.2599729112
94 0.0302860394 -0.1895038843
95 0.1974363069 0.0302860394
96 -0.2628581157 0.1974363069
97 -0.2535357978 -0.2628581157
98 -0.2602187079 -0.2535357978
99 0.0701536114 -0.2602187079
100 -0.0171547032 0.0701536114
101 -0.0155750230 -0.0171547032
102 0.0169236012 -0.0155750230
103 -0.2085260270 0.0169236012
104 -0.2327378793 -0.2085260270
105 -0.0687730695 -0.2327378793
106 0.2632807475 -0.0687730695
107 -0.0235869430 0.2632807475
108 -0.1944838872 -0.0235869430
109 -0.5189179364 -0.1944838872
110 -0.2566144292 -0.5189179364
111 -0.2726665450 -0.2566144292
112 -0.0533340906 -0.2726665450
113 -0.3037067315 -0.0533340906
114 -0.3302266496 -0.3037067315
115 -0.1007670260 -0.3302266496
116 -0.1747677909 -0.1007670260
117 -0.1194594094 -0.1747677909
118 -0.4488993124 -0.1194594094
119 -0.4238098277 -0.4488993124
120 -0.3863138863 -0.4238098277
121 -0.1291019025 -0.3863138863
122 0.1724505903 -0.1291019025
123 -0.2350904140 0.1724505903
124 -0.5140722909 -0.2350904140
125 -0.7834166652 -0.5140722909
126 -0.3194408093 -0.7834166652
127 0.1102810900 -0.3194408093
128 0.4067549434 0.1102810900
129 0.3884932071 0.4067549434
130 -0.2806940973 0.3884932071
131 0.2795200456 -0.2806940973
132 0.2669951554 0.2795200456
133 0.2289855904 0.2669951554
134 -0.0895249144 0.2289855904
135 -0.0868011389 -0.0895249144
136 -0.1700392420 -0.0868011389
137 -0.0913069451 -0.1700392420
138 0.2787954500 -0.0913069451
139 -0.1590805015 0.2787954500
140 0.0911411023 -0.1590805015
141 0.1049107993 0.0911411023
142 0.3900116313 0.1049107993
143 0.5877266249 0.3900116313
144 0.2118205749 0.5877266249
145 0.4077785215 0.2118205749
146 0.4313032214 0.4077785215
147 0.0858254181 0.4313032214
148 0.2066554617 0.0858254181
149 -0.1053830049 0.2066554617
150 NA -0.1053830049
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -0.0393532912 -0.0534689236
[2,] -0.0195795273 -0.0393532912
[3,] -0.0315776969 -0.0195795273
[4,] -0.0456550444 -0.0315776969
[5,] -0.0482756950 -0.0456550444
[6,] -0.0484814373 -0.0482756950
[7,] -0.0586801542 -0.0484814373
[8,] -0.0732499256 -0.0586801542
[9,] -0.0685943258 -0.0732499256
[10,] -0.0598304641 -0.0685943258
[11,] -0.0762015017 -0.0598304641
[12,] -0.0915536997 -0.0762015017
[13,] -0.0807496877 -0.0915536997
[14,] -0.0695536770 -0.0807496877
[15,] -0.0793366114 -0.0695536770
[16,] -0.0690977671 -0.0793366114
[17,] -0.0621342443 -0.0690977671
[18,] -0.0653694870 -0.0621342443
[19,] -0.0348087809 -0.0653694870
[20,] -0.0266345122 -0.0348087809
[21,] -0.0426971933 -0.0266345122
[22,] -0.0388474348 -0.0426971933
[23,] -0.0561781891 -0.0388474348
[24,] -0.0674720983 -0.0561781891
[25,] -0.0600916778 -0.0674720983
[26,] -0.0588796170 -0.0600916778
[27,] -0.0344265036 -0.0588796170
[28,] -0.0283374841 -0.0344265036
[29,] -0.0282475819 -0.0283374841
[30,] -0.0069280748 -0.0282475819
[31,] -0.0067506542 -0.0069280748
[32,] -0.0001232922 -0.0067506542
[33,] 0.0050169759 -0.0001232922
[34,] 0.0212309082 0.0050169759
[35,] 0.0316828103 0.0212309082
[36,] 0.0377805843 0.0316828103
[37,] 0.0299956509 0.0377805843
[38,] 0.0368987792 0.0299956509
[39,] 0.0395298200 0.0368987792
[40,] 0.0603083558 0.0395298200
[41,] 0.0780948497 0.0603083558
[42,] 0.0844588683 0.0780948497
[43,] 0.0814631140 0.0844588683
[44,] 0.0896013157 0.0814631140
[45,] 0.0792479802 0.0896013157
[46,] 0.0593917093 0.0792479802
[47,] 0.0460192796 0.0593917093
[48,] 0.0716991933 0.0460192796
[49,] 0.0634370199 0.0716991933
[50,] 0.0894947166 0.0634370199
[51,] 0.0982305328 0.0894947166
[52,] 0.1127320645 0.0982305328
[53,] 0.1088619272 0.1127320645
[54,] 0.0804309204 0.1088619272
[55,] 0.0705687163 0.0804309204
[56,] 0.0657409592 0.0705687163
[57,] 0.0645185099 0.0657409592
[58,] 0.0704355454 0.0645185099
[59,] 0.0786081428 0.0704355454
[60,] 0.0887286910 0.0786081428
[61,] 0.1258998174 0.0887286910
[62,] 0.0924624227 0.1258998174
[63,] 0.0845706410 0.0924624227
[64,] 0.0660583142 0.0845706410
[65,] 0.0960419328 0.0660583142
[66,] 0.0988907316 0.0960419328
[67,] 0.1006203896 0.0988907316
[68,] 0.1332764930 0.1006203896
[69,] 0.1160443338 0.1332764930
[70,] 0.1808290540 0.1160443338
[71,] 0.1644000033 0.1808290540
[72,] 0.1904363849 0.1644000033
[73,] 0.3665120670 0.1904363849
[74,] 0.3608487894 0.3665120670
[75,] 0.2770038177 0.3608487894
[76,] 0.4355133488 0.2770038177
[77,] 0.3072800603 0.4355133488
[78,] 0.2419369395 0.3072800603
[79,] 0.2530157991 0.2419369395
[80,] 0.1617405731 0.2530157991
[81,] -0.1337112381 0.1617405731
[82,] -0.1256124837 -0.1337112381
[83,] -0.1256171915 -0.1256124837
[84,] -0.1252093794 -0.1256171915
[85,] -0.1823157252 -0.1252093794
[86,] -0.1748797709 -0.1823157252
[87,] -0.1146061656 -0.1748797709
[88,] 0.0384055846 -0.1146061656
[89,] 0.1520190312 0.0384055846
[90,] -0.0245075871 0.1520190312
[91,] -0.1375558965 -0.0245075871
[92,] -0.2599729112 -0.1375558965
[93,] -0.1895038843 -0.2599729112
[94,] 0.0302860394 -0.1895038843
[95,] 0.1974363069 0.0302860394
[96,] -0.2628581157 0.1974363069
[97,] -0.2535357978 -0.2628581157
[98,] -0.2602187079 -0.2535357978
[99,] 0.0701536114 -0.2602187079
[100,] -0.0171547032 0.0701536114
[101,] -0.0155750230 -0.0171547032
[102,] 0.0169236012 -0.0155750230
[103,] -0.2085260270 0.0169236012
[104,] -0.2327378793 -0.2085260270
[105,] -0.0687730695 -0.2327378793
[106,] 0.2632807475 -0.0687730695
[107,] -0.0235869430 0.2632807475
[108,] -0.1944838872 -0.0235869430
[109,] -0.5189179364 -0.1944838872
[110,] -0.2566144292 -0.5189179364
[111,] -0.2726665450 -0.2566144292
[112,] -0.0533340906 -0.2726665450
[113,] -0.3037067315 -0.0533340906
[114,] -0.3302266496 -0.3037067315
[115,] -0.1007670260 -0.3302266496
[116,] -0.1747677909 -0.1007670260
[117,] -0.1194594094 -0.1747677909
[118,] -0.4488993124 -0.1194594094
[119,] -0.4238098277 -0.4488993124
[120,] -0.3863138863 -0.4238098277
[121,] -0.1291019025 -0.3863138863
[122,] 0.1724505903 -0.1291019025
[123,] -0.2350904140 0.1724505903
[124,] -0.5140722909 -0.2350904140
[125,] -0.7834166652 -0.5140722909
[126,] -0.3194408093 -0.7834166652
[127,] 0.1102810900 -0.3194408093
[128,] 0.4067549434 0.1102810900
[129,] 0.3884932071 0.4067549434
[130,] -0.2806940973 0.3884932071
[131,] 0.2795200456 -0.2806940973
[132,] 0.2669951554 0.2795200456
[133,] 0.2289855904 0.2669951554
[134,] -0.0895249144 0.2289855904
[135,] -0.0868011389 -0.0895249144
[136,] -0.1700392420 -0.0868011389
[137,] -0.0913069451 -0.1700392420
[138,] 0.2787954500 -0.0913069451
[139,] -0.1590805015 0.2787954500
[140,] 0.0911411023 -0.1590805015
[141,] 0.1049107993 0.0911411023
[142,] 0.3900116313 0.1049107993
[143,] 0.5877266249 0.3900116313
[144,] 0.2118205749 0.5877266249
[145,] 0.4077785215 0.2118205749
[146,] 0.4313032214 0.4077785215
[147,] 0.0858254181 0.4313032214
[148,] 0.2066554617 0.0858254181
[149,] -0.1053830049 0.2066554617
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -0.0393532912 -0.0534689236
2 -0.0195795273 -0.0393532912
3 -0.0315776969 -0.0195795273
4 -0.0456550444 -0.0315776969
5 -0.0482756950 -0.0456550444
6 -0.0484814373 -0.0482756950
7 -0.0586801542 -0.0484814373
8 -0.0732499256 -0.0586801542
9 -0.0685943258 -0.0732499256
10 -0.0598304641 -0.0685943258
11 -0.0762015017 -0.0598304641
12 -0.0915536997 -0.0762015017
13 -0.0807496877 -0.0915536997
14 -0.0695536770 -0.0807496877
15 -0.0793366114 -0.0695536770
16 -0.0690977671 -0.0793366114
17 -0.0621342443 -0.0690977671
18 -0.0653694870 -0.0621342443
19 -0.0348087809 -0.0653694870
20 -0.0266345122 -0.0348087809
21 -0.0426971933 -0.0266345122
22 -0.0388474348 -0.0426971933
23 -0.0561781891 -0.0388474348
24 -0.0674720983 -0.0561781891
25 -0.0600916778 -0.0674720983
26 -0.0588796170 -0.0600916778
27 -0.0344265036 -0.0588796170
28 -0.0283374841 -0.0344265036
29 -0.0282475819 -0.0283374841
30 -0.0069280748 -0.0282475819
31 -0.0067506542 -0.0069280748
32 -0.0001232922 -0.0067506542
33 0.0050169759 -0.0001232922
34 0.0212309082 0.0050169759
35 0.0316828103 0.0212309082
36 0.0377805843 0.0316828103
37 0.0299956509 0.0377805843
38 0.0368987792 0.0299956509
39 0.0395298200 0.0368987792
40 0.0603083558 0.0395298200
41 0.0780948497 0.0603083558
42 0.0844588683 0.0780948497
43 0.0814631140 0.0844588683
44 0.0896013157 0.0814631140
45 0.0792479802 0.0896013157
46 0.0593917093 0.0792479802
47 0.0460192796 0.0593917093
48 0.0716991933 0.0460192796
49 0.0634370199 0.0716991933
50 0.0894947166 0.0634370199
51 0.0982305328 0.0894947166
52 0.1127320645 0.0982305328
53 0.1088619272 0.1127320645
54 0.0804309204 0.1088619272
55 0.0705687163 0.0804309204
56 0.0657409592 0.0705687163
57 0.0645185099 0.0657409592
58 0.0704355454 0.0645185099
59 0.0786081428 0.0704355454
60 0.0887286910 0.0786081428
61 0.1258998174 0.0887286910
62 0.0924624227 0.1258998174
63 0.0845706410 0.0924624227
64 0.0660583142 0.0845706410
65 0.0960419328 0.0660583142
66 0.0988907316 0.0960419328
67 0.1006203896 0.0988907316
68 0.1332764930 0.1006203896
69 0.1160443338 0.1332764930
70 0.1808290540 0.1160443338
71 0.1644000033 0.1808290540
72 0.1904363849 0.1644000033
73 0.3665120670 0.1904363849
74 0.3608487894 0.3665120670
75 0.2770038177 0.3608487894
76 0.4355133488 0.2770038177
77 0.3072800603 0.4355133488
78 0.2419369395 0.3072800603
79 0.2530157991 0.2419369395
80 0.1617405731 0.2530157991
81 -0.1337112381 0.1617405731
82 -0.1256124837 -0.1337112381
83 -0.1256171915 -0.1256124837
84 -0.1252093794 -0.1256171915
85 -0.1823157252 -0.1252093794
86 -0.1748797709 -0.1823157252
87 -0.1146061656 -0.1748797709
88 0.0384055846 -0.1146061656
89 0.1520190312 0.0384055846
90 -0.0245075871 0.1520190312
91 -0.1375558965 -0.0245075871
92 -0.2599729112 -0.1375558965
93 -0.1895038843 -0.2599729112
94 0.0302860394 -0.1895038843
95 0.1974363069 0.0302860394
96 -0.2628581157 0.1974363069
97 -0.2535357978 -0.2628581157
98 -0.2602187079 -0.2535357978
99 0.0701536114 -0.2602187079
100 -0.0171547032 0.0701536114
101 -0.0155750230 -0.0171547032
102 0.0169236012 -0.0155750230
103 -0.2085260270 0.0169236012
104 -0.2327378793 -0.2085260270
105 -0.0687730695 -0.2327378793
106 0.2632807475 -0.0687730695
107 -0.0235869430 0.2632807475
108 -0.1944838872 -0.0235869430
109 -0.5189179364 -0.1944838872
110 -0.2566144292 -0.5189179364
111 -0.2726665450 -0.2566144292
112 -0.0533340906 -0.2726665450
113 -0.3037067315 -0.0533340906
114 -0.3302266496 -0.3037067315
115 -0.1007670260 -0.3302266496
116 -0.1747677909 -0.1007670260
117 -0.1194594094 -0.1747677909
118 -0.4488993124 -0.1194594094
119 -0.4238098277 -0.4488993124
120 -0.3863138863 -0.4238098277
121 -0.1291019025 -0.3863138863
122 0.1724505903 -0.1291019025
123 -0.2350904140 0.1724505903
124 -0.5140722909 -0.2350904140
125 -0.7834166652 -0.5140722909
126 -0.3194408093 -0.7834166652
127 0.1102810900 -0.3194408093
128 0.4067549434 0.1102810900
129 0.3884932071 0.4067549434
130 -0.2806940973 0.3884932071
131 0.2795200456 -0.2806940973
132 0.2669951554 0.2795200456
133 0.2289855904 0.2669951554
134 -0.0895249144 0.2289855904
135 -0.0868011389 -0.0895249144
136 -0.1700392420 -0.0868011389
137 -0.0913069451 -0.1700392420
138 0.2787954500 -0.0913069451
139 -0.1590805015 0.2787954500
140 0.0911411023 -0.1590805015
141 0.1049107993 0.0911411023
142 0.3900116313 0.1049107993
143 0.5877266249 0.3900116313
144 0.2118205749 0.5877266249
145 0.4077785215 0.2118205749
146 0.4313032214 0.4077785215
147 0.0858254181 0.4313032214
148 0.2066554617 0.0858254181
149 -0.1053830049 0.2066554617
> plot(z,main=paste('Residual Lag plot, lowess, and regression line'), ylab='values of Residuals', xlab='lagged values of Residuals')
> lines(lowess(z))
> abline(lm(z))
> grid()
> dev.off()
null device
1
> postscript(file="/var/wessaorg/rcomp/tmp/7frk41353429897.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> acf(mysum$resid, lag.max=length(mysum$resid)/2, main='Residual Autocorrelation Function')
> grid()
> dev.off()
null device
1
> postscript(file="/var/wessaorg/rcomp/tmp/8j9sc1353429897.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> pacf(mysum$resid, lag.max=length(mysum$resid)/2, main='Residual Partial Autocorrelation Function')
> grid()
> dev.off()
null device
1
> postscript(file="/var/wessaorg/rcomp/tmp/9wgz01353429897.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> opar <- par(mfrow = c(2,2), oma = c(0, 0, 1.1, 0))
> plot(mylm, las = 1, sub='Residual Diagnostics')
> par(opar)
> dev.off()
null device
1
> if (n > n25) {
+ postscript(file="/var/wessaorg/rcomp/tmp/10nim51353429897.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
+ plot(kp3:nmkm3,gqarr[,2], main='Goldfeld-Quandt test',ylab='2-sided p-value',xlab='breakpoint')
+ grid()
+ dev.off()
+ }
null device
1
>
> #Note: the /var/wessaorg/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab
> load(file="/var/wessaorg/rcomp/createtable")
>
> a<-table.start()
> a<-table.row.start(a)
> a<-table.element(a, 'Multiple Linear Regression - Estimated Regression Equation', 1, TRUE)
> a<-table.row.end(a)
> myeq <- colnames(x)[1]
> myeq <- paste(myeq, '[t] = ', sep='')
> for (i in 1:k){
+ if (mysum$coefficients[i,1] > 0) myeq <- paste(myeq, '+', '')
+ myeq <- paste(myeq, mysum$coefficients[i,1], sep=' ')
+ if (rownames(mysum$coefficients)[i] != '(Intercept)') {
+ myeq <- paste(myeq, rownames(mysum$coefficients)[i], sep='')
+ if (rownames(mysum$coefficients)[i] != 't') myeq <- paste(myeq, '[t]', sep='')
+ }
+ }
> myeq <- paste(myeq, ' + e[t]')
> a<-table.row.start(a)
> a<-table.element(a, myeq)
> a<-table.row.end(a)
> a<-table.end(a)
> table.save(a,file="/var/wessaorg/rcomp/tmp/11loux1353429897.tab")
> a<-table.start()
> a<-table.row.start(a)
> a<-table.element(a,hyperlink('http://www.xycoon.com/ols1.htm','Multiple Linear Regression - Ordinary Least Squares',''), 6, TRUE)
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a,'Variable',header=TRUE)
> a<-table.element(a,'Parameter',header=TRUE)
> a<-table.element(a,'S.D.',header=TRUE)
> a<-table.element(a,'T-STAT
H0: parameter = 0',header=TRUE)
> a<-table.element(a,'2-tail p-value',header=TRUE)
> a<-table.element(a,'1-tail p-value',header=TRUE)
> a<-table.row.end(a)
> for (i in 1:k){
+ a<-table.row.start(a)
+ a<-table.element(a,rownames(mysum$coefficients)[i],header=TRUE)
+ a<-table.element(a,mysum$coefficients[i,1])
+ a<-table.element(a, round(mysum$coefficients[i,2],6))
+ a<-table.element(a, round(mysum$coefficients[i,3],4))
+ a<-table.element(a, round(mysum$coefficients[i,4],6))
+ a<-table.element(a, round(mysum$coefficients[i,4]/2,6))
+ a<-table.row.end(a)
+ }
> a<-table.end(a)
> table.save(a,file="/var/wessaorg/rcomp/tmp/12g7hx1353429897.tab")
> a<-table.start()
> a<-table.row.start(a)
> a<-table.element(a, 'Multiple Linear Regression - Regression Statistics', 2, TRUE)
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a, 'Multiple R',1,TRUE)
> a<-table.element(a, sqrt(mysum$r.squared))
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a, 'R-squared',1,TRUE)
> a<-table.element(a, mysum$r.squared)
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a, 'Adjusted R-squared',1,TRUE)
> a<-table.element(a, mysum$adj.r.squared)
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a, 'F-TEST (value)',1,TRUE)
> a<-table.element(a, mysum$fstatistic[1])
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a, 'F-TEST (DF numerator)',1,TRUE)
> a<-table.element(a, mysum$fstatistic[2])
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a, 'F-TEST (DF denominator)',1,TRUE)
> a<-table.element(a, mysum$fstatistic[3])
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a, 'p-value',1,TRUE)
> a<-table.element(a, 1-pf(mysum$fstatistic[1],mysum$fstatistic[2],mysum$fstatistic[3]))
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a, 'Multiple Linear Regression - Residual Statistics', 2, TRUE)
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a, 'Residual Standard Deviation',1,TRUE)
> a<-table.element(a, mysum$sigma)
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a, 'Sum Squared Residuals',1,TRUE)
> a<-table.element(a, sum(myerror*myerror))
> a<-table.row.end(a)
> a<-table.end(a)
> table.save(a,file="/var/wessaorg/rcomp/tmp/133luz1353429897.tab")
> a<-table.start()
> a<-table.row.start(a)
> a<-table.element(a, 'Multiple Linear Regression - Actuals, Interpolation, and Residuals', 4, TRUE)
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a, 'Time or Index', 1, TRUE)
> a<-table.element(a, 'Actuals', 1, TRUE)
> a<-table.element(a, 'Interpolation
Forecast', 1, TRUE)
> a<-table.element(a, 'Residuals
Prediction Error', 1, TRUE)
> a<-table.row.end(a)
> for (i in 1:n) {
+ a<-table.row.start(a)
+ a<-table.element(a,i, 1, TRUE)
+ a<-table.element(a,x[i])
+ a<-table.element(a,x[i]-mysum$resid[i])
+ a<-table.element(a,mysum$resid[i])
+ a<-table.row.end(a)
+ }
> a<-table.end(a)
> table.save(a,file="/var/wessaorg/rcomp/tmp/14zf5r1353429897.tab")
> if (n > n25) {
+ a<-table.start()
+ a<-table.row.start(a)
+ a<-table.element(a,'Goldfeld-Quandt test for Heteroskedasticity',4,TRUE)
+ a<-table.row.end(a)
+ a<-table.row.start(a)
+ a<-table.element(a,'p-values',header=TRUE)
+ a<-table.element(a,'Alternative Hypothesis',3,header=TRUE)
+ a<-table.row.end(a)
+ a<-table.row.start(a)
+ a<-table.element(a,'breakpoint index',header=TRUE)
+ a<-table.element(a,'greater',header=TRUE)
+ a<-table.element(a,'2-sided',header=TRUE)
+ a<-table.element(a,'less',header=TRUE)
+ a<-table.row.end(a)
+ for (mypoint in kp3:nmkm3) {
+ a<-table.row.start(a)
+ a<-table.element(a,mypoint,header=TRUE)
+ a<-table.element(a,gqarr[mypoint-kp3+1,1])
+ a<-table.element(a,gqarr[mypoint-kp3+1,2])
+ a<-table.element(a,gqarr[mypoint-kp3+1,3])
+ a<-table.row.end(a)
+ }
+ a<-table.end(a)
+ table.save(a,file="/var/wessaorg/rcomp/tmp/15kn8g1353429897.tab")
+ a<-table.start()
+ a<-table.row.start(a)
+ a<-table.element(a,'Meta Analysis of Goldfeld-Quandt test for Heteroskedasticity',4,TRUE)
+ a<-table.row.end(a)
+ a<-table.row.start(a)
+ a<-table.element(a,'Description',header=TRUE)
+ a<-table.element(a,'# significant tests',header=TRUE)
+ a<-table.element(a,'% significant tests',header=TRUE)
+ a<-table.element(a,'OK/NOK',header=TRUE)
+ a<-table.row.end(a)
+ a<-table.row.start(a)
+ a<-table.element(a,'1% type I error level',header=TRUE)
+ a<-table.element(a,numsignificant1)
+ a<-table.element(a,numsignificant1/numgqtests)
+ if (numsignificant1/numgqtests < 0.01) dum <- 'OK' else dum <- 'NOK'
+ a<-table.element(a,dum)
+ a<-table.row.end(a)
+ a<-table.row.start(a)
+ a<-table.element(a,'5% type I error level',header=TRUE)
+ a<-table.element(a,numsignificant5)
+ a<-table.element(a,numsignificant5/numgqtests)
+ if (numsignificant5/numgqtests < 0.05) dum <- 'OK' else dum <- 'NOK'
+ a<-table.element(a,dum)
+ a<-table.row.end(a)
+ a<-table.row.start(a)
+ a<-table.element(a,'10% type I error level',header=TRUE)
+ a<-table.element(a,numsignificant10)
+ a<-table.element(a,numsignificant10/numgqtests)
+ if (numsignificant10/numgqtests < 0.1) dum <- 'OK' else dum <- 'NOK'
+ a<-table.element(a,dum)
+ a<-table.row.end(a)
+ a<-table.end(a)
+ table.save(a,file="/var/wessaorg/rcomp/tmp/16pmn71353429897.tab")
+ }
>
> try(system("convert tmp/116ws1353429897.ps tmp/116ws1353429897.png",intern=TRUE))
character(0)
> try(system("convert tmp/2xrx81353429897.ps tmp/2xrx81353429897.png",intern=TRUE))
character(0)
> try(system("convert tmp/3f2t41353429897.ps tmp/3f2t41353429897.png",intern=TRUE))
character(0)
> try(system("convert tmp/4lkk61353429897.ps tmp/4lkk61353429897.png",intern=TRUE))
character(0)
> try(system("convert tmp/5w7rk1353429897.ps tmp/5w7rk1353429897.png",intern=TRUE))
character(0)
> try(system("convert tmp/6lsg61353429897.ps tmp/6lsg61353429897.png",intern=TRUE))
character(0)
> try(system("convert tmp/7frk41353429897.ps tmp/7frk41353429897.png",intern=TRUE))
character(0)
> try(system("convert tmp/8j9sc1353429897.ps tmp/8j9sc1353429897.png",intern=TRUE))
character(0)
> try(system("convert tmp/9wgz01353429897.ps tmp/9wgz01353429897.png",intern=TRUE))
character(0)
> try(system("convert tmp/10nim51353429897.ps tmp/10nim51353429897.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
12.816 1.940 17.073