R version 2.12.0 (2010-10-15)
Copyright (C) 2010 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(11
+ ,7
+ ,3
+ ,7
+ ,6
+ ,11
+ ,7
+ ,0
+ ,7
+ ,7
+ ,11
+ ,6
+ ,0
+ ,8
+ ,8
+ ,11
+ ,6
+ ,6
+ ,9
+ ,8
+ ,11
+ ,8
+ ,5
+ ,5
+ ,9
+ ,11
+ ,8
+ ,0
+ ,7
+ ,8
+ ,11
+ ,8
+ ,8
+ ,8
+ ,8
+ ,11
+ ,5
+ ,0
+ ,7
+ ,7
+ ,11
+ ,4
+ ,0
+ ,8
+ ,7
+ ,11
+ ,9
+ ,9
+ ,8
+ ,4
+ ,11
+ ,6
+ ,6
+ ,6
+ ,6
+ ,11
+ ,6
+ ,6
+ ,4
+ ,7
+ ,11
+ ,5
+ ,5
+ ,8
+ ,5
+ ,11
+ ,6
+ ,4
+ ,8
+ ,8
+ ,11
+ ,2
+ ,0
+ ,7
+ ,5
+ ,11
+ ,4
+ ,0
+ ,9
+ ,4
+ ,11
+ ,2
+ ,2
+ ,2
+ ,9
+ ,11
+ ,6
+ ,6
+ ,8
+ ,8
+ ,11
+ ,7
+ ,0
+ ,8
+ ,4
+ ,11
+ ,8
+ ,4
+ ,4
+ ,6
+ ,11
+ ,5
+ ,5
+ ,5
+ ,6
+ ,11
+ ,7
+ ,7
+ ,7
+ ,7
+ ,11
+ ,5
+ ,5
+ ,8
+ ,3
+ ,11
+ ,4
+ ,4
+ ,4
+ ,4
+ ,11
+ ,6
+ ,6
+ ,6
+ ,6
+ ,11
+ ,6
+ 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)[2])
+ {
+ y[i,j] <- as.numeric(x[i,j])
+ }
+ }
> par3 = '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
Schoolprestaties Maand Relation Friends Job t
1 7 11 3 7 6 1
2 7 11 0 7 7 2
3 6 11 0 8 8 3
4 6 11 6 9 8 4
5 8 11 5 5 9 5
6 8 11 0 7 8 6
7 8 11 8 8 8 7
8 5 11 0 7 7 8
9 4 11 0 8 7 9
10 9 11 9 8 4 10
11 6 11 6 6 6 11
12 6 11 6 4 7 12
13 5 11 5 8 5 13
14 6 11 4 8 8 14
15 2 11 0 7 5 15
16 4 11 0 9 4 16
17 2 11 2 2 9 17
18 6 11 6 8 8 18
19 7 11 0 8 4 19
20 8 11 4 4 6 20
21 5 11 5 5 6 21
22 7 11 7 7 7 22
23 5 11 5 8 3 23
24 4 11 4 4 4 24
25 6 11 6 6 6 25
26 6 11 6 6 6 26
27 7 11 0 9 7 27
28 7 11 1 7 5 28
29 8 11 0 6 8 29
30 4 11 4 4 6 30
31 4 11 4 8 4 31
32 7 11 7 3 9 32
33 7 11 7 7 7 33
34 4 11 0 4 4 34
35 7 11 4 7 6 35
36 5 11 5 8 8 36
37 6 11 0 6 6 37
38 5 11 5 5 5 38
39 6 11 1 6 6 39
40 7 11 2 9 6 40
41 6 11 0 8 4 41
42 9 11 9 7 7 42
43 7 11 3 3 9 43
44 4 11 0 4 8 44
45 6 11 6 6 6 45
46 5 11 1 8 6 46
47 5 11 5 5 5 47
48 4 11 0 7 7 48
49 7 11 0 7 5 49
50 6 11 0 9 8 50
51 6 11 6 6 6 51
52 7 11 7 8 8 52
53 5 11 0 5 5 53
54 4 11 4 4 4 54
55 5 11 5 8 5 55
56 5 11 1 9 6 56
57 4 12 4 4 4 57
58 9 12 9 8 6 58
59 8 12 2 2 9 59
60 8 12 8 8 7 60
61 3 12 3 7 3 61
62 6 12 1 7 6 62
63 6 12 0 6 6 63
64 6 12 6 6 6 64
65 5 12 0 5 5 65
66 5 12 0 8 5 66
67 6 12 6 4 5 67
68 7 12 2 9 9 68
69 6 12 1 6 8 69
70 5 12 5 5 5 70
71 5 12 5 5 6 71
72 7 12 5 7 7 72
73 5 12 5 8 5 73
74 6 12 6 9 6 74
75 6 12 6 6 6 75
76 9 12 0 6 6 76
77 8 12 0 5 6 77
78 5 12 1 3 9 78
79 7 12 7 7 7 79
80 7 12 2 9 9 80
81 4 12 4 7 4 81
82 6 12 0 8 8 82
83 5 12 5 5 5 83
84 5 12 5 5 8 84
85 3 12 3 8 9 85
86 6 12 0 6 6 86
87 4 12 4 9 4 87
88 9 12 9 5 7 88
89 8 12 0 8 8 89
90 4 12 4 8 9 90
91 2 12 2 7 9 91
92 7 12 7 7 7 92
93 7 12 7 8 8 93
94 6 12 6 4 4 94
95 5 12 0 5 6 95
96 8 12 5 9 7 96
97 6 12 6 6 6 97
98 3 12 0 7 7 98
99 5 12 5 5 5 99
100 9 12 9 2 9 100
101 7 12 0 7 7 101
102 7 12 7 7 7 102
103 6 12 1 6 6 103
104 3 12 3 8 6 104
105 7 12 7 9 9 105
106 8 12 8 8 9 106
107 3 12 0 3 8 107
108 5 12 5 5 8 108
109 8 12 3 7 3 109
110 7 12 0 8 6 110
111 5 12 5 5 5 111
112 7 12 7 9 7 112
113 6 12 0 6 6 113
114 7 12 0 7 7 114
115 9 12 0 7 7 115
116 6 12 6 6 6 116
117 6 12 0 3 8 117
118 6 12 6 9 9 118
119 6 12 6 6 6 119
120 2 12 2 2 9 120
121 5 12 5 5 5 121
122 5 12 0 5 6 122
123 4 12 4 9 4 123
124 7 12 0 7 7 124
125 6 12 6 6 6 125
126 5 12 5 8 8 126
127 8 12 8 8 8 127
128 7 12 6 6 9 128
129 5 12 5 3 8 129
130 4 12 0 7 4 130
131 8 12 8 9 6 131
132 6 12 0 7 6 132
133 9 12 9 4 7 133
134 5 12 5 5 9 134
135 6 12 0 6 8 135
136 4 12 0 4 4 136
137 6 12 0 6 6 137
138 3 12 3 7 9 138
139 6 12 6 6 6 139
140 5 12 0 5 5 140
141 4 12 4 9 8 141
142 6 12 6 6 6 142
143 5 12 0 9 6 143
144 4 12 4 3 6 144
145 7 12 7 7 7 145
146 6 12 0 6 7 146
147 7 12 5 5 9 147
148 6 12 6 6 6 148
149 6 12 6 9 6 149
150 8 12 8 8 6 150
151 7 12 2 7 4 151
152 7 12 7 7 7 152
153 4 12 0 4 8 153
154 6 12 0 8 7 154
155 5 12 5 5 9 155
156 2 12 0 9 6 156
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) Maand Relation Friends Job t
-0.634404 0.388648 0.174617 0.128198 0.155388 -0.006112
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-4.1183 -0.8964 0.0454 0.9574 3.7337
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -0.634404 4.969335 -0.128 0.8986
Maand 0.388648 0.450363 0.863 0.3895
Relation 0.174617 0.041655 4.192 4.71e-05 ***
Friends 0.128198 0.066804 1.919 0.0569 .
Job 0.155388 0.077531 2.004 0.0468 *
t -0.006112 0.004793 -1.275 0.2042
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 1.499 on 150 degrees of freedom
Multiple R-squared: 0.1597, Adjusted R-squared: 0.1317
F-statistic: 5.703 on 5 and 150 DF, p-value: 7.59e-05
> 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.55933976 0.88132047 0.4406602
[2,] 0.57783862 0.84432277 0.4221614
[3,] 0.58476087 0.83047826 0.4152391
[4,] 0.51840504 0.96318991 0.4815950
[5,] 0.41862070 0.83724140 0.5813793
[6,] 0.36195725 0.72391450 0.6380428
[7,] 0.39940727 0.79881454 0.6005927
[8,] 0.35864214 0.71728428 0.6413579
[9,] 0.38892051 0.77784102 0.6110795
[10,] 0.35408553 0.70817106 0.6459145
[11,] 0.72223166 0.55553668 0.2777683
[12,] 0.88852200 0.22295599 0.1114780
[13,] 0.85158694 0.29682612 0.1484131
[14,] 0.82826256 0.34347488 0.1717374
[15,] 0.78832092 0.42335815 0.2116791
[16,] 0.74978607 0.50042786 0.2502139
[17,] 0.70342902 0.59314197 0.2965710
[18,] 0.65343958 0.69312084 0.3465604
[19,] 0.73364091 0.53271819 0.2663591
[20,] 0.77810610 0.44378779 0.2218939
[21,] 0.85518906 0.28962188 0.1448109
[22,] 0.84389558 0.31220884 0.1561044
[23,] 0.85022960 0.29954080 0.1497704
[24,] 0.82118703 0.35762594 0.1788130
[25,] 0.78037442 0.43925116 0.2196256
[26,] 0.73729744 0.52540513 0.2627026
[27,] 0.70764815 0.58470371 0.2923519
[28,] 0.72500478 0.54999045 0.2749952
[29,] 0.69696444 0.60607112 0.3030356
[30,] 0.65151319 0.69697362 0.3484868
[31,] 0.61168011 0.77663979 0.3883199
[32,] 0.57764722 0.84470556 0.4223528
[33,] 0.53942988 0.92114023 0.4605701
[34,] 0.56217169 0.87565663 0.4378283
[35,] 0.53866293 0.92267414 0.4613371
[36,] 0.52529222 0.94941555 0.4747078
[37,] 0.47457826 0.94915652 0.5254217
[38,] 0.43759810 0.87519621 0.5624019
[39,] 0.39293584 0.78587169 0.6070642
[40,] 0.39189097 0.78378194 0.6081090
[41,] 0.42743494 0.85486987 0.5725651
[42,] 0.38338855 0.76677710 0.6166114
[43,] 0.33659497 0.67318994 0.6634050
[44,] 0.29709658 0.59419315 0.7029034
[45,] 0.26061350 0.52122700 0.7393865
[46,] 0.23113717 0.46227434 0.7688628
[47,] 0.21016181 0.42032363 0.7898382
[48,] 0.18296310 0.36592619 0.8170369
[49,] 0.16458458 0.32916916 0.8354154
[50,] 0.18172499 0.36344997 0.8182750
[51,] 0.20607498 0.41214996 0.7939250
[52,] 0.17983007 0.35966013 0.8201699
[53,] 0.25954075 0.51908151 0.7404592
[54,] 0.22211171 0.44422343 0.7778883
[55,] 0.19113391 0.38226782 0.8088661
[56,] 0.16421424 0.32842847 0.8357858
[57,] 0.13609019 0.27218038 0.8639098
[58,] 0.11459478 0.22918957 0.8854052
[59,] 0.09319973 0.18639946 0.9068003
[60,] 0.07860767 0.15721534 0.9213923
[61,] 0.06331101 0.12662203 0.9366890
[62,] 0.05448136 0.10896272 0.9455186
[63,] 0.04868209 0.09736417 0.9513179
[64,] 0.03859839 0.07719677 0.9614016
[65,] 0.03651026 0.07302053 0.9634897
[66,] 0.03032178 0.06064356 0.9696782
[67,] 0.02345842 0.04691684 0.9765416
[68,] 0.08571400 0.17142801 0.9142860
[69,] 0.14203855 0.28407710 0.8579614
[70,] 0.12701547 0.25403093 0.8729845
[71,] 0.10462072 0.20924144 0.8953793
[72,] 0.09265803 0.18531606 0.9073420
[73,] 0.10126292 0.20252584 0.8987371
[74,] 0.08637719 0.17275437 0.9136228
[75,] 0.07501642 0.15003284 0.9249836
[76,] 0.07162311 0.14324622 0.9283769
[77,] 0.16723447 0.33446895 0.8327655
[78,] 0.14742010 0.29484019 0.8525799
[79,] 0.17576418 0.35152836 0.8242358
[80,] 0.21090050 0.42180101 0.7890995
[81,] 0.27184518 0.54369035 0.7281548
[82,] 0.33984242 0.67968483 0.6601576
[83,] 0.60841653 0.78316693 0.3915835
[84,] 0.56534767 0.86930466 0.4346523
[85,] 0.51849883 0.96300233 0.4815012
[86,] 0.47803572 0.95607145 0.5219643
[87,] 0.43060747 0.86121493 0.5693925
[88,] 0.42435935 0.84871870 0.5756407
[89,] 0.38186553 0.76373106 0.6181345
[90,] 0.45574857 0.91149713 0.5442514
[91,] 0.43776215 0.87552429 0.5622379
[92,] 0.50900837 0.98198327 0.4909916
[93,] 0.51173134 0.97653732 0.4882687
[94,] 0.46394970 0.92789940 0.5360503
[95,] 0.42280921 0.84561841 0.5771908
[96,] 0.59339433 0.81321134 0.4066057
[97,] 0.54444860 0.91110280 0.4555514
[98,] 0.50776733 0.98446534 0.4922327
[99,] 0.54168865 0.91662269 0.4583113
[100,] 0.52429368 0.95141264 0.4757063
[101,] 0.58211828 0.83576344 0.4178817
[102,] 0.57494619 0.85010763 0.4250538
[103,] 0.55081841 0.89836319 0.4491816
[104,] 0.49870855 0.99741711 0.5012914
[105,] 0.45642752 0.91285504 0.5435725
[106,] 0.46142448 0.92284896 0.5385755
[107,] 0.75971348 0.48057305 0.2402865
[108,] 0.71453964 0.57092073 0.2854604
[109,] 0.72925842 0.54148316 0.2707416
[110,] 0.68587438 0.62825124 0.3141256
[111,] 0.63308748 0.73382503 0.3669125
[112,] 0.77712029 0.44575942 0.2228797
[113,] 0.75849811 0.48300378 0.2415019
[114,] 0.70869378 0.58261244 0.2913062
[115,] 0.78064982 0.43870036 0.2193502
[116,] 0.82684858 0.34630284 0.1731514
[117,] 0.79316126 0.41367748 0.2068387
[118,] 0.78437324 0.43125351 0.2156268
[119,] 0.74898456 0.50203088 0.2510154
[120,] 0.70891829 0.58216342 0.2910817
[121,] 0.67520257 0.64959485 0.3247974
[122,] 0.66667777 0.66664446 0.3333222
[123,] 0.61368075 0.77263851 0.3863193
[124,] 0.57807674 0.84384651 0.4219233
[125,] 0.63519341 0.72961317 0.3648066
[126,] 0.57189860 0.85620280 0.4281014
[127,] 0.60926290 0.78147420 0.3907371
[128,] 0.57418880 0.85162240 0.4258112
[129,] 0.57823459 0.84353082 0.4217654
[130,] 0.59862664 0.80274673 0.4013734
[131,] 0.51414081 0.97171838 0.4858592
[132,] 0.42331333 0.84662665 0.5766867
[133,] 0.48917247 0.97834494 0.5108275
[134,] 0.41074245 0.82148490 0.5892575
[135,] 0.33518272 0.67036544 0.6648173
[136,] 0.50950928 0.98098145 0.4904907
[137,] 0.41077188 0.82154376 0.5892281
[138,] 0.28278369 0.56556737 0.7172163
[139,] 0.17599553 0.35199107 0.8240045
> postscript(file="/var/www/rcomp/tmp/1ymo01324496235.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/www/rcomp/tmp/2pbm81324496235.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/www/rcomp/tmp/3ery21324496235.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/www/rcomp/tmp/4wdpp1324496235.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/www/rcomp/tmp/5zbs71324496235.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 = 156
Frequency = 1
1 2 3 4 5 6
1.01182046 1.38639515 0.10892133 -1.06086479 1.47727022 2.25545710
7 8 9 10 11 12
0.73643759 -0.57693018 -1.69901616 2.20170956 -0.32270673 -0.21558526
13 14 15 16 17 18
-1.23687417 -0.52230853 -3.22336740 -1.31826397 -3.54093509 -0.84709213
19 20 21 22 23 24
1.82827179 2.33793551 -0.95876716 0.28632722 -0.86497405 -1.32683904
25 26 27 28 29 30
-0.23713250 -0.23102005 1.28280943 1.68147770 2.52424177 -1.60094003
31 32 33 34 35 36
-1.79684563 0.54946971 0.35356412 -0.56724782 1.04502691 -1.56245143
37 38 39 40 41 42
0.88391699 -0.69946776 0.72152519 1.16842567 0.96274559 2.05934274
43 44 45 46 47 48
1.31517337 -1.12767470 -0.11488359 -0.49208454 -0.64445575 -1.33243237
49 50 51 52 53 54
1.98445574 0.26800784 -0.07820892 0.18611432 0.26530238 -1.14346568
55 56 57 58 59 60
-0.98015147 -0.55915852 -1.51377654 1.79568308 2.32713942 0.82713683
61 62 63 64 65 66
-2.54391751 0.34526481 0.65419238 -0.38739532 -0.04999647 -0.42847931
67 68 69 70 71 72
0.04272670 0.48476244 0.20547469 -0.89251770 -1.04179309 0.55253467
73 74 75 76 77 78
-1.25877565 -0.71086615 -0.32015843 3.73365417 2.86796504 -0.51030585
79 80 81 82 83 84
0.24608840 0.55811179 -1.75167313 0.20315632 -0.81305591 -1.27310697
85 86 87 88 89 90
-3.45774425 0.79477862 -1.97139531 2.20826388 2.24594344 -2.60179872
91 92 93 94 95 96
-4.11825446 0.32555019 0.04807638 0.36315056 -0.02201095 1.44283650
97 98 99 100 101 102
-0.18568463 -2.41545830 -0.71525679 2.35543284 1.60287904 0.38667465
103 104 105 106 107 108
0.72407350 -2.87544429 -0.16216054 0.79753364 -2.00304041 -1.12640828
109 110 111 112 113 114
2.74947986 1.68508045 -0.64190744 0.19140225 0.95981464 1.68234083
115 116 117 118 119 120
3.68845327 -0.06954817 1.05808404 -0.90808206 -0.05121083 -3.30000141
121 122 123 124 125 126
-0.58078299 0.14302508 -1.75134728 1.74346528 -0.01453616 -1.40097954
127 128 129 130 131 132
1.08128283 0.53763768 -0.74165007 -0.75369655 1.28830985 0.94775268
133 134 135 136 137 138
2.61152235 -1.12287253 0.78351277 -0.33242659 1.10651333 -3.00558622
139 140 141 142 143 144
0.07103807 0.40843693 -2.26287460 0.08937541 -0.24140728 -1.16457104
145 146 147 148 149 150
0.64950980 1.00613751 0.95658926 0.12605008 -0.25243275 1.53264474
151 152 153 154 155 156
2.02543142 0.69229691 -0.85006636 0.79864021 -0.99451118 -3.16194549
> postscript(file="/var/www/rcomp/tmp/6f5zl1324496235.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 = 156
Frequency = 1
lag(myerror, k = 1) myerror
0 1.01182046 NA
1 1.38639515 1.01182046
2 0.10892133 1.38639515
3 -1.06086479 0.10892133
4 1.47727022 -1.06086479
5 2.25545710 1.47727022
6 0.73643759 2.25545710
7 -0.57693018 0.73643759
8 -1.69901616 -0.57693018
9 2.20170956 -1.69901616
10 -0.32270673 2.20170956
11 -0.21558526 -0.32270673
12 -1.23687417 -0.21558526
13 -0.52230853 -1.23687417
14 -3.22336740 -0.52230853
15 -1.31826397 -3.22336740
16 -3.54093509 -1.31826397
17 -0.84709213 -3.54093509
18 1.82827179 -0.84709213
19 2.33793551 1.82827179
20 -0.95876716 2.33793551
21 0.28632722 -0.95876716
22 -0.86497405 0.28632722
23 -1.32683904 -0.86497405
24 -0.23713250 -1.32683904
25 -0.23102005 -0.23713250
26 1.28280943 -0.23102005
27 1.68147770 1.28280943
28 2.52424177 1.68147770
29 -1.60094003 2.52424177
30 -1.79684563 -1.60094003
31 0.54946971 -1.79684563
32 0.35356412 0.54946971
33 -0.56724782 0.35356412
34 1.04502691 -0.56724782
35 -1.56245143 1.04502691
36 0.88391699 -1.56245143
37 -0.69946776 0.88391699
38 0.72152519 -0.69946776
39 1.16842567 0.72152519
40 0.96274559 1.16842567
41 2.05934274 0.96274559
42 1.31517337 2.05934274
43 -1.12767470 1.31517337
44 -0.11488359 -1.12767470
45 -0.49208454 -0.11488359
46 -0.64445575 -0.49208454
47 -1.33243237 -0.64445575
48 1.98445574 -1.33243237
49 0.26800784 1.98445574
50 -0.07820892 0.26800784
51 0.18611432 -0.07820892
52 0.26530238 0.18611432
53 -1.14346568 0.26530238
54 -0.98015147 -1.14346568
55 -0.55915852 -0.98015147
56 -1.51377654 -0.55915852
57 1.79568308 -1.51377654
58 2.32713942 1.79568308
59 0.82713683 2.32713942
60 -2.54391751 0.82713683
61 0.34526481 -2.54391751
62 0.65419238 0.34526481
63 -0.38739532 0.65419238
64 -0.04999647 -0.38739532
65 -0.42847931 -0.04999647
66 0.04272670 -0.42847931
67 0.48476244 0.04272670
68 0.20547469 0.48476244
69 -0.89251770 0.20547469
70 -1.04179309 -0.89251770
71 0.55253467 -1.04179309
72 -1.25877565 0.55253467
73 -0.71086615 -1.25877565
74 -0.32015843 -0.71086615
75 3.73365417 -0.32015843
76 2.86796504 3.73365417
77 -0.51030585 2.86796504
78 0.24608840 -0.51030585
79 0.55811179 0.24608840
80 -1.75167313 0.55811179
81 0.20315632 -1.75167313
82 -0.81305591 0.20315632
83 -1.27310697 -0.81305591
84 -3.45774425 -1.27310697
85 0.79477862 -3.45774425
86 -1.97139531 0.79477862
87 2.20826388 -1.97139531
88 2.24594344 2.20826388
89 -2.60179872 2.24594344
90 -4.11825446 -2.60179872
91 0.32555019 -4.11825446
92 0.04807638 0.32555019
93 0.36315056 0.04807638
94 -0.02201095 0.36315056
95 1.44283650 -0.02201095
96 -0.18568463 1.44283650
97 -2.41545830 -0.18568463
98 -0.71525679 -2.41545830
99 2.35543284 -0.71525679
100 1.60287904 2.35543284
101 0.38667465 1.60287904
102 0.72407350 0.38667465
103 -2.87544429 0.72407350
104 -0.16216054 -2.87544429
105 0.79753364 -0.16216054
106 -2.00304041 0.79753364
107 -1.12640828 -2.00304041
108 2.74947986 -1.12640828
109 1.68508045 2.74947986
110 -0.64190744 1.68508045
111 0.19140225 -0.64190744
112 0.95981464 0.19140225
113 1.68234083 0.95981464
114 3.68845327 1.68234083
115 -0.06954817 3.68845327
116 1.05808404 -0.06954817
117 -0.90808206 1.05808404
118 -0.05121083 -0.90808206
119 -3.30000141 -0.05121083
120 -0.58078299 -3.30000141
121 0.14302508 -0.58078299
122 -1.75134728 0.14302508
123 1.74346528 -1.75134728
124 -0.01453616 1.74346528
125 -1.40097954 -0.01453616
126 1.08128283 -1.40097954
127 0.53763768 1.08128283
128 -0.74165007 0.53763768
129 -0.75369655 -0.74165007
130 1.28830985 -0.75369655
131 0.94775268 1.28830985
132 2.61152235 0.94775268
133 -1.12287253 2.61152235
134 0.78351277 -1.12287253
135 -0.33242659 0.78351277
136 1.10651333 -0.33242659
137 -3.00558622 1.10651333
138 0.07103807 -3.00558622
139 0.40843693 0.07103807
140 -2.26287460 0.40843693
141 0.08937541 -2.26287460
142 -0.24140728 0.08937541
143 -1.16457104 -0.24140728
144 0.64950980 -1.16457104
145 1.00613751 0.64950980
146 0.95658926 1.00613751
147 0.12605008 0.95658926
148 -0.25243275 0.12605008
149 1.53264474 -0.25243275
150 2.02543142 1.53264474
151 0.69229691 2.02543142
152 -0.85006636 0.69229691
153 0.79864021 -0.85006636
154 -0.99451118 0.79864021
155 -3.16194549 -0.99451118
156 NA -3.16194549
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 1.38639515 1.01182046
[2,] 0.10892133 1.38639515
[3,] -1.06086479 0.10892133
[4,] 1.47727022 -1.06086479
[5,] 2.25545710 1.47727022
[6,] 0.73643759 2.25545710
[7,] -0.57693018 0.73643759
[8,] -1.69901616 -0.57693018
[9,] 2.20170956 -1.69901616
[10,] -0.32270673 2.20170956
[11,] -0.21558526 -0.32270673
[12,] -1.23687417 -0.21558526
[13,] -0.52230853 -1.23687417
[14,] -3.22336740 -0.52230853
[15,] -1.31826397 -3.22336740
[16,] -3.54093509 -1.31826397
[17,] -0.84709213 -3.54093509
[18,] 1.82827179 -0.84709213
[19,] 2.33793551 1.82827179
[20,] -0.95876716 2.33793551
[21,] 0.28632722 -0.95876716
[22,] -0.86497405 0.28632722
[23,] -1.32683904 -0.86497405
[24,] -0.23713250 -1.32683904
[25,] -0.23102005 -0.23713250
[26,] 1.28280943 -0.23102005
[27,] 1.68147770 1.28280943
[28,] 2.52424177 1.68147770
[29,] -1.60094003 2.52424177
[30,] -1.79684563 -1.60094003
[31,] 0.54946971 -1.79684563
[32,] 0.35356412 0.54946971
[33,] -0.56724782 0.35356412
[34,] 1.04502691 -0.56724782
[35,] -1.56245143 1.04502691
[36,] 0.88391699 -1.56245143
[37,] -0.69946776 0.88391699
[38,] 0.72152519 -0.69946776
[39,] 1.16842567 0.72152519
[40,] 0.96274559 1.16842567
[41,] 2.05934274 0.96274559
[42,] 1.31517337 2.05934274
[43,] -1.12767470 1.31517337
[44,] -0.11488359 -1.12767470
[45,] -0.49208454 -0.11488359
[46,] -0.64445575 -0.49208454
[47,] -1.33243237 -0.64445575
[48,] 1.98445574 -1.33243237
[49,] 0.26800784 1.98445574
[50,] -0.07820892 0.26800784
[51,] 0.18611432 -0.07820892
[52,] 0.26530238 0.18611432
[53,] -1.14346568 0.26530238
[54,] -0.98015147 -1.14346568
[55,] -0.55915852 -0.98015147
[56,] -1.51377654 -0.55915852
[57,] 1.79568308 -1.51377654
[58,] 2.32713942 1.79568308
[59,] 0.82713683 2.32713942
[60,] -2.54391751 0.82713683
[61,] 0.34526481 -2.54391751
[62,] 0.65419238 0.34526481
[63,] -0.38739532 0.65419238
[64,] -0.04999647 -0.38739532
[65,] -0.42847931 -0.04999647
[66,] 0.04272670 -0.42847931
[67,] 0.48476244 0.04272670
[68,] 0.20547469 0.48476244
[69,] -0.89251770 0.20547469
[70,] -1.04179309 -0.89251770
[71,] 0.55253467 -1.04179309
[72,] -1.25877565 0.55253467
[73,] -0.71086615 -1.25877565
[74,] -0.32015843 -0.71086615
[75,] 3.73365417 -0.32015843
[76,] 2.86796504 3.73365417
[77,] -0.51030585 2.86796504
[78,] 0.24608840 -0.51030585
[79,] 0.55811179 0.24608840
[80,] -1.75167313 0.55811179
[81,] 0.20315632 -1.75167313
[82,] -0.81305591 0.20315632
[83,] -1.27310697 -0.81305591
[84,] -3.45774425 -1.27310697
[85,] 0.79477862 -3.45774425
[86,] -1.97139531 0.79477862
[87,] 2.20826388 -1.97139531
[88,] 2.24594344 2.20826388
[89,] -2.60179872 2.24594344
[90,] -4.11825446 -2.60179872
[91,] 0.32555019 -4.11825446
[92,] 0.04807638 0.32555019
[93,] 0.36315056 0.04807638
[94,] -0.02201095 0.36315056
[95,] 1.44283650 -0.02201095
[96,] -0.18568463 1.44283650
[97,] -2.41545830 -0.18568463
[98,] -0.71525679 -2.41545830
[99,] 2.35543284 -0.71525679
[100,] 1.60287904 2.35543284
[101,] 0.38667465 1.60287904
[102,] 0.72407350 0.38667465
[103,] -2.87544429 0.72407350
[104,] -0.16216054 -2.87544429
[105,] 0.79753364 -0.16216054
[106,] -2.00304041 0.79753364
[107,] -1.12640828 -2.00304041
[108,] 2.74947986 -1.12640828
[109,] 1.68508045 2.74947986
[110,] -0.64190744 1.68508045
[111,] 0.19140225 -0.64190744
[112,] 0.95981464 0.19140225
[113,] 1.68234083 0.95981464
[114,] 3.68845327 1.68234083
[115,] -0.06954817 3.68845327
[116,] 1.05808404 -0.06954817
[117,] -0.90808206 1.05808404
[118,] -0.05121083 -0.90808206
[119,] -3.30000141 -0.05121083
[120,] -0.58078299 -3.30000141
[121,] 0.14302508 -0.58078299
[122,] -1.75134728 0.14302508
[123,] 1.74346528 -1.75134728
[124,] -0.01453616 1.74346528
[125,] -1.40097954 -0.01453616
[126,] 1.08128283 -1.40097954
[127,] 0.53763768 1.08128283
[128,] -0.74165007 0.53763768
[129,] -0.75369655 -0.74165007
[130,] 1.28830985 -0.75369655
[131,] 0.94775268 1.28830985
[132,] 2.61152235 0.94775268
[133,] -1.12287253 2.61152235
[134,] 0.78351277 -1.12287253
[135,] -0.33242659 0.78351277
[136,] 1.10651333 -0.33242659
[137,] -3.00558622 1.10651333
[138,] 0.07103807 -3.00558622
[139,] 0.40843693 0.07103807
[140,] -2.26287460 0.40843693
[141,] 0.08937541 -2.26287460
[142,] -0.24140728 0.08937541
[143,] -1.16457104 -0.24140728
[144,] 0.64950980 -1.16457104
[145,] 1.00613751 0.64950980
[146,] 0.95658926 1.00613751
[147,] 0.12605008 0.95658926
[148,] -0.25243275 0.12605008
[149,] 1.53264474 -0.25243275
[150,] 2.02543142 1.53264474
[151,] 0.69229691 2.02543142
[152,] -0.85006636 0.69229691
[153,] 0.79864021 -0.85006636
[154,] -0.99451118 0.79864021
[155,] -3.16194549 -0.99451118
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 1.38639515 1.01182046
2 0.10892133 1.38639515
3 -1.06086479 0.10892133
4 1.47727022 -1.06086479
5 2.25545710 1.47727022
6 0.73643759 2.25545710
7 -0.57693018 0.73643759
8 -1.69901616 -0.57693018
9 2.20170956 -1.69901616
10 -0.32270673 2.20170956
11 -0.21558526 -0.32270673
12 -1.23687417 -0.21558526
13 -0.52230853 -1.23687417
14 -3.22336740 -0.52230853
15 -1.31826397 -3.22336740
16 -3.54093509 -1.31826397
17 -0.84709213 -3.54093509
18 1.82827179 -0.84709213
19 2.33793551 1.82827179
20 -0.95876716 2.33793551
21 0.28632722 -0.95876716
22 -0.86497405 0.28632722
23 -1.32683904 -0.86497405
24 -0.23713250 -1.32683904
25 -0.23102005 -0.23713250
26 1.28280943 -0.23102005
27 1.68147770 1.28280943
28 2.52424177 1.68147770
29 -1.60094003 2.52424177
30 -1.79684563 -1.60094003
31 0.54946971 -1.79684563
32 0.35356412 0.54946971
33 -0.56724782 0.35356412
34 1.04502691 -0.56724782
35 -1.56245143 1.04502691
36 0.88391699 -1.56245143
37 -0.69946776 0.88391699
38 0.72152519 -0.69946776
39 1.16842567 0.72152519
40 0.96274559 1.16842567
41 2.05934274 0.96274559
42 1.31517337 2.05934274
43 -1.12767470 1.31517337
44 -0.11488359 -1.12767470
45 -0.49208454 -0.11488359
46 -0.64445575 -0.49208454
47 -1.33243237 -0.64445575
48 1.98445574 -1.33243237
49 0.26800784 1.98445574
50 -0.07820892 0.26800784
51 0.18611432 -0.07820892
52 0.26530238 0.18611432
53 -1.14346568 0.26530238
54 -0.98015147 -1.14346568
55 -0.55915852 -0.98015147
56 -1.51377654 -0.55915852
57 1.79568308 -1.51377654
58 2.32713942 1.79568308
59 0.82713683 2.32713942
60 -2.54391751 0.82713683
61 0.34526481 -2.54391751
62 0.65419238 0.34526481
63 -0.38739532 0.65419238
64 -0.04999647 -0.38739532
65 -0.42847931 -0.04999647
66 0.04272670 -0.42847931
67 0.48476244 0.04272670
68 0.20547469 0.48476244
69 -0.89251770 0.20547469
70 -1.04179309 -0.89251770
71 0.55253467 -1.04179309
72 -1.25877565 0.55253467
73 -0.71086615 -1.25877565
74 -0.32015843 -0.71086615
75 3.73365417 -0.32015843
76 2.86796504 3.73365417
77 -0.51030585 2.86796504
78 0.24608840 -0.51030585
79 0.55811179 0.24608840
80 -1.75167313 0.55811179
81 0.20315632 -1.75167313
82 -0.81305591 0.20315632
83 -1.27310697 -0.81305591
84 -3.45774425 -1.27310697
85 0.79477862 -3.45774425
86 -1.97139531 0.79477862
87 2.20826388 -1.97139531
88 2.24594344 2.20826388
89 -2.60179872 2.24594344
90 -4.11825446 -2.60179872
91 0.32555019 -4.11825446
92 0.04807638 0.32555019
93 0.36315056 0.04807638
94 -0.02201095 0.36315056
95 1.44283650 -0.02201095
96 -0.18568463 1.44283650
97 -2.41545830 -0.18568463
98 -0.71525679 -2.41545830
99 2.35543284 -0.71525679
100 1.60287904 2.35543284
101 0.38667465 1.60287904
102 0.72407350 0.38667465
103 -2.87544429 0.72407350
104 -0.16216054 -2.87544429
105 0.79753364 -0.16216054
106 -2.00304041 0.79753364
107 -1.12640828 -2.00304041
108 2.74947986 -1.12640828
109 1.68508045 2.74947986
110 -0.64190744 1.68508045
111 0.19140225 -0.64190744
112 0.95981464 0.19140225
113 1.68234083 0.95981464
114 3.68845327 1.68234083
115 -0.06954817 3.68845327
116 1.05808404 -0.06954817
117 -0.90808206 1.05808404
118 -0.05121083 -0.90808206
119 -3.30000141 -0.05121083
120 -0.58078299 -3.30000141
121 0.14302508 -0.58078299
122 -1.75134728 0.14302508
123 1.74346528 -1.75134728
124 -0.01453616 1.74346528
125 -1.40097954 -0.01453616
126 1.08128283 -1.40097954
127 0.53763768 1.08128283
128 -0.74165007 0.53763768
129 -0.75369655 -0.74165007
130 1.28830985 -0.75369655
131 0.94775268 1.28830985
132 2.61152235 0.94775268
133 -1.12287253 2.61152235
134 0.78351277 -1.12287253
135 -0.33242659 0.78351277
136 1.10651333 -0.33242659
137 -3.00558622 1.10651333
138 0.07103807 -3.00558622
139 0.40843693 0.07103807
140 -2.26287460 0.40843693
141 0.08937541 -2.26287460
142 -0.24140728 0.08937541
143 -1.16457104 -0.24140728
144 0.64950980 -1.16457104
145 1.00613751 0.64950980
146 0.95658926 1.00613751
147 0.12605008 0.95658926
148 -0.25243275 0.12605008
149 1.53264474 -0.25243275
150 2.02543142 1.53264474
151 0.69229691 2.02543142
152 -0.85006636 0.69229691
153 0.79864021 -0.85006636
154 -0.99451118 0.79864021
155 -3.16194549 -0.99451118
> 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/rcomp/tmp/7cdpf1324496235.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/www/rcomp/tmp/8l26j1324496235.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/www/rcomp/tmp/9pvke1324496235.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/www/rcomp/tmp/1067nl1324496235.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/www/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab
> load(file="/var/www/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/rcomp/tmp/11ymnu1324496235.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/rcomp/tmp/12zckz1324496235.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/rcomp/tmp/13od741324496235.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/rcomp/tmp/14j6pv1324496235.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/rcomp/tmp/15kfa61324496235.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/rcomp/tmp/16igq81324496236.tab")
+ }
>
> try(system("convert tmp/1ymo01324496235.ps tmp/1ymo01324496235.png",intern=TRUE))
character(0)
> try(system("convert tmp/2pbm81324496235.ps tmp/2pbm81324496235.png",intern=TRUE))
character(0)
> try(system("convert tmp/3ery21324496235.ps tmp/3ery21324496235.png",intern=TRUE))
character(0)
> try(system("convert tmp/4wdpp1324496235.ps tmp/4wdpp1324496235.png",intern=TRUE))
character(0)
> try(system("convert tmp/5zbs71324496235.ps tmp/5zbs71324496235.png",intern=TRUE))
character(0)
> try(system("convert tmp/6f5zl1324496235.ps tmp/6f5zl1324496235.png",intern=TRUE))
character(0)
> try(system("convert tmp/7cdpf1324496235.ps tmp/7cdpf1324496235.png",intern=TRUE))
character(0)
> try(system("convert tmp/8l26j1324496235.ps tmp/8l26j1324496235.png",intern=TRUE))
character(0)
> try(system("convert tmp/9pvke1324496235.ps tmp/9pvke1324496235.png",intern=TRUE))
character(0)
> try(system("convert tmp/1067nl1324496235.ps tmp/1067nl1324496235.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
4.110 0.250 4.346