R version 2.8.0 (2008-10-20)
Copyright (C) 2008 The R Foundation for Statistical Computing
ISBN 3-900051-07-0
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(1687
+ ,0
+ ,1508
+ ,0
+ ,1507
+ ,0
+ ,1385
+ ,0
+ ,1632
+ ,0
+ ,1511
+ ,0
+ ,1559
+ ,0
+ ,1630
+ ,0
+ ,1579
+ ,0
+ ,1653
+ ,0
+ ,2152
+ ,0
+ ,2148
+ ,0
+ ,1752
+ ,0
+ ,1765
+ ,0
+ ,1717
+ ,0
+ ,1558
+ ,0
+ ,1575
+ ,0
+ ,1520
+ ,0
+ ,1805
+ ,0
+ ,1800
+ ,0
+ ,1719
+ ,0
+ ,2008
+ ,0
+ ,2242
+ ,0
+ ,2478
+ ,0
+ ,2030
+ ,0
+ ,1655
+ ,0
+ ,1693
+ ,0
+ ,1623
+ ,0
+ ,1805
+ ,0
+ ,1746
+ ,0
+ ,1795
+ ,0
+ ,1926
+ ,0
+ ,1619
+ ,0
+ ,1992
+ ,0
+ ,2233
+ ,0
+ ,2192
+ ,0
+ ,2080
+ ,0
+ ,1768
+ ,0
+ ,1835
+ ,0
+ ,1569
+ ,0
+ ,1976
+ ,0
+ ,1853
+ ,0
+ ,1965
+ ,0
+ ,1689
+ ,0
+ ,1778
+ ,0
+ ,1976
+ ,0
+ ,2397
+ ,0
+ ,2654
+ ,0
+ ,2097
+ ,0
+ ,1963
+ ,0
+ ,1677
+ ,0
+ ,1941
+ ,0
+ ,2003
+ ,0
+ ,1813
+ ,0
+ ,2012
+ ,0
+ ,1912
+ ,0
+ ,2084
+ ,0
+ ,2080
+ ,0
+ ,2118
+ ,0
+ ,2150
+ ,0
+ ,1608
+ ,0
+ ,1503
+ ,0
+ ,1548
+ ,0
+ ,1382
+ ,0
+ ,1731
+ ,0
+ ,1798
+ ,0
+ ,1779
+ ,0
+ ,1887
+ ,0
+ ,2004
+ ,0
+ ,2077
+ ,0
+ ,2092
+ ,0
+ ,2051
+ ,0
+ ,1577
+ ,0
+ ,1356
+ ,0
+ ,1652
+ ,0
+ ,1382
+ ,0
+ ,1519
+ ,0
+ ,1421
+ ,0
+ ,1442
+ ,0
+ ,1543
+ ,0
+ ,1656
+ ,0
+ ,1561
+ ,0
+ ,1905
+ ,0
+ ,2199
+ ,0
+ ,1473
+ ,0
+ ,1655
+ ,0
+ ,1407
+ ,0
+ ,1395
+ ,0
+ ,1530
+ ,0
+ ,1309
+ ,0
+ ,1526
+ ,0
+ ,1327
+ ,0
+ ,1627
+ ,0
+ ,1748
+ ,0
+ ,1958
+ ,0
+ ,2274
+ ,0
+ ,1648
+ ,0
+ ,1401
+ ,0
+ ,1411
+ ,0
+ ,1403
+ ,0
+ ,1394
+ ,0
+ ,1520
+ ,0
+ ,1528
+ ,0
+ ,1643
+ ,0
+ ,1515
+ ,0
+ ,1685
+ ,0
+ ,2000
+ ,0
+ ,2215
+ ,0
+ ,1956
+ ,0
+ ,1462
+ ,0
+ ,1563
+ ,0
+ ,1459
+ ,0
+ ,1446
+ ,0
+ ,1622
+ ,0
+ ,1657
+ ,0
+ ,1638
+ ,0
+ ,1643
+ ,0
+ ,1683
+ ,0
+ ,2050
+ ,0
+ ,2262
+ ,0
+ ,1813
+ ,0
+ ,1445
+ ,0
+ ,1762
+ ,0
+ ,1461
+ ,0
+ ,1556
+ ,0
+ ,1431
+ ,0
+ ,1427
+ ,0
+ ,1554
+ ,0
+ ,1645
+ ,0
+ ,1653
+ ,0
+ ,2016
+ ,0
+ ,2207
+ ,0
+ ,1665
+ ,0
+ ,1361
+ ,0
+ ,1506
+ ,0
+ ,1360
+ ,0
+ ,1453
+ ,0
+ ,1522
+ ,0
+ ,1460
+ ,0
+ ,1552
+ ,0
+ ,1548
+ ,0
+ ,1827
+ ,0
+ ,1737
+ ,0
+ ,1941
+ ,0
+ ,1474
+ ,0
+ ,1458
+ ,0
+ ,1542
+ ,0
+ ,1404
+ ,0
+ ,1522
+ ,0
+ ,1385
+ ,0
+ ,1641
+ ,0
+ ,1510
+ ,0
+ ,1681
+ ,0
+ ,1938
+ ,0
+ ,1868
+ ,0
+ ,1726
+ ,0
+ ,1456
+ ,0
+ ,1445
+ ,0
+ ,1456
+ ,0
+ ,1365
+ ,0
+ ,1487
+ ,0
+ ,1558
+ ,0
+ ,1488
+ ,0
+ ,1684
+ ,0
+ ,1594
+ ,0
+ ,1850
+ ,0
+ ,1998
+ ,0
+ ,2079
+ ,0
+ ,1494
+ ,0
+ ,1057
+ ,1
+ ,1218
+ ,1
+ ,1168
+ ,1
+ ,1236
+ ,1
+ ,1076
+ ,1
+ ,1174
+ ,1
+ ,1139
+ ,1
+ ,1427
+ ,1
+ ,1487
+ ,1
+ ,1483
+ ,1
+ ,1513
+ ,1
+ ,1357
+ ,1
+ ,1165
+ ,1
+ ,1282
+ ,1
+ ,1110
+ ,1
+ ,1297
+ ,1
+ ,1185
+ ,1
+ ,1222
+ ,1
+ ,1284
+ ,1
+ ,1444
+ ,1
+ ,1575
+ ,1
+ ,1737
+ ,1
+ ,1763
+ ,1)
+ ,dim=c(2
+ ,192)
+ ,dimnames=list(c('Slachtoffers'
+ ,'Seatbelt')
+ ,1:192))
> y <- array(NA,dim=c(2,192),dimnames=list(c('Slachtoffers','Seatbelt'),1:192))
> 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'
> #'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.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
Slachtoffers Seatbelt t
1 1687 0 1
2 1508 0 2
3 1507 0 3
4 1385 0 4
5 1632 0 5
6 1511 0 6
7 1559 0 7
8 1630 0 8
9 1579 0 9
10 1653 0 10
11 2152 0 11
12 2148 0 12
13 1752 0 13
14 1765 0 14
15 1717 0 15
16 1558 0 16
17 1575 0 17
18 1520 0 18
19 1805 0 19
20 1800 0 20
21 1719 0 21
22 2008 0 22
23 2242 0 23
24 2478 0 24
25 2030 0 25
26 1655 0 26
27 1693 0 27
28 1623 0 28
29 1805 0 29
30 1746 0 30
31 1795 0 31
32 1926 0 32
33 1619 0 33
34 1992 0 34
35 2233 0 35
36 2192 0 36
37 2080 0 37
38 1768 0 38
39 1835 0 39
40 1569 0 40
41 1976 0 41
42 1853 0 42
43 1965 0 43
44 1689 0 44
45 1778 0 45
46 1976 0 46
47 2397 0 47
48 2654 0 48
49 2097 0 49
50 1963 0 50
51 1677 0 51
52 1941 0 52
53 2003 0 53
54 1813 0 54
55 2012 0 55
56 1912 0 56
57 2084 0 57
58 2080 0 58
59 2118 0 59
60 2150 0 60
61 1608 0 61
62 1503 0 62
63 1548 0 63
64 1382 0 64
65 1731 0 65
66 1798 0 66
67 1779 0 67
68 1887 0 68
69 2004 0 69
70 2077 0 70
71 2092 0 71
72 2051 0 72
73 1577 0 73
74 1356 0 74
75 1652 0 75
76 1382 0 76
77 1519 0 77
78 1421 0 78
79 1442 0 79
80 1543 0 80
81 1656 0 81
82 1561 0 82
83 1905 0 83
84 2199 0 84
85 1473 0 85
86 1655 0 86
87 1407 0 87
88 1395 0 88
89 1530 0 89
90 1309 0 90
91 1526 0 91
92 1327 0 92
93 1627 0 93
94 1748 0 94
95 1958 0 95
96 2274 0 96
97 1648 0 97
98 1401 0 98
99 1411 0 99
100 1403 0 100
101 1394 0 101
102 1520 0 102
103 1528 0 103
104 1643 0 104
105 1515 0 105
106 1685 0 106
107 2000 0 107
108 2215 0 108
109 1956 0 109
110 1462 0 110
111 1563 0 111
112 1459 0 112
113 1446 0 113
114 1622 0 114
115 1657 0 115
116 1638 0 116
117 1643 0 117
118 1683 0 118
119 2050 0 119
120 2262 0 120
121 1813 0 121
122 1445 0 122
123 1762 0 123
124 1461 0 124
125 1556 0 125
126 1431 0 126
127 1427 0 127
128 1554 0 128
129 1645 0 129
130 1653 0 130
131 2016 0 131
132 2207 0 132
133 1665 0 133
134 1361 0 134
135 1506 0 135
136 1360 0 136
137 1453 0 137
138 1522 0 138
139 1460 0 139
140 1552 0 140
141 1548 0 141
142 1827 0 142
143 1737 0 143
144 1941 0 144
145 1474 0 145
146 1458 0 146
147 1542 0 147
148 1404 0 148
149 1522 0 149
150 1385 0 150
151 1641 0 151
152 1510 0 152
153 1681 0 153
154 1938 0 154
155 1868 0 155
156 1726 0 156
157 1456 0 157
158 1445 0 158
159 1456 0 159
160 1365 0 160
161 1487 0 161
162 1558 0 162
163 1488 0 163
164 1684 0 164
165 1594 0 165
166 1850 0 166
167 1998 0 167
168 2079 0 168
169 1494 0 169
170 1057 1 170
171 1218 1 171
172 1168 1 172
173 1236 1 173
174 1076 1 174
175 1174 1 175
176 1139 1 176
177 1427 1 177
178 1487 1 178
179 1483 1 179
180 1513 1 180
181 1357 1 181
182 1165 1 182
183 1282 1 183
184 1110 1 184
185 1297 1 185
186 1185 1 186
187 1222 1 187
188 1284 1 188
189 1444 1 189
190 1575 1 190
191 1737 1 191
192 1763 1 192
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) Seatbelt t
1846.030 -251.177 -1.509
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-454.99 -181.86 -60.57 183.96 880.41
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 1846.0300 38.7814 47.601 < 2e-16 ***
Seatbelt -251.1766 67.5209 -3.720 0.000263 ***
t -1.5092 0.3956 -3.815 0.000184 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 251.2 on 189 degrees of freedom
Multiple R-squared: 0.2556, Adjusted R-squared: 0.2477
F-statistic: 32.44 on 2 and 189 DF, p-value: 7.73e-13
> 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.159385312 0.3187706242 0.8406146879
[2,] 0.076006377 0.1520127531 0.9239936234
[3,] 0.042091280 0.0841825609 0.9579087195
[4,] 0.017061423 0.0341228464 0.9829385768
[5,] 0.007893973 0.0157879464 0.9921060268
[6,] 0.190586984 0.3811739677 0.8094130161
[7,] 0.241802414 0.4836048277 0.7581975862
[8,] 0.210227648 0.4204552969 0.7897723516
[9,] 0.173049454 0.3460989088 0.8269505456
[10,] 0.154756867 0.3095137348 0.8452431326
[11,] 0.206990094 0.4139801882 0.7930099059
[12,] 0.217496955 0.4349939096 0.7825030452
[13,] 0.237213678 0.4744273554 0.7627863223
[14,] 0.182402893 0.3648057861 0.8175971070
[15,] 0.136046549 0.2720930987 0.8639534507
[16,] 0.102804531 0.2056090621 0.8971954689
[17,] 0.095888255 0.1917765098 0.9041117451
[18,] 0.159893558 0.3197871160 0.8401064420
[19,] 0.379375260 0.7587505202 0.6206247399
[20,] 0.320081733 0.6401634653 0.6799182674
[21,] 0.396918970 0.7938379408 0.6030810296
[22,] 0.424341677 0.8486833541 0.5756583230
[23,] 0.476965510 0.9539310200 0.5230344900
[24,] 0.433927886 0.8678557721 0.5660721139
[25,] 0.408001234 0.8160024676 0.5919987662
[26,] 0.366091320 0.7321826409 0.6339086795
[27,] 0.312293296 0.6245865919 0.6877067041
[28,] 0.339574227 0.6791484533 0.6604257734
[29,] 0.294404405 0.5888088100 0.7055955950
[30,] 0.322187534 0.6443750676 0.6778124662
[31,] 0.318409618 0.6368192351 0.6815903825
[32,] 0.280619325 0.5612386500 0.7193806750
[33,] 0.277471911 0.5549438219 0.7225280890
[34,] 0.252179320 0.5043586400 0.7478206800
[35,] 0.331982284 0.6639645679 0.6680177161
[36,] 0.287852806 0.5757056119 0.7121471940
[37,] 0.254098575 0.5081971510 0.7459014245
[38,] 0.216316856 0.4326337127 0.7836831436
[39,] 0.225476101 0.4509522023 0.7745238988
[40,] 0.206266799 0.4125335972 0.7937332014
[41,] 0.174299123 0.3485982460 0.8257008770
[42,] 0.268512521 0.5370250429 0.7314874786
[43,] 0.594522133 0.8109557335 0.4054778668
[44,] 0.569258645 0.8614827103 0.4307413552
[45,] 0.538917409 0.9221651829 0.4610825915
[46,] 0.586195736 0.8276085284 0.4138042642
[47,] 0.555310242 0.8893795167 0.4446897584
[48,] 0.524988467 0.9500230656 0.4750115328
[49,] 0.514994775 0.9700104495 0.4850052248
[50,] 0.487224603 0.9744492061 0.5127753969
[51,] 0.461458274 0.9229165484 0.5385417258
[52,] 0.447787504 0.8955750080 0.5522124960
[53,] 0.436728655 0.8734573108 0.5632713446
[54,] 0.438213342 0.8764266845 0.5617866578
[55,] 0.454138178 0.9082763554 0.5458618223
[56,] 0.540246619 0.9195067615 0.4597533807
[57,] 0.662375971 0.6752480578 0.3376240289
[58,] 0.728860203 0.5422795935 0.2711397968
[59,] 0.842361001 0.3152779976 0.1576389988
[60,] 0.832722617 0.3345547662 0.1672773831
[61,] 0.815790607 0.3684187866 0.1842093933
[62,] 0.798576567 0.4028468652 0.2014234326
[63,] 0.779326617 0.4413467662 0.2206733831
[64,] 0.774517927 0.4509641459 0.2254820730
[65,] 0.789097453 0.4218050945 0.2109025472
[66,] 0.811422254 0.3771554920 0.1885777460
[67,] 0.827454480 0.3450910402 0.1725455201
[68,] 0.845270019 0.3094599617 0.1547299809
[69,] 0.907943019 0.1841139626 0.0920569813
[70,] 0.904058293 0.1918834147 0.0959417074
[71,] 0.934606283 0.1307874336 0.0653937168
[72,] 0.938410446 0.1231791078 0.0615895539
[73,] 0.950511275 0.0989774501 0.0494887251
[74,] 0.957039057 0.0859218850 0.0429609425
[75,] 0.954577166 0.0908456675 0.0454228338
[76,] 0.946399455 0.1072010902 0.0536005451
[77,] 0.941055175 0.1178896510 0.0589448255
[78,] 0.937330837 0.1253383259 0.0626691630
[79,] 0.968050864 0.0638982720 0.0319491360
[80,] 0.968542177 0.0629156461 0.0314578230
[81,] 0.962308210 0.0753835794 0.0376917897
[82,] 0.966153238 0.0676935241 0.0338467620
[83,] 0.969816719 0.0603665624 0.0301832812
[84,] 0.965824162 0.0683516763 0.0341758381
[85,] 0.974738687 0.0505226250 0.0252613125
[86,] 0.970928097 0.0581438060 0.0290719030
[87,] 0.977175322 0.0456493568 0.0228246784
[88,] 0.971280246 0.0574395089 0.0287197545
[89,] 0.964450261 0.0710994773 0.0355497386
[90,] 0.966904951 0.0661900975 0.0330950487
[91,] 0.991111670 0.0177766608 0.0088883304
[92,] 0.988479999 0.0230400016 0.0115200008
[93,] 0.988741163 0.0225176737 0.0112588369
[94,] 0.988718580 0.0225628403 0.0112814202
[95,] 0.988905617 0.0221887654 0.0110943827
[96,] 0.989375068 0.0212498631 0.0106249315
[97,] 0.987230399 0.0255392021 0.0127696011
[98,] 0.984600924 0.0307981523 0.0153990761
[99,] 0.980058525 0.0398829508 0.0199414754
[100,] 0.976637815 0.0467243700 0.0233621850
[101,] 0.970199965 0.0596000708 0.0298000354
[102,] 0.975943367 0.0481132661 0.0240566331
[103,] 0.992679583 0.0146408334 0.0073204167
[104,] 0.994278133 0.0114437345 0.0057218672
[105,] 0.993305759 0.0133884812 0.0066942406
[106,] 0.991235055 0.0175298891 0.0087649445
[107,] 0.989898736 0.0202025286 0.0101012643
[108,] 0.988720415 0.0225591700 0.0112795850
[109,] 0.985122510 0.0297549797 0.0148774898
[110,] 0.980577130 0.0388457409 0.0194228705
[111,] 0.974848572 0.0503028560 0.0251514280
[112,] 0.967756910 0.0644861793 0.0322430896
[113,] 0.959456372 0.0810872565 0.0405436282
[114,] 0.975729592 0.0485408159 0.0242704080
[115,] 0.996801085 0.0063978310 0.0031989155
[116,] 0.996958250 0.0060834994 0.0030417497
[117,] 0.996184307 0.0076313862 0.0038156931
[118,] 0.995918665 0.0081626710 0.0040813355
[119,] 0.994752613 0.0104947739 0.0052473869
[120,] 0.992898284 0.0142034322 0.0071017161
[121,] 0.991333336 0.0173333283 0.0086666641
[122,] 0.989600543 0.0207989144 0.0103994572
[123,] 0.986112743 0.0277745141 0.0138872571
[124,] 0.982020657 0.0359586867 0.0179793434
[125,] 0.977131578 0.0457368440 0.0228684220
[126,] 0.990106821 0.0197863586 0.0098931793
[127,] 0.999558738 0.0008825239 0.0004412619
[128,] 0.999526055 0.0009478894 0.0004739447
[129,] 0.999390473 0.0012190544 0.0006095272
[130,] 0.999111812 0.0017763768 0.0008881884
[131,] 0.998885953 0.0022280945 0.0011140473
[132,] 0.998406157 0.0031876859 0.0015938429
[133,] 0.997681789 0.0046364218 0.0023182109
[134,] 0.996735092 0.0065298155 0.0032649077
[135,] 0.995344591 0.0093108172 0.0046554086
[136,] 0.993411824 0.0131763527 0.0065881764
[137,] 0.995261474 0.0094770526 0.0047385263
[138,] 0.995558590 0.0088828201 0.0044414100
[139,] 0.998991957 0.0020160866 0.0010080433
[140,] 0.998494928 0.0030101448 0.0015050724
[141,] 0.997761701 0.0044765978 0.0022382989
[142,] 0.996815640 0.0063687192 0.0031843596
[143,] 0.995577071 0.0088458587 0.0044229294
[144,] 0.993565093 0.0128698135 0.0064349067
[145,] 0.991818431 0.0163631386 0.0081815693
[146,] 0.989294737 0.0214105253 0.0107052627
[147,] 0.984778472 0.0304430567 0.0152215283
[148,] 0.981245409 0.0375091826 0.0187545913
[149,] 0.992579592 0.0148408167 0.0074204083
[150,] 0.996723726 0.0065525479 0.0032762740
[151,] 0.997147534 0.0057049310 0.0028524655
[152,] 0.995628708 0.0087425842 0.0043712921
[153,] 0.993616898 0.0127662030 0.0063831015
[154,] 0.990975861 0.0180482787 0.0090241393
[155,] 0.991132088 0.0177358234 0.0088679117
[156,] 0.988567324 0.0228653510 0.0114326755
[157,] 0.984171356 0.0316572875 0.0158286438
[158,] 0.983849512 0.0323009764 0.0161504882
[159,] 0.976736611 0.0465267777 0.0232633888
[160,] 0.974530118 0.0509397638 0.0254698819
[161,] 0.964272725 0.0714545490 0.0357272745
[162,] 0.964283897 0.0714322066 0.0357161033
[163,] 0.991323660 0.0173526791 0.0086763396
[164,] 0.985850251 0.0282994981 0.0141497490
[165,] 0.978667851 0.0426642977 0.0213321488
[166,] 0.968060004 0.0638799925 0.0319399962
[167,] 0.950985411 0.0980291772 0.0490145886
[168,] 0.929052600 0.1418948010 0.0709474005
[169,] 0.907327219 0.1853455617 0.0926727809
[170,] 0.870190361 0.2596192771 0.1298096386
[171,] 0.837385708 0.3252285831 0.1626142915
[172,] 0.803316777 0.3933664463 0.1966832232
[173,] 0.808578064 0.3828438722 0.1914219361
[174,] 0.844814254 0.3103714914 0.1551857457
[175,] 0.948487596 0.1030248085 0.0515124043
[176,] 0.980339297 0.0393214061 0.0196607030
[177,] 0.969429677 0.0611406461 0.0305703231
[178,] 0.988027828 0.0239443434 0.0119721717
[179,] 0.970329818 0.0593403644 0.0296701822
[180,] 0.995665893 0.0086682146 0.0043341073
[181,] 0.991156993 0.0176860133 0.0088430066
> postscript(file="/var/www/html/rcomp/tmp/1z2j51227521912.ps",horizontal=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/www/html/rcomp/tmp/2e5r11227521912.ps",horizontal=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/www/html/rcomp/tmp/3e5q61227521912.ps",horizontal=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/www/html/rcomp/tmp/4lge81227521912.ps",horizontal=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/www/html/rcomp/tmp/5qbs81227521912.ps",horizontal=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 = 192
Frequency = 1
1 2 3 4 5 6
-157.5207932 -335.0116347 -334.5024762 -454.9933177 -206.4841592 -325.9750007
7 8 9 10 11 12
-276.4658422 -203.9566837 -253.4475252 -177.9383667 322.5707918 320.0799503
13 14 15 16 17 18
-74.4108912 -59.9017327 -106.3925742 -263.8834157 -245.3742572 -298.8650987
19 20 21 22 23 24
-12.3559402 -15.8467817 -95.3376232 195.1715353 430.6806938 668.1898523
25 26 27 28 29 30
221.6990108 -151.7918308 -112.2826723 -180.7735138 2.7356447 -54.7551968
31 32 33 34 35 36
-4.2460383 128.2631202 -177.2277213 197.2814372 439.7905957 400.2997542
37 38 39 40 41 42
289.8089127 -20.6819288 47.8272297 -216.6636118 191.8455467 70.3547052
43 44 45 46 47 48
183.8638637 -90.6269778 -0.1178193 199.3913392 621.9004977 880.4096562
49 50 51 52 53 54
324.9188147 192.4279732 -92.0628683 173.4462902 236.9554487 48.4646072
55 56 57 58 59 60
248.9737657 150.4829242 323.9920827 321.5012412 361.0103997 394.5195582
61 62 63 64 65 66
-145.9712833 -249.4621248 -202.9529663 -367.4438078 -16.9346493 51.5745092
67 68 69 70 71 72
34.0836677 143.5928262 262.1019847 336.6111432 353.1203017 313.6294602
73 74 75 76 77 78
-158.8613813 -378.3522228 -80.8430643 -349.3339058 -210.8247473 -307.3155888
79 80 81 82 83 84
-284.8064303 -182.2972718 -67.7881133 -161.2789548 184.2302037 479.7393622
85 86 87 88 89 90
-244.7514793 -61.2423208 -307.7331623 -318.2240038 -181.7148453 -401.2056868
91 92 93 94 95 96
-182.6965283 -380.1873698 -78.6782113 43.8309472 255.3401057 572.8492642
97 98 99 100 101 102
-51.6415773 -297.1324188 -285.6232603 -292.1141018 -299.6049433 -172.0957848
103 104 105 106 107 108
-162.5866263 -46.0774678 -172.5683093 -1.0591508 315.4500077 531.9591662
109 110 111 112 113 114
274.4683247 -218.0225168 -115.5133583 -218.0041998 -229.4950413 -51.9858828
115 116 117 118 119 120
-15.4767243 -32.9675658 -26.4584073 15.0507512 383.5599097 597.0690682
121 122 123 124 125 126
149.5782267 -216.9126148 101.5965437 -197.8942978 -101.3851393 -224.8759808
127 128 129 130 131 132
-227.3668223 -98.8576638 -6.3485053 3.1606532 367.6698117 560.1789702
133 134 135 136 137 138
19.6881287 -282.8027128 -136.2935543 -280.7843958 -186.2752373 -115.7660788
139 140 141 142 143 144
-176.2569203 -82.7477618 -85.2386033 195.2705552 106.7797137 312.2888722
145 146 147 148 149 150
-153.2019693 -167.6928108 -82.1836523 -218.6744938 -99.1653353 -234.6561768
151 152 153 154 155 156
22.8529817 -106.6378598 65.8712987 324.3804572 255.8896157 115.3987742
157 158 159 160 161 162
-153.0920673 -162.5829088 -150.0737503 -239.5645918 -116.0554333 -43.5462748
163 164 165 166 167 168
-112.0371163 85.4720422 -3.0187993 254.4903592 403.9995177 486.5086762
169 170 171 172 173 174
-96.9821653 -281.2963957 -118.7872372 -167.2780787 -97.7689202 -256.2597617
175 176 177 178 179 180
-156.7506032 -190.2414447 99.2677138 160.7768723 158.2860308 189.7951893
181 182 183 184 185 186
35.3043478 -155.1864937 -36.6773352 -207.1681767 -18.6590182 -129.1498597
187 188 189 190 191 192
-90.6407012 -27.1315427 134.3776158 266.8867743 430.3959328 457.9050913
> postscript(file="/var/www/html/rcomp/tmp/6im3e1227521912.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> dum <- cbind(lag(myerror,k=1),myerror)
> dum
Time Series:
Start = 0
End = 192
Frequency = 1
lag(myerror, k = 1) myerror
0 -157.5207932 NA
1 -335.0116347 -157.5207932
2 -334.5024762 -335.0116347
3 -454.9933177 -334.5024762
4 -206.4841592 -454.9933177
5 -325.9750007 -206.4841592
6 -276.4658422 -325.9750007
7 -203.9566837 -276.4658422
8 -253.4475252 -203.9566837
9 -177.9383667 -253.4475252
10 322.5707918 -177.9383667
11 320.0799503 322.5707918
12 -74.4108912 320.0799503
13 -59.9017327 -74.4108912
14 -106.3925742 -59.9017327
15 -263.8834157 -106.3925742
16 -245.3742572 -263.8834157
17 -298.8650987 -245.3742572
18 -12.3559402 -298.8650987
19 -15.8467817 -12.3559402
20 -95.3376232 -15.8467817
21 195.1715353 -95.3376232
22 430.6806938 195.1715353
23 668.1898523 430.6806938
24 221.6990108 668.1898523
25 -151.7918308 221.6990108
26 -112.2826723 -151.7918308
27 -180.7735138 -112.2826723
28 2.7356447 -180.7735138
29 -54.7551968 2.7356447
30 -4.2460383 -54.7551968
31 128.2631202 -4.2460383
32 -177.2277213 128.2631202
33 197.2814372 -177.2277213
34 439.7905957 197.2814372
35 400.2997542 439.7905957
36 289.8089127 400.2997542
37 -20.6819288 289.8089127
38 47.8272297 -20.6819288
39 -216.6636118 47.8272297
40 191.8455467 -216.6636118
41 70.3547052 191.8455467
42 183.8638637 70.3547052
43 -90.6269778 183.8638637
44 -0.1178193 -90.6269778
45 199.3913392 -0.1178193
46 621.9004977 199.3913392
47 880.4096562 621.9004977
48 324.9188147 880.4096562
49 192.4279732 324.9188147
50 -92.0628683 192.4279732
51 173.4462902 -92.0628683
52 236.9554487 173.4462902
53 48.4646072 236.9554487
54 248.9737657 48.4646072
55 150.4829242 248.9737657
56 323.9920827 150.4829242
57 321.5012412 323.9920827
58 361.0103997 321.5012412
59 394.5195582 361.0103997
60 -145.9712833 394.5195582
61 -249.4621248 -145.9712833
62 -202.9529663 -249.4621248
63 -367.4438078 -202.9529663
64 -16.9346493 -367.4438078
65 51.5745092 -16.9346493
66 34.0836677 51.5745092
67 143.5928262 34.0836677
68 262.1019847 143.5928262
69 336.6111432 262.1019847
70 353.1203017 336.6111432
71 313.6294602 353.1203017
72 -158.8613813 313.6294602
73 -378.3522228 -158.8613813
74 -80.8430643 -378.3522228
75 -349.3339058 -80.8430643
76 -210.8247473 -349.3339058
77 -307.3155888 -210.8247473
78 -284.8064303 -307.3155888
79 -182.2972718 -284.8064303
80 -67.7881133 -182.2972718
81 -161.2789548 -67.7881133
82 184.2302037 -161.2789548
83 479.7393622 184.2302037
84 -244.7514793 479.7393622
85 -61.2423208 -244.7514793
86 -307.7331623 -61.2423208
87 -318.2240038 -307.7331623
88 -181.7148453 -318.2240038
89 -401.2056868 -181.7148453
90 -182.6965283 -401.2056868
91 -380.1873698 -182.6965283
92 -78.6782113 -380.1873698
93 43.8309472 -78.6782113
94 255.3401057 43.8309472
95 572.8492642 255.3401057
96 -51.6415773 572.8492642
97 -297.1324188 -51.6415773
98 -285.6232603 -297.1324188
99 -292.1141018 -285.6232603
100 -299.6049433 -292.1141018
101 -172.0957848 -299.6049433
102 -162.5866263 -172.0957848
103 -46.0774678 -162.5866263
104 -172.5683093 -46.0774678
105 -1.0591508 -172.5683093
106 315.4500077 -1.0591508
107 531.9591662 315.4500077
108 274.4683247 531.9591662
109 -218.0225168 274.4683247
110 -115.5133583 -218.0225168
111 -218.0041998 -115.5133583
112 -229.4950413 -218.0041998
113 -51.9858828 -229.4950413
114 -15.4767243 -51.9858828
115 -32.9675658 -15.4767243
116 -26.4584073 -32.9675658
117 15.0507512 -26.4584073
118 383.5599097 15.0507512
119 597.0690682 383.5599097
120 149.5782267 597.0690682
121 -216.9126148 149.5782267
122 101.5965437 -216.9126148
123 -197.8942978 101.5965437
124 -101.3851393 -197.8942978
125 -224.8759808 -101.3851393
126 -227.3668223 -224.8759808
127 -98.8576638 -227.3668223
128 -6.3485053 -98.8576638
129 3.1606532 -6.3485053
130 367.6698117 3.1606532
131 560.1789702 367.6698117
132 19.6881287 560.1789702
133 -282.8027128 19.6881287
134 -136.2935543 -282.8027128
135 -280.7843958 -136.2935543
136 -186.2752373 -280.7843958
137 -115.7660788 -186.2752373
138 -176.2569203 -115.7660788
139 -82.7477618 -176.2569203
140 -85.2386033 -82.7477618
141 195.2705552 -85.2386033
142 106.7797137 195.2705552
143 312.2888722 106.7797137
144 -153.2019693 312.2888722
145 -167.6928108 -153.2019693
146 -82.1836523 -167.6928108
147 -218.6744938 -82.1836523
148 -99.1653353 -218.6744938
149 -234.6561768 -99.1653353
150 22.8529817 -234.6561768
151 -106.6378598 22.8529817
152 65.8712987 -106.6378598
153 324.3804572 65.8712987
154 255.8896157 324.3804572
155 115.3987742 255.8896157
156 -153.0920673 115.3987742
157 -162.5829088 -153.0920673
158 -150.0737503 -162.5829088
159 -239.5645918 -150.0737503
160 -116.0554333 -239.5645918
161 -43.5462748 -116.0554333
162 -112.0371163 -43.5462748
163 85.4720422 -112.0371163
164 -3.0187993 85.4720422
165 254.4903592 -3.0187993
166 403.9995177 254.4903592
167 486.5086762 403.9995177
168 -96.9821653 486.5086762
169 -281.2963957 -96.9821653
170 -118.7872372 -281.2963957
171 -167.2780787 -118.7872372
172 -97.7689202 -167.2780787
173 -256.2597617 -97.7689202
174 -156.7506032 -256.2597617
175 -190.2414447 -156.7506032
176 99.2677138 -190.2414447
177 160.7768723 99.2677138
178 158.2860308 160.7768723
179 189.7951893 158.2860308
180 35.3043478 189.7951893
181 -155.1864937 35.3043478
182 -36.6773352 -155.1864937
183 -207.1681767 -36.6773352
184 -18.6590182 -207.1681767
185 -129.1498597 -18.6590182
186 -90.6407012 -129.1498597
187 -27.1315427 -90.6407012
188 134.3776158 -27.1315427
189 266.8867743 134.3776158
190 430.3959328 266.8867743
191 457.9050913 430.3959328
192 NA 457.9050913
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -335.0116347 -157.5207932
[2,] -334.5024762 -335.0116347
[3,] -454.9933177 -334.5024762
[4,] -206.4841592 -454.9933177
[5,] -325.9750007 -206.4841592
[6,] -276.4658422 -325.9750007
[7,] -203.9566837 -276.4658422
[8,] -253.4475252 -203.9566837
[9,] -177.9383667 -253.4475252
[10,] 322.5707918 -177.9383667
[11,] 320.0799503 322.5707918
[12,] -74.4108912 320.0799503
[13,] -59.9017327 -74.4108912
[14,] -106.3925742 -59.9017327
[15,] -263.8834157 -106.3925742
[16,] -245.3742572 -263.8834157
[17,] -298.8650987 -245.3742572
[18,] -12.3559402 -298.8650987
[19,] -15.8467817 -12.3559402
[20,] -95.3376232 -15.8467817
[21,] 195.1715353 -95.3376232
[22,] 430.6806938 195.1715353
[23,] 668.1898523 430.6806938
[24,] 221.6990108 668.1898523
[25,] -151.7918308 221.6990108
[26,] -112.2826723 -151.7918308
[27,] -180.7735138 -112.2826723
[28,] 2.7356447 -180.7735138
[29,] -54.7551968 2.7356447
[30,] -4.2460383 -54.7551968
[31,] 128.2631202 -4.2460383
[32,] -177.2277213 128.2631202
[33,] 197.2814372 -177.2277213
[34,] 439.7905957 197.2814372
[35,] 400.2997542 439.7905957
[36,] 289.8089127 400.2997542
[37,] -20.6819288 289.8089127
[38,] 47.8272297 -20.6819288
[39,] -216.6636118 47.8272297
[40,] 191.8455467 -216.6636118
[41,] 70.3547052 191.8455467
[42,] 183.8638637 70.3547052
[43,] -90.6269778 183.8638637
[44,] -0.1178193 -90.6269778
[45,] 199.3913392 -0.1178193
[46,] 621.9004977 199.3913392
[47,] 880.4096562 621.9004977
[48,] 324.9188147 880.4096562
[49,] 192.4279732 324.9188147
[50,] -92.0628683 192.4279732
[51,] 173.4462902 -92.0628683
[52,] 236.9554487 173.4462902
[53,] 48.4646072 236.9554487
[54,] 248.9737657 48.4646072
[55,] 150.4829242 248.9737657
[56,] 323.9920827 150.4829242
[57,] 321.5012412 323.9920827
[58,] 361.0103997 321.5012412
[59,] 394.5195582 361.0103997
[60,] -145.9712833 394.5195582
[61,] -249.4621248 -145.9712833
[62,] -202.9529663 -249.4621248
[63,] -367.4438078 -202.9529663
[64,] -16.9346493 -367.4438078
[65,] 51.5745092 -16.9346493
[66,] 34.0836677 51.5745092
[67,] 143.5928262 34.0836677
[68,] 262.1019847 143.5928262
[69,] 336.6111432 262.1019847
[70,] 353.1203017 336.6111432
[71,] 313.6294602 353.1203017
[72,] -158.8613813 313.6294602
[73,] -378.3522228 -158.8613813
[74,] -80.8430643 -378.3522228
[75,] -349.3339058 -80.8430643
[76,] -210.8247473 -349.3339058
[77,] -307.3155888 -210.8247473
[78,] -284.8064303 -307.3155888
[79,] -182.2972718 -284.8064303
[80,] -67.7881133 -182.2972718
[81,] -161.2789548 -67.7881133
[82,] 184.2302037 -161.2789548
[83,] 479.7393622 184.2302037
[84,] -244.7514793 479.7393622
[85,] -61.2423208 -244.7514793
[86,] -307.7331623 -61.2423208
[87,] -318.2240038 -307.7331623
[88,] -181.7148453 -318.2240038
[89,] -401.2056868 -181.7148453
[90,] -182.6965283 -401.2056868
[91,] -380.1873698 -182.6965283
[92,] -78.6782113 -380.1873698
[93,] 43.8309472 -78.6782113
[94,] 255.3401057 43.8309472
[95,] 572.8492642 255.3401057
[96,] -51.6415773 572.8492642
[97,] -297.1324188 -51.6415773
[98,] -285.6232603 -297.1324188
[99,] -292.1141018 -285.6232603
[100,] -299.6049433 -292.1141018
[101,] -172.0957848 -299.6049433
[102,] -162.5866263 -172.0957848
[103,] -46.0774678 -162.5866263
[104,] -172.5683093 -46.0774678
[105,] -1.0591508 -172.5683093
[106,] 315.4500077 -1.0591508
[107,] 531.9591662 315.4500077
[108,] 274.4683247 531.9591662
[109,] -218.0225168 274.4683247
[110,] -115.5133583 -218.0225168
[111,] -218.0041998 -115.5133583
[112,] -229.4950413 -218.0041998
[113,] -51.9858828 -229.4950413
[114,] -15.4767243 -51.9858828
[115,] -32.9675658 -15.4767243
[116,] -26.4584073 -32.9675658
[117,] 15.0507512 -26.4584073
[118,] 383.5599097 15.0507512
[119,] 597.0690682 383.5599097
[120,] 149.5782267 597.0690682
[121,] -216.9126148 149.5782267
[122,] 101.5965437 -216.9126148
[123,] -197.8942978 101.5965437
[124,] -101.3851393 -197.8942978
[125,] -224.8759808 -101.3851393
[126,] -227.3668223 -224.8759808
[127,] -98.8576638 -227.3668223
[128,] -6.3485053 -98.8576638
[129,] 3.1606532 -6.3485053
[130,] 367.6698117 3.1606532
[131,] 560.1789702 367.6698117
[132,] 19.6881287 560.1789702
[133,] -282.8027128 19.6881287
[134,] -136.2935543 -282.8027128
[135,] -280.7843958 -136.2935543
[136,] -186.2752373 -280.7843958
[137,] -115.7660788 -186.2752373
[138,] -176.2569203 -115.7660788
[139,] -82.7477618 -176.2569203
[140,] -85.2386033 -82.7477618
[141,] 195.2705552 -85.2386033
[142,] 106.7797137 195.2705552
[143,] 312.2888722 106.7797137
[144,] -153.2019693 312.2888722
[145,] -167.6928108 -153.2019693
[146,] -82.1836523 -167.6928108
[147,] -218.6744938 -82.1836523
[148,] -99.1653353 -218.6744938
[149,] -234.6561768 -99.1653353
[150,] 22.8529817 -234.6561768
[151,] -106.6378598 22.8529817
[152,] 65.8712987 -106.6378598
[153,] 324.3804572 65.8712987
[154,] 255.8896157 324.3804572
[155,] 115.3987742 255.8896157
[156,] -153.0920673 115.3987742
[157,] -162.5829088 -153.0920673
[158,] -150.0737503 -162.5829088
[159,] -239.5645918 -150.0737503
[160,] -116.0554333 -239.5645918
[161,] -43.5462748 -116.0554333
[162,] -112.0371163 -43.5462748
[163,] 85.4720422 -112.0371163
[164,] -3.0187993 85.4720422
[165,] 254.4903592 -3.0187993
[166,] 403.9995177 254.4903592
[167,] 486.5086762 403.9995177
[168,] -96.9821653 486.5086762
[169,] -281.2963957 -96.9821653
[170,] -118.7872372 -281.2963957
[171,] -167.2780787 -118.7872372
[172,] -97.7689202 -167.2780787
[173,] -256.2597617 -97.7689202
[174,] -156.7506032 -256.2597617
[175,] -190.2414447 -156.7506032
[176,] 99.2677138 -190.2414447
[177,] 160.7768723 99.2677138
[178,] 158.2860308 160.7768723
[179,] 189.7951893 158.2860308
[180,] 35.3043478 189.7951893
[181,] -155.1864937 35.3043478
[182,] -36.6773352 -155.1864937
[183,] -207.1681767 -36.6773352
[184,] -18.6590182 -207.1681767
[185,] -129.1498597 -18.6590182
[186,] -90.6407012 -129.1498597
[187,] -27.1315427 -90.6407012
[188,] 134.3776158 -27.1315427
[189,] 266.8867743 134.3776158
[190,] 430.3959328 266.8867743
[191,] 457.9050913 430.3959328
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -335.0116347 -157.5207932
2 -334.5024762 -335.0116347
3 -454.9933177 -334.5024762
4 -206.4841592 -454.9933177
5 -325.9750007 -206.4841592
6 -276.4658422 -325.9750007
7 -203.9566837 -276.4658422
8 -253.4475252 -203.9566837
9 -177.9383667 -253.4475252
10 322.5707918 -177.9383667
11 320.0799503 322.5707918
12 -74.4108912 320.0799503
13 -59.9017327 -74.4108912
14 -106.3925742 -59.9017327
15 -263.8834157 -106.3925742
16 -245.3742572 -263.8834157
17 -298.8650987 -245.3742572
18 -12.3559402 -298.8650987
19 -15.8467817 -12.3559402
20 -95.3376232 -15.8467817
21 195.1715353 -95.3376232
22 430.6806938 195.1715353
23 668.1898523 430.6806938
24 221.6990108 668.1898523
25 -151.7918308 221.6990108
26 -112.2826723 -151.7918308
27 -180.7735138 -112.2826723
28 2.7356447 -180.7735138
29 -54.7551968 2.7356447
30 -4.2460383 -54.7551968
31 128.2631202 -4.2460383
32 -177.2277213 128.2631202
33 197.2814372 -177.2277213
34 439.7905957 197.2814372
35 400.2997542 439.7905957
36 289.8089127 400.2997542
37 -20.6819288 289.8089127
38 47.8272297 -20.6819288
39 -216.6636118 47.8272297
40 191.8455467 -216.6636118
41 70.3547052 191.8455467
42 183.8638637 70.3547052
43 -90.6269778 183.8638637
44 -0.1178193 -90.6269778
45 199.3913392 -0.1178193
46 621.9004977 199.3913392
47 880.4096562 621.9004977
48 324.9188147 880.4096562
49 192.4279732 324.9188147
50 -92.0628683 192.4279732
51 173.4462902 -92.0628683
52 236.9554487 173.4462902
53 48.4646072 236.9554487
54 248.9737657 48.4646072
55 150.4829242 248.9737657
56 323.9920827 150.4829242
57 321.5012412 323.9920827
58 361.0103997 321.5012412
59 394.5195582 361.0103997
60 -145.9712833 394.5195582
61 -249.4621248 -145.9712833
62 -202.9529663 -249.4621248
63 -367.4438078 -202.9529663
64 -16.9346493 -367.4438078
65 51.5745092 -16.9346493
66 34.0836677 51.5745092
67 143.5928262 34.0836677
68 262.1019847 143.5928262
69 336.6111432 262.1019847
70 353.1203017 336.6111432
71 313.6294602 353.1203017
72 -158.8613813 313.6294602
73 -378.3522228 -158.8613813
74 -80.8430643 -378.3522228
75 -349.3339058 -80.8430643
76 -210.8247473 -349.3339058
77 -307.3155888 -210.8247473
78 -284.8064303 -307.3155888
79 -182.2972718 -284.8064303
80 -67.7881133 -182.2972718
81 -161.2789548 -67.7881133
82 184.2302037 -161.2789548
83 479.7393622 184.2302037
84 -244.7514793 479.7393622
85 -61.2423208 -244.7514793
86 -307.7331623 -61.2423208
87 -318.2240038 -307.7331623
88 -181.7148453 -318.2240038
89 -401.2056868 -181.7148453
90 -182.6965283 -401.2056868
91 -380.1873698 -182.6965283
92 -78.6782113 -380.1873698
93 43.8309472 -78.6782113
94 255.3401057 43.8309472
95 572.8492642 255.3401057
96 -51.6415773 572.8492642
97 -297.1324188 -51.6415773
98 -285.6232603 -297.1324188
99 -292.1141018 -285.6232603
100 -299.6049433 -292.1141018
101 -172.0957848 -299.6049433
102 -162.5866263 -172.0957848
103 -46.0774678 -162.5866263
104 -172.5683093 -46.0774678
105 -1.0591508 -172.5683093
106 315.4500077 -1.0591508
107 531.9591662 315.4500077
108 274.4683247 531.9591662
109 -218.0225168 274.4683247
110 -115.5133583 -218.0225168
111 -218.0041998 -115.5133583
112 -229.4950413 -218.0041998
113 -51.9858828 -229.4950413
114 -15.4767243 -51.9858828
115 -32.9675658 -15.4767243
116 -26.4584073 -32.9675658
117 15.0507512 -26.4584073
118 383.5599097 15.0507512
119 597.0690682 383.5599097
120 149.5782267 597.0690682
121 -216.9126148 149.5782267
122 101.5965437 -216.9126148
123 -197.8942978 101.5965437
124 -101.3851393 -197.8942978
125 -224.8759808 -101.3851393
126 -227.3668223 -224.8759808
127 -98.8576638 -227.3668223
128 -6.3485053 -98.8576638
129 3.1606532 -6.3485053
130 367.6698117 3.1606532
131 560.1789702 367.6698117
132 19.6881287 560.1789702
133 -282.8027128 19.6881287
134 -136.2935543 -282.8027128
135 -280.7843958 -136.2935543
136 -186.2752373 -280.7843958
137 -115.7660788 -186.2752373
138 -176.2569203 -115.7660788
139 -82.7477618 -176.2569203
140 -85.2386033 -82.7477618
141 195.2705552 -85.2386033
142 106.7797137 195.2705552
143 312.2888722 106.7797137
144 -153.2019693 312.2888722
145 -167.6928108 -153.2019693
146 -82.1836523 -167.6928108
147 -218.6744938 -82.1836523
148 -99.1653353 -218.6744938
149 -234.6561768 -99.1653353
150 22.8529817 -234.6561768
151 -106.6378598 22.8529817
152 65.8712987 -106.6378598
153 324.3804572 65.8712987
154 255.8896157 324.3804572
155 115.3987742 255.8896157
156 -153.0920673 115.3987742
157 -162.5829088 -153.0920673
158 -150.0737503 -162.5829088
159 -239.5645918 -150.0737503
160 -116.0554333 -239.5645918
161 -43.5462748 -116.0554333
162 -112.0371163 -43.5462748
163 85.4720422 -112.0371163
164 -3.0187993 85.4720422
165 254.4903592 -3.0187993
166 403.9995177 254.4903592
167 486.5086762 403.9995177
168 -96.9821653 486.5086762
169 -281.2963957 -96.9821653
170 -118.7872372 -281.2963957
171 -167.2780787 -118.7872372
172 -97.7689202 -167.2780787
173 -256.2597617 -97.7689202
174 -156.7506032 -256.2597617
175 -190.2414447 -156.7506032
176 99.2677138 -190.2414447
177 160.7768723 99.2677138
178 158.2860308 160.7768723
179 189.7951893 158.2860308
180 35.3043478 189.7951893
181 -155.1864937 35.3043478
182 -36.6773352 -155.1864937
183 -207.1681767 -36.6773352
184 -18.6590182 -207.1681767
185 -129.1498597 -18.6590182
186 -90.6407012 -129.1498597
187 -27.1315427 -90.6407012
188 134.3776158 -27.1315427
189 266.8867743 134.3776158
190 430.3959328 266.8867743
191 457.9050913 430.3959328
> 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/www/html/rcomp/tmp/76dmb1227521912.ps",horizontal=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/www/html/rcomp/tmp/8jlp31227521912.ps",horizontal=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/www/html/rcomp/tmp/95p6u1227521912.ps",horizontal=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/www/html/rcomp/tmp/10rvtd1227521912.ps",horizontal=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/www/html/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab
> load(file="/var/www/html/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/www/html/rcomp/tmp/11ytup1227521913.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/www/html/rcomp/tmp/12n1on1227521913.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/www/html/rcomp/tmp/13txw71227521913.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/www/html/rcomp/tmp/14ux4u1227521913.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/www/html/rcomp/tmp/154tdb1227521913.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/www/html/rcomp/tmp/161p3i1227521913.tab")
+ }
>
> system("convert tmp/1z2j51227521912.ps tmp/1z2j51227521912.png")
> system("convert tmp/2e5r11227521912.ps tmp/2e5r11227521912.png")
> system("convert tmp/3e5q61227521912.ps tmp/3e5q61227521912.png")
> system("convert tmp/4lge81227521912.ps tmp/4lge81227521912.png")
> system("convert tmp/5qbs81227521912.ps tmp/5qbs81227521912.png")
> system("convert tmp/6im3e1227521912.ps tmp/6im3e1227521912.png")
> system("convert tmp/76dmb1227521912.ps tmp/76dmb1227521912.png")
> system("convert tmp/8jlp31227521912.ps tmp/8jlp31227521912.png")
> system("convert tmp/95p6u1227521912.ps tmp/95p6u1227521912.png")
> system("convert tmp/10rvtd1227521912.ps tmp/10rvtd1227521912.png")
>
>
> proc.time()
user system elapsed
4.439 1.782 9.953