R version 2.13.0 (2011-04-13)
Copyright (C) 2011 The R Foundation for Statistical Computing
ISBN 3-900051-07-0
Platform: i486-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(1772
+ ,158258
+ ,89
+ ,20465
+ ,1703
+ ,186930
+ ,57
+ ,33629
+ ,192
+ ,7215
+ ,18
+ ,1423
+ ,2294
+ ,129098
+ ,94
+ ,25629
+ ,3448
+ ,230587
+ ,134
+ ,54002
+ ,6813
+ ,508313
+ ,261
+ ,151036
+ ,1795
+ ,180745
+ ,56
+ ,33287
+ ,1680
+ ,185559
+ ,58
+ ,31172
+ ,1896
+ ,154581
+ ,43
+ ,28113
+ ,2917
+ ,290658
+ ,95
+ ,57803
+ ,1946
+ ,121844
+ ,75
+ ,49830
+ ,2148
+ ,184039
+ ,69
+ ,52143
+ ,1832
+ ,100324
+ ,98
+ ,21055
+ ,3059
+ ,209427
+ ,114
+ ,47007
+ ,1469
+ ,167592
+ ,57
+ ,28735
+ ,1565
+ ,154593
+ ,86
+ ,59147
+ ,1755
+ ,142018
+ ,56
+ ,78950
+ ,1234
+ ,77855
+ ,59
+ ,13497
+ ,2779
+ ,167047
+ ,87
+ ,46154
+ ,726
+ ,27997
+ ,24
+ ,53249
+ ,1048
+ ,73019
+ ,59
+ ,10726
+ ,2804
+ ,241082
+ ,99
+ ,83700
+ ,1760
+ ,195820
+ ,72
+ ,40400
+ ,2261
+ ,141899
+ ,53
+ ,33797
+ ,1848
+ ,145433
+ ,86
+ ,36205
+ ,1647
+ ,180241
+ ,31
+ ,30165
+ ,2081
+ ,202232
+ ,160
+ ,58534
+ ,1393
+ ,190230
+ ,91
+ ,44663
+ ,2741
+ ,354924
+ ,118
+ ,92556
+ ,2112
+ ,192399
+ ,44
+ ,40078
+ ,1684
+ ,182286
+ ,44
+ ,34711
+ ,1616
+ ,181590
+ ,45
+ ,31076
+ ,2227
+ ,133801
+ ,105
+ ,74608
+ ,3088
+ ,233686
+ ,123
+ ,58092
+ ,2388
+ ,219428
+ ,52
+ ,42009
+ ,1
+ ,0
+ ,1
+ ,0
+ ,2099
+ ,223044
+ ,63
+ ,36022
+ ,1669
+ ,100129
+ ,51
+ ,23333
+ ,2094
+ ,136733
+ ,47
+ ,53349
+ ,2153
+ ,249965
+ ,64
+ ,92596
+ ,2390
+ ,242379
+ ,71
+ ,49598
+ ,1701
+ ,145794
+ ,59
+ ,44093
+ ,983
+ ,96404
+ ,32
+ ,84205
+ ,2161
+ ,195891
+ ,78
+ ,63369
+ ,1276
+ ,117156
+ ,50
+ ,60132
+ ,1189
+ ,157787
+ ,94
+ ,37403
+ ,744
+ ,81293
+ ,31
+ ,24460
+ ,2231
+ ,224049
+ ,100
+ ,46456
+ ,2242
+ ,223789
+ ,87
+ ,66616
+ ,2638
+ ,160344
+ ,58
+ ,41554
+ ,658
+ ,48188
+ ,28
+ ,22346
+ ,1859
+ ,152206
+ ,68
+ ,30874
+ ,2489
+ ,294283
+ ,73
+ ,68701
+ ,2025
+ ,235223
+ ,78
+ ,35728
+ ,1911
+ ,195583
+ ,59
+ ,29010
+ ,1714
+ ,145942
+ ,54
+ ,23110
+ ,1851
+ ,208834
+ ,66
+ ,38844
+ ,980
+ ,93764
+ ,23
+ ,27084
+ ,1177
+ ,151985
+ ,66
+ ,35139
+ ,2809
+ ,190545
+ ,95
+ ,57476
+ ,1688
+ ,148922
+ ,60
+ ,33277
+ ,2097
+ ,132856
+ ,80
+ ,31141
+ ,1309
+ ,126107
+ ,60
+ ,61281
+ ,1243
+ ,112718
+ ,36
+ ,25820
+ ,1255
+ ,160930
+ ,34
+ ,23284
+ ,1293
+ ,99184
+ ,40
+ ,35378
+ ,2259
+ ,182022
+ ,69
+ ,74990
+ ,2897
+ ,138708
+ ,65
+ ,29653
+ ,1103
+ ,114408
+ ,38
+ ,64622
+ ,340
+ ,31970
+ ,15
+ ,4157
+ ,2791
+ ,225558
+ ,112
+ ,29245
+ ,1333
+ ,137011
+ ,71
+ ,50008
+ ,1441
+ ,113612
+ ,68
+ ,52338
+ ,1622
+ ,108641
+ ,70
+ ,13310
+ ,2649
+ ,162203
+ ,66
+ ,92901
+ ,1499
+ ,100098
+ ,44
+ ,10956
+ ,2302
+ ,174768
+ ,60
+ ,34241
+ ,2540
+ ,158459
+ ,97
+ ,75043
+ ,1000
+ ,80934
+ ,30
+ ,21152
+ ,1234
+ ,84971
+ ,71
+ ,42249
+ ,927
+ ,80545
+ ,68
+ ,42005
+ ,2176
+ ,287191
+ ,64
+ ,41152
+ ,956
+ ,62974
+ ,27
+ ,14399
+ ,1531
+ ,130982
+ ,38
+ ,28263
+ ,1013
+ ,75555
+ ,45
+ ,17215
+ ,1771
+ ,162154
+ ,54
+ ,48140
+ ,2613
+ ,226638
+ ,227
+ ,62897
+ ,1203
+ ,115019
+ ,110
+ ,22883
+ ,1303
+ ,105038
+ ,60
+ ,41622
+ ,1524
+ ,155537
+ ,52
+ ,40715
+ ,1829
+ ,153133
+ ,41
+ ,65897
+ ,2227
+ ,165577
+ ,76
+ ,76542
+ ,1233
+ ,151517
+ ,57
+ ,37477
+ ,1365
+ ,133686
+ ,58
+ ,53216
+ ,901
+ ,58128
+ ,38
+ ,40911
+ ,2319
+ ,245196
+ ,117
+ ,57021
+ ,1857
+ ,195576
+ ,70
+ ,73116
+ ,223
+ ,19349
+ ,12
+ ,3895
+ ,2390
+ ,225371
+ ,105
+ ,46609
+ ,1973
+ ,152796
+ ,76
+ ,29351
+ ,699
+ ,59117
+ ,28
+ ,2325
+ ,1062
+ ,91762
+ ,24
+ ,31747
+ ,1252
+ ,127987
+ ,52
+ ,32665
+ ,1154
+ ,113552
+ ,58
+ ,19249
+ ,823
+ ,85338
+ ,40
+ ,15292
+ ,596
+ ,27676
+ ,22
+ ,5842
+ ,1471
+ ,147984
+ ,47
+ ,33994
+ ,1130
+ ,122417
+ ,37
+ ,13018
+ ,0
+ ,0
+ ,0
+ ,0
+ ,1082
+ ,91529
+ ,32
+ ,98177
+ ,1134
+ ,107205
+ ,66
+ ,37941
+ ,1366
+ ,144664
+ ,44
+ ,31032
+ ,1452
+ ,136540
+ ,62
+ ,32683
+ ,869
+ ,76656
+ ,59
+ ,34545
+ ,78
+ ,3616
+ ,5
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,1127
+ ,183065
+ ,43
+ ,27525
+ ,1578
+ ,144636
+ ,83
+ ,66856
+ ,2018
+ ,156889
+ ,97
+ ,28549
+ ,919
+ ,113273
+ ,38
+ ,38610
+ ,778
+ ,43410
+ ,19
+ ,2781
+ ,1751
+ ,175774
+ ,72
+ ,41211
+ ,956
+ ,95401
+ ,41
+ ,22698
+ ,1875
+ ,118893
+ ,54
+ ,41194
+ ,731
+ ,60493
+ ,40
+ ,32689
+ ,285
+ ,19764
+ ,12
+ ,5752
+ ,1833
+ ,164062
+ ,55
+ ,26757
+ ,1147
+ ,132696
+ ,32
+ ,22527
+ ,1646
+ ,155367
+ ,54
+ ,44810
+ ,256
+ ,11796
+ ,9
+ ,0
+ ,98
+ ,10674
+ ,9
+ ,0
+ ,1403
+ ,142261
+ ,56
+ ,100674
+ ,41
+ ,6836
+ ,3
+ ,0
+ ,1786
+ ,154206
+ ,61
+ ,57786
+ ,42
+ ,5118
+ ,3
+ ,0
+ ,528
+ ,40248
+ ,16
+ ,5444
+ ,0
+ ,0
+ ,0
+ ,0
+ ,1072
+ ,122641
+ ,46
+ ,28470
+ ,1305
+ ,88837
+ ,38
+ ,61849
+ ,81
+ ,7131
+ ,4
+ ,0
+ ,261
+ ,9056
+ ,14
+ ,2179
+ ,934
+ ,76611
+ ,24
+ ,8019
+ ,1179
+ ,132697
+ ,50
+ ,39644
+ ,1147
+ ,100681
+ ,19
+ ,23494)
+ ,dim=c(4
+ ,144)
+ ,dimnames=list(c('page_views'
+ ,'Time_spent'
+ ,'Logins'
+ ,'Writing')
+ ,1:144))
> y <- array(NA,dim=c(4,144),dimnames=list(c('page_views','Time_spent','Logins','Writing'),1:144))
> for (i in 1:dim(x)[1])
+ {
+ for (j in 1:dim(x)[2])
+ {
+ y[i,j] <- as.numeric(x[i,j])
+ }
+ }
> par3 = 'No Linear Trend'
> par2 = 'Do not include Seasonal Dummies'
> par1 = '2'
> library(lattice)
> library(lmtest)
Loading required package: zoo
> 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
Time_spent page_views Logins Writing
1 158258 1772 89 20465
2 186930 1703 57 33629
3 7215 192 18 1423
4 129098 2294 94 25629
5 230587 3448 134 54002
6 508313 6813 261 151036
7 180745 1795 56 33287
8 185559 1680 58 31172
9 154581 1896 43 28113
10 290658 2917 95 57803
11 121844 1946 75 49830
12 184039 2148 69 52143
13 100324 1832 98 21055
14 209427 3059 114 47007
15 167592 1469 57 28735
16 154593 1565 86 59147
17 142018 1755 56 78950
18 77855 1234 59 13497
19 167047 2779 87 46154
20 27997 726 24 53249
21 73019 1048 59 10726
22 241082 2804 99 83700
23 195820 1760 72 40400
24 141899 2261 53 33797
25 145433 1848 86 36205
26 180241 1647 31 30165
27 202232 2081 160 58534
28 190230 1393 91 44663
29 354924 2741 118 92556
30 192399 2112 44 40078
31 182286 1684 44 34711
32 181590 1616 45 31076
33 133801 2227 105 74608
34 233686 3088 123 58092
35 219428 2388 52 42009
36 0 1 1 0
37 223044 2099 63 36022
38 100129 1669 51 23333
39 136733 2094 47 53349
40 249965 2153 64 92596
41 242379 2390 71 49598
42 145794 1701 59 44093
43 96404 983 32 84205
44 195891 2161 78 63369
45 117156 1276 50 60132
46 157787 1189 94 37403
47 81293 744 31 24460
48 224049 2231 100 46456
49 223789 2242 87 66616
50 160344 2638 58 41554
51 48188 658 28 22346
52 152206 1859 68 30874
53 294283 2489 73 68701
54 235223 2025 78 35728
55 195583 1911 59 29010
56 145942 1714 54 23110
57 208834 1851 66 38844
58 93764 980 23 27084
59 151985 1177 66 35139
60 190545 2809 95 57476
61 148922 1688 60 33277
62 132856 2097 80 31141
63 126107 1309 60 61281
64 112718 1243 36 25820
65 160930 1255 34 23284
66 99184 1293 40 35378
67 182022 2259 69 74990
68 138708 2897 65 29653
69 114408 1103 38 64622
70 31970 340 15 4157
71 225558 2791 112 29245
72 137011 1333 71 50008
73 113612 1441 68 52338
74 108641 1622 70 13310
75 162203 2649 66 92901
76 100098 1499 44 10956
77 174768 2302 60 34241
78 158459 2540 97 75043
79 80934 1000 30 21152
80 84971 1234 71 42249
81 80545 927 68 42005
82 287191 2176 64 41152
83 62974 956 27 14399
84 130982 1531 38 28263
85 75555 1013 45 17215
86 162154 1771 54 48140
87 226638 2613 227 62897
88 115019 1203 110 22883
89 105038 1303 60 41622
90 155537 1524 52 40715
91 153133 1829 41 65897
92 165577 2227 76 76542
93 151517 1233 57 37477
94 133686 1365 58 53216
95 58128 901 38 40911
96 245196 2319 117 57021
97 195576 1857 70 73116
98 19349 223 12 3895
99 225371 2390 105 46609
100 152796 1973 76 29351
101 59117 699 28 2325
102 91762 1062 24 31747
103 127987 1252 52 32665
104 113552 1154 58 19249
105 85338 823 40 15292
106 27676 596 22 5842
107 147984 1471 47 33994
108 122417 1130 37 13018
109 0 0 0 0
110 91529 1082 32 98177
111 107205 1134 66 37941
112 144664 1366 44 31032
113 136540 1452 62 32683
114 76656 869 59 34545
115 3616 78 5 0
116 0 0 0 0
117 183065 1127 43 27525
118 144636 1578 83 66856
119 156889 2018 97 28549
120 113273 919 38 38610
121 43410 778 19 2781
122 175774 1751 72 41211
123 95401 956 41 22698
124 118893 1875 54 41194
125 60493 731 40 32689
126 19764 285 12 5752
127 164062 1833 55 26757
128 132696 1147 32 22527
129 155367 1646 54 44810
130 11796 256 9 0
131 10674 98 9 0
132 142261 1403 56 100674
133 6836 41 3 0
134 154206 1786 61 57786
135 5118 42 3 0
136 40248 528 16 5444
137 0 0 0 0
138 122641 1072 46 28470
139 88837 1305 38 61849
140 7131 81 4 0
141 9056 261 14 2179
142 76611 934 24 8019
143 132697 1179 50 39644
144 100681 1147 19 23494
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) page_views Logins Writing
12451.384 63.804 168.300 0.401
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-81416 -19792 -4231 21005 110607
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 1.245e+04 5.910e+03 2.107 0.0369 *
page_views 6.380e+01 6.353e+00 10.044 <2e-16 ***
Logins 1.683e+02 1.368e+02 1.231 0.2206
Writing 4.010e-01 1.585e-01 2.530 0.0125 *
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 34080 on 140 degrees of freedom
Multiple R-squared: 0.8051, Adjusted R-squared: 0.8009
F-statistic: 192.7 on 3 and 140 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.7470010 5.059979e-01 2.529990e-01
[2,] 0.6772405 6.455191e-01 3.227595e-01
[3,] 0.5922460 8.155079e-01 4.077540e-01
[4,] 0.6300715 7.398570e-01 3.699285e-01
[5,] 0.8239123 3.521755e-01 1.760877e-01
[6,] 0.7602065 4.795871e-01 2.397935e-01
[7,] 0.7004888 5.990223e-01 2.995112e-01
[8,] 0.6520962 6.958076e-01 3.479038e-01
[9,] 0.6688889 6.622223e-01 3.311111e-01
[10,] 0.5896467 8.207065e-01 4.103533e-01
[11,] 0.6943234 6.113531e-01 3.056766e-01
[12,] 0.6445481 7.109038e-01 3.554519e-01
[13,] 0.7650239 4.699523e-01 2.349761e-01
[14,] 0.8596466 2.807069e-01 1.403534e-01
[15,] 0.8187048 3.625903e-01 1.812952e-01
[16,] 0.7746472 4.507056e-01 2.253528e-01
[17,] 0.8304130 3.391741e-01 1.695870e-01
[18,] 0.8521322 2.957356e-01 1.478678e-01
[19,] 0.8133696 3.732608e-01 1.866304e-01
[20,] 0.8195633 3.608734e-01 1.804367e-01
[21,] 0.8296630 3.406740e-01 1.703370e-01
[22,] 0.8888952 2.222096e-01 1.111048e-01
[23,] 0.9898397 2.032054e-02 1.016027e-02
[24,] 0.9870414 2.591722e-02 1.295861e-02
[25,] 0.9874928 2.501432e-02 1.250716e-02
[26,] 0.9891402 2.171953e-02 1.085977e-02
[27,] 0.9970151 5.969897e-03 2.984949e-03
[28,] 0.9959655 8.068964e-03 4.034482e-03
[29,] 0.9950133 9.973385e-03 4.986692e-03
[30,] 0.9934572 1.308554e-02 6.542768e-03
[31,] 0.9953704 9.259244e-03 4.629622e-03
[32,] 0.9955840 8.831952e-03 4.415976e-03
[33,] 0.9965331 6.933877e-03 3.466938e-03
[34,] 0.9970697 5.860646e-03 2.930323e-03
[35,] 0.9975736 4.852729e-03 2.426365e-03
[36,] 0.9964485 7.102977e-03 3.551489e-03
[37,] 0.9964586 7.082737e-03 3.541369e-03
[38,] 0.9948600 1.027992e-02 5.139959e-03
[39,] 0.9930564 1.388726e-02 6.943630e-03
[40,] 0.9937053 1.258943e-02 6.294717e-03
[41,] 0.9911441 1.771185e-02 8.855926e-03
[42,] 0.9908808 1.823846e-02 9.119232e-03
[43,] 0.9892284 2.154322e-02 1.077161e-02
[44,] 0.9919874 1.602519e-02 8.012595e-03
[45,] 0.9902377 1.952453e-02 9.762267e-03
[46,] 0.9865164 2.696710e-02 1.348355e-02
[47,] 0.9971833 5.633328e-03 2.816664e-03
[48,] 0.9990318 1.936349e-03 9.681746e-04
[49,] 0.9991589 1.682154e-03 8.410772e-04
[50,] 0.9987421 2.515751e-03 1.257875e-03
[51,] 0.9992719 1.456255e-03 7.281273e-04
[52,] 0.9989207 2.158627e-03 1.079313e-03
[53,] 0.9990400 1.920066e-03 9.600330e-04
[54,] 0.9991575 1.684919e-03 8.424594e-04
[55,] 0.9987467 2.506616e-03 1.253308e-03
[56,] 0.9989200 2.159907e-03 1.079954e-03
[57,] 0.9984675 3.064915e-03 1.532457e-03
[58,] 0.9977657 4.468584e-03 2.234292e-03
[59,] 0.9987903 2.419326e-03 1.209663e-03
[60,] 0.9984020 3.195911e-03 1.597956e-03
[61,] 0.9978809 4.238199e-03 2.119099e-03
[62,] 0.9998226 3.548782e-04 1.774391e-04
[63,] 0.9997488 5.023724e-04 2.511862e-04
[64,] 0.9996164 7.672279e-04 3.836139e-04
[65,] 0.9994562 1.087635e-03 5.438174e-04
[66,] 0.9992231 1.553871e-03 7.769356e-04
[67,] 0.9990343 1.931329e-03 9.656645e-04
[68,] 0.9990185 1.962937e-03 9.814684e-04
[69,] 0.9998272 3.456546e-04 1.728273e-04
[70,] 0.9998197 3.605102e-04 1.802551e-04
[71,] 0.9998056 3.887516e-04 1.943758e-04
[72,] 0.9999828 3.433905e-05 1.716953e-05
[73,] 0.9999727 5.451201e-05 2.725601e-05
[74,] 0.9999750 5.009285e-05 2.504643e-05
[75,] 0.9999612 7.757379e-05 3.878690e-05
[76,] 0.9999998 3.052862e-07 1.526431e-07
[77,] 0.9999998 3.856112e-07 1.928056e-07
[78,] 0.9999996 7.449107e-07 3.724554e-07
[79,] 0.9999994 1.128179e-06 5.640894e-07
[80,] 0.9999989 2.184762e-06 1.092381e-06
[81,] 0.9999990 1.923852e-06 9.619261e-07
[82,] 0.9999986 2.886473e-06 1.443237e-06
[83,] 0.9999980 3.926886e-06 1.963443e-06
[84,] 0.9999971 5.806065e-06 2.903032e-06
[85,] 0.9999946 1.070320e-05 5.351598e-06
[86,] 0.9999970 6.053619e-06 3.026810e-06
[87,] 0.9999977 4.685189e-06 2.342594e-06
[88,] 0.9999955 9.030277e-06 4.515138e-06
[89,] 0.9999961 7.867000e-06 3.933500e-06
[90,] 0.9999956 8.767816e-06 4.383908e-06
[91,] 0.9999943 1.137240e-05 5.686198e-06
[92,] 0.9999894 2.128742e-05 1.064371e-05
[93,] 0.9999813 3.730563e-05 1.865282e-05
[94,] 0.9999798 4.045295e-05 2.022648e-05
[95,] 0.9999628 7.441683e-05 3.720842e-05
[96,] 0.9999319 1.362860e-04 6.814302e-05
[97,] 0.9998862 2.276710e-04 1.138355e-04
[98,] 0.9997984 4.031321e-04 2.015660e-04
[99,] 0.9996566 6.867657e-04 3.433829e-04
[100,] 0.9996498 7.003041e-04 3.501520e-04
[101,] 0.9994737 1.052582e-03 5.262908e-04
[102,] 0.9993335 1.333004e-03 6.665022e-04
[103,] 0.9988745 2.251074e-03 1.125537e-03
[104,] 0.9984954 3.009267e-03 1.504634e-03
[105,] 0.9974966 5.006796e-03 2.503398e-03
[106,] 0.9969495 6.101051e-03 3.050525e-03
[107,] 0.9950268 9.946308e-03 4.973154e-03
[108,] 0.9928368 1.432638e-02 7.163190e-03
[109,] 0.9889835 2.203297e-02 1.101649e-02
[110,] 0.9830587 3.388257e-02 1.694129e-02
[111,] 0.9997695 4.610258e-04 2.305129e-04
[112,] 0.9995903 8.194085e-04 4.097042e-04
[113,] 0.9998421 3.157803e-04 1.578902e-04
[114,] 0.9998399 3.202463e-04 1.601232e-04
[115,] 0.9997765 4.469174e-04 2.234587e-04
[116,] 0.9995343 9.314003e-04 4.657001e-04
[117,] 0.9990120 1.976026e-03 9.880128e-04
[118,] 0.9999280 1.439992e-04 7.199958e-05
[119,] 0.9999060 1.880226e-04 9.401128e-05
[120,] 0.9997753 4.494360e-04 2.247180e-04
[121,] 0.9995124 9.752191e-04 4.876096e-04
[122,] 0.9998646 2.707212e-04 1.353606e-04
[123,] 0.9996106 7.788883e-04 3.894441e-04
[124,] 0.9991317 1.736657e-03 8.683287e-04
[125,] 0.9976273 4.745490e-03 2.372745e-03
[126,] 0.9970628 5.874479e-03 2.937240e-03
[127,] 0.9924799 1.504012e-02 7.520060e-03
[128,] 0.9857012 2.859754e-02 1.429877e-02
[129,] 0.9666042 6.679157e-02 3.339578e-02
[130,] 0.9251173 1.497653e-01 7.488267e-02
[131,] 0.8640752 2.718496e-01 1.359248e-01
> postscript(file="/var/wessaorg/rcomp/tmp/10gyp1344776219.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> plot(x[,1], type='l', main='Actuals and Interpolation', ylab='value of Actuals and Interpolation (dots)', xlab='time or index')
> points(x[,1]-mysum$resid)
> grid()
> dev.off()
null device
1
> postscript(file="/var/wessaorg/rcomp/tmp/2wizl1344776219.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/3j3yv1344776219.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/472jt1344776219.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/5ivuw1344776219.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> qqnorm(mysum$resid, main='Residual Normal Q-Q Plot')
> qqline(mysum$resid)
> grid()
> dev.off()
null device
1
> (myerror <- as.ts(mysum$resid))
Time Series:
Start = 1
End = 144
Frequency = 1
1 2 3 4 5 6
9559.2893 42740.2222 -21086.9097 -55819.0696 -46070.8890 -43334.7014
7 8 9 10 11 12
30990.6637 43653.7589 2645.2483 52919.6651 -47376.7720 2011.9398
13 14 15 16 17 18
-53954.2875 -36239.7361 40295.1153 4094.0224 -23496.4491 -28673.5196
19 20 21 22 23 24
-55868.3046 -56170.1442 -20530.6305 -505.1371 42753.4844 -37287.8452
25 26 27 28 29 30
-13922.1828 45389.2452 6601.5473 55672.4283 110607.3112 21714.8434
31 32 33 34 35 36
41062.4915 45994.6441 -68334.5816 -19791.1976 29013.0183 -12683.4883
37 38 39 40 41 42
51618.1842 -36752.6076 -38629.6623 52237.4989 45595.2827 -2801.1602
43 44 45 46 47 48
-17921.6175 7017.8043 -9239.7012 38652.1272 6344.5650 33789.5333
49 50 51 52 53 54
26930.7936 -46849.4301 -19920.5704 -2683.7340 83185.1395 66112.1180
55 56 57 58 59 60
39637.6560 5773.7212 51595.0824 4051.8041 39236.1160 -40171.3150
61 62 63 64 65 66
5325.5523 -39345.8733 -4538.0338 4544.2319 53344.1937 -16686.2486
67 68 69 70 71 72
-16249.7182 -81416.2145 -730.5583 -6366.4908 4450.5795 7504.1845
73 74 75 76 77 78
-23215.2011 -24419.9612 -67630.4328 -19795.1834 -8390.9864 -62475.4292
79 80 81 82 83 84
-8853.4678 -35107.5712 -19342.8473 108626.6495 -20793.0068 3116.2252
85 86 87 88 89 90
-16007.5659 8311.0533 -15962.2310 -1878.9612 -17340.3329 20768.0147
91 92 93 94 95 96
-9343.8183 -32453.4758 35772.1547 3038.8332 -34613.2025 42223.7443
97 98 99 100 101 102
23536.9113 -10912.3976 24063.7648 -10103.0730 -3578.5063 -5220.4713
103 104 105 106 107 108
13801.1324 9989.4061 7510.9666 -28848.2729 20133.4829 26418.8395
109 110 111 112 113 114
-12451.3838 -34716.4692 -3923.9814 25205.7070 7903.0197 -15024.7946
115 116 117 118 119 120
-14653.6325 -12451.3838 80430.6920 -9279.0859 -12093.9473 20306.0900
121 122 123 124 125 126
-22994.2296 22956.4883 5949.6344 -38800.0482 -18440.7634 -15197.9898
127 128 129 130 131 132
14670.1282 32641.2571 10835.0462 -18504.0282 -9544.9220 -9506.2794
133 134 135 136 137 138
-8736.2671 -5640.4616 -10518.0716 -10768.1584 -12451.3838 22632.0633
139 140 141 142 143 144
-38078.0014 -11161.7459 -23278.3978 -2688.8288 20706.6613 2426.3600
> postscript(file="/var/wessaorg/rcomp/tmp/6wdm81344776219.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> dum <- cbind(lag(myerror,k=1),myerror)
> dum
Time Series:
Start = 0
End = 144
Frequency = 1
lag(myerror, k = 1) myerror
0 9559.2893 NA
1 42740.2222 9559.2893
2 -21086.9097 42740.2222
3 -55819.0696 -21086.9097
4 -46070.8890 -55819.0696
5 -43334.7014 -46070.8890
6 30990.6637 -43334.7014
7 43653.7589 30990.6637
8 2645.2483 43653.7589
9 52919.6651 2645.2483
10 -47376.7720 52919.6651
11 2011.9398 -47376.7720
12 -53954.2875 2011.9398
13 -36239.7361 -53954.2875
14 40295.1153 -36239.7361
15 4094.0224 40295.1153
16 -23496.4491 4094.0224
17 -28673.5196 -23496.4491
18 -55868.3046 -28673.5196
19 -56170.1442 -55868.3046
20 -20530.6305 -56170.1442
21 -505.1371 -20530.6305
22 42753.4844 -505.1371
23 -37287.8452 42753.4844
24 -13922.1828 -37287.8452
25 45389.2452 -13922.1828
26 6601.5473 45389.2452
27 55672.4283 6601.5473
28 110607.3112 55672.4283
29 21714.8434 110607.3112
30 41062.4915 21714.8434
31 45994.6441 41062.4915
32 -68334.5816 45994.6441
33 -19791.1976 -68334.5816
34 29013.0183 -19791.1976
35 -12683.4883 29013.0183
36 51618.1842 -12683.4883
37 -36752.6076 51618.1842
38 -38629.6623 -36752.6076
39 52237.4989 -38629.6623
40 45595.2827 52237.4989
41 -2801.1602 45595.2827
42 -17921.6175 -2801.1602
43 7017.8043 -17921.6175
44 -9239.7012 7017.8043
45 38652.1272 -9239.7012
46 6344.5650 38652.1272
47 33789.5333 6344.5650
48 26930.7936 33789.5333
49 -46849.4301 26930.7936
50 -19920.5704 -46849.4301
51 -2683.7340 -19920.5704
52 83185.1395 -2683.7340
53 66112.1180 83185.1395
54 39637.6560 66112.1180
55 5773.7212 39637.6560
56 51595.0824 5773.7212
57 4051.8041 51595.0824
58 39236.1160 4051.8041
59 -40171.3150 39236.1160
60 5325.5523 -40171.3150
61 -39345.8733 5325.5523
62 -4538.0338 -39345.8733
63 4544.2319 -4538.0338
64 53344.1937 4544.2319
65 -16686.2486 53344.1937
66 -16249.7182 -16686.2486
67 -81416.2145 -16249.7182
68 -730.5583 -81416.2145
69 -6366.4908 -730.5583
70 4450.5795 -6366.4908
71 7504.1845 4450.5795
72 -23215.2011 7504.1845
73 -24419.9612 -23215.2011
74 -67630.4328 -24419.9612
75 -19795.1834 -67630.4328
76 -8390.9864 -19795.1834
77 -62475.4292 -8390.9864
78 -8853.4678 -62475.4292
79 -35107.5712 -8853.4678
80 -19342.8473 -35107.5712
81 108626.6495 -19342.8473
82 -20793.0068 108626.6495
83 3116.2252 -20793.0068
84 -16007.5659 3116.2252
85 8311.0533 -16007.5659
86 -15962.2310 8311.0533
87 -1878.9612 -15962.2310
88 -17340.3329 -1878.9612
89 20768.0147 -17340.3329
90 -9343.8183 20768.0147
91 -32453.4758 -9343.8183
92 35772.1547 -32453.4758
93 3038.8332 35772.1547
94 -34613.2025 3038.8332
95 42223.7443 -34613.2025
96 23536.9113 42223.7443
97 -10912.3976 23536.9113
98 24063.7648 -10912.3976
99 -10103.0730 24063.7648
100 -3578.5063 -10103.0730
101 -5220.4713 -3578.5063
102 13801.1324 -5220.4713
103 9989.4061 13801.1324
104 7510.9666 9989.4061
105 -28848.2729 7510.9666
106 20133.4829 -28848.2729
107 26418.8395 20133.4829
108 -12451.3838 26418.8395
109 -34716.4692 -12451.3838
110 -3923.9814 -34716.4692
111 25205.7070 -3923.9814
112 7903.0197 25205.7070
113 -15024.7946 7903.0197
114 -14653.6325 -15024.7946
115 -12451.3838 -14653.6325
116 80430.6920 -12451.3838
117 -9279.0859 80430.6920
118 -12093.9473 -9279.0859
119 20306.0900 -12093.9473
120 -22994.2296 20306.0900
121 22956.4883 -22994.2296
122 5949.6344 22956.4883
123 -38800.0482 5949.6344
124 -18440.7634 -38800.0482
125 -15197.9898 -18440.7634
126 14670.1282 -15197.9898
127 32641.2571 14670.1282
128 10835.0462 32641.2571
129 -18504.0282 10835.0462
130 -9544.9220 -18504.0282
131 -9506.2794 -9544.9220
132 -8736.2671 -9506.2794
133 -5640.4616 -8736.2671
134 -10518.0716 -5640.4616
135 -10768.1584 -10518.0716
136 -12451.3838 -10768.1584
137 22632.0633 -12451.3838
138 -38078.0014 22632.0633
139 -11161.7459 -38078.0014
140 -23278.3978 -11161.7459
141 -2688.8288 -23278.3978
142 20706.6613 -2688.8288
143 2426.3600 20706.6613
144 NA 2426.3600
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 42740.2222 9559.2893
[2,] -21086.9097 42740.2222
[3,] -55819.0696 -21086.9097
[4,] -46070.8890 -55819.0696
[5,] -43334.7014 -46070.8890
[6,] 30990.6637 -43334.7014
[7,] 43653.7589 30990.6637
[8,] 2645.2483 43653.7589
[9,] 52919.6651 2645.2483
[10,] -47376.7720 52919.6651
[11,] 2011.9398 -47376.7720
[12,] -53954.2875 2011.9398
[13,] -36239.7361 -53954.2875
[14,] 40295.1153 -36239.7361
[15,] 4094.0224 40295.1153
[16,] -23496.4491 4094.0224
[17,] -28673.5196 -23496.4491
[18,] -55868.3046 -28673.5196
[19,] -56170.1442 -55868.3046
[20,] -20530.6305 -56170.1442
[21,] -505.1371 -20530.6305
[22,] 42753.4844 -505.1371
[23,] -37287.8452 42753.4844
[24,] -13922.1828 -37287.8452
[25,] 45389.2452 -13922.1828
[26,] 6601.5473 45389.2452
[27,] 55672.4283 6601.5473
[28,] 110607.3112 55672.4283
[29,] 21714.8434 110607.3112
[30,] 41062.4915 21714.8434
[31,] 45994.6441 41062.4915
[32,] -68334.5816 45994.6441
[33,] -19791.1976 -68334.5816
[34,] 29013.0183 -19791.1976
[35,] -12683.4883 29013.0183
[36,] 51618.1842 -12683.4883
[37,] -36752.6076 51618.1842
[38,] -38629.6623 -36752.6076
[39,] 52237.4989 -38629.6623
[40,] 45595.2827 52237.4989
[41,] -2801.1602 45595.2827
[42,] -17921.6175 -2801.1602
[43,] 7017.8043 -17921.6175
[44,] -9239.7012 7017.8043
[45,] 38652.1272 -9239.7012
[46,] 6344.5650 38652.1272
[47,] 33789.5333 6344.5650
[48,] 26930.7936 33789.5333
[49,] -46849.4301 26930.7936
[50,] -19920.5704 -46849.4301
[51,] -2683.7340 -19920.5704
[52,] 83185.1395 -2683.7340
[53,] 66112.1180 83185.1395
[54,] 39637.6560 66112.1180
[55,] 5773.7212 39637.6560
[56,] 51595.0824 5773.7212
[57,] 4051.8041 51595.0824
[58,] 39236.1160 4051.8041
[59,] -40171.3150 39236.1160
[60,] 5325.5523 -40171.3150
[61,] -39345.8733 5325.5523
[62,] -4538.0338 -39345.8733
[63,] 4544.2319 -4538.0338
[64,] 53344.1937 4544.2319
[65,] -16686.2486 53344.1937
[66,] -16249.7182 -16686.2486
[67,] -81416.2145 -16249.7182
[68,] -730.5583 -81416.2145
[69,] -6366.4908 -730.5583
[70,] 4450.5795 -6366.4908
[71,] 7504.1845 4450.5795
[72,] -23215.2011 7504.1845
[73,] -24419.9612 -23215.2011
[74,] -67630.4328 -24419.9612
[75,] -19795.1834 -67630.4328
[76,] -8390.9864 -19795.1834
[77,] -62475.4292 -8390.9864
[78,] -8853.4678 -62475.4292
[79,] -35107.5712 -8853.4678
[80,] -19342.8473 -35107.5712
[81,] 108626.6495 -19342.8473
[82,] -20793.0068 108626.6495
[83,] 3116.2252 -20793.0068
[84,] -16007.5659 3116.2252
[85,] 8311.0533 -16007.5659
[86,] -15962.2310 8311.0533
[87,] -1878.9612 -15962.2310
[88,] -17340.3329 -1878.9612
[89,] 20768.0147 -17340.3329
[90,] -9343.8183 20768.0147
[91,] -32453.4758 -9343.8183
[92,] 35772.1547 -32453.4758
[93,] 3038.8332 35772.1547
[94,] -34613.2025 3038.8332
[95,] 42223.7443 -34613.2025
[96,] 23536.9113 42223.7443
[97,] -10912.3976 23536.9113
[98,] 24063.7648 -10912.3976
[99,] -10103.0730 24063.7648
[100,] -3578.5063 -10103.0730
[101,] -5220.4713 -3578.5063
[102,] 13801.1324 -5220.4713
[103,] 9989.4061 13801.1324
[104,] 7510.9666 9989.4061
[105,] -28848.2729 7510.9666
[106,] 20133.4829 -28848.2729
[107,] 26418.8395 20133.4829
[108,] -12451.3838 26418.8395
[109,] -34716.4692 -12451.3838
[110,] -3923.9814 -34716.4692
[111,] 25205.7070 -3923.9814
[112,] 7903.0197 25205.7070
[113,] -15024.7946 7903.0197
[114,] -14653.6325 -15024.7946
[115,] -12451.3838 -14653.6325
[116,] 80430.6920 -12451.3838
[117,] -9279.0859 80430.6920
[118,] -12093.9473 -9279.0859
[119,] 20306.0900 -12093.9473
[120,] -22994.2296 20306.0900
[121,] 22956.4883 -22994.2296
[122,] 5949.6344 22956.4883
[123,] -38800.0482 5949.6344
[124,] -18440.7634 -38800.0482
[125,] -15197.9898 -18440.7634
[126,] 14670.1282 -15197.9898
[127,] 32641.2571 14670.1282
[128,] 10835.0462 32641.2571
[129,] -18504.0282 10835.0462
[130,] -9544.9220 -18504.0282
[131,] -9506.2794 -9544.9220
[132,] -8736.2671 -9506.2794
[133,] -5640.4616 -8736.2671
[134,] -10518.0716 -5640.4616
[135,] -10768.1584 -10518.0716
[136,] -12451.3838 -10768.1584
[137,] 22632.0633 -12451.3838
[138,] -38078.0014 22632.0633
[139,] -11161.7459 -38078.0014
[140,] -23278.3978 -11161.7459
[141,] -2688.8288 -23278.3978
[142,] 20706.6613 -2688.8288
[143,] 2426.3600 20706.6613
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 42740.2222 9559.2893
2 -21086.9097 42740.2222
3 -55819.0696 -21086.9097
4 -46070.8890 -55819.0696
5 -43334.7014 -46070.8890
6 30990.6637 -43334.7014
7 43653.7589 30990.6637
8 2645.2483 43653.7589
9 52919.6651 2645.2483
10 -47376.7720 52919.6651
11 2011.9398 -47376.7720
12 -53954.2875 2011.9398
13 -36239.7361 -53954.2875
14 40295.1153 -36239.7361
15 4094.0224 40295.1153
16 -23496.4491 4094.0224
17 -28673.5196 -23496.4491
18 -55868.3046 -28673.5196
19 -56170.1442 -55868.3046
20 -20530.6305 -56170.1442
21 -505.1371 -20530.6305
22 42753.4844 -505.1371
23 -37287.8452 42753.4844
24 -13922.1828 -37287.8452
25 45389.2452 -13922.1828
26 6601.5473 45389.2452
27 55672.4283 6601.5473
28 110607.3112 55672.4283
29 21714.8434 110607.3112
30 41062.4915 21714.8434
31 45994.6441 41062.4915
32 -68334.5816 45994.6441
33 -19791.1976 -68334.5816
34 29013.0183 -19791.1976
35 -12683.4883 29013.0183
36 51618.1842 -12683.4883
37 -36752.6076 51618.1842
38 -38629.6623 -36752.6076
39 52237.4989 -38629.6623
40 45595.2827 52237.4989
41 -2801.1602 45595.2827
42 -17921.6175 -2801.1602
43 7017.8043 -17921.6175
44 -9239.7012 7017.8043
45 38652.1272 -9239.7012
46 6344.5650 38652.1272
47 33789.5333 6344.5650
48 26930.7936 33789.5333
49 -46849.4301 26930.7936
50 -19920.5704 -46849.4301
51 -2683.7340 -19920.5704
52 83185.1395 -2683.7340
53 66112.1180 83185.1395
54 39637.6560 66112.1180
55 5773.7212 39637.6560
56 51595.0824 5773.7212
57 4051.8041 51595.0824
58 39236.1160 4051.8041
59 -40171.3150 39236.1160
60 5325.5523 -40171.3150
61 -39345.8733 5325.5523
62 -4538.0338 -39345.8733
63 4544.2319 -4538.0338
64 53344.1937 4544.2319
65 -16686.2486 53344.1937
66 -16249.7182 -16686.2486
67 -81416.2145 -16249.7182
68 -730.5583 -81416.2145
69 -6366.4908 -730.5583
70 4450.5795 -6366.4908
71 7504.1845 4450.5795
72 -23215.2011 7504.1845
73 -24419.9612 -23215.2011
74 -67630.4328 -24419.9612
75 -19795.1834 -67630.4328
76 -8390.9864 -19795.1834
77 -62475.4292 -8390.9864
78 -8853.4678 -62475.4292
79 -35107.5712 -8853.4678
80 -19342.8473 -35107.5712
81 108626.6495 -19342.8473
82 -20793.0068 108626.6495
83 3116.2252 -20793.0068
84 -16007.5659 3116.2252
85 8311.0533 -16007.5659
86 -15962.2310 8311.0533
87 -1878.9612 -15962.2310
88 -17340.3329 -1878.9612
89 20768.0147 -17340.3329
90 -9343.8183 20768.0147
91 -32453.4758 -9343.8183
92 35772.1547 -32453.4758
93 3038.8332 35772.1547
94 -34613.2025 3038.8332
95 42223.7443 -34613.2025
96 23536.9113 42223.7443
97 -10912.3976 23536.9113
98 24063.7648 -10912.3976
99 -10103.0730 24063.7648
100 -3578.5063 -10103.0730
101 -5220.4713 -3578.5063
102 13801.1324 -5220.4713
103 9989.4061 13801.1324
104 7510.9666 9989.4061
105 -28848.2729 7510.9666
106 20133.4829 -28848.2729
107 26418.8395 20133.4829
108 -12451.3838 26418.8395
109 -34716.4692 -12451.3838
110 -3923.9814 -34716.4692
111 25205.7070 -3923.9814
112 7903.0197 25205.7070
113 -15024.7946 7903.0197
114 -14653.6325 -15024.7946
115 -12451.3838 -14653.6325
116 80430.6920 -12451.3838
117 -9279.0859 80430.6920
118 -12093.9473 -9279.0859
119 20306.0900 -12093.9473
120 -22994.2296 20306.0900
121 22956.4883 -22994.2296
122 5949.6344 22956.4883
123 -38800.0482 5949.6344
124 -18440.7634 -38800.0482
125 -15197.9898 -18440.7634
126 14670.1282 -15197.9898
127 32641.2571 14670.1282
128 10835.0462 32641.2571
129 -18504.0282 10835.0462
130 -9544.9220 -18504.0282
131 -9506.2794 -9544.9220
132 -8736.2671 -9506.2794
133 -5640.4616 -8736.2671
134 -10518.0716 -5640.4616
135 -10768.1584 -10518.0716
136 -12451.3838 -10768.1584
137 22632.0633 -12451.3838
138 -38078.0014 22632.0633
139 -11161.7459 -38078.0014
140 -23278.3978 -11161.7459
141 -2688.8288 -23278.3978
142 20706.6613 -2688.8288
143 2426.3600 20706.6613
> 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/7mmje1344776219.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/87h481344776219.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/9x3xt1344776219.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/10lwe41344776219.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
+ plot(kp3:nmkm3,gqarr[,2], main='Goldfeld-Quandt test',ylab='2-sided p-value',xlab='breakpoint')
+ grid()
+ dev.off()
+ }
null device
1
>
> #Note: the /var/wessaorg/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab
> load(file="/var/wessaorg/rcomp/createtable")
>
> a<-table.start()
> a<-table.row.start(a)
> a<-table.element(a, 'Multiple Linear Regression - Estimated Regression Equation', 1, TRUE)
> a<-table.row.end(a)
> myeq <- colnames(x)[1]
> myeq <- paste(myeq, '[t] = ', sep='')
> for (i in 1:k){
+ if (mysum$coefficients[i,1] > 0) myeq <- paste(myeq, '+', '')
+ myeq <- paste(myeq, mysum$coefficients[i,1], sep=' ')
+ if (rownames(mysum$coefficients)[i] != '(Intercept)') {
+ myeq <- paste(myeq, rownames(mysum$coefficients)[i], sep='')
+ if (rownames(mysum$coefficients)[i] != 't') myeq <- paste(myeq, '[t]', sep='')
+ }
+ }
> myeq <- paste(myeq, ' + e[t]')
> a<-table.row.start(a)
> a<-table.element(a, myeq)
> a<-table.row.end(a)
> a<-table.end(a)
> table.save(a,file="/var/wessaorg/rcomp/tmp/11zd071344776219.tab")
> a<-table.start()
> a<-table.row.start(a)
> a<-table.element(a,hyperlink('http://www.xycoon.com/ols1.htm','Multiple Linear Regression - Ordinary Least Squares',''), 6, TRUE)
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a,'Variable',header=TRUE)
> a<-table.element(a,'Parameter',header=TRUE)
> a<-table.element(a,'S.D.',header=TRUE)
> a<-table.element(a,'T-STAT
H0: parameter = 0',header=TRUE)
> a<-table.element(a,'2-tail p-value',header=TRUE)
> a<-table.element(a,'1-tail p-value',header=TRUE)
> a<-table.row.end(a)
> for (i in 1:k){
+ a<-table.row.start(a)
+ a<-table.element(a,rownames(mysum$coefficients)[i],header=TRUE)
+ a<-table.element(a,mysum$coefficients[i,1])
+ a<-table.element(a, round(mysum$coefficients[i,2],6))
+ a<-table.element(a, round(mysum$coefficients[i,3],4))
+ a<-table.element(a, round(mysum$coefficients[i,4],6))
+ a<-table.element(a, round(mysum$coefficients[i,4]/2,6))
+ a<-table.row.end(a)
+ }
> a<-table.end(a)
> table.save(a,file="/var/wessaorg/rcomp/tmp/12fj0y1344776219.tab")
> a<-table.start()
> a<-table.row.start(a)
> a<-table.element(a, 'Multiple Linear Regression - Regression Statistics', 2, TRUE)
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a, 'Multiple R',1,TRUE)
> a<-table.element(a, sqrt(mysum$r.squared))
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a, 'R-squared',1,TRUE)
> a<-table.element(a, mysum$r.squared)
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a, 'Adjusted R-squared',1,TRUE)
> a<-table.element(a, mysum$adj.r.squared)
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a, 'F-TEST (value)',1,TRUE)
> a<-table.element(a, mysum$fstatistic[1])
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a, 'F-TEST (DF numerator)',1,TRUE)
> a<-table.element(a, mysum$fstatistic[2])
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a, 'F-TEST (DF denominator)',1,TRUE)
> a<-table.element(a, mysum$fstatistic[3])
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a, 'p-value',1,TRUE)
> a<-table.element(a, 1-pf(mysum$fstatistic[1],mysum$fstatistic[2],mysum$fstatistic[3]))
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a, 'Multiple Linear Regression - Residual Statistics', 2, TRUE)
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a, 'Residual Standard Deviation',1,TRUE)
> a<-table.element(a, mysum$sigma)
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a, 'Sum Squared Residuals',1,TRUE)
> a<-table.element(a, sum(myerror*myerror))
> a<-table.row.end(a)
> a<-table.end(a)
> table.save(a,file="/var/wessaorg/rcomp/tmp/13evub1344776219.tab")
> a<-table.start()
> a<-table.row.start(a)
> a<-table.element(a, 'Multiple Linear Regression - Actuals, Interpolation, and Residuals', 4, TRUE)
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a, 'Time or Index', 1, TRUE)
> a<-table.element(a, 'Actuals', 1, TRUE)
> a<-table.element(a, 'Interpolation
Forecast', 1, TRUE)
> a<-table.element(a, 'Residuals
Prediction Error', 1, TRUE)
> a<-table.row.end(a)
> for (i in 1:n) {
+ a<-table.row.start(a)
+ a<-table.element(a,i, 1, TRUE)
+ a<-table.element(a,x[i])
+ a<-table.element(a,x[i]-mysum$resid[i])
+ a<-table.element(a,mysum$resid[i])
+ a<-table.row.end(a)
+ }
> a<-table.end(a)
> table.save(a,file="/var/wessaorg/rcomp/tmp/149hkw1344776219.tab")
> if (n > n25) {
+ a<-table.start()
+ a<-table.row.start(a)
+ a<-table.element(a,'Goldfeld-Quandt test for Heteroskedasticity',4,TRUE)
+ a<-table.row.end(a)
+ a<-table.row.start(a)
+ a<-table.element(a,'p-values',header=TRUE)
+ a<-table.element(a,'Alternative Hypothesis',3,header=TRUE)
+ a<-table.row.end(a)
+ a<-table.row.start(a)
+ a<-table.element(a,'breakpoint index',header=TRUE)
+ a<-table.element(a,'greater',header=TRUE)
+ a<-table.element(a,'2-sided',header=TRUE)
+ a<-table.element(a,'less',header=TRUE)
+ a<-table.row.end(a)
+ for (mypoint in kp3:nmkm3) {
+ a<-table.row.start(a)
+ a<-table.element(a,mypoint,header=TRUE)
+ a<-table.element(a,gqarr[mypoint-kp3+1,1])
+ a<-table.element(a,gqarr[mypoint-kp3+1,2])
+ a<-table.element(a,gqarr[mypoint-kp3+1,3])
+ a<-table.row.end(a)
+ }
+ a<-table.end(a)
+ table.save(a,file="/var/wessaorg/rcomp/tmp/1534ab1344776219.tab")
+ a<-table.start()
+ a<-table.row.start(a)
+ a<-table.element(a,'Meta Analysis of Goldfeld-Quandt test for Heteroskedasticity',4,TRUE)
+ a<-table.row.end(a)
+ a<-table.row.start(a)
+ a<-table.element(a,'Description',header=TRUE)
+ a<-table.element(a,'# significant tests',header=TRUE)
+ a<-table.element(a,'% significant tests',header=TRUE)
+ a<-table.element(a,'OK/NOK',header=TRUE)
+ a<-table.row.end(a)
+ a<-table.row.start(a)
+ a<-table.element(a,'1% type I error level',header=TRUE)
+ a<-table.element(a,numsignificant1)
+ a<-table.element(a,numsignificant1/numgqtests)
+ if (numsignificant1/numgqtests < 0.01) dum <- 'OK' else dum <- 'NOK'
+ a<-table.element(a,dum)
+ a<-table.row.end(a)
+ a<-table.row.start(a)
+ a<-table.element(a,'5% type I error level',header=TRUE)
+ a<-table.element(a,numsignificant5)
+ a<-table.element(a,numsignificant5/numgqtests)
+ if (numsignificant5/numgqtests < 0.05) dum <- 'OK' else dum <- 'NOK'
+ a<-table.element(a,dum)
+ a<-table.row.end(a)
+ a<-table.row.start(a)
+ a<-table.element(a,'10% type I error level',header=TRUE)
+ a<-table.element(a,numsignificant10)
+ a<-table.element(a,numsignificant10/numgqtests)
+ if (numsignificant10/numgqtests < 0.1) dum <- 'OK' else dum <- 'NOK'
+ a<-table.element(a,dum)
+ a<-table.row.end(a)
+ a<-table.end(a)
+ table.save(a,file="/var/wessaorg/rcomp/tmp/16lfjj1344776219.tab")
+ }
>
> try(system("convert tmp/10gyp1344776219.ps tmp/10gyp1344776219.png",intern=TRUE))
character(0)
> try(system("convert tmp/2wizl1344776219.ps tmp/2wizl1344776219.png",intern=TRUE))
character(0)
> try(system("convert tmp/3j3yv1344776219.ps tmp/3j3yv1344776219.png",intern=TRUE))
character(0)
> try(system("convert tmp/472jt1344776219.ps tmp/472jt1344776219.png",intern=TRUE))
character(0)
> try(system("convert tmp/5ivuw1344776219.ps tmp/5ivuw1344776219.png",intern=TRUE))
character(0)
> try(system("convert tmp/6wdm81344776219.ps tmp/6wdm81344776219.png",intern=TRUE))
character(0)
> try(system("convert tmp/7mmje1344776219.ps tmp/7mmje1344776219.png",intern=TRUE))
character(0)
> try(system("convert tmp/87h481344776219.ps tmp/87h481344776219.png",intern=TRUE))
character(0)
> try(system("convert tmp/9x3xt1344776219.ps tmp/9x3xt1344776219.png",intern=TRUE))
character(0)
> try(system("convert tmp/10lwe41344776219.ps tmp/10lwe41344776219.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
6.232 0.789 7.043