R version 3.0.2 (2013-09-25) -- "Frisbee Sailing"
Copyright (C) 2013 The R Foundation for Statistical Computing
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(1687
+ ,0
+ ,NA
+ ,1508
+ ,0
+ ,1687
+ ,1507
+ ,0
+ ,1508
+ ,1385
+ ,0
+ ,1507
+ ,1632
+ ,0
+ ,1385
+ ,1511
+ ,0
+ ,1632
+ ,1559
+ ,0
+ ,1511
+ ,1630
+ ,0
+ ,1559
+ ,1579
+ ,0
+ ,1630
+ ,1653
+ ,0
+ ,1579
+ ,2152
+ ,0
+ ,1653
+ ,2148
+ ,0
+ ,2152
+ ,1752
+ ,0
+ ,2148
+ ,1765
+ ,0
+ ,1752
+ ,1717
+ ,0
+ ,1765
+ ,1558
+ ,0
+ ,1717
+ ,1575
+ ,0
+ ,1558
+ ,1520
+ ,0
+ ,1575
+ ,1805
+ ,0
+ ,1520
+ ,1800
+ ,0
+ ,1805
+ ,1719
+ ,0
+ ,1800
+ ,2008
+ ,0
+ ,1719
+ ,2242
+ ,0
+ ,2008
+ ,2478
+ ,0
+ ,2242
+ ,2030
+ ,0
+ ,2478
+ ,1655
+ ,0
+ ,2030
+ ,1693
+ ,0
+ ,1655
+ ,1623
+ ,0
+ ,1693
+ ,1805
+ ,0
+ ,1623
+ ,1746
+ ,0
+ ,1805
+ ,1795
+ ,0
+ ,1746
+ ,1926
+ ,0
+ ,1795
+ ,1619
+ ,0
+ ,1926
+ ,1992
+ ,0
+ ,1619
+ ,2233
+ ,0
+ ,1992
+ ,2192
+ ,0
+ ,2233
+ ,2080
+ ,0
+ ,2192
+ ,1768
+ ,0
+ ,2080
+ ,1835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737)
+ ,dim=c(3
+ ,192)
+ ,dimnames=list(c('Accidents'
+ ,'Belt'
+ ,'A1')
+ ,1:192))
> y <- array(NA,dim=c(3,192),dimnames=list(c('Accidents','Belt','A1'),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 = 'No Linear Trend'
> par2 = 'Do not include Seasonal Dummies'
> par1 = '1'
> par3 <- 'No Linear Trend'
> par2 <- 'Do not include Seasonal Dummies'
> par1 <- '1'
> #'GNU S' R Code compiled by R2WASP v. 1.2.327 ()
> #Author: root
> #To cite this work: Wessa P., (2013), Multiple Regression (v1.0.29) in Free Statistics Software (v$_version), Office for Research Development and Education, URL http://www.wessa.net/rwasp_multipleregression.wasp/
> #Source of accompanying publication: Office for Research, Development, and Education
> #
> library(lattice)
> library(lmtest)
Loading required package: zoo
Attaching package: 'zoo'
The following objects 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
Accidents Belt A1
1 1687 0 NA
2 1508 0 1687
3 1507 0 1508
4 1385 0 1507
5 1632 0 1385
6 1511 0 1632
7 1559 0 1511
8 1630 0 1559
9 1579 0 1630
10 1653 0 1579
11 2152 0 1653
12 2148 0 2152
13 1752 0 2148
14 1765 0 1752
15 1717 0 1765
16 1558 0 1717
17 1575 0 1558
18 1520 0 1575
19 1805 0 1520
20 1800 0 1805
21 1719 0 1800
22 2008 0 1719
23 2242 0 2008
24 2478 0 2242
25 2030 0 2478
26 1655 0 2030
27 1693 0 1655
28 1623 0 1693
29 1805 0 1623
30 1746 0 1805
31 1795 0 1746
32 1926 0 1795
33 1619 0 1926
34 1992 0 1619
35 2233 0 1992
36 2192 0 2233
37 2080 0 2192
38 1768 0 2080
39 1835 0 1768
40 1569 0 1835
41 1976 0 1569
42 1853 0 1976
43 1965 0 1853
44 1689 0 1965
45 1778 0 1689
46 1976 0 1778
47 2397 0 1976
48 2654 0 2397
49 2097 0 2654
50 1963 0 2097
51 1677 0 1963
52 1941 0 1677
53 2003 0 1941
54 1813 0 2003
55 2012 0 1813
56 1912 0 2012
57 2084 0 1912
58 2080 0 2084
59 2118 0 2080
60 2150 0 2118
61 1608 0 2150
62 1503 0 1608
63 1548 0 1503
64 1382 0 1548
65 1731 0 1382
66 1798 0 1731
67 1779 0 1798
68 1887 0 1779
69 2004 0 1887
70 2077 0 2004
71 2092 0 2077
72 2051 0 2092
73 1577 0 2051
74 1356 0 1577
75 1652 0 1356
76 1382 0 1652
77 1519 0 1382
78 1421 0 1519
79 1442 0 1421
80 1543 0 1442
81 1656 0 1543
82 1561 0 1656
83 1905 0 1561
84 2199 0 1905
85 1473 0 2199
86 1655 0 1473
87 1407 0 1655
88 1395 0 1407
89 1530 0 1395
90 1309 0 1530
91 1526 0 1309
92 1327 0 1526
93 1627 0 1327
94 1748 0 1627
95 1958 0 1748
96 2274 0 1958
97 1648 0 2274
98 1401 0 1648
99 1411 0 1401
100 1403 0 1411
101 1394 0 1403
102 1520 0 1394
103 1528 0 1520
104 1643 0 1528
105 1515 0 1643
106 1685 0 1515
107 2000 0 1685
108 2215 0 2000
109 1956 0 2215
110 1462 0 1956
111 1563 0 1462
112 1459 0 1563
113 1446 0 1459
114 1622 0 1446
115 1657 0 1622
116 1638 0 1657
117 1643 0 1638
118 1683 0 1643
119 2050 0 1683
120 2262 0 2050
121 1813 0 2262
122 1445 0 1813
123 1762 0 1445
124 1461 0 1762
125 1556 0 1461
126 1431 0 1556
127 1427 0 1431
128 1554 0 1427
129 1645 0 1554
130 1653 0 1645
131 2016 0 1653
132 2207 0 2016
133 1665 0 2207
134 1361 0 1665
135 1506 0 1361
136 1360 0 1506
137 1453 0 1360
138 1522 0 1453
139 1460 0 1522
140 1552 0 1460
141 1548 0 1552
142 1827 0 1548
143 1737 0 1827
144 1941 0 1737
145 1474 0 1941
146 1458 0 1474
147 1542 0 1458
148 1404 0 1542
149 1522 0 1404
150 1385 0 1522
151 1641 0 1385
152 1510 0 1641
153 1681 0 1510
154 1938 0 1681
155 1868 0 1938
156 1726 0 1868
157 1456 0 1726
158 1445 0 1456
159 1456 0 1445
160 1365 0 1456
161 1487 0 1365
162 1558 0 1487
163 1488 0 1558
164 1684 0 1488
165 1594 0 1684
166 1850 0 1594
167 1998 0 1850
168 2079 0 1998
169 1494 0 2079
170 1057 1 1494
171 1218 1 1057
172 1168 1 1218
173 1236 1 1168
174 1076 1 1236
175 1174 1 1076
176 1139 1 1174
177 1427 1 1139
178 1487 1 1427
179 1483 1 1487
180 1513 1 1483
181 1357 1 1513
182 1165 1 1357
183 1282 1 1165
184 1110 1 1282
185 1297 1 1110
186 1185 1 1297
187 1222 1 1185
188 1284 1 1222
189 1444 1 1284
190 1575 1 1444
191 1737 1 1575
192 1763 1 1737
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) Belt A1
617.4672 -134.3651 0.6401
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-552.15 -130.07 3.14 143.98 514.60
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 617.46722 98.95216 6.240 2.83e-09 ***
Belt -134.36510 50.56941 -2.657 0.00856 **
A1 0.64015 0.05684 11.262 < 2e-16 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 202 on 188 degrees of freedom
(1 observation deleted due to missingness)
Multiple R-squared: 0.5212, Adjusted R-squared: 0.5162
F-statistic: 102.3 on 2 and 188 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.12114543 0.24229086 0.878854570
[2,] 0.08465125 0.16930250 0.915348750
[3,] 0.04135086 0.08270172 0.958649141
[4,] 0.03057196 0.06114392 0.969428040
[5,] 0.71210845 0.57578309 0.287891547
[6,] 0.62882121 0.74235758 0.371178788
[7,] 0.68121676 0.63756648 0.318783241
[8,] 0.59540571 0.80918859 0.404594294
[9,] 0.50473210 0.99053580 0.495267900
[10,] 0.45837047 0.91674094 0.541629529
[11,] 0.37556207 0.75112415 0.624437927
[12,] 0.31322556 0.62645112 0.686774438
[13,] 0.33648840 0.67297681 0.663511597
[14,] 0.27226157 0.54452314 0.727738429
[15,] 0.21330239 0.42660479 0.786697607
[16,] 0.29687512 0.59375024 0.703124878
[17,] 0.41540299 0.83080598 0.584597012
[18,] 0.52696084 0.94607832 0.473039161
[19,] 0.60107411 0.79785177 0.398925885
[20,] 0.65861776 0.68276448 0.341382240
[21,] 0.59849219 0.80301563 0.401507815
[22,] 0.54777230 0.90445539 0.452227696
[23,] 0.51496942 0.97006116 0.485030582
[24,] 0.45636093 0.91272187 0.543639066
[25,] 0.40037351 0.80074703 0.599626486
[26,] 0.37268751 0.74537503 0.627312486
[27,] 0.40045805 0.80091611 0.599541947
[28,] 0.48780588 0.97561176 0.512194121
[29,] 0.56983008 0.86033983 0.430169916
[30,] 0.53148897 0.93702207 0.468511034
[31,] 0.47792607 0.95585215 0.522073926
[32,] 0.48256393 0.96512787 0.517436066
[33,] 0.43441826 0.86883652 0.565581742
[34,] 0.45852087 0.91704174 0.541479130
[35,] 0.54489003 0.91021995 0.455109973
[36,] 0.49622463 0.99244926 0.503775368
[37,] 0.46920425 0.93840849 0.530795754
[38,] 0.47024454 0.94048908 0.529755461
[39,] 0.42404972 0.84809945 0.575950277
[40,] 0.42204271 0.84408542 0.577957289
[41,] 0.65771193 0.68457614 0.342288072
[42,] 0.81703712 0.36592576 0.182962879
[43,] 0.83911857 0.32176286 0.160881430
[44,] 0.80978967 0.38042067 0.190210334
[45,] 0.81479287 0.37041427 0.185207135
[46,] 0.82052190 0.35895620 0.179478099
[47,] 0.80066926 0.39866148 0.199330740
[48,] 0.77719184 0.44561632 0.222808162
[49,] 0.77967593 0.44064815 0.220324075
[50,] 0.74559358 0.50881284 0.254406422
[51,] 0.75345097 0.49309806 0.246549029
[52,] 0.73001065 0.53997871 0.269989353
[53,] 0.71648047 0.56703907 0.283519535
[54,] 0.70668705 0.58662590 0.293312951
[55,] 0.80631401 0.38737197 0.193685987
[56,] 0.79808902 0.40382195 0.201910976
[57,] 0.76904458 0.46191084 0.230955422
[58,] 0.78573691 0.42852618 0.214263092
[59,] 0.78591660 0.42816681 0.214083404
[60,] 0.75637601 0.48724799 0.243623994
[61,] 0.72225623 0.55548755 0.277743774
[62,] 0.69888643 0.60222714 0.301113568
[63,] 0.68966052 0.62067896 0.310339481
[64,] 0.68274790 0.63450419 0.317252097
[65,] 0.66885079 0.66229842 0.331149212
[66,] 0.64413066 0.71173868 0.355869339
[67,] 0.72471091 0.55057818 0.275289091
[68,] 0.76124935 0.47750129 0.238750647
[69,] 0.74455786 0.51088429 0.255442143
[70,] 0.78632760 0.42734480 0.213672402
[71,] 0.75441237 0.49117527 0.245587633
[72,] 0.74806894 0.50386212 0.251931059
[73,] 0.72168024 0.55663952 0.278319759
[74,] 0.68536808 0.62926385 0.314631924
[75,] 0.64931749 0.70136502 0.350682512
[76,] 0.62431979 0.75136042 0.375680209
[77,] 0.66324277 0.67351446 0.336757229
[78,] 0.75322496 0.49355009 0.246775044
[79,] 0.90410193 0.19179613 0.095898066
[80,] 0.88911974 0.22176053 0.110880263
[81,] 0.90414381 0.19171239 0.095856194
[82,] 0.89368853 0.21262294 0.106311472
[83,] 0.87351154 0.25297691 0.126488456
[84,] 0.89496931 0.21006139 0.105030694
[85,] 0.87676248 0.24647505 0.123237523
[86,] 0.89207774 0.21584452 0.107922261
[87,] 0.88370983 0.23258034 0.116290169
[88,] 0.86722023 0.26555954 0.132779770
[89,] 0.87487435 0.25025130 0.125125649
[90,] 0.93660431 0.12679138 0.063395691
[91,] 0.96532428 0.06935144 0.034675721
[92,] 0.97084960 0.05830080 0.029150401
[93,] 0.96544370 0.06911260 0.034556299
[94,] 0.95991864 0.08016273 0.040081363
[95,] 0.95393465 0.09213071 0.046065353
[96,] 0.94289759 0.11420482 0.057102409
[97,] 0.93105523 0.13788954 0.068944770
[98,] 0.91716537 0.16566926 0.082834631
[99,] 0.90926343 0.18147314 0.090736569
[100,] 0.89598039 0.20803922 0.104019610
[101,] 0.92251042 0.15497916 0.077489582
[102,] 0.95118079 0.09763842 0.048819211
[103,] 0.94088601 0.11822797 0.059113987
[104,] 0.96675220 0.06649560 0.033247799
[105,] 0.95813845 0.08372310 0.041861550
[106,] 0.95377494 0.09245013 0.046225064
[107,] 0.94553673 0.10892655 0.054463274
[108,] 0.93511801 0.12976398 0.064881989
[109,] 0.92059529 0.15880942 0.079404711
[110,] 0.90384569 0.19230861 0.096154307
[111,] 0.88431569 0.23136861 0.115684306
[112,] 0.86263816 0.27472368 0.137361839
[113,] 0.91615556 0.16768888 0.083844438
[114,] 0.95668099 0.08663803 0.043319015
[115,] 0.95523450 0.08953101 0.044765504
[116,] 0.96719985 0.06560030 0.032800151
[117,] 0.97068807 0.05862385 0.029311925
[118,] 0.97550679 0.04898641 0.024493206
[119,] 0.96844602 0.06310796 0.031553982
[120,] 0.96603398 0.06793204 0.033966022
[121,] 0.95903646 0.08192708 0.040963539
[122,] 0.94844770 0.10310459 0.051552296
[123,] 0.93638085 0.12723830 0.063619149
[124,] 0.92105282 0.15789436 0.078947181
[125,] 0.95692760 0.08614480 0.043072400
[126,] 0.97920780 0.04158439 0.020792196
[127,] 0.98536018 0.02927963 0.014639817
[128,] 0.99028310 0.01943380 0.009716902
[129,] 0.98687540 0.02624921 0.013124604
[130,] 0.98731473 0.02537055 0.012685275
[131,] 0.98286115 0.03427770 0.017138852
[132,] 0.97703371 0.04593259 0.022966294
[133,] 0.97234423 0.05531154 0.027655768
[134,] 0.96365917 0.07268166 0.036340829
[135,] 0.95331829 0.09336341 0.046681705
[136,] 0.96041479 0.07917043 0.039585213
[137,] 0.94869579 0.10260843 0.051304214
[138,] 0.95865274 0.08269453 0.041347265
[139,] 0.97813014 0.04373971 0.021869855
[140,] 0.97188129 0.05623743 0.028118713
[141,] 0.96250985 0.07498031 0.037490153
[142,] 0.96113430 0.07773140 0.038865702
[143,] 0.94887399 0.10225203 0.051126013
[144,] 0.94883970 0.10232060 0.051160301
[145,] 0.94355101 0.11289798 0.056448992
[146,] 0.93574962 0.12850076 0.064250380
[147,] 0.92436886 0.15126228 0.075631139
[148,] 0.94471827 0.11056346 0.055281730
[149,] 0.92897572 0.14204856 0.071024281
[150,] 0.90887070 0.18225861 0.091129303
[151,] 0.91998746 0.16002508 0.080012538
[152,] 0.90073619 0.19852762 0.099263808
[153,] 0.87662281 0.24675439 0.123377193
[154,] 0.87392036 0.25215928 0.126079640
[155,] 0.84027070 0.31945860 0.159729302
[156,] 0.80106488 0.39787024 0.198935122
[157,] 0.78427240 0.43145520 0.215727601
[158,] 0.74352335 0.51295330 0.256476650
[159,] 0.71471558 0.57056884 0.285284422
[160,] 0.71026375 0.57947251 0.289736254
[161,] 0.75632975 0.48734049 0.243670246
[162,] 0.92857746 0.14284508 0.071422539
[163,] 0.91351054 0.17297892 0.086489458
[164,] 0.98528616 0.02942769 0.014713843
[165,] 0.98079066 0.03841868 0.019209339
[166,] 0.97301380 0.05397240 0.026986200
[167,] 0.95796438 0.08407125 0.042035623
[168,] 0.96584488 0.06831024 0.034155118
[169,] 0.94614751 0.10770499 0.053852493
[170,] 0.92849451 0.14301098 0.071505491
[171,] 0.94976319 0.10047362 0.050236810
[172,] 0.92185171 0.15629658 0.078148289
[173,] 0.87805513 0.24388974 0.121944869
[174,] 0.81786250 0.36427499 0.182137497
[175,] 0.81054533 0.37890934 0.189454672
[176,] 0.87330481 0.25339038 0.126695190
[177,] 0.80400180 0.39199640 0.195998200
[178,] 0.89332689 0.21334622 0.106673112
[179,] 0.85728126 0.28543749 0.142718745
[180,] 0.92610688 0.14778623 0.073893116
[181,] 0.84611211 0.30777578 0.153887888
> postscript(file="/var/wessaorg/rcomp/tmp/1ntgr1384974375.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)
Warning message:
In x[, 1] - mysum$resid :
longer object length is not a multiple of shorter object length
> grid()
> dev.off()
null device
1
> postscript(file="/var/wessaorg/rcomp/tmp/2k2of1384974375.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/3l6b81384974375.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/4tmkx1384974375.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/5k24y1384974375.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 = 191
Frequency = 1
2 3 4 5 6
-189.39645069 -75.81000638 -197.16985865 127.92816485 -151.18832534
7 8 9 10 11
-25.73044958 14.54245921 -81.90802988 24.73950454 476.36857225
12 13 14 15 16
152.93485319 -240.50455587 25.99394663 -30.32797391 -158.60088270
17 18 19 20 21
-39.81739306 -105.69990453 214.50822082 27.06611675 -50.73314459
22 23 24 25 26
290.11882183 339.11612683 425.32155717 -173.75330795 -261.96712331
27 28 29 30 31
16.08827678 -78.23733709 148.57300426 -26.93388325 59.83483303
32 33 34 35 36
159.46759408 -231.39175902 338.13359519 340.35849057 145.08288677
37 38 39 40 41
59.32894385 -180.97450999 85.75158289 -223.13831526 354.14098187
42 43 44 45 46
-29.39914570 161.33902554 -186.35752063 79.32325384 220.35010555
47 48 49 50 51
514.60085430 502.09865847 -219.41930906 3.14297854 -197.07722516
52 53 54 55 56
250.00502665 143.00602498 -86.68313450 233.94493488 6.55553590
57 58 59 60 61
242.57030925 128.46489908 169.02549001 176.69987614 -385.78485134
62 63 64 65 66
-143.82477974 -31.60926771 -226.41591572 228.84860805 72.43704903
67 68 69 70 71
10.54715088 130.70995782 178.57400259 176.67671776 144.94593321
72 73 74 75 76
94.34371721 -353.41022571 -270.98020000 166.49244912 -292.99128002
77 78 79 80 81
16.84860805 -168.85163145 -85.11715356 2.43974404 50.78482295
82 83 84 85 86
-116.55187095 288.26216374 362.05134339 -552.15209028 94.59516430
87 88 89 90 91
-269.91172322 -123.15508529 19.52668752 -287.89325652 70.57939260
92 93 94 95 96
-267.33266558 160.05673340 89.01241332 221.55453756 403.12351351
97 98 99 100 101
-425.16317030 -271.43068908 -103.31419889 -117.71567622 -121.59449435
102 103 104 105 106
10.16683525 -62.49177918 47.38703895 -154.22995041 97.70895949
107 108 109 110 111
303.88384478 317.23730870 -79.39445402 -407.59619102 9.63678937
112 113 114 115 116
-159.01813173 -105.44276743 78.87915310 1.21315199 -40.19201868
117 118 119 120 121
-23.02921175 13.77004959 355.16414024 332.22992202 -252.48139750
122 123 124 125 126
-333.05506512 219.51930084 -284.40753071 3.27693710 -182.53709759
127 128 129 130 131
-106.51863089 23.04196004 32.74319788 -17.51024588 340.36857225
132 133 134 135 136
298.99494496 -365.27327215 -322.31320055 17.29171046 -221.52971091
137 138 139 140 141
-35.06814181 -25.60188103 -131.77207465 -0.08291517 -62.97650666
142 143 144 145 146
218.58408428 -50.01713339 211.59616263 -385.99397502 -103.04498344
147 148 149 150 151
-8.80261970 -200.57502932 5.76535791 -206.77207465 136.92816485
152 153 154 155 156
-157.94965495 96.90969815 244.44443571 9.92646818 -87.26319047
157 158 159 160 161
-266.36221230 -104.52232423 -86.48069916 -184.52232423 -4.26888048
162 163 164 165 166
-11.36690397 -126.81739306 113.99294829 -101.47600749 212.13728853
167 168 169 170 171
196.25946874 182.51760417 -454.33436225 -382.48283515 58.26172442
172 173 174 175 176
-94.80206068 5.20532599 -198.32471989 2.09891748 -95.63556041
177 178 179 180 181
214.76961027 90.40706300 47.99819898 80.55878992 -94.64564209
182 183 184 185 186
-186.78259565 53.12576920 -193.77151563 103.33389454 -128.37373164
187 188 189 190 191
-19.67718548 18.63734838 138.94818890 167.52455153 245.66519843
192
167.96126559
> postscript(file="/var/wessaorg/rcomp/tmp/6dg8q1384974375.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 = 191
Frequency = 1
lag(myerror, k = 1) myerror
0 -189.39645069 NA
1 -75.81000638 -189.39645069
2 -197.16985865 -75.81000638
3 127.92816485 -197.16985865
4 -151.18832534 127.92816485
5 -25.73044958 -151.18832534
6 14.54245921 -25.73044958
7 -81.90802988 14.54245921
8 24.73950454 -81.90802988
9 476.36857225 24.73950454
10 152.93485319 476.36857225
11 -240.50455587 152.93485319
12 25.99394663 -240.50455587
13 -30.32797391 25.99394663
14 -158.60088270 -30.32797391
15 -39.81739306 -158.60088270
16 -105.69990453 -39.81739306
17 214.50822082 -105.69990453
18 27.06611675 214.50822082
19 -50.73314459 27.06611675
20 290.11882183 -50.73314459
21 339.11612683 290.11882183
22 425.32155717 339.11612683
23 -173.75330795 425.32155717
24 -261.96712331 -173.75330795
25 16.08827678 -261.96712331
26 -78.23733709 16.08827678
27 148.57300426 -78.23733709
28 -26.93388325 148.57300426
29 59.83483303 -26.93388325
30 159.46759408 59.83483303
31 -231.39175902 159.46759408
32 338.13359519 -231.39175902
33 340.35849057 338.13359519
34 145.08288677 340.35849057
35 59.32894385 145.08288677
36 -180.97450999 59.32894385
37 85.75158289 -180.97450999
38 -223.13831526 85.75158289
39 354.14098187 -223.13831526
40 -29.39914570 354.14098187
41 161.33902554 -29.39914570
42 -186.35752063 161.33902554
43 79.32325384 -186.35752063
44 220.35010555 79.32325384
45 514.60085430 220.35010555
46 502.09865847 514.60085430
47 -219.41930906 502.09865847
48 3.14297854 -219.41930906
49 -197.07722516 3.14297854
50 250.00502665 -197.07722516
51 143.00602498 250.00502665
52 -86.68313450 143.00602498
53 233.94493488 -86.68313450
54 6.55553590 233.94493488
55 242.57030925 6.55553590
56 128.46489908 242.57030925
57 169.02549001 128.46489908
58 176.69987614 169.02549001
59 -385.78485134 176.69987614
60 -143.82477974 -385.78485134
61 -31.60926771 -143.82477974
62 -226.41591572 -31.60926771
63 228.84860805 -226.41591572
64 72.43704903 228.84860805
65 10.54715088 72.43704903
66 130.70995782 10.54715088
67 178.57400259 130.70995782
68 176.67671776 178.57400259
69 144.94593321 176.67671776
70 94.34371721 144.94593321
71 -353.41022571 94.34371721
72 -270.98020000 -353.41022571
73 166.49244912 -270.98020000
74 -292.99128002 166.49244912
75 16.84860805 -292.99128002
76 -168.85163145 16.84860805
77 -85.11715356 -168.85163145
78 2.43974404 -85.11715356
79 50.78482295 2.43974404
80 -116.55187095 50.78482295
81 288.26216374 -116.55187095
82 362.05134339 288.26216374
83 -552.15209028 362.05134339
84 94.59516430 -552.15209028
85 -269.91172322 94.59516430
86 -123.15508529 -269.91172322
87 19.52668752 -123.15508529
88 -287.89325652 19.52668752
89 70.57939260 -287.89325652
90 -267.33266558 70.57939260
91 160.05673340 -267.33266558
92 89.01241332 160.05673340
93 221.55453756 89.01241332
94 403.12351351 221.55453756
95 -425.16317030 403.12351351
96 -271.43068908 -425.16317030
97 -103.31419889 -271.43068908
98 -117.71567622 -103.31419889
99 -121.59449435 -117.71567622
100 10.16683525 -121.59449435
101 -62.49177918 10.16683525
102 47.38703895 -62.49177918
103 -154.22995041 47.38703895
104 97.70895949 -154.22995041
105 303.88384478 97.70895949
106 317.23730870 303.88384478
107 -79.39445402 317.23730870
108 -407.59619102 -79.39445402
109 9.63678937 -407.59619102
110 -159.01813173 9.63678937
111 -105.44276743 -159.01813173
112 78.87915310 -105.44276743
113 1.21315199 78.87915310
114 -40.19201868 1.21315199
115 -23.02921175 -40.19201868
116 13.77004959 -23.02921175
117 355.16414024 13.77004959
118 332.22992202 355.16414024
119 -252.48139750 332.22992202
120 -333.05506512 -252.48139750
121 219.51930084 -333.05506512
122 -284.40753071 219.51930084
123 3.27693710 -284.40753071
124 -182.53709759 3.27693710
125 -106.51863089 -182.53709759
126 23.04196004 -106.51863089
127 32.74319788 23.04196004
128 -17.51024588 32.74319788
129 340.36857225 -17.51024588
130 298.99494496 340.36857225
131 -365.27327215 298.99494496
132 -322.31320055 -365.27327215
133 17.29171046 -322.31320055
134 -221.52971091 17.29171046
135 -35.06814181 -221.52971091
136 -25.60188103 -35.06814181
137 -131.77207465 -25.60188103
138 -0.08291517 -131.77207465
139 -62.97650666 -0.08291517
140 218.58408428 -62.97650666
141 -50.01713339 218.58408428
142 211.59616263 -50.01713339
143 -385.99397502 211.59616263
144 -103.04498344 -385.99397502
145 -8.80261970 -103.04498344
146 -200.57502932 -8.80261970
147 5.76535791 -200.57502932
148 -206.77207465 5.76535791
149 136.92816485 -206.77207465
150 -157.94965495 136.92816485
151 96.90969815 -157.94965495
152 244.44443571 96.90969815
153 9.92646818 244.44443571
154 -87.26319047 9.92646818
155 -266.36221230 -87.26319047
156 -104.52232423 -266.36221230
157 -86.48069916 -104.52232423
158 -184.52232423 -86.48069916
159 -4.26888048 -184.52232423
160 -11.36690397 -4.26888048
161 -126.81739306 -11.36690397
162 113.99294829 -126.81739306
163 -101.47600749 113.99294829
164 212.13728853 -101.47600749
165 196.25946874 212.13728853
166 182.51760417 196.25946874
167 -454.33436225 182.51760417
168 -382.48283515 -454.33436225
169 58.26172442 -382.48283515
170 -94.80206068 58.26172442
171 5.20532599 -94.80206068
172 -198.32471989 5.20532599
173 2.09891748 -198.32471989
174 -95.63556041 2.09891748
175 214.76961027 -95.63556041
176 90.40706300 214.76961027
177 47.99819898 90.40706300
178 80.55878992 47.99819898
179 -94.64564209 80.55878992
180 -186.78259565 -94.64564209
181 53.12576920 -186.78259565
182 -193.77151563 53.12576920
183 103.33389454 -193.77151563
184 -128.37373164 103.33389454
185 -19.67718548 -128.37373164
186 18.63734838 -19.67718548
187 138.94818890 18.63734838
188 167.52455153 138.94818890
189 245.66519843 167.52455153
190 167.96126559 245.66519843
191 NA 167.96126559
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -75.81000638 -189.39645069
[2,] -197.16985865 -75.81000638
[3,] 127.92816485 -197.16985865
[4,] -151.18832534 127.92816485
[5,] -25.73044958 -151.18832534
[6,] 14.54245921 -25.73044958
[7,] -81.90802988 14.54245921
[8,] 24.73950454 -81.90802988
[9,] 476.36857225 24.73950454
[10,] 152.93485319 476.36857225
[11,] -240.50455587 152.93485319
[12,] 25.99394663 -240.50455587
[13,] -30.32797391 25.99394663
[14,] -158.60088270 -30.32797391
[15,] -39.81739306 -158.60088270
[16,] -105.69990453 -39.81739306
[17,] 214.50822082 -105.69990453
[18,] 27.06611675 214.50822082
[19,] -50.73314459 27.06611675
[20,] 290.11882183 -50.73314459
[21,] 339.11612683 290.11882183
[22,] 425.32155717 339.11612683
[23,] -173.75330795 425.32155717
[24,] -261.96712331 -173.75330795
[25,] 16.08827678 -261.96712331
[26,] -78.23733709 16.08827678
[27,] 148.57300426 -78.23733709
[28,] -26.93388325 148.57300426
[29,] 59.83483303 -26.93388325
[30,] 159.46759408 59.83483303
[31,] -231.39175902 159.46759408
[32,] 338.13359519 -231.39175902
[33,] 340.35849057 338.13359519
[34,] 145.08288677 340.35849057
[35,] 59.32894385 145.08288677
[36,] -180.97450999 59.32894385
[37,] 85.75158289 -180.97450999
[38,] -223.13831526 85.75158289
[39,] 354.14098187 -223.13831526
[40,] -29.39914570 354.14098187
[41,] 161.33902554 -29.39914570
[42,] -186.35752063 161.33902554
[43,] 79.32325384 -186.35752063
[44,] 220.35010555 79.32325384
[45,] 514.60085430 220.35010555
[46,] 502.09865847 514.60085430
[47,] -219.41930906 502.09865847
[48,] 3.14297854 -219.41930906
[49,] -197.07722516 3.14297854
[50,] 250.00502665 -197.07722516
[51,] 143.00602498 250.00502665
[52,] -86.68313450 143.00602498
[53,] 233.94493488 -86.68313450
[54,] 6.55553590 233.94493488
[55,] 242.57030925 6.55553590
[56,] 128.46489908 242.57030925
[57,] 169.02549001 128.46489908
[58,] 176.69987614 169.02549001
[59,] -385.78485134 176.69987614
[60,] -143.82477974 -385.78485134
[61,] -31.60926771 -143.82477974
[62,] -226.41591572 -31.60926771
[63,] 228.84860805 -226.41591572
[64,] 72.43704903 228.84860805
[65,] 10.54715088 72.43704903
[66,] 130.70995782 10.54715088
[67,] 178.57400259 130.70995782
[68,] 176.67671776 178.57400259
[69,] 144.94593321 176.67671776
[70,] 94.34371721 144.94593321
[71,] -353.41022571 94.34371721
[72,] -270.98020000 -353.41022571
[73,] 166.49244912 -270.98020000
[74,] -292.99128002 166.49244912
[75,] 16.84860805 -292.99128002
[76,] -168.85163145 16.84860805
[77,] -85.11715356 -168.85163145
[78,] 2.43974404 -85.11715356
[79,] 50.78482295 2.43974404
[80,] -116.55187095 50.78482295
[81,] 288.26216374 -116.55187095
[82,] 362.05134339 288.26216374
[83,] -552.15209028 362.05134339
[84,] 94.59516430 -552.15209028
[85,] -269.91172322 94.59516430
[86,] -123.15508529 -269.91172322
[87,] 19.52668752 -123.15508529
[88,] -287.89325652 19.52668752
[89,] 70.57939260 -287.89325652
[90,] -267.33266558 70.57939260
[91,] 160.05673340 -267.33266558
[92,] 89.01241332 160.05673340
[93,] 221.55453756 89.01241332
[94,] 403.12351351 221.55453756
[95,] -425.16317030 403.12351351
[96,] -271.43068908 -425.16317030
[97,] -103.31419889 -271.43068908
[98,] -117.71567622 -103.31419889
[99,] -121.59449435 -117.71567622
[100,] 10.16683525 -121.59449435
[101,] -62.49177918 10.16683525
[102,] 47.38703895 -62.49177918
[103,] -154.22995041 47.38703895
[104,] 97.70895949 -154.22995041
[105,] 303.88384478 97.70895949
[106,] 317.23730870 303.88384478
[107,] -79.39445402 317.23730870
[108,] -407.59619102 -79.39445402
[109,] 9.63678937 -407.59619102
[110,] -159.01813173 9.63678937
[111,] -105.44276743 -159.01813173
[112,] 78.87915310 -105.44276743
[113,] 1.21315199 78.87915310
[114,] -40.19201868 1.21315199
[115,] -23.02921175 -40.19201868
[116,] 13.77004959 -23.02921175
[117,] 355.16414024 13.77004959
[118,] 332.22992202 355.16414024
[119,] -252.48139750 332.22992202
[120,] -333.05506512 -252.48139750
[121,] 219.51930084 -333.05506512
[122,] -284.40753071 219.51930084
[123,] 3.27693710 -284.40753071
[124,] -182.53709759 3.27693710
[125,] -106.51863089 -182.53709759
[126,] 23.04196004 -106.51863089
[127,] 32.74319788 23.04196004
[128,] -17.51024588 32.74319788
[129,] 340.36857225 -17.51024588
[130,] 298.99494496 340.36857225
[131,] -365.27327215 298.99494496
[132,] -322.31320055 -365.27327215
[133,] 17.29171046 -322.31320055
[134,] -221.52971091 17.29171046
[135,] -35.06814181 -221.52971091
[136,] -25.60188103 -35.06814181
[137,] -131.77207465 -25.60188103
[138,] -0.08291517 -131.77207465
[139,] -62.97650666 -0.08291517
[140,] 218.58408428 -62.97650666
[141,] -50.01713339 218.58408428
[142,] 211.59616263 -50.01713339
[143,] -385.99397502 211.59616263
[144,] -103.04498344 -385.99397502
[145,] -8.80261970 -103.04498344
[146,] -200.57502932 -8.80261970
[147,] 5.76535791 -200.57502932
[148,] -206.77207465 5.76535791
[149,] 136.92816485 -206.77207465
[150,] -157.94965495 136.92816485
[151,] 96.90969815 -157.94965495
[152,] 244.44443571 96.90969815
[153,] 9.92646818 244.44443571
[154,] -87.26319047 9.92646818
[155,] -266.36221230 -87.26319047
[156,] -104.52232423 -266.36221230
[157,] -86.48069916 -104.52232423
[158,] -184.52232423 -86.48069916
[159,] -4.26888048 -184.52232423
[160,] -11.36690397 -4.26888048
[161,] -126.81739306 -11.36690397
[162,] 113.99294829 -126.81739306
[163,] -101.47600749 113.99294829
[164,] 212.13728853 -101.47600749
[165,] 196.25946874 212.13728853
[166,] 182.51760417 196.25946874
[167,] -454.33436225 182.51760417
[168,] -382.48283515 -454.33436225
[169,] 58.26172442 -382.48283515
[170,] -94.80206068 58.26172442
[171,] 5.20532599 -94.80206068
[172,] -198.32471989 5.20532599
[173,] 2.09891748 -198.32471989
[174,] -95.63556041 2.09891748
[175,] 214.76961027 -95.63556041
[176,] 90.40706300 214.76961027
[177,] 47.99819898 90.40706300
[178,] 80.55878992 47.99819898
[179,] -94.64564209 80.55878992
[180,] -186.78259565 -94.64564209
[181,] 53.12576920 -186.78259565
[182,] -193.77151563 53.12576920
[183,] 103.33389454 -193.77151563
[184,] -128.37373164 103.33389454
[185,] -19.67718548 -128.37373164
[186,] 18.63734838 -19.67718548
[187,] 138.94818890 18.63734838
[188,] 167.52455153 138.94818890
[189,] 245.66519843 167.52455153
[190,] 167.96126559 245.66519843
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -75.81000638 -189.39645069
2 -197.16985865 -75.81000638
3 127.92816485 -197.16985865
4 -151.18832534 127.92816485
5 -25.73044958 -151.18832534
6 14.54245921 -25.73044958
7 -81.90802988 14.54245921
8 24.73950454 -81.90802988
9 476.36857225 24.73950454
10 152.93485319 476.36857225
11 -240.50455587 152.93485319
12 25.99394663 -240.50455587
13 -30.32797391 25.99394663
14 -158.60088270 -30.32797391
15 -39.81739306 -158.60088270
16 -105.69990453 -39.81739306
17 214.50822082 -105.69990453
18 27.06611675 214.50822082
19 -50.73314459 27.06611675
20 290.11882183 -50.73314459
21 339.11612683 290.11882183
22 425.32155717 339.11612683
23 -173.75330795 425.32155717
24 -261.96712331 -173.75330795
25 16.08827678 -261.96712331
26 -78.23733709 16.08827678
27 148.57300426 -78.23733709
28 -26.93388325 148.57300426
29 59.83483303 -26.93388325
30 159.46759408 59.83483303
31 -231.39175902 159.46759408
32 338.13359519 -231.39175902
33 340.35849057 338.13359519
34 145.08288677 340.35849057
35 59.32894385 145.08288677
36 -180.97450999 59.32894385
37 85.75158289 -180.97450999
38 -223.13831526 85.75158289
39 354.14098187 -223.13831526
40 -29.39914570 354.14098187
41 161.33902554 -29.39914570
42 -186.35752063 161.33902554
43 79.32325384 -186.35752063
44 220.35010555 79.32325384
45 514.60085430 220.35010555
46 502.09865847 514.60085430
47 -219.41930906 502.09865847
48 3.14297854 -219.41930906
49 -197.07722516 3.14297854
50 250.00502665 -197.07722516
51 143.00602498 250.00502665
52 -86.68313450 143.00602498
53 233.94493488 -86.68313450
54 6.55553590 233.94493488
55 242.57030925 6.55553590
56 128.46489908 242.57030925
57 169.02549001 128.46489908
58 176.69987614 169.02549001
59 -385.78485134 176.69987614
60 -143.82477974 -385.78485134
61 -31.60926771 -143.82477974
62 -226.41591572 -31.60926771
63 228.84860805 -226.41591572
64 72.43704903 228.84860805
65 10.54715088 72.43704903
66 130.70995782 10.54715088
67 178.57400259 130.70995782
68 176.67671776 178.57400259
69 144.94593321 176.67671776
70 94.34371721 144.94593321
71 -353.41022571 94.34371721
72 -270.98020000 -353.41022571
73 166.49244912 -270.98020000
74 -292.99128002 166.49244912
75 16.84860805 -292.99128002
76 -168.85163145 16.84860805
77 -85.11715356 -168.85163145
78 2.43974404 -85.11715356
79 50.78482295 2.43974404
80 -116.55187095 50.78482295
81 288.26216374 -116.55187095
82 362.05134339 288.26216374
83 -552.15209028 362.05134339
84 94.59516430 -552.15209028
85 -269.91172322 94.59516430
86 -123.15508529 -269.91172322
87 19.52668752 -123.15508529
88 -287.89325652 19.52668752
89 70.57939260 -287.89325652
90 -267.33266558 70.57939260
91 160.05673340 -267.33266558
92 89.01241332 160.05673340
93 221.55453756 89.01241332
94 403.12351351 221.55453756
95 -425.16317030 403.12351351
96 -271.43068908 -425.16317030
97 -103.31419889 -271.43068908
98 -117.71567622 -103.31419889
99 -121.59449435 -117.71567622
100 10.16683525 -121.59449435
101 -62.49177918 10.16683525
102 47.38703895 -62.49177918
103 -154.22995041 47.38703895
104 97.70895949 -154.22995041
105 303.88384478 97.70895949
106 317.23730870 303.88384478
107 -79.39445402 317.23730870
108 -407.59619102 -79.39445402
109 9.63678937 -407.59619102
110 -159.01813173 9.63678937
111 -105.44276743 -159.01813173
112 78.87915310 -105.44276743
113 1.21315199 78.87915310
114 -40.19201868 1.21315199
115 -23.02921175 -40.19201868
116 13.77004959 -23.02921175
117 355.16414024 13.77004959
118 332.22992202 355.16414024
119 -252.48139750 332.22992202
120 -333.05506512 -252.48139750
121 219.51930084 -333.05506512
122 -284.40753071 219.51930084
123 3.27693710 -284.40753071
124 -182.53709759 3.27693710
125 -106.51863089 -182.53709759
126 23.04196004 -106.51863089
127 32.74319788 23.04196004
128 -17.51024588 32.74319788
129 340.36857225 -17.51024588
130 298.99494496 340.36857225
131 -365.27327215 298.99494496
132 -322.31320055 -365.27327215
133 17.29171046 -322.31320055
134 -221.52971091 17.29171046
135 -35.06814181 -221.52971091
136 -25.60188103 -35.06814181
137 -131.77207465 -25.60188103
138 -0.08291517 -131.77207465
139 -62.97650666 -0.08291517
140 218.58408428 -62.97650666
141 -50.01713339 218.58408428
142 211.59616263 -50.01713339
143 -385.99397502 211.59616263
144 -103.04498344 -385.99397502
145 -8.80261970 -103.04498344
146 -200.57502932 -8.80261970
147 5.76535791 -200.57502932
148 -206.77207465 5.76535791
149 136.92816485 -206.77207465
150 -157.94965495 136.92816485
151 96.90969815 -157.94965495
152 244.44443571 96.90969815
153 9.92646818 244.44443571
154 -87.26319047 9.92646818
155 -266.36221230 -87.26319047
156 -104.52232423 -266.36221230
157 -86.48069916 -104.52232423
158 -184.52232423 -86.48069916
159 -4.26888048 -184.52232423
160 -11.36690397 -4.26888048
161 -126.81739306 -11.36690397
162 113.99294829 -126.81739306
163 -101.47600749 113.99294829
164 212.13728853 -101.47600749
165 196.25946874 212.13728853
166 182.51760417 196.25946874
167 -454.33436225 182.51760417
168 -382.48283515 -454.33436225
169 58.26172442 -382.48283515
170 -94.80206068 58.26172442
171 5.20532599 -94.80206068
172 -198.32471989 5.20532599
173 2.09891748 -198.32471989
174 -95.63556041 2.09891748
175 214.76961027 -95.63556041
176 90.40706300 214.76961027
177 47.99819898 90.40706300
178 80.55878992 47.99819898
179 -94.64564209 80.55878992
180 -186.78259565 -94.64564209
181 53.12576920 -186.78259565
182 -193.77151563 53.12576920
183 103.33389454 -193.77151563
184 -128.37373164 103.33389454
185 -19.67718548 -128.37373164
186 18.63734838 -19.67718548
187 138.94818890 18.63734838
188 167.52455153 138.94818890
189 245.66519843 167.52455153
190 167.96126559 245.66519843
> 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/7blnm1384974375.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/80nib1384974375.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/9im3z1384974375.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/10bk8u1384974375.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, signif(mysum$coefficients[i,1],6), 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/11788t1384974375.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,signif(mysum$coefficients[i,1],6))
+ a<-table.element(a, signif(mysum$coefficients[i,2],6))
+ a<-table.element(a, signif(mysum$coefficients[i,3],4))
+ a<-table.element(a, signif(mysum$coefficients[i,4],6))
+ a<-table.element(a, signif(mysum$coefficients[i,4]/2,6))
+ a<-table.row.end(a)
+ }
> a<-table.end(a)
> table.save(a,file="/var/wessaorg/rcomp/tmp/12u5a81384974375.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, signif(sqrt(mysum$r.squared),6))
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a, 'R-squared',1,TRUE)
> a<-table.element(a, signif(mysum$r.squared,6))
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a, 'Adjusted R-squared',1,TRUE)
> a<-table.element(a, signif(mysum$adj.r.squared,6))
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a, 'F-TEST (value)',1,TRUE)
> a<-table.element(a, signif(mysum$fstatistic[1],6))
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a, 'F-TEST (DF numerator)',1,TRUE)
> a<-table.element(a, signif(mysum$fstatistic[2],6))
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a, 'F-TEST (DF denominator)',1,TRUE)
> a<-table.element(a, signif(mysum$fstatistic[3],6))
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a, 'p-value',1,TRUE)
> a<-table.element(a, signif(1-pf(mysum$fstatistic[1],mysum$fstatistic[2],mysum$fstatistic[3]),6))
> 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, signif(mysum$sigma,6))
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a, 'Sum Squared Residuals',1,TRUE)
> a<-table.element(a, signif(sum(myerror*myerror),6))
> a<-table.row.end(a)
> a<-table.end(a)
> table.save(a,file="/var/wessaorg/rcomp/tmp/13vqzh1384974375.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,signif(x[i],6))
+ a<-table.element(a,signif(x[i]-mysum$resid[i],6))
+ a<-table.element(a,signif(mysum$resid[i],6))
+ a<-table.row.end(a)
+ }
> a<-table.end(a)
> table.save(a,file="/var/wessaorg/rcomp/tmp/14jqts1384974375.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,signif(gqarr[mypoint-kp3+1,1],6))
+ a<-table.element(a,signif(gqarr[mypoint-kp3+1,2],6))
+ a<-table.element(a,signif(gqarr[mypoint-kp3+1,3],6))
+ a<-table.row.end(a)
+ }
+ a<-table.end(a)
+ table.save(a,file="/var/wessaorg/rcomp/tmp/15haht1384974376.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,signif(numsignificant1,6))
+ a<-table.element(a,signif(numsignificant1/numgqtests,6))
+ 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,signif(numsignificant5,6))
+ a<-table.element(a,signif(numsignificant5/numgqtests,6))
+ 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,signif(numsignificant10,6))
+ a<-table.element(a,signif(numsignificant10/numgqtests,6))
+ 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/165su11384974376.tab")
+ }
>
> try(system("convert tmp/1ntgr1384974375.ps tmp/1ntgr1384974375.png",intern=TRUE))
character(0)
> try(system("convert tmp/2k2of1384974375.ps tmp/2k2of1384974375.png",intern=TRUE))
character(0)
> try(system("convert tmp/3l6b81384974375.ps tmp/3l6b81384974375.png",intern=TRUE))
character(0)
> try(system("convert tmp/4tmkx1384974375.ps tmp/4tmkx1384974375.png",intern=TRUE))
character(0)
> try(system("convert tmp/5k24y1384974375.ps tmp/5k24y1384974375.png",intern=TRUE))
character(0)
> try(system("convert tmp/6dg8q1384974375.ps tmp/6dg8q1384974375.png",intern=TRUE))
character(0)
> try(system("convert tmp/7blnm1384974375.ps tmp/7blnm1384974375.png",intern=TRUE))
character(0)
> try(system("convert tmp/80nib1384974375.ps tmp/80nib1384974375.png",intern=TRUE))
character(0)
> try(system("convert tmp/9im3z1384974375.ps tmp/9im3z1384974375.png",intern=TRUE))
character(0)
> try(system("convert tmp/10bk8u1384974375.ps tmp/10bk8u1384974375.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
10.817 1.695 12.492