R version 2.15.2 (2012-10-26) -- "Trick or Treat"
Copyright (C) 2012 The R Foundation for Statistical Computing
ISBN 3-900051-07-0
Platform: i686-pc-linux-gnu (32-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> x <- array(list(1
+ ,9
+ ,5
+ ,-1
+ ,6
+ ,24
+ ,2
+ ,11
+ ,5
+ ,-4
+ ,6
+ ,29
+ ,3
+ ,13
+ ,9
+ ,-6
+ ,8
+ ,29
+ ,4
+ ,12
+ ,10
+ ,-9
+ ,4
+ ,25
+ ,5
+ ,13
+ ,14
+ ,-13
+ ,8
+ ,16
+ ,6
+ ,15
+ ,19
+ ,-13
+ ,10
+ ,18
+ ,7
+ ,13
+ ,18
+ ,-10
+ ,9
+ ,13
+ ,8
+ ,16
+ ,16
+ ,-12
+ ,12
+ ,22
+ ,9
+ ,10
+ ,8
+ ,-9
+ ,9
+ ,15
+ ,10
+ ,14
+ ,10
+ ,-15
+ ,11
+ ,20
+ ,11
+ ,14
+ ,12
+ ,-14
+ ,11
+ ,19
+ ,12
+ ,15
+ ,13
+ ,-18
+ ,11
+ ,18
+ ,1
+ ,13
+ ,15
+ ,-13
+ ,11
+ ,13
+ ,2
+ ,8
+ ,3
+ ,-2
+ ,11
+ ,17
+ ,3
+ ,7
+ ,2
+ ,-1
+ ,9
+ ,17
+ ,4
+ ,3
+ ,-2
+ ,5
+ ,8
+ ,13
+ ,5
+ ,3
+ ,1
+ ,8
+ ,6
+ ,14
+ ,6
+ ,4
+ ,1
+ ,6
+ ,7
+ ,13
+ ,7
+ ,4
+ ,-1
+ ,7
+ ,8
+ ,17
+ ,8
+ ,0
+ ,-6
+ ,15
+ ,6
+ ,17
+ ,9
+ ,-4
+ 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ertrouwen'
+ ,'economischesituatie'
+ ,'werkloosheid'
+ ,'financielesituatie'
+ ,'spaarvermogen')
+ ,1:154))
> y <- array(NA,dim=c(6,154),dimnames=list(c('maand','consumentenvertrouwen','economischesituatie','werkloosheid','financielesituatie','spaarvermogen'),1:154))
> for (i in 1:dim(x)[1])
+ {
+ for (j in 1:dim(x)[2])
+ {
+ y[i,j] <- as.numeric(x[i,j])
+ }
+ }
> par3 = 'Linear Trend'
> par2 = 'Do not include Seasonal Dummies'
> par1 = '2'
> library(lattice)
> library(lmtest)
Loading required package: zoo
Attaching package: 'zoo'
The following object(s) are masked from 'package:base':
as.Date, as.Date.numeric
> n25 <- 25 #minimum number of obs. for Goldfeld-Quandt test
> par1 <- as.numeric(par1)
> x <- t(y)
> k <- length(x[1,])
> n <- length(x[,1])
> x1 <- cbind(x[,par1], x[,1:k!=par1])
> mycolnames <- c(colnames(x)[par1], colnames(x)[1:k!=par1])
> colnames(x1) <- mycolnames #colnames(x)[par1]
> x <- x1
> if (par3 == 'First Differences'){
+ x2 <- array(0, dim=c(n-1,k), dimnames=list(1:(n-1), paste('(1-B)',colnames(x),sep='')))
+ for (i in 1:n-1) {
+ for (j in 1:k) {
+ x2[i,j] <- x[i+1,j] - x[i,j]
+ }
+ }
+ x <- x2
+ }
> if (par2 == 'Include Monthly Dummies'){
+ x2 <- array(0, dim=c(n,11), dimnames=list(1:n, paste('M', seq(1:11), sep ='')))
+ for (i in 1:11){
+ x2[seq(i,n,12),i] <- 1
+ }
+ x <- cbind(x, x2)
+ }
> if (par2 == 'Include Quarterly Dummies'){
+ x2 <- array(0, dim=c(n,3), dimnames=list(1:n, paste('Q', seq(1:3), sep ='')))
+ for (i in 1:3){
+ x2[seq(i,n,4),i] <- 1
+ }
+ x <- cbind(x, x2)
+ }
> k <- length(x[1,])
> if (par3 == 'Linear Trend'){
+ x <- cbind(x, c(1:n))
+ colnames(x)[k+1] <- 't'
+ }
> x
consumentenvertrouwen maand economischesituatie werkloosheid
1 9 1 5 -1
2 11 2 5 -4
3 13 3 9 -6
4 12 4 10 -9
5 13 5 14 -13
6 15 6 19 -13
7 13 7 18 -10
8 16 8 16 -12
9 10 9 8 -9
10 14 10 10 -15
11 14 11 12 -14
12 15 12 13 -18
13 13 1 15 -13
14 8 2 3 -2
15 7 3 2 -1
16 3 4 -2 5
17 3 5 1 8
18 4 6 1 6
19 4 7 -1 7
20 0 8 -6 15
21 -4 9 -13 23
22 -14 10 -25 43
23 -18 11 -26 60
24 -8 12 -9 36
25 -1 1 1 28
26 1 2 3 23
27 2 3 6 23
28 0 4 2 22
29 1 5 5 22
30 0 6 5 24
31 -1 7 0 32
32 -3 8 -5 27
33 -3 9 -4 27
34 -3 10 -2 27
35 -4 11 -1 29
36 -8 12 -8 38
37 -9 1 -16 40
38 -13 2 -19 45
39 -18 3 -28 50
40 -11 4 -11 43
41 -9 5 -4 44
42 -10 6 -9 44
43 -13 7 -12 49
44 -11 8 -10 42
45 -5 9 -2 36
46 -15 10 -13 57
47 -6 11 0 42
48 -6 12 0 39
49 -3 1 4 33
50 -1 2 7 32
51 -3 3 5 34
52 -4 4 2 37
53 -6 5 -2 38
54 0 6 6 28
55 -4 7 -3 31
56 -2 8 1 28
57 -2 9 0 30
58 -6 10 -7 39
59 -7 11 -6 38
60 -6 12 -4 39
61 -6 1 -4 38
62 -3 2 -2 37
63 -2 3 2 32
64 -5 4 -5 32
65 -11 5 -15 44
66 -11 6 -16 43
67 -11 7 -18 42
68 -10 8 -13 38
69 -14 9 -23 37
70 -8 10 -10 35
71 -9 11 -10 37
72 -5 12 -6 33
73 -1 1 -3 24
74 -2 2 -4 24
75 -5 3 -7 31
76 -4 4 -7 25
77 -6 5 -7 28
78 -2 6 -3 24
79 -2 7 0 25
80 -2 8 -5 16
81 -2 9 -3 17
82 2 10 3 11
83 1 11 2 12
84 -8 12 -7 39
85 -1 1 -1 19
86 1 2 0 14
87 -1 3 -3 15
88 2 4 4 7
89 2 5 2 12
90 1 6 3 12
91 -1 7 0 14
92 -2 8 -10 9
93 -2 9 -10 8
94 -1 10 -9 4
95 -8 11 -22 7
96 -4 12 -16 3
97 -6 1 -18 5
98 -3 2 -14 0
99 -3 3 -12 -2
100 -7 4 -17 6
101 -9 5 -23 11
102 -11 6 -28 9
103 -13 7 -31 17
104 -11 8 -21 21
105 -9 9 -19 21
106 -17 10 -22 41
107 -22 11 -22 57
108 -25 12 -25 65
109 -20 1 -16 68
110 -24 2 -22 73
111 -24 3 -21 71
112 -22 4 -10 71
113 -19 5 -7 70
114 -18 6 -5 69
115 -17 7 -4 65
116 -11 8 7 57
117 -11 9 6 57
118 -12 10 3 57
119 -10 11 10 55
120 -15 12 0 65
121 -15 1 -2 65
122 -15 2 -1 64
123 -13 3 2 60
124 -8 4 8 43
125 -13 5 -6 47
126 -9 6 -4 40
127 -7 7 4 31
128 -4 8 7 27
129 -4 9 3 24
130 -2 10 3 23
131 0 11 8 17
132 -2 12 3 16
133 -3 1 -3 15
134 1 2 4 8
135 -2 3 -5 5
136 -1 4 -1 6
137 1 5 5 5
138 -3 6 0 12
139 -4 7 -6 8
140 -9 8 -13 17
141 -9 9 -15 22
142 -7 10 -8 24
143 -14 11 -20 36
144 -12 12 -10 31
145 -16 1 -22 34
146 -20 2 -25 47
147 -12 3 -10 33
148 -12 4 -8 35
149 -10 5 -9 31
150 -10 6 -5 35
151 -13 7 -7 39
152 -16 8 -11 46
153 -14 9 -11 40
154 -17 10 -16 50
financielesituatie spaarvermogen t
1 6 24 1
2 6 29 2
3 8 29 3
4 4 25 4
5 8 16 5
6 10 18 6
7 9 13 7
8 12 22 8
9 9 15 9
10 11 20 10
11 11 19 11
12 11 18 12
13 11 13 13
14 11 17 14
15 9 17 15
16 8 13 16
17 6 14 17
18 7 13 18
19 8 17 19
20 6 17 20
21 5 15 21
22 2 9 22
23 3 10 23
24 3 9 24
25 7 14 25
26 8 18 26
27 7 18 27
28 7 12 28
29 6 16 29
30 6 12 30
31 7 19 31
32 5 13 32
33 5 12 33
34 5 13 34
35 4 11 35
36 4 10 36
37 4 16 37
38 1 12 38
39 -1 6 39
40 3 8 40
41 4 6 41
42 3 8 42
43 2 8 43
44 1 9 44
45 4 13 45
46 3 8 46
47 5 11 47
48 6 8 48
49 6 10 49
50 6 15 50
51 6 12 51
52 6 13 52
53 5 12 53
54 6 15 54
55 5 13 55
56 6 13 56
57 5 16 57
58 7 14 58
59 4 12 59
60 5 15 60
61 6 14 61
62 6 19 62
63 5 16 63
64 3 16 64
65 2 11 65
66 3 13 66
67 3 12 67
68 2 11 68
69 0 6 69
70 4 9 70
71 4 6 71
72 5 15 72
73 6 17 73
74 6 13 74
75 5 12 75
76 5 13 76
77 3 10 77
78 5 14 78
79 5 13 79
80 5 10 80
81 3 11 81
82 6 12 82
83 6 7 83
84 4 11 84
85 6 9 85
86 5 13 86
87 4 12 87
88 5 5 88
89 5 13 89
90 4 11 90
91 3 8 91
92 2 8 92
93 3 8 93
94 2 8 94
95 -1 0 95
96 0 3 96
97 -2 0 97
98 1 -1 98
99 -2 -1 99
100 -2 -4 100
101 -2 1 101
102 -6 -1 102
103 -4 0 103
104 -2 -1 104
105 0 6 105
106 -5 0 106
107 -4 -3 107
108 -5 -3 108
109 -1 4 109
110 -2 1 110
111 -4 0 111
112 -1 -4 112
113 1 -2 113
114 1 3 114
115 -2 2 115
116 1 5 116
117 1 6 117
118 3 6 118
119 3 3 119
120 1 4 120
121 1 7 121
122 0 5 122
123 2 6 123
124 2 1 124
125 -1 3 125
126 1 6 126
127 0 0 127
128 1 3 128
129 1 4 129
130 3 7 130
131 2 6 131
132 0 6 132
133 0 6 133
134 3 6 134
135 -2 2 135
136 0 2 136
137 1 2 137
138 -1 3 138
139 -2 -1 139
140 -1 -4 140
141 -1 4 141
142 1 5 142
143 -2 3 143
144 -5 -1 144
145 -5 -4 145
146 -6 0 146
147 -4 -1 147
148 -3 -1 148
149 -3 3 149
150 -1 2 150
151 -2 -4 151
152 -3 -3 152
153 -3 -1 153
154 -3 3 154
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) maand economischesituatie
0.49104 -0.01247 0.25546
werkloosheid financielesituatie spaarvermogen
-0.25040 0.25165 0.23014
t
-0.00324
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-0.63150 -0.25082 0.04936 0.22723 0.68165
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 0.491041 0.175299 2.801 0.00578 **
maand -0.012470 0.007271 -1.715 0.08846 .
economischesituatie 0.255458 0.004099 62.327 < 2e-16 ***
werkloosheid -0.250395 0.001334 -187.700 < 2e-16 ***
financielesituatie 0.251651 0.017577 14.317 < 2e-16 ***
spaarvermogen 0.230144 0.007595 30.303 < 2e-16 ***
t -0.003240 0.001190 -2.724 0.00723 **
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.3047 on 147 degrees of freedom
Multiple R-squared: 0.9988, Adjusted R-squared: 0.9987
F-statistic: 2.005e+04 on 6 and 147 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.57047648 0.85904705 0.42952352
[2,] 0.40287903 0.80575807 0.59712097
[3,] 0.26311897 0.52623794 0.73688103
[4,] 0.16259035 0.32518070 0.83740965
[5,] 0.09684598 0.19369195 0.90315402
[6,] 0.05624197 0.11248394 0.94375803
[7,] 0.03750072 0.07500144 0.96249928
[8,] 0.02079808 0.04159616 0.97920192
[9,] 0.07639964 0.15279928 0.92360036
[10,] 0.05295071 0.10590142 0.94704929
[11,] 0.05350671 0.10701342 0.94649329
[12,] 0.08169932 0.16339865 0.91830068
[13,] 0.08543696 0.17087392 0.91456304
[14,] 0.07875112 0.15750223 0.92124888
[15,] 0.05464828 0.10929656 0.94535172
[16,] 0.05697155 0.11394310 0.94302845
[17,] 0.17860804 0.35721608 0.82139196
[18,] 0.13580400 0.27160800 0.86419600
[19,] 0.13251246 0.26502493 0.86748754
[20,] 0.12501449 0.25002897 0.87498551
[21,] 0.10341299 0.20682599 0.89658701
[22,] 0.15956024 0.31912048 0.84043976
[23,] 0.29018916 0.58037832 0.70981084
[24,] 0.34855920 0.69711840 0.65144080
[25,] 0.39614718 0.79229435 0.60385282
[26,] 0.44708872 0.89417744 0.55291128
[27,] 0.39796036 0.79592072 0.60203964
[28,] 0.39331659 0.78663319 0.60668341
[29,] 0.34478013 0.68956025 0.65521987
[30,] 0.39993595 0.79987189 0.60006405
[31,] 0.40364066 0.80728131 0.59635934
[32,] 0.40059637 0.80119275 0.59940363
[33,] 0.44105564 0.88211129 0.55894436
[34,] 0.46620145 0.93240289 0.53379855
[35,] 0.55242051 0.89515898 0.44757949
[36,] 0.54465632 0.91068736 0.45534368
[37,] 0.57238667 0.85522665 0.42761333
[38,] 0.61741524 0.76516952 0.38258476
[39,] 0.58063266 0.83873468 0.41936734
[40,] 0.54818065 0.90363870 0.45181935
[41,] 0.49841394 0.99682788 0.50158606
[42,] 0.50492073 0.99015854 0.49507927
[43,] 0.45482397 0.90964794 0.54517603
[44,] 0.42891145 0.85782290 0.57108855
[45,] 0.43872302 0.87744604 0.56127698
[46,] 0.40344325 0.80688649 0.59655675
[47,] 0.36073741 0.72147482 0.63926259
[48,] 0.38359616 0.76719231 0.61640384
[49,] 0.40141500 0.80283000 0.59858500
[50,] 0.36180111 0.72360221 0.63819889
[51,] 0.34226235 0.68452470 0.65773765
[52,] 0.38815331 0.77630662 0.61184669
[53,] 0.56042619 0.87914761 0.43957381
[54,] 0.56760499 0.86479003 0.43239501
[55,] 0.57411261 0.85177479 0.42588739
[56,] 0.75596827 0.48806345 0.24403173
[57,] 0.71872856 0.56254288 0.28127144
[58,] 0.78181805 0.43636390 0.21818195
[59,] 0.78468237 0.43063527 0.21531763
[60,] 0.76941099 0.46117802 0.23058901
[61,] 0.74499728 0.51000543 0.25500272
[62,] 0.77129868 0.45740264 0.22870132
[63,] 0.75018665 0.49962671 0.24981335
[64,] 0.72687895 0.54624210 0.27312105
[65,] 0.75345274 0.49309452 0.24654726
[66,] 0.78321638 0.43356724 0.21678362
[67,] 0.78661950 0.42676101 0.21338050
[68,] 0.79774006 0.40451988 0.20225994
[69,] 0.78152380 0.43695240 0.21847620
[70,] 0.74820818 0.50358363 0.25179182
[71,] 0.74634761 0.50730478 0.25365239
[72,] 0.74000216 0.51999569 0.25999784
[73,] 0.74404652 0.51190695 0.25595348
[74,] 0.77562694 0.44874611 0.22437306
[75,] 0.74804945 0.50390111 0.25195055
[76,] 0.75780402 0.48439195 0.24219598
[77,] 0.73139298 0.53721405 0.26860702
[78,] 0.75401842 0.49196316 0.24598158
[79,] 0.75084018 0.49831964 0.24915982
[80,] 0.72056445 0.55887110 0.27943555
[81,] 0.76912796 0.46174407 0.23087204
[82,] 0.75891787 0.48216427 0.24108213
[83,] 0.80962751 0.38074499 0.19037249
[84,] 0.77860538 0.44278923 0.22139462
[85,] 0.74960713 0.50078574 0.25039287
[86,] 0.76862090 0.46275820 0.23137910
[87,] 0.75221195 0.49557611 0.24778805
[88,] 0.75436129 0.49127741 0.24563871
[89,] 0.78376859 0.43246281 0.21623141
[90,] 0.75782555 0.48434889 0.24217445
[91,] 0.72263006 0.55473987 0.27736994
[92,] 0.71297634 0.57404733 0.28702366
[93,] 0.67861786 0.64276428 0.32138214
[94,] 0.63424212 0.73151576 0.36575788
[95,] 0.62504385 0.74991230 0.37495615
[96,] 0.64059243 0.71881514 0.35940757
[97,] 0.59243273 0.81513454 0.40756727
[98,] 0.63328911 0.73342178 0.36671089
[99,] 0.68480313 0.63039374 0.31519687
[100,] 0.68162103 0.63675794 0.31837897
[101,] 0.63873063 0.72253875 0.36126937
[102,] 0.58787062 0.82425876 0.41212938
[103,] 0.71777989 0.56444021 0.28222011
[104,] 0.82187186 0.35625628 0.17812814
[105,] 0.83079034 0.33841931 0.16920966
[106,] 0.83134793 0.33730414 0.16865207
[107,] 0.79544798 0.40910403 0.20455202
[108,] 0.76324778 0.47350444 0.23675222
[109,] 0.85385466 0.29229068 0.14614534
[110,] 0.82796664 0.34406671 0.17203336
[111,] 0.81302420 0.37395159 0.18697580
[112,] 0.76994824 0.46010351 0.23005176
[113,] 0.74232096 0.51535807 0.25767904
[114,] 0.75033086 0.49933829 0.24966914
[115,] 0.70011272 0.59977456 0.29988728
[116,] 0.67378392 0.65243217 0.32621608
[117,] 0.69701203 0.60597595 0.30298797
[118,] 0.74180753 0.51638495 0.25819247
[119,] 0.72029419 0.55941163 0.27970581
[120,] 0.68972057 0.62055886 0.31027943
[121,] 0.86531658 0.26936685 0.13468342
[122,] 0.94067803 0.11864395 0.05932197
[123,] 0.92773544 0.14452912 0.07226456
[124,] 0.91708585 0.16582830 0.08291415
[125,] 0.87957217 0.24085567 0.12042783
[126,] 0.90937429 0.18125142 0.09062571
[127,] 0.90364476 0.19271047 0.09635524
[128,] 0.94935690 0.10128619 0.05064310
[129,] 0.94863123 0.10273754 0.05136877
[130,] 0.93018822 0.13962357 0.06981178
[131,] 0.94146933 0.11706134 0.05853067
[132,] 0.96952880 0.06094241 0.03047120
[133,] 0.98640409 0.02719182 0.01359591
[134,] 0.95929724 0.08140553 0.04070276
[135,] 0.88832999 0.22334003 0.11167001
> postscript(file="/var/fisher/rcomp/tmp/1fe4m1353436558.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/fisher/rcomp/tmp/2hjhg1353436558.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/fisher/rcomp/tmp/3raau1353436558.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/fisher/rcomp/tmp/4f6xq1353436558.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/fisher/rcomp/tmp/5zrvp1353436558.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 = 154
Frequency = 1
1 2 3 4 5 6
-0.036369392 0.077436586 0.067222973 0.003467029 0.060455695 -0.164713260
7 8 9 10 11 12
0.260009374 0.459599740 -0.363882600 -0.015479217 -0.030146492 -0.041331197
13 14 15 16 17 18
-0.283478946 -0.368501343 -0.343637005 -0.631498691 -0.357820089 0.135592833
19 20 21 22 23 24
-0.259611582 -0.460149395 0.058865761 0.283788477 0.329878766 0.223463425
25 26 27 28 29 30
0.374475206 -0.544931964 -0.043945514 0.124064012 -0.295524510 0.141550631
31 32 33 34 35 36
0.575054789 0.500243199 0.490638875 -0.234710981 -0.261730763 0.025885136
37 38 39 40 41 42
0.055551387 -0.234862222 0.216109322 -0.330623068 0.355912561 0.440275893
43 44 45 46 47 48
-0.274013906 -0.500478819 0.293669423 -0.219915773 0.525180735 0.228486049
49 50 51 52 53 54
0.110069961 -0.041708009 -0.323860519 -0.020734860 -0.251003250 0.275009572
55 56 57 58 59 60
0.052965345 0.044007245 0.377184840 0.391643264 0.116739415 -0.070153441
61 62 63 64 65 66
-0.475981251 0.627698826 0.311682984 -0.381099497 0.596301406 -0.094863760
67 68 69 70 71 72
0.411510959 -0.369855320 -0.395940044 0.100991482 0.307922880 -0.022724001
73 74 75 76 77 78
0.111482062 0.303225059 0.319869193 -0.396935142 -0.436307431 0.132113794
79 80 81 82 83 84
-0.138011527 -0.408135945 -0.379789488 -0.384293925 0.287987909 -0.053785886
85 86 87 88 89 90
0.228624357 0.067976452 -0.417749985 0.165948504 0.103400106 -0.424409866
91 92 93 94 95 96
-0.199453721 0.370511851 -0.115823875 -0.105501713 -0.421550080 0.117749405
97 98 99 100 101 102
0.189262286 0.406356521 0.165312045 0.151904243 -0.198380742 0.060719199
103 104 105 106 107 108
0.112519114 0.302071539 -0.307441994 0.121659528 -0.417528353 -0.380632867
109 110 111 112 113 114
0.319895519 0.062411087 0.055317791 -0.573387591 0.461964451 -0.434355473
115 116 117 118 119 120
0.309411650 0.066539307 0.107563589 -0.613653513 -0.196508817 0.150890047
121 122 123 124 125 126
-0.162550938 0.059243995 -0.426445506 -0.049481704 -0.161114360 0.397181414
127 128 129 130 131 132
-0.251815763 0.053857860 0.110070994 0.681653430 0.399496961 -0.054596707
133 134 135 136 137 138
0.093830625 -0.186383210 0.556091914 0.297063586 0.277979585 -0.403097066
139 140 141 142 143 144
0.316006390 -0.187740835 -0.250289233 -0.255440347 0.045746637 -0.069572519
145 146 147 148 149 150
0.303614698 -0.328089313 0.077061171 -0.169005361 0.180007311 -0.097691989
151 152 153 154
0.063027530 -0.125157776 -0.072105854 -0.195729667
> postscript(file="/var/fisher/rcomp/tmp/6b37f1353436558.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 = 154
Frequency = 1
lag(myerror, k = 1) myerror
0 -0.036369392 NA
1 0.077436586 -0.036369392
2 0.067222973 0.077436586
3 0.003467029 0.067222973
4 0.060455695 0.003467029
5 -0.164713260 0.060455695
6 0.260009374 -0.164713260
7 0.459599740 0.260009374
8 -0.363882600 0.459599740
9 -0.015479217 -0.363882600
10 -0.030146492 -0.015479217
11 -0.041331197 -0.030146492
12 -0.283478946 -0.041331197
13 -0.368501343 -0.283478946
14 -0.343637005 -0.368501343
15 -0.631498691 -0.343637005
16 -0.357820089 -0.631498691
17 0.135592833 -0.357820089
18 -0.259611582 0.135592833
19 -0.460149395 -0.259611582
20 0.058865761 -0.460149395
21 0.283788477 0.058865761
22 0.329878766 0.283788477
23 0.223463425 0.329878766
24 0.374475206 0.223463425
25 -0.544931964 0.374475206
26 -0.043945514 -0.544931964
27 0.124064012 -0.043945514
28 -0.295524510 0.124064012
29 0.141550631 -0.295524510
30 0.575054789 0.141550631
31 0.500243199 0.575054789
32 0.490638875 0.500243199
33 -0.234710981 0.490638875
34 -0.261730763 -0.234710981
35 0.025885136 -0.261730763
36 0.055551387 0.025885136
37 -0.234862222 0.055551387
38 0.216109322 -0.234862222
39 -0.330623068 0.216109322
40 0.355912561 -0.330623068
41 0.440275893 0.355912561
42 -0.274013906 0.440275893
43 -0.500478819 -0.274013906
44 0.293669423 -0.500478819
45 -0.219915773 0.293669423
46 0.525180735 -0.219915773
47 0.228486049 0.525180735
48 0.110069961 0.228486049
49 -0.041708009 0.110069961
50 -0.323860519 -0.041708009
51 -0.020734860 -0.323860519
52 -0.251003250 -0.020734860
53 0.275009572 -0.251003250
54 0.052965345 0.275009572
55 0.044007245 0.052965345
56 0.377184840 0.044007245
57 0.391643264 0.377184840
58 0.116739415 0.391643264
59 -0.070153441 0.116739415
60 -0.475981251 -0.070153441
61 0.627698826 -0.475981251
62 0.311682984 0.627698826
63 -0.381099497 0.311682984
64 0.596301406 -0.381099497
65 -0.094863760 0.596301406
66 0.411510959 -0.094863760
67 -0.369855320 0.411510959
68 -0.395940044 -0.369855320
69 0.100991482 -0.395940044
70 0.307922880 0.100991482
71 -0.022724001 0.307922880
72 0.111482062 -0.022724001
73 0.303225059 0.111482062
74 0.319869193 0.303225059
75 -0.396935142 0.319869193
76 -0.436307431 -0.396935142
77 0.132113794 -0.436307431
78 -0.138011527 0.132113794
79 -0.408135945 -0.138011527
80 -0.379789488 -0.408135945
81 -0.384293925 -0.379789488
82 0.287987909 -0.384293925
83 -0.053785886 0.287987909
84 0.228624357 -0.053785886
85 0.067976452 0.228624357
86 -0.417749985 0.067976452
87 0.165948504 -0.417749985
88 0.103400106 0.165948504
89 -0.424409866 0.103400106
90 -0.199453721 -0.424409866
91 0.370511851 -0.199453721
92 -0.115823875 0.370511851
93 -0.105501713 -0.115823875
94 -0.421550080 -0.105501713
95 0.117749405 -0.421550080
96 0.189262286 0.117749405
97 0.406356521 0.189262286
98 0.165312045 0.406356521
99 0.151904243 0.165312045
100 -0.198380742 0.151904243
101 0.060719199 -0.198380742
102 0.112519114 0.060719199
103 0.302071539 0.112519114
104 -0.307441994 0.302071539
105 0.121659528 -0.307441994
106 -0.417528353 0.121659528
107 -0.380632867 -0.417528353
108 0.319895519 -0.380632867
109 0.062411087 0.319895519
110 0.055317791 0.062411087
111 -0.573387591 0.055317791
112 0.461964451 -0.573387591
113 -0.434355473 0.461964451
114 0.309411650 -0.434355473
115 0.066539307 0.309411650
116 0.107563589 0.066539307
117 -0.613653513 0.107563589
118 -0.196508817 -0.613653513
119 0.150890047 -0.196508817
120 -0.162550938 0.150890047
121 0.059243995 -0.162550938
122 -0.426445506 0.059243995
123 -0.049481704 -0.426445506
124 -0.161114360 -0.049481704
125 0.397181414 -0.161114360
126 -0.251815763 0.397181414
127 0.053857860 -0.251815763
128 0.110070994 0.053857860
129 0.681653430 0.110070994
130 0.399496961 0.681653430
131 -0.054596707 0.399496961
132 0.093830625 -0.054596707
133 -0.186383210 0.093830625
134 0.556091914 -0.186383210
135 0.297063586 0.556091914
136 0.277979585 0.297063586
137 -0.403097066 0.277979585
138 0.316006390 -0.403097066
139 -0.187740835 0.316006390
140 -0.250289233 -0.187740835
141 -0.255440347 -0.250289233
142 0.045746637 -0.255440347
143 -0.069572519 0.045746637
144 0.303614698 -0.069572519
145 -0.328089313 0.303614698
146 0.077061171 -0.328089313
147 -0.169005361 0.077061171
148 0.180007311 -0.169005361
149 -0.097691989 0.180007311
150 0.063027530 -0.097691989
151 -0.125157776 0.063027530
152 -0.072105854 -0.125157776
153 -0.195729667 -0.072105854
154 NA -0.195729667
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 0.077436586 -0.036369392
[2,] 0.067222973 0.077436586
[3,] 0.003467029 0.067222973
[4,] 0.060455695 0.003467029
[5,] -0.164713260 0.060455695
[6,] 0.260009374 -0.164713260
[7,] 0.459599740 0.260009374
[8,] -0.363882600 0.459599740
[9,] -0.015479217 -0.363882600
[10,] -0.030146492 -0.015479217
[11,] -0.041331197 -0.030146492
[12,] -0.283478946 -0.041331197
[13,] -0.368501343 -0.283478946
[14,] -0.343637005 -0.368501343
[15,] -0.631498691 -0.343637005
[16,] -0.357820089 -0.631498691
[17,] 0.135592833 -0.357820089
[18,] -0.259611582 0.135592833
[19,] -0.460149395 -0.259611582
[20,] 0.058865761 -0.460149395
[21,] 0.283788477 0.058865761
[22,] 0.329878766 0.283788477
[23,] 0.223463425 0.329878766
[24,] 0.374475206 0.223463425
[25,] -0.544931964 0.374475206
[26,] -0.043945514 -0.544931964
[27,] 0.124064012 -0.043945514
[28,] -0.295524510 0.124064012
[29,] 0.141550631 -0.295524510
[30,] 0.575054789 0.141550631
[31,] 0.500243199 0.575054789
[32,] 0.490638875 0.500243199
[33,] -0.234710981 0.490638875
[34,] -0.261730763 -0.234710981
[35,] 0.025885136 -0.261730763
[36,] 0.055551387 0.025885136
[37,] -0.234862222 0.055551387
[38,] 0.216109322 -0.234862222
[39,] -0.330623068 0.216109322
[40,] 0.355912561 -0.330623068
[41,] 0.440275893 0.355912561
[42,] -0.274013906 0.440275893
[43,] -0.500478819 -0.274013906
[44,] 0.293669423 -0.500478819
[45,] -0.219915773 0.293669423
[46,] 0.525180735 -0.219915773
[47,] 0.228486049 0.525180735
[48,] 0.110069961 0.228486049
[49,] -0.041708009 0.110069961
[50,] -0.323860519 -0.041708009
[51,] -0.020734860 -0.323860519
[52,] -0.251003250 -0.020734860
[53,] 0.275009572 -0.251003250
[54,] 0.052965345 0.275009572
[55,] 0.044007245 0.052965345
[56,] 0.377184840 0.044007245
[57,] 0.391643264 0.377184840
[58,] 0.116739415 0.391643264
[59,] -0.070153441 0.116739415
[60,] -0.475981251 -0.070153441
[61,] 0.627698826 -0.475981251
[62,] 0.311682984 0.627698826
[63,] -0.381099497 0.311682984
[64,] 0.596301406 -0.381099497
[65,] -0.094863760 0.596301406
[66,] 0.411510959 -0.094863760
[67,] -0.369855320 0.411510959
[68,] -0.395940044 -0.369855320
[69,] 0.100991482 -0.395940044
[70,] 0.307922880 0.100991482
[71,] -0.022724001 0.307922880
[72,] 0.111482062 -0.022724001
[73,] 0.303225059 0.111482062
[74,] 0.319869193 0.303225059
[75,] -0.396935142 0.319869193
[76,] -0.436307431 -0.396935142
[77,] 0.132113794 -0.436307431
[78,] -0.138011527 0.132113794
[79,] -0.408135945 -0.138011527
[80,] -0.379789488 -0.408135945
[81,] -0.384293925 -0.379789488
[82,] 0.287987909 -0.384293925
[83,] -0.053785886 0.287987909
[84,] 0.228624357 -0.053785886
[85,] 0.067976452 0.228624357
[86,] -0.417749985 0.067976452
[87,] 0.165948504 -0.417749985
[88,] 0.103400106 0.165948504
[89,] -0.424409866 0.103400106
[90,] -0.199453721 -0.424409866
[91,] 0.370511851 -0.199453721
[92,] -0.115823875 0.370511851
[93,] -0.105501713 -0.115823875
[94,] -0.421550080 -0.105501713
[95,] 0.117749405 -0.421550080
[96,] 0.189262286 0.117749405
[97,] 0.406356521 0.189262286
[98,] 0.165312045 0.406356521
[99,] 0.151904243 0.165312045
[100,] -0.198380742 0.151904243
[101,] 0.060719199 -0.198380742
[102,] 0.112519114 0.060719199
[103,] 0.302071539 0.112519114
[104,] -0.307441994 0.302071539
[105,] 0.121659528 -0.307441994
[106,] -0.417528353 0.121659528
[107,] -0.380632867 -0.417528353
[108,] 0.319895519 -0.380632867
[109,] 0.062411087 0.319895519
[110,] 0.055317791 0.062411087
[111,] -0.573387591 0.055317791
[112,] 0.461964451 -0.573387591
[113,] -0.434355473 0.461964451
[114,] 0.309411650 -0.434355473
[115,] 0.066539307 0.309411650
[116,] 0.107563589 0.066539307
[117,] -0.613653513 0.107563589
[118,] -0.196508817 -0.613653513
[119,] 0.150890047 -0.196508817
[120,] -0.162550938 0.150890047
[121,] 0.059243995 -0.162550938
[122,] -0.426445506 0.059243995
[123,] -0.049481704 -0.426445506
[124,] -0.161114360 -0.049481704
[125,] 0.397181414 -0.161114360
[126,] -0.251815763 0.397181414
[127,] 0.053857860 -0.251815763
[128,] 0.110070994 0.053857860
[129,] 0.681653430 0.110070994
[130,] 0.399496961 0.681653430
[131,] -0.054596707 0.399496961
[132,] 0.093830625 -0.054596707
[133,] -0.186383210 0.093830625
[134,] 0.556091914 -0.186383210
[135,] 0.297063586 0.556091914
[136,] 0.277979585 0.297063586
[137,] -0.403097066 0.277979585
[138,] 0.316006390 -0.403097066
[139,] -0.187740835 0.316006390
[140,] -0.250289233 -0.187740835
[141,] -0.255440347 -0.250289233
[142,] 0.045746637 -0.255440347
[143,] -0.069572519 0.045746637
[144,] 0.303614698 -0.069572519
[145,] -0.328089313 0.303614698
[146,] 0.077061171 -0.328089313
[147,] -0.169005361 0.077061171
[148,] 0.180007311 -0.169005361
[149,] -0.097691989 0.180007311
[150,] 0.063027530 -0.097691989
[151,] -0.125157776 0.063027530
[152,] -0.072105854 -0.125157776
[153,] -0.195729667 -0.072105854
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 0.077436586 -0.036369392
2 0.067222973 0.077436586
3 0.003467029 0.067222973
4 0.060455695 0.003467029
5 -0.164713260 0.060455695
6 0.260009374 -0.164713260
7 0.459599740 0.260009374
8 -0.363882600 0.459599740
9 -0.015479217 -0.363882600
10 -0.030146492 -0.015479217
11 -0.041331197 -0.030146492
12 -0.283478946 -0.041331197
13 -0.368501343 -0.283478946
14 -0.343637005 -0.368501343
15 -0.631498691 -0.343637005
16 -0.357820089 -0.631498691
17 0.135592833 -0.357820089
18 -0.259611582 0.135592833
19 -0.460149395 -0.259611582
20 0.058865761 -0.460149395
21 0.283788477 0.058865761
22 0.329878766 0.283788477
23 0.223463425 0.329878766
24 0.374475206 0.223463425
25 -0.544931964 0.374475206
26 -0.043945514 -0.544931964
27 0.124064012 -0.043945514
28 -0.295524510 0.124064012
29 0.141550631 -0.295524510
30 0.575054789 0.141550631
31 0.500243199 0.575054789
32 0.490638875 0.500243199
33 -0.234710981 0.490638875
34 -0.261730763 -0.234710981
35 0.025885136 -0.261730763
36 0.055551387 0.025885136
37 -0.234862222 0.055551387
38 0.216109322 -0.234862222
39 -0.330623068 0.216109322
40 0.355912561 -0.330623068
41 0.440275893 0.355912561
42 -0.274013906 0.440275893
43 -0.500478819 -0.274013906
44 0.293669423 -0.500478819
45 -0.219915773 0.293669423
46 0.525180735 -0.219915773
47 0.228486049 0.525180735
48 0.110069961 0.228486049
49 -0.041708009 0.110069961
50 -0.323860519 -0.041708009
51 -0.020734860 -0.323860519
52 -0.251003250 -0.020734860
53 0.275009572 -0.251003250
54 0.052965345 0.275009572
55 0.044007245 0.052965345
56 0.377184840 0.044007245
57 0.391643264 0.377184840
58 0.116739415 0.391643264
59 -0.070153441 0.116739415
60 -0.475981251 -0.070153441
61 0.627698826 -0.475981251
62 0.311682984 0.627698826
63 -0.381099497 0.311682984
64 0.596301406 -0.381099497
65 -0.094863760 0.596301406
66 0.411510959 -0.094863760
67 -0.369855320 0.411510959
68 -0.395940044 -0.369855320
69 0.100991482 -0.395940044
70 0.307922880 0.100991482
71 -0.022724001 0.307922880
72 0.111482062 -0.022724001
73 0.303225059 0.111482062
74 0.319869193 0.303225059
75 -0.396935142 0.319869193
76 -0.436307431 -0.396935142
77 0.132113794 -0.436307431
78 -0.138011527 0.132113794
79 -0.408135945 -0.138011527
80 -0.379789488 -0.408135945
81 -0.384293925 -0.379789488
82 0.287987909 -0.384293925
83 -0.053785886 0.287987909
84 0.228624357 -0.053785886
85 0.067976452 0.228624357
86 -0.417749985 0.067976452
87 0.165948504 -0.417749985
88 0.103400106 0.165948504
89 -0.424409866 0.103400106
90 -0.199453721 -0.424409866
91 0.370511851 -0.199453721
92 -0.115823875 0.370511851
93 -0.105501713 -0.115823875
94 -0.421550080 -0.105501713
95 0.117749405 -0.421550080
96 0.189262286 0.117749405
97 0.406356521 0.189262286
98 0.165312045 0.406356521
99 0.151904243 0.165312045
100 -0.198380742 0.151904243
101 0.060719199 -0.198380742
102 0.112519114 0.060719199
103 0.302071539 0.112519114
104 -0.307441994 0.302071539
105 0.121659528 -0.307441994
106 -0.417528353 0.121659528
107 -0.380632867 -0.417528353
108 0.319895519 -0.380632867
109 0.062411087 0.319895519
110 0.055317791 0.062411087
111 -0.573387591 0.055317791
112 0.461964451 -0.573387591
113 -0.434355473 0.461964451
114 0.309411650 -0.434355473
115 0.066539307 0.309411650
116 0.107563589 0.066539307
117 -0.613653513 0.107563589
118 -0.196508817 -0.613653513
119 0.150890047 -0.196508817
120 -0.162550938 0.150890047
121 0.059243995 -0.162550938
122 -0.426445506 0.059243995
123 -0.049481704 -0.426445506
124 -0.161114360 -0.049481704
125 0.397181414 -0.161114360
126 -0.251815763 0.397181414
127 0.053857860 -0.251815763
128 0.110070994 0.053857860
129 0.681653430 0.110070994
130 0.399496961 0.681653430
131 -0.054596707 0.399496961
132 0.093830625 -0.054596707
133 -0.186383210 0.093830625
134 0.556091914 -0.186383210
135 0.297063586 0.556091914
136 0.277979585 0.297063586
137 -0.403097066 0.277979585
138 0.316006390 -0.403097066
139 -0.187740835 0.316006390
140 -0.250289233 -0.187740835
141 -0.255440347 -0.250289233
142 0.045746637 -0.255440347
143 -0.069572519 0.045746637
144 0.303614698 -0.069572519
145 -0.328089313 0.303614698
146 0.077061171 -0.328089313
147 -0.169005361 0.077061171
148 0.180007311 -0.169005361
149 -0.097691989 0.180007311
150 0.063027530 -0.097691989
151 -0.125157776 0.063027530
152 -0.072105854 -0.125157776
153 -0.195729667 -0.072105854
> 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/fisher/rcomp/tmp/7eboi1353436558.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/fisher/rcomp/tmp/8urnm1353436558.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/fisher/rcomp/tmp/9k3261353436558.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/fisher/rcomp/tmp/1013t31353436558.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/fisher/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab
> load(file="/var/fisher/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/fisher/rcomp/tmp/11ky201353436558.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/fisher/rcomp/tmp/12y1af1353436558.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/fisher/rcomp/tmp/13njzx1353436558.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/fisher/rcomp/tmp/14notz1353436558.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/fisher/rcomp/tmp/15hx4b1353436558.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/fisher/rcomp/tmp/16gq111353436558.tab")
+ }
>
> try(system("convert tmp/1fe4m1353436558.ps tmp/1fe4m1353436558.png",intern=TRUE))
character(0)
> try(system("convert tmp/2hjhg1353436558.ps tmp/2hjhg1353436558.png",intern=TRUE))
character(0)
> try(system("convert tmp/3raau1353436558.ps tmp/3raau1353436558.png",intern=TRUE))
character(0)
> try(system("convert tmp/4f6xq1353436558.ps tmp/4f6xq1353436558.png",intern=TRUE))
character(0)
> try(system("convert tmp/5zrvp1353436558.ps tmp/5zrvp1353436558.png",intern=TRUE))
character(0)
> try(system("convert tmp/6b37f1353436558.ps tmp/6b37f1353436558.png",intern=TRUE))
character(0)
> try(system("convert tmp/7eboi1353436558.ps tmp/7eboi1353436558.png",intern=TRUE))
character(0)
> try(system("convert tmp/8urnm1353436558.ps tmp/8urnm1353436558.png",intern=TRUE))
character(0)
> try(system("convert tmp/9k3261353436558.ps tmp/9k3261353436558.png",intern=TRUE))
character(0)
> try(system("convert tmp/1013t31353436558.ps tmp/1013t31353436558.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
8.765 1.591 10.381