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(14915
+ ,3440
+ ,813
+ ,5126
+ ,2563
+ ,11773
+ ,3054
+ ,647
+ ,4127
+ ,1505
+ ,11608
+ ,3203
+ ,630
+ ,4232
+ ,1145
+ ,11468
+ ,3148
+ ,662
+ ,4167
+ ,1082
+ ,11511
+ ,3181
+ ,653
+ ,4058
+ ,1135
+ ,11200
+ ,3211
+ ,660
+ ,3802
+ ,1109
+ ,11164
+ ,3306
+ ,632
+ ,3907
+ ,932
+ ,10960
+ ,3252
+ ,673
+ ,3708
+ ,957
+ ,10667
+ ,3218
+ ,627
+ ,3724
+ ,806
+ ,11556
+ ,3418
+ ,641
+ ,4025
+ ,1107
+ ,11372
+ ,3188
+ ,660
+ ,4051
+ ,1081
+ ,12333
+ ,3186
+ ,723
+ ,4264
+ ,1255
+ ,13102
+ ,3360
+ ,797
+ ,4533
+ ,1507
+ ,11115
+ ,2944
+ ,680
+ ,3827
+ ,1205
+ ,12572
+ ,3522
+ ,752
+ ,4316
+ ,1305
+ ,11557
+ ,3121
+ ,724
+ ,4091
+ ,1089
+ ,12059
+ ,3305
+ ,799
+ ,4175
+ ,1164
+ ,11420
+ ,3283
+ ,778
+ ,3822
+ ,988
+ ,11185
+ ,3139
+ ,789
+ ,3610
+ ,1000
+ ,11113
+ ,3315
+ ,688
+ ,3478
+ ,1023
+ ,10706
+ ,3163
+ ,623
+ ,3526
+ ,878
+ ,11523
+ ,3318
+ ,683
+ ,3887
+ ,1032
+ ,11391
+ ,3208
+ ,694
+ ,3912
+ ,994
+ ,12634
+ ,3335
+ ,742
+ ,4466
+ ,1193
+ ,13469
+ ,3393
+ ,966
+ ,4553
+ ,1503
+ ,11735
+ ,3118
+ ,779
+ ,3992
+ ,1251
+ ,13281
+ ,3379
+ ,854
+ ,4535
+ ,1694
+ ,11968
+ ,3245
+ ,808
+ ,4113
+ ,1273
+ ,11623
+ ,3326
+ ,783
+ ,3982
+ ,984
+ ,11084
+ ,3318
+ ,815
+ ,3587
+ ,943
+ ,11509
+ ,3380
+ ,811
+ ,3792
+ ,936
+ ,11134
+ ,3283
+ ,912
+ ,3546
+ ,962
+ ,10438
+ ,3174
+ ,717
+ ,3444
+ ,717
+ ,11530
+ ,3348
+ ,787
+ ,4001
+ ,898
+ ,11491
+ ,3306
+ ,775
+ ,3928
+ ,963
+ ,13093
+ ,3407
+ ,961
+ ,4519
+ ,1387
+ ,13106
+ ,3373
+ ,952
+ ,4502
+ ,1442
+ ,11305
+ ,3055
+ ,778
+ ,3891
+ ,1197
+ ,13113
+ ,3382
+ ,928
+ ,4522
+ ,1536
+ ,12203
+ ,3344
+ ,811
+ ,4113
+ ,1308
+ ,11309
+ ,3315
+ ,811
+ ,3769
+ ,1047
+ ,11088
+ ,3276
+ ,844
+ ,3538
+ ,975
+ ,11234
+ ,3386
+ ,829
+ ,3504
+ ,975
+ ,11619
+ ,3304
+ ,972
+ ,3599
+ ,1092
+ ,10942
+ ,3301
+ ,791
+ ,3572
+ ,887
+ ,11445
+ ,3357
+ ,782
+ ,3816
+ ,972
+ ,11291
+ ,3289
+ ,828
+ ,3716
+ ,1066
+ ,13281
+ ,3485
+ ,912
+ ,4400
+ ,1745
+ ,13726
+ ,3489
+ ,990
+ ,4498
+ ,1930
+ ,11300
+ ,3189
+ ,755
+ ,3859
+ ,1108
+ ,11983
+ ,3455
+ ,840
+ ,4006
+ ,1167
+ ,11092
+ ,3295
+ ,781
+ ,3648
+ ,1024
+ ,11093
+ ,3335
+ ,828
+ ,3691
+ ,918
+ ,10692
+ ,3329
+ ,795
+ ,3481
+ ,894
+ ,10786
+ ,3382
+ ,838
+ ,3326
+ ,899
+ ,11166
+ ,3395
+ ,944
+ ,3376
+ ,1013
+ ,10553
+ ,3345
+ ,739
+ ,3436
+ ,770
+ ,11103
+ ,3374
+ ,789
+ ,3651
+ ,902
+ ,10969
+ ,3270
+ ,803
+ ,3629
+ ,937
+ ,12090
+ ,3442
+ ,859
+ ,4037
+ ,1193
+ ,12544
+ ,3448
+ ,927
+ ,4095
+ ,1493
+ ,12264
+ ,3216
+ ,860
+ ,3891
+ ,1827
+ ,13783
+ ,3542
+ ,1052
+ ,4476
+ ,2034
+ ,11214
+ ,3361
+ ,744
+ ,3568
+ ,1273
+ ,11453
+ ,3425
+ ,778
+ ,3681
+ ,1153
+ ,10883
+ ,3383
+ ,843
+ ,3299
+ ,1083
+ ,10381
+ ,3285
+ ,779
+ ,3156
+ ,907
+ ,10348
+ ,3435
+ ,760
+ ,3186
+ ,694
+ ,10024
+ ,3254
+ ,743
+ ,3012
+ ,803
+ ,10805
+ ,3337
+ ,838
+ ,3436
+ ,876
+ ,10796
+ ,3296
+ ,749
+ ,3587
+ ,975
+ ,11907
+ ,3391
+ ,918
+ ,3963
+ ,1197
+ ,12261
+ ,3508
+ ,907
+ ,3906
+ ,1356
+ ,11377
+ ,3091
+ ,873
+ ,3700
+ ,1366
+ ,12689
+ ,3451
+ ,968
+ ,4115
+ ,1532
+ ,11474
+ ,3315
+ ,957
+ ,3590
+ ,1262
+ ,10992
+ ,3368
+ ,866
+ ,3341
+ ,1073
+ ,10764
+ ,3412
+ ,887
+ ,3199
+ ,1029
+ ,12164
+ ,3521
+ ,1255
+ ,3407
+ ,1294
+ ,10409
+ ,3302
+ ,832
+ ,3081
+ ,824
+ ,10398
+ ,3278
+ ,887
+ ,3050
+ ,919
+ ,10349
+ ,3425
+ ,776
+ ,3155
+ ,899
+ ,10865
+ ,3384
+ ,784
+ ,3445
+ ,987
+ ,11630
+ ,3508
+ ,834
+ ,3731
+ ,1190
+ ,12221
+ ,3609
+ ,902
+ ,3803
+ ,1445
+ ,10884
+ ,3211
+ ,759
+ ,3471
+ ,1277
+ ,12019
+ ,3418
+ ,877
+ ,3840
+ ,1393
+ ,11021
+ ,3306
+ ,901
+ ,3396
+ ,1179
+ ,10799
+ ,3313
+ ,851
+ ,3270
+ ,1117
+ ,10423
+ ,3362
+ ,829
+ ,3106
+ ,997
+ ,10484
+ ,3413
+ ,825
+ ,3050
+ ,950
+ ,10450
+ ,3479
+ ,887
+ ,3035
+ ,817
+ ,9906
+ ,3213
+ ,787
+ ,2992
+ ,811
+ ,11049
+ ,3465
+ ,832
+ ,3430
+ ,1003
+ ,11281
+ ,3476
+ ,838
+ ,3541
+ ,1124
+ ,12485
+ ,3629
+ ,996
+ ,3915
+ ,1423
+ ,12849
+ ,3665
+ ,1080
+ ,3873
+ ,1562
+ ,11380
+ ,3420
+ ,931
+ ,3490
+ ,1246
+ ,12079
+ ,3611
+ ,987
+ ,3677
+ ,1317
+ ,11366
+ ,3341
+ ,953
+ ,3491
+ ,1257
+ ,11328
+ ,3511
+ ,989
+ ,3308
+ ,1139
+ ,10444
+ ,3407
+ ,907
+ ,3031
+ ,922
+ ,10854
+ ,3523
+ ,898
+ ,3044
+ ,1044
+ ,10434
+ ,3472
+ ,877
+ ,2933
+ ,903
+ ,10137
+ ,3385
+ ,893
+ ,2941
+ ,820
+ ,10992
+ ,3546
+ ,851
+ ,3355
+ ,1010
+ ,10906
+ ,3443
+ ,912
+ ,3259
+ ,1069
+ ,12367
+ ,3550
+ ,1062
+ ,3727
+ ,1500
+ ,14371
+ ,3795
+ ,1252
+ ,4201
+ ,2293
+ ,11695
+ ,3268
+ ,1013
+ ,3406
+ ,1616
+ ,11546
+ ,3560
+ ,912
+ ,3519
+ ,1229
+ ,10922
+ ,3488
+ ,877
+ ,3243
+ ,1127
+ ,10670
+ ,3436
+ ,926
+ ,3095
+ ,1031
+ ,10254
+ ,3440
+ ,925
+ ,2822
+ ,916
+ ,10573
+ ,3502
+ ,950
+ ,2997
+ ,900
+ ,10239
+ ,3509
+ ,990
+ ,2758
+ ,826
+ ,10253
+ ,3494
+ ,861
+ ,2932
+ ,797
+ ,11176
+ ,3782
+ ,937
+ ,3181
+ ,1054
+ ,10719
+ ,3430
+ ,906
+ ,3128
+ ,1050
+ ,11817
+ ,3692
+ ,1017
+ ,3615
+ ,1123
+ ,12487
+ ,3760
+ ,1107
+ ,3700
+ ,1398
+ ,11519
+ ,3370
+ ,1000
+ ,3477
+ ,1356
+ ,12025
+ ,3755
+ ,1068
+ ,3512
+ ,1208
+ ,10976
+ ,3515
+ ,885
+ ,3231
+ ,983
+ ,11276
+ ,3560
+ ,1042
+ ,3143
+ ,1062
+ ,10657
+ ,3607
+ ,974
+ ,2954
+ ,925
+ ,11141
+ ,3635
+ ,1136
+ ,2954
+ ,1029
+ ,10423
+ ,3628
+ ,968
+ ,2834
+ ,808
+ ,10640
+ ,3552
+ ,957
+ ,2941
+ ,936
+ ,11426
+ ,3742
+ ,1019
+ ,3281
+ ,1097
+ ,10948
+ ,3551
+ ,954
+ ,3196
+ ,1007
+ ,12540
+ ,3841
+ ,1211
+ ,3786
+ ,1207
+ ,12200
+ ,3675
+ ,1133
+ ,3602
+ ,1339
+ ,10644
+ ,3367
+ ,954
+ ,3066
+ ,1101
+ ,12044
+ ,3736
+ ,1050
+ ,3484
+ ,1275
+ ,11338
+ ,3632
+ ,1024
+ ,3194
+ ,1243
+ ,11292
+ ,3668
+ ,1025
+ ,3162
+ ,1147
+ ,10612
+ ,3543
+ ,985
+ ,2865
+ ,1032
+ ,10995
+ ,3773
+ ,1076
+ ,2960
+ ,936
+ ,10686
+ ,3653
+ ,1051
+ ,2909
+ ,915
+ ,10635
+ ,3662
+ ,1041
+ ,2864
+ ,864
+ ,11285
+ ,3745
+ ,1041
+ ,3204
+ ,995
+ ,11475
+ ,3761
+ ,1084
+ ,3188
+ ,1109
+ ,12535
+ ,3823
+ ,1204
+ ,3634
+ ,1361)
+ ,dim=c(5
+ ,144)
+ ,dimnames=list(c('Y_t'
+ ,'X_1t'
+ ,'X_2t'
+ ,'X_3t'
+ ,'X_4t')
+ ,1:144))
> y <- array(NA,dim=c(5,144),dimnames=list(c('Y_t','X_1t','X_2t','X_3t','X_4t'),1:144))
> 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 = '1'
> par3 <- 'Linear Trend'
> par2 <- 'Do not include Seasonal Dummies'
> par1 <- '1'
> #'GNU S' R Code compiled by R2WASP v. 1.0.44 ()
> #Author: Prof. Dr. P. Wessa
> #To cite this work: AUTHOR(S), (YEAR), YOUR SOFTWARE TITLE (vNUMBER) in Free Statistics Software (v$_version), Office for Research Development and Education, URL http://www.wessa.net/rwasp_YOURPAGE.wasp/
> #Source of accompanying publication: Office for Research, Development, and Education
> #Technical description: Write here your technical program description (don't use hard returns!)
> 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
Y_t X_1t X_2t X_3t X_4t t
1 14915 3440 813 5126 2563 1
2 11773 3054 647 4127 1505 2
3 11608 3203 630 4232 1145 3
4 11468 3148 662 4167 1082 4
5 11511 3181 653 4058 1135 5
6 11200 3211 660 3802 1109 6
7 11164 3306 632 3907 932 7
8 10960 3252 673 3708 957 8
9 10667 3218 627 3724 806 9
10 11556 3418 641 4025 1107 10
11 11372 3188 660 4051 1081 11
12 12333 3186 723 4264 1255 12
13 13102 3360 797 4533 1507 13
14 11115 2944 680 3827 1205 14
15 12572 3522 752 4316 1305 15
16 11557 3121 724 4091 1089 16
17 12059 3305 799 4175 1164 17
18 11420 3283 778 3822 988 18
19 11185 3139 789 3610 1000 19
20 11113 3315 688 3478 1023 20
21 10706 3163 623 3526 878 21
22 11523 3318 683 3887 1032 22
23 11391 3208 694 3912 994 23
24 12634 3335 742 4466 1193 24
25 13469 3393 966 4553 1503 25
26 11735 3118 779 3992 1251 26
27 13281 3379 854 4535 1694 27
28 11968 3245 808 4113 1273 28
29 11623 3326 783 3982 984 29
30 11084 3318 815 3587 943 30
31 11509 3380 811 3792 936 31
32 11134 3283 912 3546 962 32
33 10438 3174 717 3444 717 33
34 11530 3348 787 4001 898 34
35 11491 3306 775 3928 963 35
36 13093 3407 961 4519 1387 36
37 13106 3373 952 4502 1442 37
38 11305 3055 778 3891 1197 38
39 13113 3382 928 4522 1536 39
40 12203 3344 811 4113 1308 40
41 11309 3315 811 3769 1047 41
42 11088 3276 844 3538 975 42
43 11234 3386 829 3504 975 43
44 11619 3304 972 3599 1092 44
45 10942 3301 791 3572 887 45
46 11445 3357 782 3816 972 46
47 11291 3289 828 3716 1066 47
48 13281 3485 912 4400 1745 48
49 13726 3489 990 4498 1930 49
50 11300 3189 755 3859 1108 50
51 11983 3455 840 4006 1167 51
52 11092 3295 781 3648 1024 52
53 11093 3335 828 3691 918 53
54 10692 3329 795 3481 894 54
55 10786 3382 838 3326 899 55
56 11166 3395 944 3376 1013 56
57 10553 3345 739 3436 770 57
58 11103 3374 789 3651 902 58
59 10969 3270 803 3629 937 59
60 12090 3442 859 4037 1193 60
61 12544 3448 927 4095 1493 61
62 12264 3216 860 3891 1827 62
63 13783 3542 1052 4476 2034 63
64 11214 3361 744 3568 1273 64
65 11453 3425 778 3681 1153 65
66 10883 3383 843 3299 1083 66
67 10381 3285 779 3156 907 67
68 10348 3435 760 3186 694 68
69 10024 3254 743 3012 803 69
70 10805 3337 838 3436 876 70
71 10796 3296 749 3587 975 71
72 11907 3391 918 3963 1197 72
73 12261 3508 907 3906 1356 73
74 11377 3091 873 3700 1366 74
75 12689 3451 968 4115 1532 75
76 11474 3315 957 3590 1262 76
77 10992 3368 866 3341 1073 77
78 10764 3412 887 3199 1029 78
79 12164 3521 1255 3407 1294 79
80 10409 3302 832 3081 824 80
81 10398 3278 887 3050 919 81
82 10349 3425 776 3155 899 82
83 10865 3384 784 3445 987 83
84 11630 3508 834 3731 1190 84
85 12221 3609 902 3803 1445 85
86 10884 3211 759 3471 1277 86
87 12019 3418 877 3840 1393 87
88 11021 3306 901 3396 1179 88
89 10799 3313 851 3270 1117 89
90 10423 3362 829 3106 997 90
91 10484 3413 825 3050 950 91
92 10450 3479 887 3035 817 92
93 9906 3213 787 2992 811 93
94 11049 3465 832 3430 1003 94
95 11281 3476 838 3541 1124 95
96 12485 3629 996 3915 1423 96
97 12849 3665 1080 3873 1562 97
98 11380 3420 931 3490 1246 98
99 12079 3611 987 3677 1317 99
100 11366 3341 953 3491 1257 100
101 11328 3511 989 3308 1139 101
102 10444 3407 907 3031 922 102
103 10854 3523 898 3044 1044 103
104 10434 3472 877 2933 903 104
105 10137 3385 893 2941 820 105
106 10992 3546 851 3355 1010 106
107 10906 3443 912 3259 1069 107
108 12367 3550 1062 3727 1500 108
109 14371 3795 1252 4201 2293 109
110 11695 3268 1013 3406 1616 110
111 11546 3560 912 3519 1229 111
112 10922 3488 877 3243 1127 112
113 10670 3436 926 3095 1031 113
114 10254 3440 925 2822 916 114
115 10573 3502 950 2997 900 115
116 10239 3509 990 2758 826 116
117 10253 3494 861 2932 797 117
118 11176 3782 937 3181 1054 118
119 10719 3430 906 3128 1050 119
120 11817 3692 1017 3615 1123 120
121 12487 3760 1107 3700 1398 121
122 11519 3370 1000 3477 1356 122
123 12025 3755 1068 3512 1208 123
124 10976 3515 885 3231 983 124
125 11276 3560 1042 3143 1062 125
126 10657 3607 974 2954 925 126
127 11141 3635 1136 2954 1029 127
128 10423 3628 968 2834 808 128
129 10640 3552 957 2941 936 129
130 11426 3742 1019 3281 1097 130
131 10948 3551 954 3196 1007 131
132 12540 3841 1211 3786 1207 132
133 12200 3675 1133 3602 1339 133
134 10644 3367 954 3066 1101 134
135 12044 3736 1050 3484 1275 135
136 11338 3632 1024 3194 1243 136
137 11292 3668 1025 3162 1147 137
138 10612 3543 985 2865 1032 138
139 10995 3773 1076 2960 936 139
140 10686 3653 1051 2909 915 140
141 10635 3662 1041 2864 864 141
142 11285 3745 1041 3204 995 142
143 11475 3761 1084 3188 1109 143
144 12535 3823 1204 3634 1361 144
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) X_1t X_2t X_3t X_4t t
543.179 1.169 1.839 1.216 1.025 -3.369
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-171.440 -45.447 -3.693 37.382 305.306
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 543.17921 196.29568 2.767 0.00643 **
X_1t 1.16860 0.07469 15.646 < 2e-16 ***
X_2t 1.83918 0.10790 17.046 < 2e-16 ***
X_3t 1.21611 0.04106 29.621 < 2e-16 ***
X_4t 1.02513 0.04666 21.968 < 2e-16 ***
t -3.36895 0.51004 -6.605 7.93e-10 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 81.95 on 138 degrees of freedom
Multiple R-squared: 0.9918, Adjusted R-squared: 0.9915
F-statistic: 3342 on 5 and 138 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,] 0.19303705 3.860741e-01 8.069629e-01
[2,] 0.13158638 2.631728e-01 8.684136e-01
[3,] 0.07270373 1.454075e-01 9.272963e-01
[4,] 0.85450227 2.909955e-01 1.454977e-01
[5,] 0.85317060 2.936588e-01 1.468294e-01
[6,] 0.86579695 2.684061e-01 1.342030e-01
[7,] 0.83971141 3.205772e-01 1.602886e-01
[8,] 0.90416075 1.916785e-01 9.583925e-02
[9,] 0.96317385 7.365230e-02 3.682615e-02
[10,] 0.94728588 1.054282e-01 5.271412e-02
[11,] 0.95159064 9.681873e-02 4.840936e-02
[12,] 0.98524187 2.951627e-02 1.475813e-02
[13,] 0.98825011 2.349978e-02 1.174989e-02
[14,] 0.98534329 2.931342e-02 1.465671e-02
[15,] 0.98359094 3.281813e-02 1.640906e-02
[16,] 0.99406389 1.187221e-02 5.936105e-03
[17,] 0.99703774 5.924524e-03 2.962262e-03
[18,] 0.99962051 7.589861e-04 3.794930e-04
[19,] 0.99994221 1.155891e-04 5.779455e-05
[20,] 0.99999796 4.087005e-06 2.043502e-06
[21,] 0.99999871 2.571642e-06 1.285821e-06
[22,] 0.99999968 6.375118e-07 3.187559e-07
[23,] 0.99999957 8.556890e-07 4.278445e-07
[24,] 0.99999989 2.153655e-07 1.076828e-07
[25,] 0.99999986 2.843300e-07 1.421650e-07
[26,] 0.99999991 1.769085e-07 8.845426e-08
[27,] 0.99999989 2.128516e-07 1.064258e-07
[28,] 0.99999988 2.482094e-07 1.241047e-07
[29,] 0.99999987 2.541122e-07 1.270561e-07
[30,] 0.99999996 7.874905e-08 3.937452e-08
[31,] 0.99999996 8.309590e-08 4.154795e-08
[32,] 0.99999995 1.005862e-07 5.029308e-08
[33,] 0.99999998 3.512176e-08 1.756088e-08
[34,] 0.99999997 6.657122e-08 3.328561e-08
[35,] 0.99999997 5.030414e-08 2.515207e-08
[36,] 0.99999998 3.268745e-08 1.634373e-08
[37,] 0.99999997 5.544639e-08 2.772320e-08
[38,] 0.99999997 5.088393e-08 2.544196e-08
[39,] 0.99999997 5.518948e-08 2.759474e-08
[40,] 0.99999996 8.212403e-08 4.106202e-08
[41,] 0.99999994 1.170461e-07 5.852305e-08
[42,] 0.99999990 2.008181e-07 1.004090e-07
[43,] 0.99999983 3.340993e-07 1.670497e-07
[44,] 0.99999972 5.684070e-07 2.842035e-07
[45,] 0.99999979 4.264336e-07 2.132168e-07
[46,] 0.99999996 7.989110e-08 3.994555e-08
[47,] 0.99999992 1.573322e-07 7.866612e-08
[48,] 0.99999985 2.952059e-07 1.476029e-07
[49,] 0.99999972 5.566728e-07 2.783364e-07
[50,] 0.99999951 9.884606e-07 4.942303e-07
[51,] 0.99999911 1.779304e-06 8.896520e-07
[52,] 0.99999873 2.530155e-06 1.265078e-06
[53,] 0.99999778 4.438675e-06 2.219337e-06
[54,] 0.99999600 8.004608e-06 4.002304e-06
[55,] 0.99999845 3.100316e-06 1.550158e-06
[56,] 0.99999783 4.348268e-06 2.174134e-06
[57,] 0.99999731 5.389657e-06 2.694828e-06
[58,] 0.99999643 7.134561e-06 3.567280e-06
[59,] 0.99999465 1.070043e-05 5.350217e-06
[60,] 0.99999319 1.361588e-05 6.807941e-06
[61,] 0.99999262 1.475336e-05 7.376682e-06
[62,] 0.99998730 2.540740e-05 1.270370e-05
[63,] 0.99998679 2.641252e-05 1.320626e-05
[64,] 0.99998355 3.289338e-05 1.644669e-05
[65,] 0.99998416 3.168729e-05 1.584364e-05
[66,] 0.99997340 5.319361e-05 2.659680e-05
[67,] 0.99996050 7.900176e-05 3.950088e-05
[68,] 0.99996696 6.608636e-05 3.304318e-05
[69,] 0.99994884 1.023119e-04 5.115597e-05
[70,] 0.99994622 1.075553e-04 5.377763e-05
[71,] 0.99991224 1.755192e-04 8.775958e-05
[72,] 0.99999271 1.457613e-05 7.288067e-06
[73,] 0.99998916 2.168920e-05 1.084460e-05
[74,] 0.99999340 1.320432e-05 6.602161e-06
[75,] 0.99998858 2.283127e-05 1.141564e-05
[76,] 0.99997982 4.036282e-05 2.018141e-05
[77,] 0.99996647 6.705512e-05 3.352756e-05
[78,] 0.99996385 7.230900e-05 3.615450e-05
[79,] 0.99996348 7.304308e-05 3.652154e-05
[80,] 0.99996300 7.400161e-05 3.700080e-05
[81,] 0.99993656 1.268884e-04 6.344420e-05
[82,] 0.99994620 1.075944e-04 5.379722e-05
[83,] 0.99992883 1.423303e-04 7.116514e-05
[84,] 0.99987701 2.459865e-04 1.229932e-04
[85,] 0.99979345 4.130949e-04 2.065475e-04
[86,] 0.99972739 5.452232e-04 2.726116e-04
[87,] 0.99954766 9.046723e-04 4.523361e-04
[88,] 0.99926121 1.477577e-03 7.387883e-04
[89,] 0.99927236 1.455282e-03 7.276412e-04
[90,] 0.99914064 1.718726e-03 8.593630e-04
[91,] 0.99870753 2.584935e-03 1.292468e-03
[92,] 0.99804384 3.912315e-03 1.956158e-03
[93,] 0.99709025 5.819496e-03 2.909748e-03
[94,] 0.99592965 8.140709e-03 4.070355e-03
[95,] 0.99773361 4.532784e-03 2.266392e-03
[96,] 0.99804116 3.917681e-03 1.958840e-03
[97,] 0.99775387 4.492260e-03 2.246130e-03
[98,] 0.99649438 7.011238e-03 3.505619e-03
[99,] 0.99535445 9.291095e-03 4.645547e-03
[100,] 0.99299206 1.401588e-02 7.007939e-03
[101,] 0.99009822 1.980356e-02 9.901779e-03
[102,] 0.98592409 2.815182e-02 1.407591e-02
[103,] 0.97897721 4.204559e-02 2.102279e-02
[104,] 0.97552235 4.895531e-02 2.447765e-02
[105,] 0.97139721 5.720558e-02 2.860279e-02
[106,] 0.96030045 7.939909e-02 3.969955e-02
[107,] 0.94367762 1.126448e-01 5.632238e-02
[108,] 0.93425285 1.314943e-01 6.574715e-02
[109,] 0.91064590 1.787082e-01 8.935410e-02
[110,] 0.92782379 1.443524e-01 7.217621e-02
[111,] 0.91244104 1.751179e-01 8.755896e-02
[112,] 0.91782881 1.643424e-01 8.217119e-02
[113,] 0.89366823 2.126635e-01 1.063318e-01
[114,] 0.90073506 1.985299e-01 9.926494e-02
[115,] 0.86205188 2.758962e-01 1.379481e-01
[116,] 0.91230389 1.753922e-01 8.769611e-02
[117,] 0.98403009 3.193982e-02 1.596991e-02
[118,] 0.97546919 4.906162e-02 2.453081e-02
[119,] 0.98401010 3.197980e-02 1.598990e-02
[120,] 0.97187210 5.625581e-02 2.812790e-02
[121,] 0.99001572 1.996857e-02 9.984283e-03
[122,] 0.98636409 2.727182e-02 1.363591e-02
[123,] 0.97026665 5.946670e-02 2.973335e-02
[124,] 0.95693964 8.612073e-02 4.306036e-02
[125,] 0.91196303 1.760739e-01 8.803697e-02
[126,] 0.83371966 3.325607e-01 1.662803e-01
[127,] 0.90418722 1.916256e-01 9.581278e-02
> postscript(file="/var/wessaorg/rcomp/tmp/1z92s1353865784.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/2u2ak1353865784.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/3csfb1353865784.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/4lwm01353865784.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/5i2m21353865784.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 = 144
Frequency = 1
1 2 3 4 5 6
-1.2680888 -84.0264700 -147.1567365 -134.7374451 -32.1558490 -49.7412140
7 8 9 10 11 12
-88.1355840 -84.6904099 -114.6492191 -156.3647836 -108.1265668 305.3062588
13 14 15 16 17 18
152.7710045 38.6284780 -6.0686358 -2.5381615 -29.1691339 9.2429156
19 20 21 22 23 24
171.1739798 219.5739820 203.3884656 135.3861220 123.6229511 255.5710556
25 26 27 28 29 30
190.5919317 65.8256161 57.7672871 -65.8878233 -0.6218379 -63.3631208
31 32 33 34 35 36
57.7821425 -113.7411692 54.8464657 -44.7876235 12.8751991 4.7492089
37 38 39 40 41 42
41.6947710 -70.1012162 -31.6294495 52.4504589 -118.3885038 3.5946660
43 44 45 46 47 48
93.3525657 79.0734813 -15.1731781 58.4388363 -72.0807557 9.8640613
49 50 51 52 53 54
1.2739556 -18.8132104 -38.8743750 -49.0551092 -121.5001257 -171.4400772
55 56 57 58 59 60
-31.7201363 -36.1666911 -34.1952876 -3.4564644 -47.4263952 14.3406938
61 62 63 64 65 66
-38.4409066 -15.0392193 -150.3853227 -53.6757684 36.9660842 -63.8160073
67 68 69 70 71 72
24.1111424 36.0041618 58.0202070 -19.7928929 -98.9456600 -91.2528063
73 74 75 76 77 78
55.9422776 -34.5811190 10.5098217 -106.7151319 16.6450882 -80.2334924
79 80 81 82 83 84
-5.6712605 154.8593935 14.4317911 -106.0245449 3.6595644 -20.7475242
85 86 87 88 89 90
-18.4410351 -47.9936346 63.7905970 -84.7646203 -2.8286731 -69.8009889
91 92 93 94 95 96
58.6094230 -8.5938441 3.9851149 43.6200778 -3.9303790 -27.2888027
97 98 99 100 101 102
52.1025086 -63.4698586 12.5043425 -31.3666909 12.6434806 -36.3230963
103 104 105 106 107 108
117.1644235 78.2872938 -67.7446953 -18.5214424 -36.7122513 15.7662532
109 110 111 112 113 114
-1.9851967 41.6263826 -0.1737503 -32.0835786 -31.6693921 2.7532676
115 116 117 118 119 120
10.2719758 -35.5957297 54.6815416 -61.5564116 21.7302029 -54.3049325
121 122 123 124 125 126
-11.2085250 -9.0434574 34.5048597 178.2908190 166.3540385 -8.8488754
127 128 129 130 131 132
41.2385521 16.2575465 84.3301730 -40.8892797 22.8611891 -115.8662324
133 134 135 136 137 138
-26.6064823 5.7230606 114.6079718 -33.1929824 17.5955460 39.6827281
139 140 141 142 143 144
-27.2100325 -63.0796282 4.1705396 12.7747384 10.9538409 -19.5515706
> postscript(file="/var/wessaorg/rcomp/tmp/6xpad1353865784.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 = 144
Frequency = 1
lag(myerror, k = 1) myerror
0 -1.2680888 NA
1 -84.0264700 -1.2680888
2 -147.1567365 -84.0264700
3 -134.7374451 -147.1567365
4 -32.1558490 -134.7374451
5 -49.7412140 -32.1558490
6 -88.1355840 -49.7412140
7 -84.6904099 -88.1355840
8 -114.6492191 -84.6904099
9 -156.3647836 -114.6492191
10 -108.1265668 -156.3647836
11 305.3062588 -108.1265668
12 152.7710045 305.3062588
13 38.6284780 152.7710045
14 -6.0686358 38.6284780
15 -2.5381615 -6.0686358
16 -29.1691339 -2.5381615
17 9.2429156 -29.1691339
18 171.1739798 9.2429156
19 219.5739820 171.1739798
20 203.3884656 219.5739820
21 135.3861220 203.3884656
22 123.6229511 135.3861220
23 255.5710556 123.6229511
24 190.5919317 255.5710556
25 65.8256161 190.5919317
26 57.7672871 65.8256161
27 -65.8878233 57.7672871
28 -0.6218379 -65.8878233
29 -63.3631208 -0.6218379
30 57.7821425 -63.3631208
31 -113.7411692 57.7821425
32 54.8464657 -113.7411692
33 -44.7876235 54.8464657
34 12.8751991 -44.7876235
35 4.7492089 12.8751991
36 41.6947710 4.7492089
37 -70.1012162 41.6947710
38 -31.6294495 -70.1012162
39 52.4504589 -31.6294495
40 -118.3885038 52.4504589
41 3.5946660 -118.3885038
42 93.3525657 3.5946660
43 79.0734813 93.3525657
44 -15.1731781 79.0734813
45 58.4388363 -15.1731781
46 -72.0807557 58.4388363
47 9.8640613 -72.0807557
48 1.2739556 9.8640613
49 -18.8132104 1.2739556
50 -38.8743750 -18.8132104
51 -49.0551092 -38.8743750
52 -121.5001257 -49.0551092
53 -171.4400772 -121.5001257
54 -31.7201363 -171.4400772
55 -36.1666911 -31.7201363
56 -34.1952876 -36.1666911
57 -3.4564644 -34.1952876
58 -47.4263952 -3.4564644
59 14.3406938 -47.4263952
60 -38.4409066 14.3406938
61 -15.0392193 -38.4409066
62 -150.3853227 -15.0392193
63 -53.6757684 -150.3853227
64 36.9660842 -53.6757684
65 -63.8160073 36.9660842
66 24.1111424 -63.8160073
67 36.0041618 24.1111424
68 58.0202070 36.0041618
69 -19.7928929 58.0202070
70 -98.9456600 -19.7928929
71 -91.2528063 -98.9456600
72 55.9422776 -91.2528063
73 -34.5811190 55.9422776
74 10.5098217 -34.5811190
75 -106.7151319 10.5098217
76 16.6450882 -106.7151319
77 -80.2334924 16.6450882
78 -5.6712605 -80.2334924
79 154.8593935 -5.6712605
80 14.4317911 154.8593935
81 -106.0245449 14.4317911
82 3.6595644 -106.0245449
83 -20.7475242 3.6595644
84 -18.4410351 -20.7475242
85 -47.9936346 -18.4410351
86 63.7905970 -47.9936346
87 -84.7646203 63.7905970
88 -2.8286731 -84.7646203
89 -69.8009889 -2.8286731
90 58.6094230 -69.8009889
91 -8.5938441 58.6094230
92 3.9851149 -8.5938441
93 43.6200778 3.9851149
94 -3.9303790 43.6200778
95 -27.2888027 -3.9303790
96 52.1025086 -27.2888027
97 -63.4698586 52.1025086
98 12.5043425 -63.4698586
99 -31.3666909 12.5043425
100 12.6434806 -31.3666909
101 -36.3230963 12.6434806
102 117.1644235 -36.3230963
103 78.2872938 117.1644235
104 -67.7446953 78.2872938
105 -18.5214424 -67.7446953
106 -36.7122513 -18.5214424
107 15.7662532 -36.7122513
108 -1.9851967 15.7662532
109 41.6263826 -1.9851967
110 -0.1737503 41.6263826
111 -32.0835786 -0.1737503
112 -31.6693921 -32.0835786
113 2.7532676 -31.6693921
114 10.2719758 2.7532676
115 -35.5957297 10.2719758
116 54.6815416 -35.5957297
117 -61.5564116 54.6815416
118 21.7302029 -61.5564116
119 -54.3049325 21.7302029
120 -11.2085250 -54.3049325
121 -9.0434574 -11.2085250
122 34.5048597 -9.0434574
123 178.2908190 34.5048597
124 166.3540385 178.2908190
125 -8.8488754 166.3540385
126 41.2385521 -8.8488754
127 16.2575465 41.2385521
128 84.3301730 16.2575465
129 -40.8892797 84.3301730
130 22.8611891 -40.8892797
131 -115.8662324 22.8611891
132 -26.6064823 -115.8662324
133 5.7230606 -26.6064823
134 114.6079718 5.7230606
135 -33.1929824 114.6079718
136 17.5955460 -33.1929824
137 39.6827281 17.5955460
138 -27.2100325 39.6827281
139 -63.0796282 -27.2100325
140 4.1705396 -63.0796282
141 12.7747384 4.1705396
142 10.9538409 12.7747384
143 -19.5515706 10.9538409
144 NA -19.5515706
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -84.0264700 -1.2680888
[2,] -147.1567365 -84.0264700
[3,] -134.7374451 -147.1567365
[4,] -32.1558490 -134.7374451
[5,] -49.7412140 -32.1558490
[6,] -88.1355840 -49.7412140
[7,] -84.6904099 -88.1355840
[8,] -114.6492191 -84.6904099
[9,] -156.3647836 -114.6492191
[10,] -108.1265668 -156.3647836
[11,] 305.3062588 -108.1265668
[12,] 152.7710045 305.3062588
[13,] 38.6284780 152.7710045
[14,] -6.0686358 38.6284780
[15,] -2.5381615 -6.0686358
[16,] -29.1691339 -2.5381615
[17,] 9.2429156 -29.1691339
[18,] 171.1739798 9.2429156
[19,] 219.5739820 171.1739798
[20,] 203.3884656 219.5739820
[21,] 135.3861220 203.3884656
[22,] 123.6229511 135.3861220
[23,] 255.5710556 123.6229511
[24,] 190.5919317 255.5710556
[25,] 65.8256161 190.5919317
[26,] 57.7672871 65.8256161
[27,] -65.8878233 57.7672871
[28,] -0.6218379 -65.8878233
[29,] -63.3631208 -0.6218379
[30,] 57.7821425 -63.3631208
[31,] -113.7411692 57.7821425
[32,] 54.8464657 -113.7411692
[33,] -44.7876235 54.8464657
[34,] 12.8751991 -44.7876235
[35,] 4.7492089 12.8751991
[36,] 41.6947710 4.7492089
[37,] -70.1012162 41.6947710
[38,] -31.6294495 -70.1012162
[39,] 52.4504589 -31.6294495
[40,] -118.3885038 52.4504589
[41,] 3.5946660 -118.3885038
[42,] 93.3525657 3.5946660
[43,] 79.0734813 93.3525657
[44,] -15.1731781 79.0734813
[45,] 58.4388363 -15.1731781
[46,] -72.0807557 58.4388363
[47,] 9.8640613 -72.0807557
[48,] 1.2739556 9.8640613
[49,] -18.8132104 1.2739556
[50,] -38.8743750 -18.8132104
[51,] -49.0551092 -38.8743750
[52,] -121.5001257 -49.0551092
[53,] -171.4400772 -121.5001257
[54,] -31.7201363 -171.4400772
[55,] -36.1666911 -31.7201363
[56,] -34.1952876 -36.1666911
[57,] -3.4564644 -34.1952876
[58,] -47.4263952 -3.4564644
[59,] 14.3406938 -47.4263952
[60,] -38.4409066 14.3406938
[61,] -15.0392193 -38.4409066
[62,] -150.3853227 -15.0392193
[63,] -53.6757684 -150.3853227
[64,] 36.9660842 -53.6757684
[65,] -63.8160073 36.9660842
[66,] 24.1111424 -63.8160073
[67,] 36.0041618 24.1111424
[68,] 58.0202070 36.0041618
[69,] -19.7928929 58.0202070
[70,] -98.9456600 -19.7928929
[71,] -91.2528063 -98.9456600
[72,] 55.9422776 -91.2528063
[73,] -34.5811190 55.9422776
[74,] 10.5098217 -34.5811190
[75,] -106.7151319 10.5098217
[76,] 16.6450882 -106.7151319
[77,] -80.2334924 16.6450882
[78,] -5.6712605 -80.2334924
[79,] 154.8593935 -5.6712605
[80,] 14.4317911 154.8593935
[81,] -106.0245449 14.4317911
[82,] 3.6595644 -106.0245449
[83,] -20.7475242 3.6595644
[84,] -18.4410351 -20.7475242
[85,] -47.9936346 -18.4410351
[86,] 63.7905970 -47.9936346
[87,] -84.7646203 63.7905970
[88,] -2.8286731 -84.7646203
[89,] -69.8009889 -2.8286731
[90,] 58.6094230 -69.8009889
[91,] -8.5938441 58.6094230
[92,] 3.9851149 -8.5938441
[93,] 43.6200778 3.9851149
[94,] -3.9303790 43.6200778
[95,] -27.2888027 -3.9303790
[96,] 52.1025086 -27.2888027
[97,] -63.4698586 52.1025086
[98,] 12.5043425 -63.4698586
[99,] -31.3666909 12.5043425
[100,] 12.6434806 -31.3666909
[101,] -36.3230963 12.6434806
[102,] 117.1644235 -36.3230963
[103,] 78.2872938 117.1644235
[104,] -67.7446953 78.2872938
[105,] -18.5214424 -67.7446953
[106,] -36.7122513 -18.5214424
[107,] 15.7662532 -36.7122513
[108,] -1.9851967 15.7662532
[109,] 41.6263826 -1.9851967
[110,] -0.1737503 41.6263826
[111,] -32.0835786 -0.1737503
[112,] -31.6693921 -32.0835786
[113,] 2.7532676 -31.6693921
[114,] 10.2719758 2.7532676
[115,] -35.5957297 10.2719758
[116,] 54.6815416 -35.5957297
[117,] -61.5564116 54.6815416
[118,] 21.7302029 -61.5564116
[119,] -54.3049325 21.7302029
[120,] -11.2085250 -54.3049325
[121,] -9.0434574 -11.2085250
[122,] 34.5048597 -9.0434574
[123,] 178.2908190 34.5048597
[124,] 166.3540385 178.2908190
[125,] -8.8488754 166.3540385
[126,] 41.2385521 -8.8488754
[127,] 16.2575465 41.2385521
[128,] 84.3301730 16.2575465
[129,] -40.8892797 84.3301730
[130,] 22.8611891 -40.8892797
[131,] -115.8662324 22.8611891
[132,] -26.6064823 -115.8662324
[133,] 5.7230606 -26.6064823
[134,] 114.6079718 5.7230606
[135,] -33.1929824 114.6079718
[136,] 17.5955460 -33.1929824
[137,] 39.6827281 17.5955460
[138,] -27.2100325 39.6827281
[139,] -63.0796282 -27.2100325
[140,] 4.1705396 -63.0796282
[141,] 12.7747384 4.1705396
[142,] 10.9538409 12.7747384
[143,] -19.5515706 10.9538409
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -84.0264700 -1.2680888
2 -147.1567365 -84.0264700
3 -134.7374451 -147.1567365
4 -32.1558490 -134.7374451
5 -49.7412140 -32.1558490
6 -88.1355840 -49.7412140
7 -84.6904099 -88.1355840
8 -114.6492191 -84.6904099
9 -156.3647836 -114.6492191
10 -108.1265668 -156.3647836
11 305.3062588 -108.1265668
12 152.7710045 305.3062588
13 38.6284780 152.7710045
14 -6.0686358 38.6284780
15 -2.5381615 -6.0686358
16 -29.1691339 -2.5381615
17 9.2429156 -29.1691339
18 171.1739798 9.2429156
19 219.5739820 171.1739798
20 203.3884656 219.5739820
21 135.3861220 203.3884656
22 123.6229511 135.3861220
23 255.5710556 123.6229511
24 190.5919317 255.5710556
25 65.8256161 190.5919317
26 57.7672871 65.8256161
27 -65.8878233 57.7672871
28 -0.6218379 -65.8878233
29 -63.3631208 -0.6218379
30 57.7821425 -63.3631208
31 -113.7411692 57.7821425
32 54.8464657 -113.7411692
33 -44.7876235 54.8464657
34 12.8751991 -44.7876235
35 4.7492089 12.8751991
36 41.6947710 4.7492089
37 -70.1012162 41.6947710
38 -31.6294495 -70.1012162
39 52.4504589 -31.6294495
40 -118.3885038 52.4504589
41 3.5946660 -118.3885038
42 93.3525657 3.5946660
43 79.0734813 93.3525657
44 -15.1731781 79.0734813
45 58.4388363 -15.1731781
46 -72.0807557 58.4388363
47 9.8640613 -72.0807557
48 1.2739556 9.8640613
49 -18.8132104 1.2739556
50 -38.8743750 -18.8132104
51 -49.0551092 -38.8743750
52 -121.5001257 -49.0551092
53 -171.4400772 -121.5001257
54 -31.7201363 -171.4400772
55 -36.1666911 -31.7201363
56 -34.1952876 -36.1666911
57 -3.4564644 -34.1952876
58 -47.4263952 -3.4564644
59 14.3406938 -47.4263952
60 -38.4409066 14.3406938
61 -15.0392193 -38.4409066
62 -150.3853227 -15.0392193
63 -53.6757684 -150.3853227
64 36.9660842 -53.6757684
65 -63.8160073 36.9660842
66 24.1111424 -63.8160073
67 36.0041618 24.1111424
68 58.0202070 36.0041618
69 -19.7928929 58.0202070
70 -98.9456600 -19.7928929
71 -91.2528063 -98.9456600
72 55.9422776 -91.2528063
73 -34.5811190 55.9422776
74 10.5098217 -34.5811190
75 -106.7151319 10.5098217
76 16.6450882 -106.7151319
77 -80.2334924 16.6450882
78 -5.6712605 -80.2334924
79 154.8593935 -5.6712605
80 14.4317911 154.8593935
81 -106.0245449 14.4317911
82 3.6595644 -106.0245449
83 -20.7475242 3.6595644
84 -18.4410351 -20.7475242
85 -47.9936346 -18.4410351
86 63.7905970 -47.9936346
87 -84.7646203 63.7905970
88 -2.8286731 -84.7646203
89 -69.8009889 -2.8286731
90 58.6094230 -69.8009889
91 -8.5938441 58.6094230
92 3.9851149 -8.5938441
93 43.6200778 3.9851149
94 -3.9303790 43.6200778
95 -27.2888027 -3.9303790
96 52.1025086 -27.2888027
97 -63.4698586 52.1025086
98 12.5043425 -63.4698586
99 -31.3666909 12.5043425
100 12.6434806 -31.3666909
101 -36.3230963 12.6434806
102 117.1644235 -36.3230963
103 78.2872938 117.1644235
104 -67.7446953 78.2872938
105 -18.5214424 -67.7446953
106 -36.7122513 -18.5214424
107 15.7662532 -36.7122513
108 -1.9851967 15.7662532
109 41.6263826 -1.9851967
110 -0.1737503 41.6263826
111 -32.0835786 -0.1737503
112 -31.6693921 -32.0835786
113 2.7532676 -31.6693921
114 10.2719758 2.7532676
115 -35.5957297 10.2719758
116 54.6815416 -35.5957297
117 -61.5564116 54.6815416
118 21.7302029 -61.5564116
119 -54.3049325 21.7302029
120 -11.2085250 -54.3049325
121 -9.0434574 -11.2085250
122 34.5048597 -9.0434574
123 178.2908190 34.5048597
124 166.3540385 178.2908190
125 -8.8488754 166.3540385
126 41.2385521 -8.8488754
127 16.2575465 41.2385521
128 84.3301730 16.2575465
129 -40.8892797 84.3301730
130 22.8611891 -40.8892797
131 -115.8662324 22.8611891
132 -26.6064823 -115.8662324
133 5.7230606 -26.6064823
134 114.6079718 5.7230606
135 -33.1929824 114.6079718
136 17.5955460 -33.1929824
137 39.6827281 17.5955460
138 -27.2100325 39.6827281
139 -63.0796282 -27.2100325
140 4.1705396 -63.0796282
141 12.7747384 4.1705396
142 10.9538409 12.7747384
143 -19.5515706 10.9538409
> 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/7dp9n1353865784.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/8yw6b1353865784.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/92byf1353865784.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/10k2xc1353865784.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/11ayi81353865784.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/12znep1353865784.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/13i4ww1353865784.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/146acc1353865784.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/15li5h1353865784.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/16nrtv1353865784.tab")
+ }
>
> try(system("convert tmp/1z92s1353865784.ps tmp/1z92s1353865784.png",intern=TRUE))
character(0)
> try(system("convert tmp/2u2ak1353865784.ps tmp/2u2ak1353865784.png",intern=TRUE))
character(0)
> try(system("convert tmp/3csfb1353865784.ps tmp/3csfb1353865784.png",intern=TRUE))
character(0)
> try(system("convert tmp/4lwm01353865784.ps tmp/4lwm01353865784.png",intern=TRUE))
character(0)
> try(system("convert tmp/5i2m21353865784.ps tmp/5i2m21353865784.png",intern=TRUE))
character(0)
> try(system("convert tmp/6xpad1353865784.ps tmp/6xpad1353865784.png",intern=TRUE))
character(0)
> try(system("convert tmp/7dp9n1353865784.ps tmp/7dp9n1353865784.png",intern=TRUE))
character(0)
> try(system("convert tmp/8yw6b1353865784.ps tmp/8yw6b1353865784.png",intern=TRUE))
character(0)
> try(system("convert tmp/92byf1353865784.ps tmp/92byf1353865784.png",intern=TRUE))
character(0)
> try(system("convert tmp/10k2xc1353865784.ps tmp/10k2xc1353865784.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
7.131 1.103 8.270