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(26
+ ,21
+ ,21
+ ,23
+ ,17
+ ,23
+ ,4
+ ,20
+ ,16
+ ,15
+ ,24
+ ,17
+ ,20
+ ,4
+ ,19
+ ,19
+ ,18
+ ,22
+ ,18
+ ,20
+ ,6
+ ,19
+ ,18
+ ,11
+ ,20
+ ,21
+ ,21
+ ,8
+ ,20
+ ,16
+ ,8
+ ,24
+ ,20
+ ,24
+ ,8
+ ,25
+ ,23
+ ,19
+ ,27
+ ,28
+ ,22
+ ,4
+ ,25
+ ,17
+ ,4
+ ,28
+ ,19
+ ,23
+ ,4
+ ,22
+ ,12
+ ,20
+ ,27
+ ,22
+ ,20
+ ,8
+ ,26
+ ,19
+ ,16
+ ,24
+ ,16
+ ,25
+ ,5
+ ,22
+ ,16
+ ,14
+ ,23
+ ,18
+ ,23
+ ,4
+ ,17
+ ,19
+ ,10
+ ,24
+ ,25
+ ,27
+ ,4
+ ,22
+ ,20
+ ,13
+ ,27
+ ,17
+ ,27
+ ,4
+ ,19
+ ,13
+ ,14
+ ,27
+ ,14
+ ,22
+ ,4
+ ,24
+ ,20
+ ,8
+ ,28
+ ,11
+ ,24
+ ,4
+ ,26
+ ,27
+ ,23
+ ,27
+ ,27
+ ,25
+ ,4
+ ,21
+ ,17
+ ,11
+ ,23
+ ,20
+ ,22
+ ,8
+ ,13
+ ,8
+ ,9
+ ,24
+ ,22
+ ,28
+ ,4
+ ,26
+ ,25
+ ,24
+ ,28
+ ,22
+ ,28
+ ,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:162))
> y <- array(NA,dim=c(7,162),dimnames=list(c('I1','I2','I3','E1','E2','E3','A'),1:162))
> 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 = '3'
> 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
I3 I1 I2 E1 E2 E3 A
1 21 26 21 23 17 23 4
2 15 20 16 24 17 20 4
3 18 19 19 22 18 20 6
4 11 19 18 20 21 21 8
5 8 20 16 24 20 24 8
6 19 25 23 27 28 22 4
7 4 25 17 28 19 23 4
8 20 22 12 27 22 20 8
9 16 26 19 24 16 25 5
10 14 22 16 23 18 23 4
11 10 17 19 24 25 27 4
12 13 22 20 27 17 27 4
13 14 19 13 27 14 22 4
14 8 24 20 28 11 24 4
15 23 26 27 27 27 25 4
16 11 21 17 23 20 22 8
17 9 13 8 24 22 28 4
18 24 26 25 28 22 28 4
19 5 20 26 27 21 27 4
20 15 22 13 25 23 25 8
21 5 14 19 19 17 16 4
22 19 21 15 24 24 28 7
23 6 7 5 20 14 21 4
24 13 23 16 28 17 24 4
25 11 17 14 26 23 27 5
26 17 25 24 23 24 14 4
27 17 25 24 23 24 14 4
28 5 19 9 20 8 27 4
29 9 20 19 11 22 20 4
30 15 23 19 24 23 21 4
31 17 22 25 25 25 22 4
32 17 22 19 23 21 21 4
33 20 21 18 18 24 12 15
34 12 15 15 20 15 20 10
35 7 20 12 20 22 24 4
36 16 22 21 24 21 19 8
37 7 18 12 23 25 28 4
38 14 20 15 25 16 23 4
39 24 28 28 28 28 27 4
40 15 22 25 26 23 22 4
41 15 18 19 26 21 27 7
42 10 23 20 23 21 26 4
43 14 20 24 22 26 22 6
44 18 25 26 24 22 21 5
45 12 26 25 21 21 19 4
46 9 15 12 20 18 24 16
47 9 17 12 22 12 19 5
48 8 23 15 20 25 26 12
49 18 21 17 25 17 22 6
50 10 13 14 20 24 28 9
51 17 18 16 22 15 21 9
52 14 19 11 23 13 23 4
53 16 22 20 25 26 28 5
54 10 16 11 23 16 10 4
55 19 24 22 23 24 24 4
56 10 18 20 22 21 21 5
57 14 20 19 24 20 21 4
58 10 24 17 25 14 24 4
59 4 14 21 21 25 24 4
60 19 22 23 12 25 25 5
61 9 24 18 17 20 25 4
62 12 18 17 20 22 23 6
63 16 21 27 23 20 21 4
64 11 23 25 23 26 16 4
65 18 17 19 20 18 17 18
66 11 22 22 28 22 25 4
67 24 24 24 24 24 24 6
68 17 21 20 24 17 23 4
69 18 22 19 24 24 25 4
70 9 16 11 24 20 23 5
71 19 21 22 28 19 28 4
72 18 23 22 25 20 26 4
73 12 22 16 21 15 22 5
74 23 24 20 25 23 19 10
75 22 24 24 25 26 26 5
76 14 16 16 18 22 18 8
77 14 16 16 17 20 18 8
78 16 21 22 26 24 25 5
79 23 26 24 28 26 27 4
80 7 15 16 21 21 12 4
81 10 25 27 27 25 15 4
82 12 18 11 22 13 21 5
83 12 23 21 21 20 23 4
84 12 20 20 25 22 22 4
85 17 17 20 22 23 21 8
86 21 25 27 23 28 24 4
87 16 24 20 26 22 27 5
88 11 17 12 19 20 22 14
89 14 19 8 25 6 28 8
90 13 20 21 21 21 26 8
91 9 15 18 13 20 10 4
92 19 27 24 24 18 19 4
93 13 22 16 25 23 22 6
94 19 23 18 26 20 21 4
95 13 16 20 25 24 24 7
96 13 19 20 25 22 25 7
97 13 25 19 22 21 21 4
98 14 19 17 21 18 20 6
99 12 19 16 23 21 21 4
100 22 26 26 25 23 24 7
101 11 21 15 24 23 23 4
102 5 20 22 21 15 18 4
103 18 24 17 21 21 24 8
104 19 22 23 25 24 24 4
105 14 20 21 22 23 19 4
106 15 18 19 20 21 20 10
107 12 18 14 20 21 18 8
108 19 24 17 23 20 20 6
109 15 24 12 28 11 27 4
110 17 22 24 23 22 23 4
111 8 23 18 28 27 26 4
112 10 22 20 24 25 23 5
113 12 20 16 18 18 17 4
114 12 18 20 20 20 21 6
115 20 25 22 28 24 25 4
116 12 18 12 21 10 23 5
117 12 16 16 21 27 27 7
118 14 20 17 25 21 24 8
119 6 19 22 19 21 20 5
120 10 15 12 18 18 27 8
121 18 19 14 21 15 21 10
122 18 19 23 22 24 24 8
123 7 16 15 24 22 21 5
124 18 17 17 15 14 15 12
125 9 28 28 28 28 25 4
126 17 23 20 26 18 25 5
127 22 25 23 23 26 22 4
128 11 20 13 26 17 24 6
129 15 17 18 20 19 21 4
130 17 23 23 22 22 22 4
131 15 16 19 20 18 23 7
132 22 23 23 23 24 22 7
133 9 11 12 22 15 20 10
134 13 18 16 24 18 23 4
135 20 24 23 23 26 25 5
136 14 23 13 22 11 23 8
137 14 21 22 26 26 22 11
138 12 16 18 23 21 25 7
139 20 24 23 27 23 26 4
140 20 23 20 23 23 22 8
141 8 18 10 21 15 24 6
142 17 20 17 26 22 24 7
143 9 9 18 23 26 25 5
144 18 24 15 21 16 20 4
145 22 25 23 27 20 26 8
146 10 20 17 19 18 21 4
147 13 21 17 23 22 26 8
148 15 25 22 25 16 21 6
149 18 22 20 23 19 22 4
150 18 21 20 22 20 16 9
151 12 21 19 22 19 26 5
152 12 22 18 25 23 28 6
153 20 27 22 25 24 18 4
154 12 24 20 28 25 25 4
155 16 24 22 28 21 23 4
156 16 21 18 20 21 21 5
157 18 18 16 25 23 20 6
158 16 16 16 19 27 25 16
159 13 22 16 25 23 22 6
160 17 20 16 22 18 21 6
161 13 18 17 18 16 16 4
162 17 20 18 20 16 18 4
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) I1 I2 E1 E2 E3
-6.62222 0.55226 0.23152 0.11014 0.01737 -0.03281
A
0.51213
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-11.8282 -1.8666 0.2187 2.8980 6.4657
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -6.62222 3.01163 -2.199 0.0294 *
I1 0.55226 0.11054 4.996 1.56e-06 ***
I2 0.23152 0.10098 2.293 0.0232 *
E1 0.11014 0.11496 0.958 0.3395
E2 0.01737 0.08825 0.197 0.8442
E3 -0.03281 0.09078 -0.361 0.7183
A 0.51213 0.12026 4.258 3.56e-05 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 3.707 on 155 degrees of freedom
Multiple R-squared: 0.3749, Adjusted R-squared: 0.3507
F-statistic: 15.49 on 6 and 155 DF, p-value: 7.026e-14
> 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.9796228 0.040754442 0.020377221
[2,] 0.9888623 0.022275346 0.011137673
[3,] 0.9890226 0.021954863 0.010977431
[4,] 0.9817871 0.036425746 0.018212873
[5,] 0.9826116 0.034776878 0.017388439
[6,] 0.9859697 0.028060641 0.014030321
[7,] 0.9804325 0.039134986 0.019567493
[8,] 0.9736408 0.052718373 0.026359187
[9,] 0.9925422 0.014915605 0.007457803
[10,] 0.9977514 0.004497216 0.002248608
[11,] 0.9960811 0.007837708 0.003918854
[12,] 0.9960811 0.007837837 0.003918918
[13,] 0.9957690 0.008461968 0.004230984
[14,] 0.9956261 0.008747729 0.004373864
[15,] 0.9930773 0.013845344 0.006922672
[16,] 0.9891841 0.021631881 0.010815941
[17,] 0.9851227 0.029754628 0.014877314
[18,] 0.9786440 0.042712087 0.021356043
[19,] 0.9827658 0.034468456 0.017234228
[20,] 0.9842620 0.031476006 0.015738003
[21,] 0.9776742 0.044651557 0.022325778
[22,] 0.9698922 0.060215509 0.030107755
[23,] 0.9636710 0.072657923 0.036328961
[24,] 0.9559777 0.088044590 0.044022295
[25,] 0.9480460 0.103908056 0.051954028
[26,] 0.9575924 0.084815212 0.042407606
[27,] 0.9433185 0.113363001 0.056681501
[28,] 0.9439178 0.112164430 0.056082215
[29,] 0.9336564 0.132687290 0.066343645
[30,] 0.9337445 0.132511016 0.066255508
[31,] 0.9151683 0.169663403 0.084831701
[32,] 0.8974056 0.205188707 0.102594354
[33,] 0.9019690 0.196061914 0.098030957
[34,] 0.8791590 0.241681929 0.120840964
[35,] 0.8516914 0.296617119 0.148308559
[36,] 0.8688438 0.262312473 0.131156236
[37,] 0.8751857 0.249628551 0.124814275
[38,] 0.8493747 0.301250629 0.150625315
[39,] 0.9348447 0.130310646 0.065155323
[40,] 0.9387530 0.122493942 0.061246971
[41,] 0.9246405 0.150718937 0.075359469
[42,] 0.9330624 0.133875207 0.066937603
[43,] 0.9347265 0.130546930 0.065273465
[44,] 0.9197756 0.160448777 0.080224388
[45,] 0.9083954 0.183209264 0.091604632
[46,] 0.9049362 0.190127622 0.095063811
[47,] 0.8921681 0.215663798 0.107831899
[48,] 0.8690718 0.261856389 0.130928195
[49,] 0.8783164 0.243367111 0.121683556
[50,] 0.9105672 0.178865662 0.089432831
[51,] 0.9388930 0.122213945 0.061106973
[52,] 0.9527295 0.094541023 0.047270512
[53,] 0.9403434 0.119313287 0.059656643
[54,] 0.9269702 0.146059632 0.073029816
[55,] 0.9444196 0.111160863 0.055580432
[56,] 0.9333082 0.133383527 0.066691763
[57,] 0.9374642 0.125071665 0.062535832
[58,] 0.9626083 0.074783421 0.037391710
[59,] 0.9608963 0.078207491 0.039103745
[60,] 0.9608157 0.078368600 0.039184300
[61,] 0.9500259 0.099948288 0.049974144
[62,] 0.9545983 0.090803488 0.045401744
[63,] 0.9482638 0.103472301 0.051736151
[64,] 0.9386486 0.122702754 0.061351377
[65,] 0.9430351 0.113929707 0.056964853
[66,] 0.9506358 0.098728499 0.049364249
[67,] 0.9428793 0.114241383 0.057120691
[68,] 0.9349737 0.130052512 0.065026256
[69,] 0.9198190 0.160362052 0.080181026
[70,] 0.9331731 0.133653705 0.066826852
[71,] 0.9248656 0.150268746 0.075134373
[72,] 0.9726784 0.054643282 0.027321641
[73,] 0.9664263 0.067147417 0.033573709
[74,] 0.9635063 0.072987451 0.036493725
[75,] 0.9551162 0.089767662 0.044883831
[76,] 0.9528224 0.094355200 0.047177600
[77,] 0.9506633 0.098673328 0.049336664
[78,] 0.9374616 0.125076747 0.062538373
[79,] 0.9376345 0.124731045 0.062365523
[80,] 0.9279778 0.144044336 0.072022168
[81,] 0.9180074 0.163985158 0.081992579
[82,] 0.9040030 0.191994052 0.095997026
[83,] 0.8836307 0.232738548 0.116369274
[84,] 0.8644289 0.271142177 0.135571088
[85,] 0.8723038 0.255392409 0.127696204
[86,] 0.8459514 0.308097248 0.154048624
[87,] 0.8196385 0.360722966 0.180361483
[88,] 0.8086942 0.382611600 0.191305800
[89,] 0.7772021 0.445595760 0.222797880
[90,] 0.7394562 0.521087679 0.260543839
[91,] 0.7140136 0.571972832 0.285986416
[92,] 0.6815552 0.636889631 0.318444816
[93,] 0.8833047 0.233390646 0.116695323
[94,] 0.8616002 0.276799533 0.138399767
[95,] 0.8633703 0.273259381 0.136629690
[96,] 0.8347798 0.330440371 0.165220186
[97,] 0.8046323 0.390735422 0.195367711
[98,] 0.7740003 0.451999335 0.225999667
[99,] 0.7586143 0.482771448 0.241385724
[100,] 0.7258221 0.548355728 0.274177864
[101,] 0.6879681 0.624063887 0.312031943
[102,] 0.7651922 0.469615518 0.234807759
[103,] 0.8028879 0.394224161 0.197112081
[104,] 0.7789018 0.442196383 0.221098191
[105,] 0.7519811 0.496037716 0.248018858
[106,] 0.7506373 0.498725338 0.249362669
[107,] 0.7118146 0.576370819 0.288185409
[108,] 0.6657736 0.668452822 0.334226411
[109,] 0.6162985 0.767403038 0.383701519
[110,] 0.8702468 0.259506339 0.129753169
[111,] 0.8401019 0.319796255 0.159898127
[112,] 0.8368776 0.326244792 0.163122396
[113,] 0.8087120 0.382576064 0.191288032
[114,] 0.8329344 0.334131120 0.167065560
[115,] 0.8072241 0.385551865 0.192775932
[116,] 0.9946985 0.010602938 0.005301469
[117,] 0.9924432 0.015113503 0.007556751
[118,] 0.9917999 0.016400287 0.008200143
[119,] 0.9875561 0.024887787 0.012443894
[120,] 0.9838976 0.032204847 0.016102423
[121,] 0.9773776 0.045244853 0.022622427
[122,] 0.9694862 0.061027557 0.030513779
[123,] 0.9691830 0.061633977 0.030816989
[124,] 0.9552600 0.089479938 0.044739969
[125,] 0.9380006 0.123998755 0.061999377
[126,] 0.9291762 0.141647506 0.070823753
[127,] 0.9007716 0.198456757 0.099228379
[128,] 0.9452125 0.109574963 0.054787482
[129,] 0.9210674 0.157865278 0.078932639
[130,] 0.9323208 0.135358318 0.067679159
[131,] 0.9187131 0.162573784 0.081286892
[132,] 0.9217104 0.156579213 0.078289606
[133,] 0.8934579 0.213084189 0.106542095
[134,] 0.8476666 0.304666724 0.152333362
[135,] 0.8563397 0.287320652 0.143660326
[136,] 0.9245770 0.150845973 0.075422986
[137,] 0.9400000 0.119999915 0.059999957
[138,] 0.8973863 0.205227317 0.102613658
[139,] 0.8464337 0.307132688 0.153566344
[140,] 0.8475320 0.304935948 0.152467974
[141,] 0.8120922 0.375815671 0.187907836
[142,] 0.6877201 0.624559740 0.312279870
[143,] 0.5305864 0.938827111 0.469413555
> postscript(file="/var/fisher/rcomp/tmp/1db4p1353169270.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/2x3f71353169270.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/3zjah1353169270.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/46ns71353169270.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/5wfni1353169270.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 = 162
Frequency = 1
1 2 3 4 5 6
4.27894078 2.54155461 4.57790612 -3.01384428 -6.42783665 1.70369914
7 8 9 10 11 12
-11.82815797 4.89734820 -0.79729733 0.62822394 -1.40556621 -1.58984404
13 14 15 16 17 18
2.57568244 -7.79869559 4.34113406 -4.16708864 2.43514696 5.87931066
19 20 21 22 23 24
-9.94394988 0.03276585 -4.41997282 4.82529135 3.79316894 -1.42456846
25 26 27 28 29 30
0.05438370 -0.28021762 -0.28021762 -4.45897632 -2.80802515 0.11878639
31 32 33 34 35 36
1.16982690 2.81592954 1.16968104 -0.06306723 -4.04741626 -0.87137136
37 38 39 40 41 42
-3.19421398 1.77872393 3.94319045 -0.90557311 1.35499886 -4.80382501
43 44 45 46 47 48
-1.20532672 -0.10115030 -5.62757537 -5.36213867 -1.11336604 -9.48226768
49 50 51 52 53 54
3.68899080 -0.10879377 3.37327851 3.52947366 0.99478156 0.70766540
55 56 57 58 59 60
3.06314474 -2.60854009 0.82767708 -4.82581240 -5.97982628 4.65101072
61 62 63 64 65 66
-5.24762041 -0.15757088 0.53337244 -5.37635320 -0.34121093 -4.31549891
67 68 69 70 71 72
6.46570552 3.16161856 3.78489719 -0.55761249 4.38729013 2.53021523
73 74 75 76 77 78
-1.64431010 4.08649921 4.89855811 2.21047639 2.35536028 0.91017709
79 80 81 82 83 84
5.00854458 -2.69865211 -8.39992101 1.61413840 -2.89611044 -1.51592459
85 86 87 88 89 90
3.37260159 3.28378452 -0.18320067 -3.43261801 2.24088405 -2.20678761
91 92 93 94 95 96
-0.32880365 0.77337584 -1.73597085 4.18213882 0.18760613 -1.40162410
97 98 99 100 101 102
-2.73070630 1.15109490 0.16727758 2.29324397 -1.78499016 -8.54802936
103 104 105 106 107 108
1.44465775 3.71585595 0.46718999 0.24983551 -0.63390823 3.13477275
109 110 111 112 113 114
1.15190862 1.70655274 -6.99571372 -5.04173366 0.08661845 -0.88301045
115 116 117 118 119 120
2.99298136 1.61048109 0.60057157 -0.78687298 -7.32622597 0.05356383
121 122 123 124 125 126
3.88208282 2.65455872 -3.58405935 3.74916956 -11.12242080 1.37293121
127 128 129 130 131 132
5.17900887 -1.87718696 4.17391705 1.46315322 3.04125947 4.78189368
133 134 135 136 137 138
-0.37974382 1.72711905 3.31755980 -1.04622721 -4.29573302 -0.04414461
139 140 141 142 143 144
3.47403575 2.98170968 -2.49264651 2.59773932 1.75906583 3.91183779
145 146 147 148 149 150
2.92538853 -2.12382441 -2.07060807 -2.69309799 3.65195368 1.53952409
151 152 153 154 155 156
-1.83502440 -3.00218392 1.98924929 -4.00908351 -0.46825772 2.41801285
157 158 159 160 161 162
5.40745495 0.14611726 -1.73597085 3.75302273 1.96154987 4.47083528
> postscript(file="/var/fisher/rcomp/tmp/69sxj1353169270.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 = 162
Frequency = 1
lag(myerror, k = 1) myerror
0 4.27894078 NA
1 2.54155461 4.27894078
2 4.57790612 2.54155461
3 -3.01384428 4.57790612
4 -6.42783665 -3.01384428
5 1.70369914 -6.42783665
6 -11.82815797 1.70369914
7 4.89734820 -11.82815797
8 -0.79729733 4.89734820
9 0.62822394 -0.79729733
10 -1.40556621 0.62822394
11 -1.58984404 -1.40556621
12 2.57568244 -1.58984404
13 -7.79869559 2.57568244
14 4.34113406 -7.79869559
15 -4.16708864 4.34113406
16 2.43514696 -4.16708864
17 5.87931066 2.43514696
18 -9.94394988 5.87931066
19 0.03276585 -9.94394988
20 -4.41997282 0.03276585
21 4.82529135 -4.41997282
22 3.79316894 4.82529135
23 -1.42456846 3.79316894
24 0.05438370 -1.42456846
25 -0.28021762 0.05438370
26 -0.28021762 -0.28021762
27 -4.45897632 -0.28021762
28 -2.80802515 -4.45897632
29 0.11878639 -2.80802515
30 1.16982690 0.11878639
31 2.81592954 1.16982690
32 1.16968104 2.81592954
33 -0.06306723 1.16968104
34 -4.04741626 -0.06306723
35 -0.87137136 -4.04741626
36 -3.19421398 -0.87137136
37 1.77872393 -3.19421398
38 3.94319045 1.77872393
39 -0.90557311 3.94319045
40 1.35499886 -0.90557311
41 -4.80382501 1.35499886
42 -1.20532672 -4.80382501
43 -0.10115030 -1.20532672
44 -5.62757537 -0.10115030
45 -5.36213867 -5.62757537
46 -1.11336604 -5.36213867
47 -9.48226768 -1.11336604
48 3.68899080 -9.48226768
49 -0.10879377 3.68899080
50 3.37327851 -0.10879377
51 3.52947366 3.37327851
52 0.99478156 3.52947366
53 0.70766540 0.99478156
54 3.06314474 0.70766540
55 -2.60854009 3.06314474
56 0.82767708 -2.60854009
57 -4.82581240 0.82767708
58 -5.97982628 -4.82581240
59 4.65101072 -5.97982628
60 -5.24762041 4.65101072
61 -0.15757088 -5.24762041
62 0.53337244 -0.15757088
63 -5.37635320 0.53337244
64 -0.34121093 -5.37635320
65 -4.31549891 -0.34121093
66 6.46570552 -4.31549891
67 3.16161856 6.46570552
68 3.78489719 3.16161856
69 -0.55761249 3.78489719
70 4.38729013 -0.55761249
71 2.53021523 4.38729013
72 -1.64431010 2.53021523
73 4.08649921 -1.64431010
74 4.89855811 4.08649921
75 2.21047639 4.89855811
76 2.35536028 2.21047639
77 0.91017709 2.35536028
78 5.00854458 0.91017709
79 -2.69865211 5.00854458
80 -8.39992101 -2.69865211
81 1.61413840 -8.39992101
82 -2.89611044 1.61413840
83 -1.51592459 -2.89611044
84 3.37260159 -1.51592459
85 3.28378452 3.37260159
86 -0.18320067 3.28378452
87 -3.43261801 -0.18320067
88 2.24088405 -3.43261801
89 -2.20678761 2.24088405
90 -0.32880365 -2.20678761
91 0.77337584 -0.32880365
92 -1.73597085 0.77337584
93 4.18213882 -1.73597085
94 0.18760613 4.18213882
95 -1.40162410 0.18760613
96 -2.73070630 -1.40162410
97 1.15109490 -2.73070630
98 0.16727758 1.15109490
99 2.29324397 0.16727758
100 -1.78499016 2.29324397
101 -8.54802936 -1.78499016
102 1.44465775 -8.54802936
103 3.71585595 1.44465775
104 0.46718999 3.71585595
105 0.24983551 0.46718999
106 -0.63390823 0.24983551
107 3.13477275 -0.63390823
108 1.15190862 3.13477275
109 1.70655274 1.15190862
110 -6.99571372 1.70655274
111 -5.04173366 -6.99571372
112 0.08661845 -5.04173366
113 -0.88301045 0.08661845
114 2.99298136 -0.88301045
115 1.61048109 2.99298136
116 0.60057157 1.61048109
117 -0.78687298 0.60057157
118 -7.32622597 -0.78687298
119 0.05356383 -7.32622597
120 3.88208282 0.05356383
121 2.65455872 3.88208282
122 -3.58405935 2.65455872
123 3.74916956 -3.58405935
124 -11.12242080 3.74916956
125 1.37293121 -11.12242080
126 5.17900887 1.37293121
127 -1.87718696 5.17900887
128 4.17391705 -1.87718696
129 1.46315322 4.17391705
130 3.04125947 1.46315322
131 4.78189368 3.04125947
132 -0.37974382 4.78189368
133 1.72711905 -0.37974382
134 3.31755980 1.72711905
135 -1.04622721 3.31755980
136 -4.29573302 -1.04622721
137 -0.04414461 -4.29573302
138 3.47403575 -0.04414461
139 2.98170968 3.47403575
140 -2.49264651 2.98170968
141 2.59773932 -2.49264651
142 1.75906583 2.59773932
143 3.91183779 1.75906583
144 2.92538853 3.91183779
145 -2.12382441 2.92538853
146 -2.07060807 -2.12382441
147 -2.69309799 -2.07060807
148 3.65195368 -2.69309799
149 1.53952409 3.65195368
150 -1.83502440 1.53952409
151 -3.00218392 -1.83502440
152 1.98924929 -3.00218392
153 -4.00908351 1.98924929
154 -0.46825772 -4.00908351
155 2.41801285 -0.46825772
156 5.40745495 2.41801285
157 0.14611726 5.40745495
158 -1.73597085 0.14611726
159 3.75302273 -1.73597085
160 1.96154987 3.75302273
161 4.47083528 1.96154987
162 NA 4.47083528
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 2.54155461 4.27894078
[2,] 4.57790612 2.54155461
[3,] -3.01384428 4.57790612
[4,] -6.42783665 -3.01384428
[5,] 1.70369914 -6.42783665
[6,] -11.82815797 1.70369914
[7,] 4.89734820 -11.82815797
[8,] -0.79729733 4.89734820
[9,] 0.62822394 -0.79729733
[10,] -1.40556621 0.62822394
[11,] -1.58984404 -1.40556621
[12,] 2.57568244 -1.58984404
[13,] -7.79869559 2.57568244
[14,] 4.34113406 -7.79869559
[15,] -4.16708864 4.34113406
[16,] 2.43514696 -4.16708864
[17,] 5.87931066 2.43514696
[18,] -9.94394988 5.87931066
[19,] 0.03276585 -9.94394988
[20,] -4.41997282 0.03276585
[21,] 4.82529135 -4.41997282
[22,] 3.79316894 4.82529135
[23,] -1.42456846 3.79316894
[24,] 0.05438370 -1.42456846
[25,] -0.28021762 0.05438370
[26,] -0.28021762 -0.28021762
[27,] -4.45897632 -0.28021762
[28,] -2.80802515 -4.45897632
[29,] 0.11878639 -2.80802515
[30,] 1.16982690 0.11878639
[31,] 2.81592954 1.16982690
[32,] 1.16968104 2.81592954
[33,] -0.06306723 1.16968104
[34,] -4.04741626 -0.06306723
[35,] -0.87137136 -4.04741626
[36,] -3.19421398 -0.87137136
[37,] 1.77872393 -3.19421398
[38,] 3.94319045 1.77872393
[39,] -0.90557311 3.94319045
[40,] 1.35499886 -0.90557311
[41,] -4.80382501 1.35499886
[42,] -1.20532672 -4.80382501
[43,] -0.10115030 -1.20532672
[44,] -5.62757537 -0.10115030
[45,] -5.36213867 -5.62757537
[46,] -1.11336604 -5.36213867
[47,] -9.48226768 -1.11336604
[48,] 3.68899080 -9.48226768
[49,] -0.10879377 3.68899080
[50,] 3.37327851 -0.10879377
[51,] 3.52947366 3.37327851
[52,] 0.99478156 3.52947366
[53,] 0.70766540 0.99478156
[54,] 3.06314474 0.70766540
[55,] -2.60854009 3.06314474
[56,] 0.82767708 -2.60854009
[57,] -4.82581240 0.82767708
[58,] -5.97982628 -4.82581240
[59,] 4.65101072 -5.97982628
[60,] -5.24762041 4.65101072
[61,] -0.15757088 -5.24762041
[62,] 0.53337244 -0.15757088
[63,] -5.37635320 0.53337244
[64,] -0.34121093 -5.37635320
[65,] -4.31549891 -0.34121093
[66,] 6.46570552 -4.31549891
[67,] 3.16161856 6.46570552
[68,] 3.78489719 3.16161856
[69,] -0.55761249 3.78489719
[70,] 4.38729013 -0.55761249
[71,] 2.53021523 4.38729013
[72,] -1.64431010 2.53021523
[73,] 4.08649921 -1.64431010
[74,] 4.89855811 4.08649921
[75,] 2.21047639 4.89855811
[76,] 2.35536028 2.21047639
[77,] 0.91017709 2.35536028
[78,] 5.00854458 0.91017709
[79,] -2.69865211 5.00854458
[80,] -8.39992101 -2.69865211
[81,] 1.61413840 -8.39992101
[82,] -2.89611044 1.61413840
[83,] -1.51592459 -2.89611044
[84,] 3.37260159 -1.51592459
[85,] 3.28378452 3.37260159
[86,] -0.18320067 3.28378452
[87,] -3.43261801 -0.18320067
[88,] 2.24088405 -3.43261801
[89,] -2.20678761 2.24088405
[90,] -0.32880365 -2.20678761
[91,] 0.77337584 -0.32880365
[92,] -1.73597085 0.77337584
[93,] 4.18213882 -1.73597085
[94,] 0.18760613 4.18213882
[95,] -1.40162410 0.18760613
[96,] -2.73070630 -1.40162410
[97,] 1.15109490 -2.73070630
[98,] 0.16727758 1.15109490
[99,] 2.29324397 0.16727758
[100,] -1.78499016 2.29324397
[101,] -8.54802936 -1.78499016
[102,] 1.44465775 -8.54802936
[103,] 3.71585595 1.44465775
[104,] 0.46718999 3.71585595
[105,] 0.24983551 0.46718999
[106,] -0.63390823 0.24983551
[107,] 3.13477275 -0.63390823
[108,] 1.15190862 3.13477275
[109,] 1.70655274 1.15190862
[110,] -6.99571372 1.70655274
[111,] -5.04173366 -6.99571372
[112,] 0.08661845 -5.04173366
[113,] -0.88301045 0.08661845
[114,] 2.99298136 -0.88301045
[115,] 1.61048109 2.99298136
[116,] 0.60057157 1.61048109
[117,] -0.78687298 0.60057157
[118,] -7.32622597 -0.78687298
[119,] 0.05356383 -7.32622597
[120,] 3.88208282 0.05356383
[121,] 2.65455872 3.88208282
[122,] -3.58405935 2.65455872
[123,] 3.74916956 -3.58405935
[124,] -11.12242080 3.74916956
[125,] 1.37293121 -11.12242080
[126,] 5.17900887 1.37293121
[127,] -1.87718696 5.17900887
[128,] 4.17391705 -1.87718696
[129,] 1.46315322 4.17391705
[130,] 3.04125947 1.46315322
[131,] 4.78189368 3.04125947
[132,] -0.37974382 4.78189368
[133,] 1.72711905 -0.37974382
[134,] 3.31755980 1.72711905
[135,] -1.04622721 3.31755980
[136,] -4.29573302 -1.04622721
[137,] -0.04414461 -4.29573302
[138,] 3.47403575 -0.04414461
[139,] 2.98170968 3.47403575
[140,] -2.49264651 2.98170968
[141,] 2.59773932 -2.49264651
[142,] 1.75906583 2.59773932
[143,] 3.91183779 1.75906583
[144,] 2.92538853 3.91183779
[145,] -2.12382441 2.92538853
[146,] -2.07060807 -2.12382441
[147,] -2.69309799 -2.07060807
[148,] 3.65195368 -2.69309799
[149,] 1.53952409 3.65195368
[150,] -1.83502440 1.53952409
[151,] -3.00218392 -1.83502440
[152,] 1.98924929 -3.00218392
[153,] -4.00908351 1.98924929
[154,] -0.46825772 -4.00908351
[155,] 2.41801285 -0.46825772
[156,] 5.40745495 2.41801285
[157,] 0.14611726 5.40745495
[158,] -1.73597085 0.14611726
[159,] 3.75302273 -1.73597085
[160,] 1.96154987 3.75302273
[161,] 4.47083528 1.96154987
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 2.54155461 4.27894078
2 4.57790612 2.54155461
3 -3.01384428 4.57790612
4 -6.42783665 -3.01384428
5 1.70369914 -6.42783665
6 -11.82815797 1.70369914
7 4.89734820 -11.82815797
8 -0.79729733 4.89734820
9 0.62822394 -0.79729733
10 -1.40556621 0.62822394
11 -1.58984404 -1.40556621
12 2.57568244 -1.58984404
13 -7.79869559 2.57568244
14 4.34113406 -7.79869559
15 -4.16708864 4.34113406
16 2.43514696 -4.16708864
17 5.87931066 2.43514696
18 -9.94394988 5.87931066
19 0.03276585 -9.94394988
20 -4.41997282 0.03276585
21 4.82529135 -4.41997282
22 3.79316894 4.82529135
23 -1.42456846 3.79316894
24 0.05438370 -1.42456846
25 -0.28021762 0.05438370
26 -0.28021762 -0.28021762
27 -4.45897632 -0.28021762
28 -2.80802515 -4.45897632
29 0.11878639 -2.80802515
30 1.16982690 0.11878639
31 2.81592954 1.16982690
32 1.16968104 2.81592954
33 -0.06306723 1.16968104
34 -4.04741626 -0.06306723
35 -0.87137136 -4.04741626
36 -3.19421398 -0.87137136
37 1.77872393 -3.19421398
38 3.94319045 1.77872393
39 -0.90557311 3.94319045
40 1.35499886 -0.90557311
41 -4.80382501 1.35499886
42 -1.20532672 -4.80382501
43 -0.10115030 -1.20532672
44 -5.62757537 -0.10115030
45 -5.36213867 -5.62757537
46 -1.11336604 -5.36213867
47 -9.48226768 -1.11336604
48 3.68899080 -9.48226768
49 -0.10879377 3.68899080
50 3.37327851 -0.10879377
51 3.52947366 3.37327851
52 0.99478156 3.52947366
53 0.70766540 0.99478156
54 3.06314474 0.70766540
55 -2.60854009 3.06314474
56 0.82767708 -2.60854009
57 -4.82581240 0.82767708
58 -5.97982628 -4.82581240
59 4.65101072 -5.97982628
60 -5.24762041 4.65101072
61 -0.15757088 -5.24762041
62 0.53337244 -0.15757088
63 -5.37635320 0.53337244
64 -0.34121093 -5.37635320
65 -4.31549891 -0.34121093
66 6.46570552 -4.31549891
67 3.16161856 6.46570552
68 3.78489719 3.16161856
69 -0.55761249 3.78489719
70 4.38729013 -0.55761249
71 2.53021523 4.38729013
72 -1.64431010 2.53021523
73 4.08649921 -1.64431010
74 4.89855811 4.08649921
75 2.21047639 4.89855811
76 2.35536028 2.21047639
77 0.91017709 2.35536028
78 5.00854458 0.91017709
79 -2.69865211 5.00854458
80 -8.39992101 -2.69865211
81 1.61413840 -8.39992101
82 -2.89611044 1.61413840
83 -1.51592459 -2.89611044
84 3.37260159 -1.51592459
85 3.28378452 3.37260159
86 -0.18320067 3.28378452
87 -3.43261801 -0.18320067
88 2.24088405 -3.43261801
89 -2.20678761 2.24088405
90 -0.32880365 -2.20678761
91 0.77337584 -0.32880365
92 -1.73597085 0.77337584
93 4.18213882 -1.73597085
94 0.18760613 4.18213882
95 -1.40162410 0.18760613
96 -2.73070630 -1.40162410
97 1.15109490 -2.73070630
98 0.16727758 1.15109490
99 2.29324397 0.16727758
100 -1.78499016 2.29324397
101 -8.54802936 -1.78499016
102 1.44465775 -8.54802936
103 3.71585595 1.44465775
104 0.46718999 3.71585595
105 0.24983551 0.46718999
106 -0.63390823 0.24983551
107 3.13477275 -0.63390823
108 1.15190862 3.13477275
109 1.70655274 1.15190862
110 -6.99571372 1.70655274
111 -5.04173366 -6.99571372
112 0.08661845 -5.04173366
113 -0.88301045 0.08661845
114 2.99298136 -0.88301045
115 1.61048109 2.99298136
116 0.60057157 1.61048109
117 -0.78687298 0.60057157
118 -7.32622597 -0.78687298
119 0.05356383 -7.32622597
120 3.88208282 0.05356383
121 2.65455872 3.88208282
122 -3.58405935 2.65455872
123 3.74916956 -3.58405935
124 -11.12242080 3.74916956
125 1.37293121 -11.12242080
126 5.17900887 1.37293121
127 -1.87718696 5.17900887
128 4.17391705 -1.87718696
129 1.46315322 4.17391705
130 3.04125947 1.46315322
131 4.78189368 3.04125947
132 -0.37974382 4.78189368
133 1.72711905 -0.37974382
134 3.31755980 1.72711905
135 -1.04622721 3.31755980
136 -4.29573302 -1.04622721
137 -0.04414461 -4.29573302
138 3.47403575 -0.04414461
139 2.98170968 3.47403575
140 -2.49264651 2.98170968
141 2.59773932 -2.49264651
142 1.75906583 2.59773932
143 3.91183779 1.75906583
144 2.92538853 3.91183779
145 -2.12382441 2.92538853
146 -2.07060807 -2.12382441
147 -2.69309799 -2.07060807
148 3.65195368 -2.69309799
149 1.53952409 3.65195368
150 -1.83502440 1.53952409
151 -3.00218392 -1.83502440
152 1.98924929 -3.00218392
153 -4.00908351 1.98924929
154 -0.46825772 -4.00908351
155 2.41801285 -0.46825772
156 5.40745495 2.41801285
157 0.14611726 5.40745495
158 -1.73597085 0.14611726
159 3.75302273 -1.73597085
160 1.96154987 3.75302273
161 4.47083528 1.96154987
> 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/7divg1353169270.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/8iede1353169270.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/93fc91353169270.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/10ec5n1353169270.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/11rf6w1353169270.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/128djr1353169270.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/13zzjt1353169270.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/14emaf1353169270.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/159hte1353169270.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/16quve1353169270.tab")
+ }
>
> try(system("convert tmp/1db4p1353169270.ps tmp/1db4p1353169270.png",intern=TRUE))
character(0)
> try(system("convert tmp/2x3f71353169270.ps tmp/2x3f71353169270.png",intern=TRUE))
character(0)
> try(system("convert tmp/3zjah1353169270.ps tmp/3zjah1353169270.png",intern=TRUE))
character(0)
> try(system("convert tmp/46ns71353169270.ps tmp/46ns71353169270.png",intern=TRUE))
character(0)
> try(system("convert tmp/5wfni1353169270.ps tmp/5wfni1353169270.png",intern=TRUE))
character(0)
> try(system("convert tmp/69sxj1353169270.ps tmp/69sxj1353169270.png",intern=TRUE))
character(0)
> try(system("convert tmp/7divg1353169270.ps tmp/7divg1353169270.png",intern=TRUE))
character(0)
> try(system("convert tmp/8iede1353169270.ps tmp/8iede1353169270.png",intern=TRUE))
character(0)
> try(system("convert tmp/93fc91353169270.ps tmp/93fc91353169270.png",intern=TRUE))
character(0)
> try(system("convert tmp/10ec5n1353169270.ps tmp/10ec5n1353169270.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
7.870 1.241 9.125