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
+ ,1901
+ ,61
+ ,17
+ ,56
+ ,84
+ ,4
+ ,21
+ ,51
+ ,2
+ ,2509
+ ,74
+ ,19
+ ,73
+ ,47
+ ,3
+ ,15
+ ,45
+ ,3
+ ,2114
+ ,57
+ ,18
+ ,62
+ ,63
+ ,3
+ ,17
+ ,44
+ ,4
+ ,1331
+ ,50
+ ,15
+ ,42
+ ,28
+ ,3
+ ,20
+ ,42
+ ,5
+ ,1399
+ ,48
+ ,15
+ ,59
+ ,22
+ ,2
+ ,12
+ ,38
+ ,6
+ ,7333
+ ,2
+ ,12
+ ,27
+ ,18
+ ,6
+ ,4
+ ,38
+ ,7
+ ,1170
+ ,31
+ ,20
+ ,78
+ ,27
+ ,5
+ ,11
+ ,35
+ ,8
+ ,1507
+ ,61
+ ,14
+ ,56
+ ,37
+ ,5
+ ,12
+ ,35
+ ,9
+ ,1107
+ ,36
+ ,15
+ ,59
+ ,20
+ ,5
+ ,9
+ ,34
+ ,10
+ ,2051
+ ,46
+ ,13
+ ,51
+ ,67
+ ,5
+ ,14
+ ,33
+ ,11
+ ,1290
+ ,30
+ ,17
+ ,47
+ ,28
+ ,4
+ ,11
+ ,32
+ ,12
+ ,820
+ ,49
+ ,10
+ ,35
+ ,45
+ ,3
+ ,14
+ ,31
+ ,13
+ ,1502
+ ,14
+ ,13
+ ,47
+ ,15
+ ,5
+ ,4
+ ,30
+ ,14
+ ,1451
+ ,12
+ ,12
+ ,47
+ ,23
+ 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al Dummies'
> par1 <- '1'
> #'GNU S' R Code compiled by R2WASP v. 1.0.44 ()
> #Author: Prof. Dr. P. Wessa
> #To cite this work: AUTHOR(S), (YEAR), YOUR SOFTWARE TITLE (vNUMBER) in Free Statistics Software (v$_version), Office for Research Development and Education, URL http://www.wessa.net/rwasp_YOURPAGE.wasp/
> #Source of accompanying publication: Office for Research, Development, and Education
> #Technical description: Write here your technical program description (don't use hard returns!)
> 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
A B C D E F G H I
1 1 1901 61 17 56 84 4 21 51
2 2 2509 74 19 73 47 3 15 45
3 3 2114 57 18 62 63 3 17 44
4 4 1331 50 15 42 28 3 20 42
5 5 1399 48 15 59 22 2 12 38
6 6 7333 2 12 27 18 6 4 38
7 7 1170 31 20 78 27 5 11 35
8 8 1507 61 14 56 37 5 12 35
9 9 1107 36 15 59 20 5 9 34
10 10 2051 46 13 51 67 5 14 33
11 11 1290 30 17 47 28 4 11 32
12 12 820 49 10 35 45 3 14 31
13 13 1502 14 13 47 15 5 4 30
14 14 1451 12 12 47 23 6 7 30
15 15 1178 54 16 55 30 6 9 30
16 16 1514 44 15 54 27 2 14 29
17 17 883 40 15 60 43 5 13 29
18 18 1405 57 15 55 36 5 11 29
19 19 927 29 12 48 28 5 9 28
20 20 1352 32 13 47 28 9 8 27
21 21 1314 28 12 47 22 4 9 27
22 22 1307 40 15 52 27 4 11 27
23 23 1243 54 12 48 24 5 7 26
24 24 1232 56 12 48 52 3 15 26
25 25 1097 19 9 27 12 0 4 26
26 26 1100 67 12 12 24 5 10 26
27 27 1316 25 13 51 10 3 10 26
28 28 903 42 16 58 71 4 13 25
29 29 929 28 15 60 12 2 10 25
30 30 1049 57 13 46 24 5 10 25
31 31 1372 28 12 45 22 11 6 24
32 32 1470 35 13 42 21 5 8 24
33 33 821 10 12 41 13 3 7 24
34 34 1239 30 12 47 28 4 11 24
35 35 1384 23 8 32 19 5 10 24
36 36 820 32 15 56 29 5 11 24
37 37 1462 24 12 42 12 2 10 24
38 38 1202 42 12 41 32 6 8 23
39 39 1091 33 12 47 21 3 10 23
40 40 1228 19 14 47 19 4 5 23
41 41 707 17 15 49 15 8 5 23
42 42 868 49 15 52 14 14 5 23
43 43 1165 30 12 42 34 11 9 22
44 44 1106 3 13 55 8 8 2 22
45 45 1429 56 12 48 27 3 9 22
46 46 1671 37 13 48 31 3 13 22
47 47 1579 26 12 38 21 11 7 22
48 48 774 19 12 48 10 3 5 21
49 49 934 22 13 50 21 4 7 21
50 50 825 53 12 39 19 3 8 21
51 51 1375 35 12 48 27 5 8 21
52 52 968 12 9 36 17 6 5 21
53 53 1156 34 13 49 30 8 5 21
54 54 1374 28 13 39 19 3 10 21
55 55 1224 38 12 41 17 3 5 21
56 56 804 38 15 45 24 5 10 21
57 57 998 45 15 60 36 5 10 21
58 58 1112 15 13 45 16 3 7 21
59 59 1153 35 14 41 16 3 10 20
60 60 613 27 14 52 30 3 9 20
61 61 729 23 12 46 18 5 10 20
62 62 813 33 12 39 26 3 10 20
63 63 912 23 9 32 17 3 5 20
64 64 1178 26 14 52 28 6 8 20
65 65 1201 32 16 54 20 4 6 19
66 66 1165 35 15 51 27 3 7 19
67 67 705 18 13 52 13 13 6 18
68 68 814 18 16 57 10 5 3 17
69 69 1082 41 12 47 29 6 9 17
70 70 885 39 12 45 34 5 11 17
71 71 837 56 12 41 30 3 9 17
72 72 586 35 12 43 16 4 10 16
73 73 913 37 10 31 22 4 9 16
74 74 547 26 15 32 22 7 7 15
75 75 758 33 12 41 31 4 6 15
76 76 848 7 9 27 10 5 6 15
77 77 634 16 10 40 7 7 5 15
78 78 501 13 13 46 10 3 5 15
79 79 849 54 12 32 55 6 8 15
80 80 733 30 13 9 25 8 7 15
81 81 634 9 16 64 9 5 5 15
82 82 1010 35 15 30 31 5 10 15
83 83 778 0 12 46 0 0 0 15
84 84 480 40 12 37 24 3 10 15
85 85 848 22 12 22 14 5 6 15
86 86 714 29 12 20 11 3 6 14
87 87 871 25 12 21 8 8 4 14
88 88 776 17 14 44 9 9 3 14
89 89 815 32 12 24 18 9 7 14
90 90 811 40 12 33 14 4 5 14
91 91 529 24 12 45 27 2 8 13
92 92 642 18 13 35 10 0 0 13
93 93 562 15 8 31 16 3 5 13
94 94 626 17 16 20 13 7 5 13
95 95 636 28 12 13 10 5 5 13
96 96 935 18 11 33 16 3 5 13
97 97 473 16 15 58 11 3 6 12
98 98 836 28 13 26 8 3 5 12
99 99 938 17 12 36 29 7 6 12
100 100 656 25 13 32 12 4 4 12
101 101 566 2 13 34 1 0 0 12
102 102 765 10 12 15 26 5 8 12
103 103 705 9 12 40 5 5 2 11
104 104 558 7 12 37 5 5 2 11
105 105 582 27 14 26 24 6 8 11
106 106 608 25 12 31 19 6 3 11
107 107 567 16 16 47 10 5 3 11
108 108 434 28 8 21 6 6 3 11
109 109 479 7 8 21 61 0 3 11
110 110 488 0 5 9 25 25 1 10
111 111 507 16 9 28 7 2 2 10
112 112 394 10 11 24 10 5 2 10
113 113 504 0 4 15 3 3 1 9
114 114 368 2 8 19 1 1 2 9
115 115 386 5 13 35 38 5 7 9
116 116 451 36 13 45 13 4 4 9
117 117 580 10 12 20 2 0 1 9
118 118 565 43 13 1 8 4 6 9
119 119 510 14 12 29 30 10 3 9
120 120 495 12 12 33 11 6 2 8
121 121 596 15 10 32 69 23 3 8
122 122 412 8 12 11 2 0 2 8
123 123 338 39 5 10 23 6 5 7
124 124 446 10 13 18 8 4 4 7
125 125 418 0 12 41 0 0 0 7
126 126 335 7 6 0 2 0 0 6
127 127 349 10 9 10 4 2 3 6
128 128 308 3 12 24 4 4 2 5
129 129 466 8 15 28 0 0 0 5
130 130 228 0 11 38 9 9 1 5
131 131 428 8 3 4 5 5 3 5
132 132 242 1 8 25 0 0 0 5
133 133 352 0 12 40 0 0 0 5
134 134 244 8 0 0 13 4 4 5
135 135 269 3 9 23 1 0 1 5
136 136 242 0 4 13 0 0 0 4
137 137 291 0 14 6 39 0 2 4
138 138 213 0 9 31 10 0 0 4
139 139 135 0 0 0 1 0 1 3
140 140 210 3 1 3 3 3 3 3
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) B C D E F
1.450e+02 -1.299e-04 -1.552e-01 9.024e-01 -3.527e-01 2.589e-01
G H I
-5.872e-01 -3.546e-01 -3.780e+00
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-21.272 -7.566 -0.521 5.461 50.959
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 1.450e+02 3.590e+00 40.395 < 2e-16 ***
B -1.299e-04 1.861e-03 -0.070 0.944472
C -1.552e-01 8.561e-02 -1.813 0.072087 .
D 9.024e-01 4.007e-01 2.252 0.025981 *
E -3.527e-01 9.417e-02 -3.746 0.000268 ***
F 2.589e-01 8.440e-02 3.067 0.002628 **
G -5.872e-01 2.642e-01 -2.223 0.027961 *
H -3.546e-01 4.814e-01 -0.737 0.462597
I -3.780e+00 2.337e-01 -16.177 < 2e-16 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 10.4 on 131 degrees of freedom
Multiple R-squared: 0.938, Adjusted R-squared: 0.9342
F-statistic: 247.7 on 8 and 131 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.005682773 1.136555e-02 9.943172e-01
[2,] 0.001372556 2.745113e-03 9.986274e-01
[3,] 0.002147752 4.295505e-03 9.978522e-01
[4,] 0.003027413 6.054827e-03 9.969726e-01
[5,] 0.069183586 1.383672e-01 9.308164e-01
[6,] 0.076305822 1.526116e-01 9.236942e-01
[7,] 0.095641018 1.912820e-01 9.043590e-01
[8,] 0.148090696 2.961814e-01 8.519093e-01
[9,] 0.105629259 2.112585e-01 8.943707e-01
[10,] 0.195325113 3.906502e-01 8.046749e-01
[11,] 0.261065395 5.221308e-01 7.389346e-01
[12,] 0.299065580 5.981312e-01 7.009344e-01
[13,] 0.268779673 5.375593e-01 7.312203e-01
[14,] 0.340020101 6.800402e-01 6.599799e-01
[15,] 0.272834682 5.456694e-01 7.271653e-01
[16,] 0.563763452 8.724731e-01 4.362365e-01
[17,] 0.567618221 8.647636e-01 4.323818e-01
[18,] 0.689105294 6.217894e-01 3.108947e-01
[19,] 0.789308885 4.213822e-01 2.106911e-01
[20,] 0.929541158 1.409177e-01 7.045884e-02
[21,] 0.958663923 8.267215e-02 4.133608e-02
[22,] 0.981948234 3.610353e-02 1.805177e-02
[23,] 0.989613379 2.077324e-02 1.038662e-02
[24,] 0.992960234 1.407953e-02 7.039766e-03
[25,] 0.996579638 6.840724e-03 3.420362e-03
[26,] 0.997924725 4.150549e-03 2.075275e-03
[27,] 0.999333017 1.333966e-03 6.669832e-04
[28,] 0.999630490 7.390202e-04 3.695101e-04
[29,] 0.999921084 1.578314e-04 7.891569e-05
[30,] 0.999978217 4.356567e-05 2.178283e-05
[31,] 0.999991030 1.793973e-05 8.969866e-06
[32,] 0.999992745 1.451071e-05 7.255354e-06
[33,] 0.999997940 4.120386e-06 2.060193e-06
[34,] 0.999999668 6.641718e-07 3.320859e-07
[35,] 0.999999787 4.265779e-07 2.132890e-07
[36,] 0.999999818 3.641123e-07 1.820562e-07
[37,] 0.999999974 5.127638e-08 2.563819e-08
[38,] 0.999999992 1.541274e-08 7.706369e-09
[39,] 0.999999998 4.543461e-09 2.271730e-09
[40,] 0.999999999 2.006397e-09 1.003199e-09
[41,] 1.000000000 5.933877e-10 2.966938e-10
[42,] 1.000000000 2.930366e-10 1.465183e-10
[43,] 1.000000000 1.631797e-10 8.158983e-11
[44,] 1.000000000 6.093350e-11 3.046675e-11
[45,] 1.000000000 3.616556e-11 1.808278e-11
[46,] 1.000000000 1.589606e-11 7.948031e-12
[47,] 1.000000000 4.757420e-12 2.378710e-12
[48,] 1.000000000 5.467736e-12 2.733868e-12
[49,] 1.000000000 4.442149e-12 2.221074e-12
[50,] 1.000000000 1.259420e-12 6.297100e-13
[51,] 1.000000000 3.729188e-13 1.864594e-13
[52,] 1.000000000 4.719228e-14 2.359614e-14
[53,] 1.000000000 7.293069e-15 3.646534e-15
[54,] 1.000000000 1.023817e-14 5.119086e-15
[55,] 1.000000000 1.007847e-14 5.039235e-15
[56,] 1.000000000 7.921952e-15 3.960976e-15
[57,] 1.000000000 8.705592e-15 4.352796e-15
[58,] 1.000000000 1.258764e-14 6.293819e-15
[59,] 1.000000000 2.512972e-14 1.256486e-14
[60,] 1.000000000 4.250533e-14 2.125267e-14
[61,] 1.000000000 6.802475e-14 3.401238e-14
[62,] 1.000000000 8.361297e-14 4.180648e-14
[63,] 1.000000000 8.367746e-15 4.183873e-15
[64,] 1.000000000 6.854092e-16 3.427046e-16
[65,] 1.000000000 2.145943e-16 1.072972e-16
[66,] 1.000000000 4.694105e-17 2.347052e-17
[67,] 1.000000000 1.471453e-17 7.357266e-18
[68,] 1.000000000 1.212623e-18 6.063114e-19
[69,] 1.000000000 2.833316e-19 1.416658e-19
[70,] 1.000000000 4.490875e-19 2.245438e-19
[71,] 1.000000000 9.744220e-19 4.872110e-19
[72,] 1.000000000 1.365365e-18 6.826824e-19
[73,] 1.000000000 2.946965e-18 1.473482e-18
[74,] 1.000000000 8.413611e-18 4.206805e-18
[75,] 1.000000000 5.839358e-18 2.919679e-18
[76,] 1.000000000 5.910752e-18 2.955376e-18
[77,] 1.000000000 9.318089e-18 4.659044e-18
[78,] 1.000000000 2.118527e-17 1.059263e-17
[79,] 1.000000000 4.460126e-17 2.230063e-17
[80,] 1.000000000 2.240990e-17 1.120495e-17
[81,] 1.000000000 4.589926e-18 2.294963e-18
[82,] 1.000000000 3.073717e-18 1.536859e-18
[83,] 1.000000000 5.828357e-18 2.914179e-18
[84,] 1.000000000 1.032055e-17 5.160277e-18
[85,] 1.000000000 3.184308e-17 1.592154e-17
[86,] 1.000000000 1.751566e-17 8.757830e-18
[87,] 1.000000000 3.489143e-17 1.744571e-17
[88,] 1.000000000 1.175823e-16 5.879114e-17
[89,] 1.000000000 2.478341e-16 1.239170e-16
[90,] 1.000000000 9.871025e-16 4.935513e-16
[91,] 1.000000000 4.529181e-15 2.264591e-15
[92,] 1.000000000 7.186598e-15 3.593299e-15
[93,] 1.000000000 1.269404e-14 6.347019e-15
[94,] 1.000000000 3.002802e-14 1.501401e-14
[95,] 1.000000000 7.263564e-14 3.631782e-14
[96,] 1.000000000 3.351747e-13 1.675873e-13
[97,] 1.000000000 9.021679e-13 4.510840e-13
[98,] 1.000000000 4.171081e-12 2.085541e-12
[99,] 1.000000000 1.276928e-11 6.384640e-12
[100,] 1.000000000 4.364409e-11 2.182205e-11
[101,] 1.000000000 2.028699e-10 1.014349e-10
[102,] 1.000000000 2.691941e-10 1.345971e-10
[103,] 1.000000000 5.250531e-10 2.625266e-10
[104,] 1.000000000 1.460217e-10 7.301086e-11
[105,] 1.000000000 3.097174e-10 1.548587e-10
[106,] 0.999999999 1.735099e-09 8.675495e-10
[107,] 1.000000000 3.739370e-10 1.869685e-10
[108,] 0.999999999 2.345013e-09 1.172506e-09
[109,] 0.999999992 1.619956e-08 8.099781e-09
[110,] 0.999999963 7.416545e-08 3.708273e-08
[111,] 0.999999865 2.691875e-07 1.345937e-07
[112,] 0.999999535 9.302568e-07 4.651284e-07
[113,] 0.999997034 5.931148e-06 2.965574e-06
[114,] 0.999982229 3.554189e-05 1.777094e-05
[115,] 0.999854523 2.909540e-04 1.454770e-04
[116,] 0.998892346 2.215309e-03 1.107654e-03
[117,] 0.997282273 5.435453e-03 2.717727e-03
> postscript(file="/var/wessaorg/rcomp/tmp/1huw01352124347.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> plot(x[,1], type='l', main='Actuals and Interpolation', ylab='value of Actuals and Interpolation (dots)', xlab='time or index')
> points(x[,1]-mysum$resid)
> grid()
> dev.off()
null device
1
> postscript(file="/var/wessaorg/rcomp/tmp/28o5a1352124347.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> plot(mysum$resid, type='b', pch=19, main='Residuals', ylab='value of Residuals', xlab='time or index')
> grid()
> dev.off()
null device
1
> postscript(file="/var/wessaorg/rcomp/tmp/3xs2l1352124347.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> hist(mysum$resid, main='Residual Histogram', xlab='values of Residuals')
> grid()
> dev.off()
null device
1
> postscript(file="/var/wessaorg/rcomp/tmp/4fs0a1352124347.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> densityplot(~mysum$resid,col='black',main='Residual Density Plot', xlab='values of Residuals')
> dev.off()
null device
1
> postscript(file="/var/wessaorg/rcomp/tmp/5tszh1352124347.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 = 140
Frequency = 1
1 2 3 4 5 6
50.9586460 42.4282734 30.5476074 28.5752419 18.2775929 4.8741067
7 8 9 10 11 12
8.5705082 9.6917407 6.4709977 -6.0444294 -7.9834296 -9.7151464
13 14 15 16 17 18
-10.9209977 -9.7554561 -4.1612935 -7.6995715 -8.0209424 -4.9750332
19 20 21 22 23 24
-10.5644639 -12.0848651 -11.8364845 -10.5030101 -9.8769048 -14.1530308
25 26 27 28 29 30
-18.9228947 -16.5115869 -6.6999258 -21.2720079 -7.7998528 -6.7605424
31 32 33 34 35 36
-10.8289369 -13.2450179 -15.1187572 -10.7204366 -9.9074320 -7.6686318
37 38 39 40 41 42
-7.7738256 -11.6840443 -8.1840506 -11.8126892 -8.0035966 2.8250460
43 44 45 46 47 48
-9.2064260 -6.2362346 -3.9050290 -6.3423274 -4.5286699 -7.5322019
49 50 51 52 53 54
-7.7935818 -4.6877926 -4.1326113 -6.1697376 -2.9449183 -4.6905187
55 56 57 58 59 60
-1.8053264 -1.0204771 3.2759910 -0.9136562 -1.8331809 -2.2438779
61 62 63 64 65 66
2.4739202 -0.6770960 -0.4221182 3.5988651 0.8409090 0.1016078
67 68 69 70 71 72
5.9211667 -2.7732584 -0.2889695 -1.5026510 -0.1289730 -0.9305617
73 74 75 76 77 78
-3.9133866 -11.5557128 -8.0058955 -7.2382623 0.4104431 -2.7885939
79 80 81 82 83 84
-8.2375388 -11.4079626 4.6829038 -5.2440227 0.1854450 3.2771826
85 86 87 88 89 90
-1.4158715 -4.2301286 -0.4747920 5.5526038 2.7253347 5.5314894
91 92 93 94 95 96
0.9879364 -2.9694331 2.6370619 -4.0178288 -0.5662949 4.1495530
97 98 99 100 101 102
7.8564072 1.7058256 2.7084524 4.5301943 1.7335988 -2.4964258
103 104 105 106 107 108
6.6865363 6.2987899 2.5187159 6.3010332 9.6752387 12.1915225
109 110 111 112 113 114
-7.8228759 10.0748143 8.1623521 5.9855650 5.0922508 3.8844862
115 116 117 118 119 120
1.0285393 15.1969346 3.6964726 4.7820265 8.8159599 9.3490850
121 122 123 124 125 126
7.6029052 1.7640089 8.9013975 3.3702067 10.1328141 -1.1368470
127 128 129 130 131 132
2.8714269 2.0499194 0.5278290 10.7013214 7.5914872 7.6704993
133 134 135 136 137 138
10.2109549 9.5604119 9.4724485 7.1117519 -12.7608382 8.3566257
139 140
5.4374123 9.0217977
> postscript(file="/var/wessaorg/rcomp/tmp/6masy1352124347.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 = 140
Frequency = 1
lag(myerror, k = 1) myerror
0 50.9586460 NA
1 42.4282734 50.9586460
2 30.5476074 42.4282734
3 28.5752419 30.5476074
4 18.2775929 28.5752419
5 4.8741067 18.2775929
6 8.5705082 4.8741067
7 9.6917407 8.5705082
8 6.4709977 9.6917407
9 -6.0444294 6.4709977
10 -7.9834296 -6.0444294
11 -9.7151464 -7.9834296
12 -10.9209977 -9.7151464
13 -9.7554561 -10.9209977
14 -4.1612935 -9.7554561
15 -7.6995715 -4.1612935
16 -8.0209424 -7.6995715
17 -4.9750332 -8.0209424
18 -10.5644639 -4.9750332
19 -12.0848651 -10.5644639
20 -11.8364845 -12.0848651
21 -10.5030101 -11.8364845
22 -9.8769048 -10.5030101
23 -14.1530308 -9.8769048
24 -18.9228947 -14.1530308
25 -16.5115869 -18.9228947
26 -6.6999258 -16.5115869
27 -21.2720079 -6.6999258
28 -7.7998528 -21.2720079
29 -6.7605424 -7.7998528
30 -10.8289369 -6.7605424
31 -13.2450179 -10.8289369
32 -15.1187572 -13.2450179
33 -10.7204366 -15.1187572
34 -9.9074320 -10.7204366
35 -7.6686318 -9.9074320
36 -7.7738256 -7.6686318
37 -11.6840443 -7.7738256
38 -8.1840506 -11.6840443
39 -11.8126892 -8.1840506
40 -8.0035966 -11.8126892
41 2.8250460 -8.0035966
42 -9.2064260 2.8250460
43 -6.2362346 -9.2064260
44 -3.9050290 -6.2362346
45 -6.3423274 -3.9050290
46 -4.5286699 -6.3423274
47 -7.5322019 -4.5286699
48 -7.7935818 -7.5322019
49 -4.6877926 -7.7935818
50 -4.1326113 -4.6877926
51 -6.1697376 -4.1326113
52 -2.9449183 -6.1697376
53 -4.6905187 -2.9449183
54 -1.8053264 -4.6905187
55 -1.0204771 -1.8053264
56 3.2759910 -1.0204771
57 -0.9136562 3.2759910
58 -1.8331809 -0.9136562
59 -2.2438779 -1.8331809
60 2.4739202 -2.2438779
61 -0.6770960 2.4739202
62 -0.4221182 -0.6770960
63 3.5988651 -0.4221182
64 0.8409090 3.5988651
65 0.1016078 0.8409090
66 5.9211667 0.1016078
67 -2.7732584 5.9211667
68 -0.2889695 -2.7732584
69 -1.5026510 -0.2889695
70 -0.1289730 -1.5026510
71 -0.9305617 -0.1289730
72 -3.9133866 -0.9305617
73 -11.5557128 -3.9133866
74 -8.0058955 -11.5557128
75 -7.2382623 -8.0058955
76 0.4104431 -7.2382623
77 -2.7885939 0.4104431
78 -8.2375388 -2.7885939
79 -11.4079626 -8.2375388
80 4.6829038 -11.4079626
81 -5.2440227 4.6829038
82 0.1854450 -5.2440227
83 3.2771826 0.1854450
84 -1.4158715 3.2771826
85 -4.2301286 -1.4158715
86 -0.4747920 -4.2301286
87 5.5526038 -0.4747920
88 2.7253347 5.5526038
89 5.5314894 2.7253347
90 0.9879364 5.5314894
91 -2.9694331 0.9879364
92 2.6370619 -2.9694331
93 -4.0178288 2.6370619
94 -0.5662949 -4.0178288
95 4.1495530 -0.5662949
96 7.8564072 4.1495530
97 1.7058256 7.8564072
98 2.7084524 1.7058256
99 4.5301943 2.7084524
100 1.7335988 4.5301943
101 -2.4964258 1.7335988
102 6.6865363 -2.4964258
103 6.2987899 6.6865363
104 2.5187159 6.2987899
105 6.3010332 2.5187159
106 9.6752387 6.3010332
107 12.1915225 9.6752387
108 -7.8228759 12.1915225
109 10.0748143 -7.8228759
110 8.1623521 10.0748143
111 5.9855650 8.1623521
112 5.0922508 5.9855650
113 3.8844862 5.0922508
114 1.0285393 3.8844862
115 15.1969346 1.0285393
116 3.6964726 15.1969346
117 4.7820265 3.6964726
118 8.8159599 4.7820265
119 9.3490850 8.8159599
120 7.6029052 9.3490850
121 1.7640089 7.6029052
122 8.9013975 1.7640089
123 3.3702067 8.9013975
124 10.1328141 3.3702067
125 -1.1368470 10.1328141
126 2.8714269 -1.1368470
127 2.0499194 2.8714269
128 0.5278290 2.0499194
129 10.7013214 0.5278290
130 7.5914872 10.7013214
131 7.6704993 7.5914872
132 10.2109549 7.6704993
133 9.5604119 10.2109549
134 9.4724485 9.5604119
135 7.1117519 9.4724485
136 -12.7608382 7.1117519
137 8.3566257 -12.7608382
138 5.4374123 8.3566257
139 9.0217977 5.4374123
140 NA 9.0217977
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 42.4282734 50.9586460
[2,] 30.5476074 42.4282734
[3,] 28.5752419 30.5476074
[4,] 18.2775929 28.5752419
[5,] 4.8741067 18.2775929
[6,] 8.5705082 4.8741067
[7,] 9.6917407 8.5705082
[8,] 6.4709977 9.6917407
[9,] -6.0444294 6.4709977
[10,] -7.9834296 -6.0444294
[11,] -9.7151464 -7.9834296
[12,] -10.9209977 -9.7151464
[13,] -9.7554561 -10.9209977
[14,] -4.1612935 -9.7554561
[15,] -7.6995715 -4.1612935
[16,] -8.0209424 -7.6995715
[17,] -4.9750332 -8.0209424
[18,] -10.5644639 -4.9750332
[19,] -12.0848651 -10.5644639
[20,] -11.8364845 -12.0848651
[21,] -10.5030101 -11.8364845
[22,] -9.8769048 -10.5030101
[23,] -14.1530308 -9.8769048
[24,] -18.9228947 -14.1530308
[25,] -16.5115869 -18.9228947
[26,] -6.6999258 -16.5115869
[27,] -21.2720079 -6.6999258
[28,] -7.7998528 -21.2720079
[29,] -6.7605424 -7.7998528
[30,] -10.8289369 -6.7605424
[31,] -13.2450179 -10.8289369
[32,] -15.1187572 -13.2450179
[33,] -10.7204366 -15.1187572
[34,] -9.9074320 -10.7204366
[35,] -7.6686318 -9.9074320
[36,] -7.7738256 -7.6686318
[37,] -11.6840443 -7.7738256
[38,] -8.1840506 -11.6840443
[39,] -11.8126892 -8.1840506
[40,] -8.0035966 -11.8126892
[41,] 2.8250460 -8.0035966
[42,] -9.2064260 2.8250460
[43,] -6.2362346 -9.2064260
[44,] -3.9050290 -6.2362346
[45,] -6.3423274 -3.9050290
[46,] -4.5286699 -6.3423274
[47,] -7.5322019 -4.5286699
[48,] -7.7935818 -7.5322019
[49,] -4.6877926 -7.7935818
[50,] -4.1326113 -4.6877926
[51,] -6.1697376 -4.1326113
[52,] -2.9449183 -6.1697376
[53,] -4.6905187 -2.9449183
[54,] -1.8053264 -4.6905187
[55,] -1.0204771 -1.8053264
[56,] 3.2759910 -1.0204771
[57,] -0.9136562 3.2759910
[58,] -1.8331809 -0.9136562
[59,] -2.2438779 -1.8331809
[60,] 2.4739202 -2.2438779
[61,] -0.6770960 2.4739202
[62,] -0.4221182 -0.6770960
[63,] 3.5988651 -0.4221182
[64,] 0.8409090 3.5988651
[65,] 0.1016078 0.8409090
[66,] 5.9211667 0.1016078
[67,] -2.7732584 5.9211667
[68,] -0.2889695 -2.7732584
[69,] -1.5026510 -0.2889695
[70,] -0.1289730 -1.5026510
[71,] -0.9305617 -0.1289730
[72,] -3.9133866 -0.9305617
[73,] -11.5557128 -3.9133866
[74,] -8.0058955 -11.5557128
[75,] -7.2382623 -8.0058955
[76,] 0.4104431 -7.2382623
[77,] -2.7885939 0.4104431
[78,] -8.2375388 -2.7885939
[79,] -11.4079626 -8.2375388
[80,] 4.6829038 -11.4079626
[81,] -5.2440227 4.6829038
[82,] 0.1854450 -5.2440227
[83,] 3.2771826 0.1854450
[84,] -1.4158715 3.2771826
[85,] -4.2301286 -1.4158715
[86,] -0.4747920 -4.2301286
[87,] 5.5526038 -0.4747920
[88,] 2.7253347 5.5526038
[89,] 5.5314894 2.7253347
[90,] 0.9879364 5.5314894
[91,] -2.9694331 0.9879364
[92,] 2.6370619 -2.9694331
[93,] -4.0178288 2.6370619
[94,] -0.5662949 -4.0178288
[95,] 4.1495530 -0.5662949
[96,] 7.8564072 4.1495530
[97,] 1.7058256 7.8564072
[98,] 2.7084524 1.7058256
[99,] 4.5301943 2.7084524
[100,] 1.7335988 4.5301943
[101,] -2.4964258 1.7335988
[102,] 6.6865363 -2.4964258
[103,] 6.2987899 6.6865363
[104,] 2.5187159 6.2987899
[105,] 6.3010332 2.5187159
[106,] 9.6752387 6.3010332
[107,] 12.1915225 9.6752387
[108,] -7.8228759 12.1915225
[109,] 10.0748143 -7.8228759
[110,] 8.1623521 10.0748143
[111,] 5.9855650 8.1623521
[112,] 5.0922508 5.9855650
[113,] 3.8844862 5.0922508
[114,] 1.0285393 3.8844862
[115,] 15.1969346 1.0285393
[116,] 3.6964726 15.1969346
[117,] 4.7820265 3.6964726
[118,] 8.8159599 4.7820265
[119,] 9.3490850 8.8159599
[120,] 7.6029052 9.3490850
[121,] 1.7640089 7.6029052
[122,] 8.9013975 1.7640089
[123,] 3.3702067 8.9013975
[124,] 10.1328141 3.3702067
[125,] -1.1368470 10.1328141
[126,] 2.8714269 -1.1368470
[127,] 2.0499194 2.8714269
[128,] 0.5278290 2.0499194
[129,] 10.7013214 0.5278290
[130,] 7.5914872 10.7013214
[131,] 7.6704993 7.5914872
[132,] 10.2109549 7.6704993
[133,] 9.5604119 10.2109549
[134,] 9.4724485 9.5604119
[135,] 7.1117519 9.4724485
[136,] -12.7608382 7.1117519
[137,] 8.3566257 -12.7608382
[138,] 5.4374123 8.3566257
[139,] 9.0217977 5.4374123
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 42.4282734 50.9586460
2 30.5476074 42.4282734
3 28.5752419 30.5476074
4 18.2775929 28.5752419
5 4.8741067 18.2775929
6 8.5705082 4.8741067
7 9.6917407 8.5705082
8 6.4709977 9.6917407
9 -6.0444294 6.4709977
10 -7.9834296 -6.0444294
11 -9.7151464 -7.9834296
12 -10.9209977 -9.7151464
13 -9.7554561 -10.9209977
14 -4.1612935 -9.7554561
15 -7.6995715 -4.1612935
16 -8.0209424 -7.6995715
17 -4.9750332 -8.0209424
18 -10.5644639 -4.9750332
19 -12.0848651 -10.5644639
20 -11.8364845 -12.0848651
21 -10.5030101 -11.8364845
22 -9.8769048 -10.5030101
23 -14.1530308 -9.8769048
24 -18.9228947 -14.1530308
25 -16.5115869 -18.9228947
26 -6.6999258 -16.5115869
27 -21.2720079 -6.6999258
28 -7.7998528 -21.2720079
29 -6.7605424 -7.7998528
30 -10.8289369 -6.7605424
31 -13.2450179 -10.8289369
32 -15.1187572 -13.2450179
33 -10.7204366 -15.1187572
34 -9.9074320 -10.7204366
35 -7.6686318 -9.9074320
36 -7.7738256 -7.6686318
37 -11.6840443 -7.7738256
38 -8.1840506 -11.6840443
39 -11.8126892 -8.1840506
40 -8.0035966 -11.8126892
41 2.8250460 -8.0035966
42 -9.2064260 2.8250460
43 -6.2362346 -9.2064260
44 -3.9050290 -6.2362346
45 -6.3423274 -3.9050290
46 -4.5286699 -6.3423274
47 -7.5322019 -4.5286699
48 -7.7935818 -7.5322019
49 -4.6877926 -7.7935818
50 -4.1326113 -4.6877926
51 -6.1697376 -4.1326113
52 -2.9449183 -6.1697376
53 -4.6905187 -2.9449183
54 -1.8053264 -4.6905187
55 -1.0204771 -1.8053264
56 3.2759910 -1.0204771
57 -0.9136562 3.2759910
58 -1.8331809 -0.9136562
59 -2.2438779 -1.8331809
60 2.4739202 -2.2438779
61 -0.6770960 2.4739202
62 -0.4221182 -0.6770960
63 3.5988651 -0.4221182
64 0.8409090 3.5988651
65 0.1016078 0.8409090
66 5.9211667 0.1016078
67 -2.7732584 5.9211667
68 -0.2889695 -2.7732584
69 -1.5026510 -0.2889695
70 -0.1289730 -1.5026510
71 -0.9305617 -0.1289730
72 -3.9133866 -0.9305617
73 -11.5557128 -3.9133866
74 -8.0058955 -11.5557128
75 -7.2382623 -8.0058955
76 0.4104431 -7.2382623
77 -2.7885939 0.4104431
78 -8.2375388 -2.7885939
79 -11.4079626 -8.2375388
80 4.6829038 -11.4079626
81 -5.2440227 4.6829038
82 0.1854450 -5.2440227
83 3.2771826 0.1854450
84 -1.4158715 3.2771826
85 -4.2301286 -1.4158715
86 -0.4747920 -4.2301286
87 5.5526038 -0.4747920
88 2.7253347 5.5526038
89 5.5314894 2.7253347
90 0.9879364 5.5314894
91 -2.9694331 0.9879364
92 2.6370619 -2.9694331
93 -4.0178288 2.6370619
94 -0.5662949 -4.0178288
95 4.1495530 -0.5662949
96 7.8564072 4.1495530
97 1.7058256 7.8564072
98 2.7084524 1.7058256
99 4.5301943 2.7084524
100 1.7335988 4.5301943
101 -2.4964258 1.7335988
102 6.6865363 -2.4964258
103 6.2987899 6.6865363
104 2.5187159 6.2987899
105 6.3010332 2.5187159
106 9.6752387 6.3010332
107 12.1915225 9.6752387
108 -7.8228759 12.1915225
109 10.0748143 -7.8228759
110 8.1623521 10.0748143
111 5.9855650 8.1623521
112 5.0922508 5.9855650
113 3.8844862 5.0922508
114 1.0285393 3.8844862
115 15.1969346 1.0285393
116 3.6964726 15.1969346
117 4.7820265 3.6964726
118 8.8159599 4.7820265
119 9.3490850 8.8159599
120 7.6029052 9.3490850
121 1.7640089 7.6029052
122 8.9013975 1.7640089
123 3.3702067 8.9013975
124 10.1328141 3.3702067
125 -1.1368470 10.1328141
126 2.8714269 -1.1368470
127 2.0499194 2.8714269
128 0.5278290 2.0499194
129 10.7013214 0.5278290
130 7.5914872 10.7013214
131 7.6704993 7.5914872
132 10.2109549 7.6704993
133 9.5604119 10.2109549
134 9.4724485 9.5604119
135 7.1117519 9.4724485
136 -12.7608382 7.1117519
137 8.3566257 -12.7608382
138 5.4374123 8.3566257
139 9.0217977 5.4374123
> plot(z,main=paste('Residual Lag plot, lowess, and regression line'), ylab='values of Residuals', xlab='lagged values of Residuals')
> lines(lowess(z))
> abline(lm(z))
> grid()
> dev.off()
null device
1
> postscript(file="/var/wessaorg/rcomp/tmp/7rzw41352124347.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> acf(mysum$resid, lag.max=length(mysum$resid)/2, main='Residual Autocorrelation Function')
> grid()
> dev.off()
null device
1
> postscript(file="/var/wessaorg/rcomp/tmp/8s0d71352124347.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> pacf(mysum$resid, lag.max=length(mysum$resid)/2, main='Residual Partial Autocorrelation Function')
> grid()
> dev.off()
null device
1
> postscript(file="/var/wessaorg/rcomp/tmp/9aodw1352124347.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> opar <- par(mfrow = c(2,2), oma = c(0, 0, 1.1, 0))
> plot(mylm, las = 1, sub='Residual Diagnostics')
> par(opar)
> dev.off()
null device
1
> if (n > n25) {
+ postscript(file="/var/wessaorg/rcomp/tmp/105bge1352124347.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
+ plot(kp3:nmkm3,gqarr[,2], main='Goldfeld-Quandt test',ylab='2-sided p-value',xlab='breakpoint')
+ grid()
+ dev.off()
+ }
null device
1
>
> #Note: the /var/wessaorg/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab
> load(file="/var/wessaorg/rcomp/createtable")
>
> a<-table.start()
> a<-table.row.start(a)
> a<-table.element(a, 'Multiple Linear Regression - Estimated Regression Equation', 1, TRUE)
> a<-table.row.end(a)
> myeq <- colnames(x)[1]
> myeq <- paste(myeq, '[t] = ', sep='')
> for (i in 1:k){
+ if (mysum$coefficients[i,1] > 0) myeq <- paste(myeq, '+', '')
+ myeq <- paste(myeq, mysum$coefficients[i,1], sep=' ')
+ if (rownames(mysum$coefficients)[i] != '(Intercept)') {
+ myeq <- paste(myeq, rownames(mysum$coefficients)[i], sep='')
+ if (rownames(mysum$coefficients)[i] != 't') myeq <- paste(myeq, '[t]', sep='')
+ }
+ }
> myeq <- paste(myeq, ' + e[t]')
> a<-table.row.start(a)
> a<-table.element(a, myeq)
> a<-table.row.end(a)
> a<-table.end(a)
> table.save(a,file="/var/wessaorg/rcomp/tmp/11ozvk1352124347.tab")
> a<-table.start()
> a<-table.row.start(a)
> a<-table.element(a,hyperlink('http://www.xycoon.com/ols1.htm','Multiple Linear Regression - Ordinary Least Squares',''), 6, TRUE)
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a,'Variable',header=TRUE)
> a<-table.element(a,'Parameter',header=TRUE)
> a<-table.element(a,'S.D.',header=TRUE)
> a<-table.element(a,'T-STAT
H0: parameter = 0',header=TRUE)
> a<-table.element(a,'2-tail p-value',header=TRUE)
> a<-table.element(a,'1-tail p-value',header=TRUE)
> a<-table.row.end(a)
> for (i in 1:k){
+ a<-table.row.start(a)
+ a<-table.element(a,rownames(mysum$coefficients)[i],header=TRUE)
+ a<-table.element(a,mysum$coefficients[i,1])
+ a<-table.element(a, round(mysum$coefficients[i,2],6))
+ a<-table.element(a, round(mysum$coefficients[i,3],4))
+ a<-table.element(a, round(mysum$coefficients[i,4],6))
+ a<-table.element(a, round(mysum$coefficients[i,4]/2,6))
+ a<-table.row.end(a)
+ }
> a<-table.end(a)
> table.save(a,file="/var/wessaorg/rcomp/tmp/12u5x31352124347.tab")
> a<-table.start()
> a<-table.row.start(a)
> a<-table.element(a, 'Multiple Linear Regression - Regression Statistics', 2, TRUE)
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a, 'Multiple R',1,TRUE)
> a<-table.element(a, sqrt(mysum$r.squared))
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a, 'R-squared',1,TRUE)
> a<-table.element(a, mysum$r.squared)
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a, 'Adjusted R-squared',1,TRUE)
> a<-table.element(a, mysum$adj.r.squared)
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a, 'F-TEST (value)',1,TRUE)
> a<-table.element(a, mysum$fstatistic[1])
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a, 'F-TEST (DF numerator)',1,TRUE)
> a<-table.element(a, mysum$fstatistic[2])
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a, 'F-TEST (DF denominator)',1,TRUE)
> a<-table.element(a, mysum$fstatistic[3])
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a, 'p-value',1,TRUE)
> a<-table.element(a, 1-pf(mysum$fstatistic[1],mysum$fstatistic[2],mysum$fstatistic[3]))
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a, 'Multiple Linear Regression - Residual Statistics', 2, TRUE)
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a, 'Residual Standard Deviation',1,TRUE)
> a<-table.element(a, mysum$sigma)
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a, 'Sum Squared Residuals',1,TRUE)
> a<-table.element(a, sum(myerror*myerror))
> a<-table.row.end(a)
> a<-table.end(a)
> table.save(a,file="/var/wessaorg/rcomp/tmp/13xhdd1352124347.tab")
> a<-table.start()
> a<-table.row.start(a)
> a<-table.element(a, 'Multiple Linear Regression - Actuals, Interpolation, and Residuals', 4, TRUE)
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a, 'Time or Index', 1, TRUE)
> a<-table.element(a, 'Actuals', 1, TRUE)
> a<-table.element(a, 'Interpolation
Forecast', 1, TRUE)
> a<-table.element(a, 'Residuals
Prediction Error', 1, TRUE)
> a<-table.row.end(a)
> for (i in 1:n) {
+ a<-table.row.start(a)
+ a<-table.element(a,i, 1, TRUE)
+ a<-table.element(a,x[i])
+ a<-table.element(a,x[i]-mysum$resid[i])
+ a<-table.element(a,mysum$resid[i])
+ a<-table.row.end(a)
+ }
> a<-table.end(a)
> table.save(a,file="/var/wessaorg/rcomp/tmp/14s8871352124347.tab")
> if (n > n25) {
+ a<-table.start()
+ a<-table.row.start(a)
+ a<-table.element(a,'Goldfeld-Quandt test for Heteroskedasticity',4,TRUE)
+ a<-table.row.end(a)
+ a<-table.row.start(a)
+ a<-table.element(a,'p-values',header=TRUE)
+ a<-table.element(a,'Alternative Hypothesis',3,header=TRUE)
+ a<-table.row.end(a)
+ a<-table.row.start(a)
+ a<-table.element(a,'breakpoint index',header=TRUE)
+ a<-table.element(a,'greater',header=TRUE)
+ a<-table.element(a,'2-sided',header=TRUE)
+ a<-table.element(a,'less',header=TRUE)
+ a<-table.row.end(a)
+ for (mypoint in kp3:nmkm3) {
+ a<-table.row.start(a)
+ a<-table.element(a,mypoint,header=TRUE)
+ a<-table.element(a,gqarr[mypoint-kp3+1,1])
+ a<-table.element(a,gqarr[mypoint-kp3+1,2])
+ a<-table.element(a,gqarr[mypoint-kp3+1,3])
+ a<-table.row.end(a)
+ }
+ a<-table.end(a)
+ table.save(a,file="/var/wessaorg/rcomp/tmp/15ivqw1352124347.tab")
+ a<-table.start()
+ a<-table.row.start(a)
+ a<-table.element(a,'Meta Analysis of Goldfeld-Quandt test for Heteroskedasticity',4,TRUE)
+ a<-table.row.end(a)
+ a<-table.row.start(a)
+ a<-table.element(a,'Description',header=TRUE)
+ a<-table.element(a,'# significant tests',header=TRUE)
+ a<-table.element(a,'% significant tests',header=TRUE)
+ a<-table.element(a,'OK/NOK',header=TRUE)
+ a<-table.row.end(a)
+ a<-table.row.start(a)
+ a<-table.element(a,'1% type I error level',header=TRUE)
+ a<-table.element(a,numsignificant1)
+ a<-table.element(a,numsignificant1/numgqtests)
+ if (numsignificant1/numgqtests < 0.01) dum <- 'OK' else dum <- 'NOK'
+ a<-table.element(a,dum)
+ a<-table.row.end(a)
+ a<-table.row.start(a)
+ a<-table.element(a,'5% type I error level',header=TRUE)
+ a<-table.element(a,numsignificant5)
+ a<-table.element(a,numsignificant5/numgqtests)
+ if (numsignificant5/numgqtests < 0.05) dum <- 'OK' else dum <- 'NOK'
+ a<-table.element(a,dum)
+ a<-table.row.end(a)
+ a<-table.row.start(a)
+ a<-table.element(a,'10% type I error level',header=TRUE)
+ a<-table.element(a,numsignificant10)
+ a<-table.element(a,numsignificant10/numgqtests)
+ if (numsignificant10/numgqtests < 0.1) dum <- 'OK' else dum <- 'NOK'
+ a<-table.element(a,dum)
+ a<-table.row.end(a)
+ a<-table.end(a)
+ table.save(a,file="/var/wessaorg/rcomp/tmp/16zixi1352124347.tab")
+ }
>
> try(system("convert tmp/1huw01352124347.ps tmp/1huw01352124347.png",intern=TRUE))
character(0)
> try(system("convert tmp/28o5a1352124347.ps tmp/28o5a1352124347.png",intern=TRUE))
character(0)
> try(system("convert tmp/3xs2l1352124347.ps tmp/3xs2l1352124347.png",intern=TRUE))
character(0)
> try(system("convert tmp/4fs0a1352124347.ps tmp/4fs0a1352124347.png",intern=TRUE))
character(0)
> try(system("convert tmp/5tszh1352124347.ps tmp/5tszh1352124347.png",intern=TRUE))
character(0)
> try(system("convert tmp/6masy1352124347.ps tmp/6masy1352124347.png",intern=TRUE))
character(0)
> try(system("convert tmp/7rzw41352124347.ps tmp/7rzw41352124347.png",intern=TRUE))
character(0)
> try(system("convert tmp/8s0d71352124347.ps tmp/8s0d71352124347.png",intern=TRUE))
character(0)
> try(system("convert tmp/9aodw1352124347.ps tmp/9aodw1352124347.png",intern=TRUE))
character(0)
> try(system("convert tmp/105bge1352124347.ps tmp/105bge1352124347.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
9.627 1.508 11.127