R version 2.9.0 (2009-04-17)
Copyright (C) 2009 The R Foundation for Statistical Computing
ISBN 3-900051-07-0
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(27
+ ,24
+ ,14
+ ,11
+ ,12
+ ,24
+ ,23
+ ,25
+ ,11
+ ,7
+ ,8
+ ,25
+ ,25
+ ,17
+ ,6
+ ,17
+ ,8
+ ,30
+ ,23
+ ,18
+ ,12
+ ,10
+ ,8
+ ,19
+ ,19
+ ,18
+ ,8
+ ,12
+ ,9
+ ,22
+ ,29
+ ,16
+ ,10
+ ,12
+ ,7
+ ,22
+ ,25
+ ,20
+ ,10
+ ,11
+ ,4
+ ,25
+ ,21
+ ,16
+ ,11
+ ,11
+ ,11
+ ,23
+ ,22
+ ,18
+ ,16
+ ,12
+ ,7
+ ,17
+ ,25
+ ,17
+ ,11
+ ,13
+ ,7
+ ,21
+ ,24
+ ,23
+ ,13
+ ,14
+ ,12
+ ,19
+ ,18
+ ,30
+ ,12
+ ,16
+ ,10
+ ,19
+ ,22
+ ,23
+ ,8
+ ,11
+ ,10
+ ,15
+ ,15
+ ,18
+ ,12
+ ,10
+ ,8
+ ,16
+ ,22
+ ,15
+ ,11
+ ,11
+ ,8
+ ,23
+ ,28
+ ,12
+ ,4
+ ,15
+ ,4
+ ,27
+ ,20
+ ,21
+ ,9
+ ,9
+ ,9
+ ,22
+ ,12
+ ,15
+ ,8
+ ,11
+ ,8
+ ,14
+ ,24
+ ,20
+ ,8
+ ,17
+ ,7
+ ,22
+ ,20
+ ,31
+ ,14
+ ,17
+ ,11
+ ,23
+ ,21
+ ,27
+ ,15
+ ,11
+ ,9
+ ,23
+ ,20
+ ,34
+ ,16
+ ,18
+ ,11
+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i,j] <- as.numeric(x[i,j])
+ }
+ }
> par3 = 'Linear Trend'
> par2 = 'Do not include Seasonal 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.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
O CM D PE PC PS t
1 27 24 14 11 12 24 1
2 23 25 11 7 8 25 2
3 25 17 6 17 8 30 3
4 23 18 12 10 8 19 4
5 19 18 8 12 9 22 5
6 29 16 10 12 7 22 6
7 25 20 10 11 4 25 7
8 21 16 11 11 11 23 8
9 22 18 16 12 7 17 9
10 25 17 11 13 7 21 10
11 24 23 13 14 12 19 11
12 18 30 12 16 10 19 12
13 22 23 8 11 10 15 13
14 15 18 12 10 8 16 14
15 22 15 11 11 8 23 15
16 28 12 4 15 4 27 16
17 20 21 9 9 9 22 17
18 12 15 8 11 8 14 18
19 24 20 8 17 7 22 19
20 20 31 14 17 11 23 20
21 21 27 15 11 9 23 21
22 20 34 16 18 11 21 22
23 21 21 9 14 13 19 23
24 23 31 14 10 8 18 24
25 28 19 11 11 8 20 25
26 24 16 8 15 9 23 26
27 24 20 9 15 6 25 27
28 24 21 9 13 9 19 28
29 23 22 9 16 9 24 29
30 23 17 9 13 6 22 30
31 29 24 10 9 6 25 31
32 24 25 16 18 16 26 32
33 18 26 11 18 5 29 33
34 25 25 8 12 7 32 34
35 21 17 9 17 9 25 35
36 26 32 16 9 6 29 36
37 22 33 11 9 6 28 37
38 22 13 16 12 5 17 38
39 22 32 12 18 12 28 39
40 23 25 12 12 7 29 40
41 30 29 14 18 10 26 41
42 23 22 9 14 9 25 42
43 17 18 10 15 8 14 43
44 23 17 9 16 5 25 44
45 23 20 10 10 8 26 45
46 25 15 12 11 8 20 46
47 24 20 14 14 10 18 47
48 24 33 14 9 6 32 48
49 23 29 10 12 8 25 49
50 21 23 14 17 7 25 50
51 24 26 16 5 4 23 51
52 24 18 9 12 8 21 52
53 28 20 10 12 8 20 53
54 16 11 6 6 4 15 54
55 20 28 8 24 20 30 55
56 29 26 13 12 8 24 56
57 27 22 10 12 8 26 57
58 22 17 8 14 6 24 58
59 28 12 7 7 4 22 59
60 16 14 15 13 8 14 60
61 25 17 9 12 9 24 61
62 24 21 10 13 6 24 62
63 28 19 12 14 7 24 63
64 24 18 13 8 9 24 64
65 23 10 10 11 5 19 65
66 30 29 11 9 5 31 66
67 24 31 8 11 8 22 67
68 21 19 9 13 8 27 68
69 25 9 13 10 6 19 69
70 25 20 11 11 8 25 70
71 22 28 8 12 7 20 71
72 23 19 9 9 7 21 72
73 26 30 9 15 9 27 73
74 23 29 15 18 11 23 74
75 25 26 9 15 6 25 75
76 21 23 10 12 8 20 76
77 25 13 14 13 6 21 77
78 24 21 12 14 9 22 78
79 29 19 12 10 8 23 79
80 22 28 11 13 6 25 80
81 27 23 14 13 10 25 81
82 26 18 6 11 8 17 82
83 22 21 12 13 8 19 83
84 24 20 8 16 10 25 84
85 27 23 14 8 5 19 85
86 24 21 11 16 7 20 86
87 24 21 10 11 5 26 87
88 29 15 14 9 8 23 88
89 22 28 12 16 14 27 89
90 21 19 10 12 7 17 90
91 24 26 14 14 8 17 91
92 24 10 5 8 6 19 92
93 23 16 11 9 5 17 93
94 20 22 10 15 6 22 94
95 27 19 9 11 10 21 95
96 26 31 10 21 12 32 96
97 25 31 16 14 9 21 97
98 21 29 13 18 12 21 98
99 21 19 9 12 7 18 99
100 19 22 10 13 8 18 100
101 21 23 10 15 10 23 101
102 21 15 7 12 6 19 102
103 16 20 9 19 10 20 103
104 22 18 8 15 10 21 104
105 29 23 14 11 10 20 105
106 15 25 14 11 5 17 106
107 17 21 8 10 7 18 107
108 15 24 9 13 10 19 108
109 21 25 14 15 11 22 109
110 21 17 14 12 6 15 110
111 19 13 8 12 7 14 111
112 24 28 8 16 12 18 112
113 20 21 8 9 11 24 113
114 17 25 7 18 11 35 114
115 23 9 6 8 11 29 115
116 24 16 8 13 5 21 116
117 14 19 6 17 8 25 117
118 19 17 11 9 6 20 118
119 24 25 14 15 9 22 119
120 13 20 11 8 4 13 120
121 22 29 11 7 4 26 121
122 16 14 11 12 7 17 122
123 19 22 14 14 11 25 123
124 25 15 8 6 6 20 124
125 25 19 20 8 7 19 125
126 23 20 11 17 8 21 126
127 24 15 8 10 4 22 127
128 26 20 11 11 8 24 128
129 26 18 10 14 9 21 129
130 25 33 14 11 8 26 130
131 18 22 11 13 11 24 131
132 21 16 9 12 8 16 132
133 26 17 9 11 5 23 133
134 23 16 8 9 4 18 134
135 23 21 10 12 8 16 135
136 22 26 13 20 10 26 136
137 20 18 13 12 6 19 137
138 13 18 12 13 9 21 138
139 24 17 8 12 9 21 139
140 15 22 13 12 13 22 140
141 14 30 14 9 9 23 141
142 22 30 12 15 10 29 142
143 10 24 14 24 20 21 143
144 24 21 15 7 5 21 144
145 22 21 13 17 11 23 145
146 24 29 16 11 6 27 146
147 19 31 9 17 9 25 147
148 20 20 9 11 7 21 148
149 13 16 9 12 9 10 149
150 20 22 8 14 10 20 150
151 22 20 7 11 9 26 151
152 24 28 16 16 8 24 152
153 29 38 11 21 7 29 153
154 12 22 9 14 6 19 154
155 20 20 11 20 13 24 155
156 21 17 9 13 6 19 156
157 24 28 14 11 8 24 157
158 22 22 13 15 10 22 158
159 20 31 16 19 16 17 159
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) CM D PE PC PS
17.45575 -0.05962 0.21894 -0.13685 -0.24720 0.39681
t
-0.01510
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-8.2725 -1.9563 0.2824 2.2589 7.4777
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 17.455748 2.044985 8.536 1.33e-14 ***
CM -0.059622 0.062157 -0.959 0.3390
D 0.218936 0.110949 1.973 0.0503 .
PE -0.136853 0.102916 -1.330 0.1856
PC -0.247202 0.128476 -1.924 0.0562 .
PS 0.396808 0.075282 5.271 4.58e-07 ***
t -0.015105 0.006042 -2.500 0.0135 *
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 3.447 on 152 degrees of freedom
Multiple R-squared: 0.2528, Adjusted R-squared: 0.2233
F-statistic: 8.573 on 6 and 152 DF, p-value: 4.965e-08
> 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.718619911 0.562760178 0.2813801
[2,] 0.660019415 0.679961170 0.3399806
[3,] 0.599606851 0.800786298 0.4003931
[4,] 0.625577621 0.748844757 0.3744224
[5,] 0.751302983 0.497394033 0.2486970
[6,] 0.675144334 0.649711332 0.3248557
[7,] 0.689095192 0.621809616 0.3109048
[8,] 0.606750202 0.786499595 0.3932498
[9,] 0.729059055 0.541881889 0.2709409
[10,] 0.670703294 0.658593412 0.3292967
[11,] 0.621144152 0.757711697 0.3788558
[12,] 0.552779097 0.894441805 0.4472209
[13,] 0.479721518 0.959443036 0.5202785
[14,] 0.465868329 0.931736657 0.5341317
[15,] 0.518990054 0.962019892 0.4810099
[16,] 0.687995955 0.624008089 0.3120040
[17,] 0.626121860 0.747756279 0.3738781
[18,] 0.562712864 0.874574272 0.4372871
[19,] 0.544286622 0.911426756 0.4557134
[20,] 0.479832449 0.959664898 0.5201676
[21,] 0.417262423 0.834524845 0.5827376
[22,] 0.417851728 0.835703456 0.5821483
[23,] 0.356829400 0.713658800 0.6431706
[24,] 0.618502441 0.762995118 0.3814976
[25,] 0.578211751 0.843576497 0.4217882
[26,] 0.547302486 0.905395028 0.4526975
[27,] 0.492119005 0.984238010 0.5078810
[28,] 0.477748300 0.955496600 0.5222517
[29,] 0.425770259 0.851540517 0.5742297
[30,] 0.376887144 0.753774287 0.6231129
[31,] 0.353918178 0.707836357 0.6460818
[32,] 0.518675895 0.962648210 0.4813241
[33,] 0.464795096 0.929590192 0.5352049
[34,] 0.435117745 0.870235490 0.5648823
[35,] 0.387983840 0.775967679 0.6120162
[36,] 0.348608915 0.697217829 0.6513911
[37,] 0.321786708 0.643573415 0.6782133
[38,] 0.297634823 0.595269646 0.7023652
[39,] 0.294230051 0.588460102 0.7057699
[40,] 0.256853152 0.513706305 0.7431468
[41,] 0.256757178 0.513514356 0.7432428
[42,] 0.236669075 0.473338151 0.7633309
[43,] 0.206553415 0.413106830 0.7934466
[44,] 0.276840060 0.553680120 0.7231599
[45,] 0.355039081 0.710078162 0.6449609
[46,] 0.340031715 0.680063431 0.6599683
[47,] 0.400755759 0.801511517 0.5992442
[48,] 0.377443000 0.754886001 0.6225570
[49,] 0.346348089 0.692696179 0.6536519
[50,] 0.346841084 0.693682167 0.6531589
[51,] 0.427876281 0.855752562 0.5721237
[52,] 0.383740556 0.767481113 0.6162594
[53,] 0.341548990 0.683097980 0.6584510
[54,] 0.343301630 0.686603260 0.6566984
[55,] 0.309632766 0.619265531 0.6903672
[56,] 0.270414690 0.540829380 0.7295853
[57,] 0.253991767 0.507983534 0.7460082
[58,] 0.225833267 0.451666533 0.7741667
[59,] 0.248782085 0.497564170 0.7512179
[60,] 0.215016518 0.430033035 0.7849835
[61,] 0.182093734 0.364187468 0.8179063
[62,] 0.153139382 0.306278765 0.8468606
[63,] 0.127726527 0.255453053 0.8722735
[64,] 0.111530232 0.223060465 0.8884698
[65,] 0.091003508 0.182007015 0.9089965
[66,] 0.074443906 0.148887811 0.9255561
[67,] 0.062375538 0.124751076 0.9376245
[68,] 0.049617242 0.099234484 0.9503828
[69,] 0.038829731 0.077659463 0.9611703
[70,] 0.044117682 0.088235363 0.9558823
[71,] 0.040463759 0.080927518 0.9595362
[72,] 0.033964723 0.067929446 0.9660353
[73,] 0.045048970 0.090097940 0.9549510
[74,] 0.035295894 0.070591789 0.9647041
[75,] 0.027723743 0.055447487 0.9722763
[76,] 0.025506292 0.051012584 0.9744937
[77,] 0.020293455 0.040586911 0.9797065
[78,] 0.016536196 0.033072392 0.9834638
[79,] 0.016948496 0.033896992 0.9830515
[80,] 0.014310854 0.028621708 0.9856891
[81,] 0.010838193 0.021676387 0.9891618
[82,] 0.009292071 0.018584143 0.9907079
[83,] 0.007608712 0.015217423 0.9923913
[84,] 0.005622982 0.011245963 0.9943770
[85,] 0.005316713 0.010633427 0.9946833
[86,] 0.007886378 0.015772755 0.9921136
[87,] 0.006454362 0.012908724 0.9935456
[88,] 0.005531671 0.011063342 0.9944683
[89,] 0.004248576 0.008497151 0.9957514
[90,] 0.003212601 0.006425201 0.9967874
[91,] 0.002667847 0.005335695 0.9973322
[92,] 0.002103407 0.004206814 0.9978966
[93,] 0.001547179 0.003094358 0.9984528
[94,] 0.001883757 0.003767513 0.9981162
[95,] 0.001475768 0.002951536 0.9985242
[96,] 0.006374876 0.012749752 0.9936251
[97,] 0.015212424 0.030424849 0.9847876
[98,] 0.016007331 0.032014662 0.9839927
[99,] 0.021688421 0.043376841 0.9783116
[100,] 0.017001659 0.034003317 0.9829983
[101,] 0.012418941 0.024837881 0.9875811
[102,] 0.009034572 0.018069144 0.9909654
[103,] 0.025893483 0.051786965 0.9741065
[104,] 0.026077262 0.052154523 0.9739227
[105,] 0.063718303 0.127436606 0.9362817
[106,] 0.054949965 0.109899931 0.9450500
[107,] 0.046497218 0.092994435 0.9535028
[108,] 0.118464158 0.236928315 0.8815358
[109,] 0.112186205 0.224372410 0.8878138
[110,] 0.100826087 0.201652175 0.8991739
[111,] 0.172653978 0.345307956 0.8273460
[112,] 0.170125418 0.340250836 0.8298746
[113,] 0.214658123 0.429316245 0.7853419
[114,] 0.214943641 0.429887282 0.7850564
[115,] 0.204906199 0.409812397 0.7950938
[116,] 0.179355066 0.358710131 0.8206449
[117,] 0.145873182 0.291746365 0.8541268
[118,] 0.115976366 0.231952732 0.8840236
[119,] 0.113743066 0.227486133 0.8862569
[120,] 0.158069707 0.316139415 0.8419303
[121,] 0.138474615 0.276949231 0.8615254
[122,] 0.117805782 0.235611563 0.8821942
[123,] 0.105936270 0.211872540 0.8940637
[124,] 0.104621514 0.209243028 0.8953785
[125,] 0.094473474 0.188946949 0.9055265
[126,] 0.212612478 0.425224956 0.7873875
[127,] 0.173516744 0.347033488 0.8264833
[128,] 0.148414593 0.296829186 0.8515854
[129,] 0.206579074 0.413158149 0.7934209
[130,] 0.466771230 0.933542460 0.5332288
[131,] 0.412967830 0.825935659 0.5870322
[132,] 0.567839663 0.864320674 0.4321603
[133,] 0.479197082 0.958394164 0.5208029
[134,] 0.650488588 0.699022823 0.3495114
[135,] 0.605555081 0.788889838 0.3944449
[136,] 0.515794453 0.968411094 0.4842055
[137,] 0.411769175 0.823538350 0.5882308
[138,] 0.417030688 0.834061376 0.5829693
[139,] 0.286984021 0.573968042 0.7130160
[140,] 0.200020944 0.400041889 0.7999791
> postscript(file="/var/www/html/rcomp/tmp/1x7iq1291303170.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> plot(x[,1], type='l', main='Actuals and Interpolation', ylab='value of Actuals and Interpolation (dots)', xlab='time or index')
> points(x[,1]-mysum$resid)
> grid()
> dev.off()
null device
1
> postscript(file="/var/www/html/rcomp/tmp/2x7iq1291303170.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> plot(mysum$resid, type='b', pch=19, main='Residuals', ylab='value of Residuals', xlab='time or index')
> grid()
> dev.off()
null device
1
> postscript(file="/var/www/html/rcomp/tmp/3x7iq1291303170.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> hist(mysum$resid, main='Residual Histogram', xlab='values of Residuals')
> grid()
> dev.off()
null device
1
> postscript(file="/var/www/html/rcomp/tmp/47gzb1291303170.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> densityplot(~mysum$resid,col='black',main='Residual Density Plot', xlab='values of Residuals')
> dev.off()
null device
1
> postscript(file="/var/www/html/rcomp/tmp/57gzb1291303170.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 = 159
Frequency = 1
1 2 3 4 5 6
2.87360502 -2.32789051 -0.31059465 -0.14256480 -3.92123289 5.04235110
7 8 9 10 11 12
-0.77294030 -2.69122657 -1.12266543 1.47711677 2.57856356 -2.99074057
13 14 15 16 17 18
2.38572000 -6.80109472 -2.38672380 2.95343469 -3.19060593 -8.11333054
19 20 21 22 23 24
1.59933539 -2.45132989 -3.20917180 -1.74965702 0.76352015 0.89355082
25 26 27 28 29 30
5.19323461 1.29047033 -0.21009590 2.71338042 0.21462577 -0.42693013
31 32 33 34 35 36
4.04875757 1.11676246 -7.62348309 -1.52832992 -2.25281213 -1.29958942
37 38 39 40 41 42
-3.73337589 -1.47714729 -1.26683354 -3.12302132 6.44584901 -0.25952825
43 44 45 46 47 48
-2.44730910 -1.24253345 -1.74381652 2.05300716 2.62693034 -3.81126463
49 50 51 52 53 54
-0.47628551 -3.25759434 -2.09172136 1.71935322 6.03157424 -5.44006408
55 56 57 58 59 60
-0.38278405 5.19058118 2.83038871 -1.44182861 3.83534205 -4.79740385
61 62 63 64 65 66
1.85245096 0.28235368 4.12439796 -0.46576788 0.13495637 3.02854274
67 68 69 70 71 72
2.40628417 -3.22334624 1.58929494 0.94852371 0.97110282 0.42330614
73 74 75 76 77 78
3.02892797 1.16299163 1.87265751 -0.44215366 1.34662705 1.75823211
79 80 81 82 83 84
5.46267040 -1.64415268 3.40484404 6.27967774 0.64012380 1.99546494
85 86 87 88 89 90
3.92583368 2.67092165 -0.65455558 4.78539905 -0.13258466 0.47404404
91 92 93 94 95 96
3.55166845 2.47410317 1.21659217 -2.10735509 5.78602520 2.79570493
97 98 99 100 101 102
3.16250534 1.00419211 0.43211321 -1.20879633 -0.34999898 0.03279975
103 104 105 106 107 108
-3.54188454 1.62869198 7.47768875 -6.43355071 -3.38257587 -4.65218268
109 110 111 112 113 114
-0.34165059 0.32756244 0.06180378 6.16743151 -1.82083945 -7.48152268
115 116 117 118 119 120
-1.18911671 2.18098493 -7.48538572 -3.28939228 2.31499053 -6.93391853
121 122 123 124 125 126
-2.67757233 -4.55965486 -3.63632937 2.92823972 1.47231977 2.20273102
127 128 129 130 131 132
1.23294425 3.22139867 5.18438013 1.57627162 -3.59873015 1.79251734
133 134 135 136 137 138
3.21112762 1.84867770 3.91700579 0.19456159 -1.57328751 -8.25440289
139 140 141 142 143 144
3.43996977 -5.74949223 -8.27252333 -1.13207533 -7.03440981 0.54835635
145 146 147 148 149 150
1.05946035 -0.74962753 -1.72638749 -1.09541615 -3.32265386 0.82194712
151 152 153 154 155 156
-0.10186599 1.65047155 6.80949786 -7.92857204 0.09691147 0.66667383
157 158 159
1.47960151 1.19134200 3.10090453
> postscript(file="/var/www/html/rcomp/tmp/67gzb1291303170.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 = 159
Frequency = 1
lag(myerror, k = 1) myerror
0 2.87360502 NA
1 -2.32789051 2.87360502
2 -0.31059465 -2.32789051
3 -0.14256480 -0.31059465
4 -3.92123289 -0.14256480
5 5.04235110 -3.92123289
6 -0.77294030 5.04235110
7 -2.69122657 -0.77294030
8 -1.12266543 -2.69122657
9 1.47711677 -1.12266543
10 2.57856356 1.47711677
11 -2.99074057 2.57856356
12 2.38572000 -2.99074057
13 -6.80109472 2.38572000
14 -2.38672380 -6.80109472
15 2.95343469 -2.38672380
16 -3.19060593 2.95343469
17 -8.11333054 -3.19060593
18 1.59933539 -8.11333054
19 -2.45132989 1.59933539
20 -3.20917180 -2.45132989
21 -1.74965702 -3.20917180
22 0.76352015 -1.74965702
23 0.89355082 0.76352015
24 5.19323461 0.89355082
25 1.29047033 5.19323461
26 -0.21009590 1.29047033
27 2.71338042 -0.21009590
28 0.21462577 2.71338042
29 -0.42693013 0.21462577
30 4.04875757 -0.42693013
31 1.11676246 4.04875757
32 -7.62348309 1.11676246
33 -1.52832992 -7.62348309
34 -2.25281213 -1.52832992
35 -1.29958942 -2.25281213
36 -3.73337589 -1.29958942
37 -1.47714729 -3.73337589
38 -1.26683354 -1.47714729
39 -3.12302132 -1.26683354
40 6.44584901 -3.12302132
41 -0.25952825 6.44584901
42 -2.44730910 -0.25952825
43 -1.24253345 -2.44730910
44 -1.74381652 -1.24253345
45 2.05300716 -1.74381652
46 2.62693034 2.05300716
47 -3.81126463 2.62693034
48 -0.47628551 -3.81126463
49 -3.25759434 -0.47628551
50 -2.09172136 -3.25759434
51 1.71935322 -2.09172136
52 6.03157424 1.71935322
53 -5.44006408 6.03157424
54 -0.38278405 -5.44006408
55 5.19058118 -0.38278405
56 2.83038871 5.19058118
57 -1.44182861 2.83038871
58 3.83534205 -1.44182861
59 -4.79740385 3.83534205
60 1.85245096 -4.79740385
61 0.28235368 1.85245096
62 4.12439796 0.28235368
63 -0.46576788 4.12439796
64 0.13495637 -0.46576788
65 3.02854274 0.13495637
66 2.40628417 3.02854274
67 -3.22334624 2.40628417
68 1.58929494 -3.22334624
69 0.94852371 1.58929494
70 0.97110282 0.94852371
71 0.42330614 0.97110282
72 3.02892797 0.42330614
73 1.16299163 3.02892797
74 1.87265751 1.16299163
75 -0.44215366 1.87265751
76 1.34662705 -0.44215366
77 1.75823211 1.34662705
78 5.46267040 1.75823211
79 -1.64415268 5.46267040
80 3.40484404 -1.64415268
81 6.27967774 3.40484404
82 0.64012380 6.27967774
83 1.99546494 0.64012380
84 3.92583368 1.99546494
85 2.67092165 3.92583368
86 -0.65455558 2.67092165
87 4.78539905 -0.65455558
88 -0.13258466 4.78539905
89 0.47404404 -0.13258466
90 3.55166845 0.47404404
91 2.47410317 3.55166845
92 1.21659217 2.47410317
93 -2.10735509 1.21659217
94 5.78602520 -2.10735509
95 2.79570493 5.78602520
96 3.16250534 2.79570493
97 1.00419211 3.16250534
98 0.43211321 1.00419211
99 -1.20879633 0.43211321
100 -0.34999898 -1.20879633
101 0.03279975 -0.34999898
102 -3.54188454 0.03279975
103 1.62869198 -3.54188454
104 7.47768875 1.62869198
105 -6.43355071 7.47768875
106 -3.38257587 -6.43355071
107 -4.65218268 -3.38257587
108 -0.34165059 -4.65218268
109 0.32756244 -0.34165059
110 0.06180378 0.32756244
111 6.16743151 0.06180378
112 -1.82083945 6.16743151
113 -7.48152268 -1.82083945
114 -1.18911671 -7.48152268
115 2.18098493 -1.18911671
116 -7.48538572 2.18098493
117 -3.28939228 -7.48538572
118 2.31499053 -3.28939228
119 -6.93391853 2.31499053
120 -2.67757233 -6.93391853
121 -4.55965486 -2.67757233
122 -3.63632937 -4.55965486
123 2.92823972 -3.63632937
124 1.47231977 2.92823972
125 2.20273102 1.47231977
126 1.23294425 2.20273102
127 3.22139867 1.23294425
128 5.18438013 3.22139867
129 1.57627162 5.18438013
130 -3.59873015 1.57627162
131 1.79251734 -3.59873015
132 3.21112762 1.79251734
133 1.84867770 3.21112762
134 3.91700579 1.84867770
135 0.19456159 3.91700579
136 -1.57328751 0.19456159
137 -8.25440289 -1.57328751
138 3.43996977 -8.25440289
139 -5.74949223 3.43996977
140 -8.27252333 -5.74949223
141 -1.13207533 -8.27252333
142 -7.03440981 -1.13207533
143 0.54835635 -7.03440981
144 1.05946035 0.54835635
145 -0.74962753 1.05946035
146 -1.72638749 -0.74962753
147 -1.09541615 -1.72638749
148 -3.32265386 -1.09541615
149 0.82194712 -3.32265386
150 -0.10186599 0.82194712
151 1.65047155 -0.10186599
152 6.80949786 1.65047155
153 -7.92857204 6.80949786
154 0.09691147 -7.92857204
155 0.66667383 0.09691147
156 1.47960151 0.66667383
157 1.19134200 1.47960151
158 3.10090453 1.19134200
159 NA 3.10090453
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -2.32789051 2.87360502
[2,] -0.31059465 -2.32789051
[3,] -0.14256480 -0.31059465
[4,] -3.92123289 -0.14256480
[5,] 5.04235110 -3.92123289
[6,] -0.77294030 5.04235110
[7,] -2.69122657 -0.77294030
[8,] -1.12266543 -2.69122657
[9,] 1.47711677 -1.12266543
[10,] 2.57856356 1.47711677
[11,] -2.99074057 2.57856356
[12,] 2.38572000 -2.99074057
[13,] -6.80109472 2.38572000
[14,] -2.38672380 -6.80109472
[15,] 2.95343469 -2.38672380
[16,] -3.19060593 2.95343469
[17,] -8.11333054 -3.19060593
[18,] 1.59933539 -8.11333054
[19,] -2.45132989 1.59933539
[20,] -3.20917180 -2.45132989
[21,] -1.74965702 -3.20917180
[22,] 0.76352015 -1.74965702
[23,] 0.89355082 0.76352015
[24,] 5.19323461 0.89355082
[25,] 1.29047033 5.19323461
[26,] -0.21009590 1.29047033
[27,] 2.71338042 -0.21009590
[28,] 0.21462577 2.71338042
[29,] -0.42693013 0.21462577
[30,] 4.04875757 -0.42693013
[31,] 1.11676246 4.04875757
[32,] -7.62348309 1.11676246
[33,] -1.52832992 -7.62348309
[34,] -2.25281213 -1.52832992
[35,] -1.29958942 -2.25281213
[36,] -3.73337589 -1.29958942
[37,] -1.47714729 -3.73337589
[38,] -1.26683354 -1.47714729
[39,] -3.12302132 -1.26683354
[40,] 6.44584901 -3.12302132
[41,] -0.25952825 6.44584901
[42,] -2.44730910 -0.25952825
[43,] -1.24253345 -2.44730910
[44,] -1.74381652 -1.24253345
[45,] 2.05300716 -1.74381652
[46,] 2.62693034 2.05300716
[47,] -3.81126463 2.62693034
[48,] -0.47628551 -3.81126463
[49,] -3.25759434 -0.47628551
[50,] -2.09172136 -3.25759434
[51,] 1.71935322 -2.09172136
[52,] 6.03157424 1.71935322
[53,] -5.44006408 6.03157424
[54,] -0.38278405 -5.44006408
[55,] 5.19058118 -0.38278405
[56,] 2.83038871 5.19058118
[57,] -1.44182861 2.83038871
[58,] 3.83534205 -1.44182861
[59,] -4.79740385 3.83534205
[60,] 1.85245096 -4.79740385
[61,] 0.28235368 1.85245096
[62,] 4.12439796 0.28235368
[63,] -0.46576788 4.12439796
[64,] 0.13495637 -0.46576788
[65,] 3.02854274 0.13495637
[66,] 2.40628417 3.02854274
[67,] -3.22334624 2.40628417
[68,] 1.58929494 -3.22334624
[69,] 0.94852371 1.58929494
[70,] 0.97110282 0.94852371
[71,] 0.42330614 0.97110282
[72,] 3.02892797 0.42330614
[73,] 1.16299163 3.02892797
[74,] 1.87265751 1.16299163
[75,] -0.44215366 1.87265751
[76,] 1.34662705 -0.44215366
[77,] 1.75823211 1.34662705
[78,] 5.46267040 1.75823211
[79,] -1.64415268 5.46267040
[80,] 3.40484404 -1.64415268
[81,] 6.27967774 3.40484404
[82,] 0.64012380 6.27967774
[83,] 1.99546494 0.64012380
[84,] 3.92583368 1.99546494
[85,] 2.67092165 3.92583368
[86,] -0.65455558 2.67092165
[87,] 4.78539905 -0.65455558
[88,] -0.13258466 4.78539905
[89,] 0.47404404 -0.13258466
[90,] 3.55166845 0.47404404
[91,] 2.47410317 3.55166845
[92,] 1.21659217 2.47410317
[93,] -2.10735509 1.21659217
[94,] 5.78602520 -2.10735509
[95,] 2.79570493 5.78602520
[96,] 3.16250534 2.79570493
[97,] 1.00419211 3.16250534
[98,] 0.43211321 1.00419211
[99,] -1.20879633 0.43211321
[100,] -0.34999898 -1.20879633
[101,] 0.03279975 -0.34999898
[102,] -3.54188454 0.03279975
[103,] 1.62869198 -3.54188454
[104,] 7.47768875 1.62869198
[105,] -6.43355071 7.47768875
[106,] -3.38257587 -6.43355071
[107,] -4.65218268 -3.38257587
[108,] -0.34165059 -4.65218268
[109,] 0.32756244 -0.34165059
[110,] 0.06180378 0.32756244
[111,] 6.16743151 0.06180378
[112,] -1.82083945 6.16743151
[113,] -7.48152268 -1.82083945
[114,] -1.18911671 -7.48152268
[115,] 2.18098493 -1.18911671
[116,] -7.48538572 2.18098493
[117,] -3.28939228 -7.48538572
[118,] 2.31499053 -3.28939228
[119,] -6.93391853 2.31499053
[120,] -2.67757233 -6.93391853
[121,] -4.55965486 -2.67757233
[122,] -3.63632937 -4.55965486
[123,] 2.92823972 -3.63632937
[124,] 1.47231977 2.92823972
[125,] 2.20273102 1.47231977
[126,] 1.23294425 2.20273102
[127,] 3.22139867 1.23294425
[128,] 5.18438013 3.22139867
[129,] 1.57627162 5.18438013
[130,] -3.59873015 1.57627162
[131,] 1.79251734 -3.59873015
[132,] 3.21112762 1.79251734
[133,] 1.84867770 3.21112762
[134,] 3.91700579 1.84867770
[135,] 0.19456159 3.91700579
[136,] -1.57328751 0.19456159
[137,] -8.25440289 -1.57328751
[138,] 3.43996977 -8.25440289
[139,] -5.74949223 3.43996977
[140,] -8.27252333 -5.74949223
[141,] -1.13207533 -8.27252333
[142,] -7.03440981 -1.13207533
[143,] 0.54835635 -7.03440981
[144,] 1.05946035 0.54835635
[145,] -0.74962753 1.05946035
[146,] -1.72638749 -0.74962753
[147,] -1.09541615 -1.72638749
[148,] -3.32265386 -1.09541615
[149,] 0.82194712 -3.32265386
[150,] -0.10186599 0.82194712
[151,] 1.65047155 -0.10186599
[152,] 6.80949786 1.65047155
[153,] -7.92857204 6.80949786
[154,] 0.09691147 -7.92857204
[155,] 0.66667383 0.09691147
[156,] 1.47960151 0.66667383
[157,] 1.19134200 1.47960151
[158,] 3.10090453 1.19134200
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -2.32789051 2.87360502
2 -0.31059465 -2.32789051
3 -0.14256480 -0.31059465
4 -3.92123289 -0.14256480
5 5.04235110 -3.92123289
6 -0.77294030 5.04235110
7 -2.69122657 -0.77294030
8 -1.12266543 -2.69122657
9 1.47711677 -1.12266543
10 2.57856356 1.47711677
11 -2.99074057 2.57856356
12 2.38572000 -2.99074057
13 -6.80109472 2.38572000
14 -2.38672380 -6.80109472
15 2.95343469 -2.38672380
16 -3.19060593 2.95343469
17 -8.11333054 -3.19060593
18 1.59933539 -8.11333054
19 -2.45132989 1.59933539
20 -3.20917180 -2.45132989
21 -1.74965702 -3.20917180
22 0.76352015 -1.74965702
23 0.89355082 0.76352015
24 5.19323461 0.89355082
25 1.29047033 5.19323461
26 -0.21009590 1.29047033
27 2.71338042 -0.21009590
28 0.21462577 2.71338042
29 -0.42693013 0.21462577
30 4.04875757 -0.42693013
31 1.11676246 4.04875757
32 -7.62348309 1.11676246
33 -1.52832992 -7.62348309
34 -2.25281213 -1.52832992
35 -1.29958942 -2.25281213
36 -3.73337589 -1.29958942
37 -1.47714729 -3.73337589
38 -1.26683354 -1.47714729
39 -3.12302132 -1.26683354
40 6.44584901 -3.12302132
41 -0.25952825 6.44584901
42 -2.44730910 -0.25952825
43 -1.24253345 -2.44730910
44 -1.74381652 -1.24253345
45 2.05300716 -1.74381652
46 2.62693034 2.05300716
47 -3.81126463 2.62693034
48 -0.47628551 -3.81126463
49 -3.25759434 -0.47628551
50 -2.09172136 -3.25759434
51 1.71935322 -2.09172136
52 6.03157424 1.71935322
53 -5.44006408 6.03157424
54 -0.38278405 -5.44006408
55 5.19058118 -0.38278405
56 2.83038871 5.19058118
57 -1.44182861 2.83038871
58 3.83534205 -1.44182861
59 -4.79740385 3.83534205
60 1.85245096 -4.79740385
61 0.28235368 1.85245096
62 4.12439796 0.28235368
63 -0.46576788 4.12439796
64 0.13495637 -0.46576788
65 3.02854274 0.13495637
66 2.40628417 3.02854274
67 -3.22334624 2.40628417
68 1.58929494 -3.22334624
69 0.94852371 1.58929494
70 0.97110282 0.94852371
71 0.42330614 0.97110282
72 3.02892797 0.42330614
73 1.16299163 3.02892797
74 1.87265751 1.16299163
75 -0.44215366 1.87265751
76 1.34662705 -0.44215366
77 1.75823211 1.34662705
78 5.46267040 1.75823211
79 -1.64415268 5.46267040
80 3.40484404 -1.64415268
81 6.27967774 3.40484404
82 0.64012380 6.27967774
83 1.99546494 0.64012380
84 3.92583368 1.99546494
85 2.67092165 3.92583368
86 -0.65455558 2.67092165
87 4.78539905 -0.65455558
88 -0.13258466 4.78539905
89 0.47404404 -0.13258466
90 3.55166845 0.47404404
91 2.47410317 3.55166845
92 1.21659217 2.47410317
93 -2.10735509 1.21659217
94 5.78602520 -2.10735509
95 2.79570493 5.78602520
96 3.16250534 2.79570493
97 1.00419211 3.16250534
98 0.43211321 1.00419211
99 -1.20879633 0.43211321
100 -0.34999898 -1.20879633
101 0.03279975 -0.34999898
102 -3.54188454 0.03279975
103 1.62869198 -3.54188454
104 7.47768875 1.62869198
105 -6.43355071 7.47768875
106 -3.38257587 -6.43355071
107 -4.65218268 -3.38257587
108 -0.34165059 -4.65218268
109 0.32756244 -0.34165059
110 0.06180378 0.32756244
111 6.16743151 0.06180378
112 -1.82083945 6.16743151
113 -7.48152268 -1.82083945
114 -1.18911671 -7.48152268
115 2.18098493 -1.18911671
116 -7.48538572 2.18098493
117 -3.28939228 -7.48538572
118 2.31499053 -3.28939228
119 -6.93391853 2.31499053
120 -2.67757233 -6.93391853
121 -4.55965486 -2.67757233
122 -3.63632937 -4.55965486
123 2.92823972 -3.63632937
124 1.47231977 2.92823972
125 2.20273102 1.47231977
126 1.23294425 2.20273102
127 3.22139867 1.23294425
128 5.18438013 3.22139867
129 1.57627162 5.18438013
130 -3.59873015 1.57627162
131 1.79251734 -3.59873015
132 3.21112762 1.79251734
133 1.84867770 3.21112762
134 3.91700579 1.84867770
135 0.19456159 3.91700579
136 -1.57328751 0.19456159
137 -8.25440289 -1.57328751
138 3.43996977 -8.25440289
139 -5.74949223 3.43996977
140 -8.27252333 -5.74949223
141 -1.13207533 -8.27252333
142 -7.03440981 -1.13207533
143 0.54835635 -7.03440981
144 1.05946035 0.54835635
145 -0.74962753 1.05946035
146 -1.72638749 -0.74962753
147 -1.09541615 -1.72638749
148 -3.32265386 -1.09541615
149 0.82194712 -3.32265386
150 -0.10186599 0.82194712
151 1.65047155 -0.10186599
152 6.80949786 1.65047155
153 -7.92857204 6.80949786
154 0.09691147 -7.92857204
155 0.66667383 0.09691147
156 1.47960151 0.66667383
157 1.19134200 1.47960151
158 3.10090453 1.19134200
> plot(z,main=paste('Residual Lag plot, lowess, and regression line'), ylab='values of Residuals', xlab='lagged values of Residuals')
> lines(lowess(z))
> abline(lm(z))
> grid()
> dev.off()
null device
1
> postscript(file="/var/www/html/rcomp/tmp/7i7gw1291303170.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> acf(mysum$resid, lag.max=length(mysum$resid)/2, main='Residual Autocorrelation Function')
> grid()
> dev.off()
null device
1
> postscript(file="/var/www/html/rcomp/tmp/8i7gw1291303170.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> pacf(mysum$resid, lag.max=length(mysum$resid)/2, main='Residual Partial Autocorrelation Function')
> grid()
> dev.off()
null device
1
> postscript(file="/var/www/html/rcomp/tmp/9bhgz1291303170.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> opar <- par(mfrow = c(2,2), oma = c(0, 0, 1.1, 0))
> plot(mylm, las = 1, sub='Residual Diagnostics')
> par(opar)
> dev.off()
null device
1
> if (n > n25) {
+ postscript(file="/var/www/html/rcomp/tmp/10bhgz1291303170.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
+ plot(kp3:nmkm3,gqarr[,2], main='Goldfeld-Quandt test',ylab='2-sided p-value',xlab='breakpoint')
+ grid()
+ dev.off()
+ }
null device
1
>
> #Note: the /var/www/html/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab
> load(file="/var/www/html/rcomp/createtable")
>
> a<-table.start()
> a<-table.row.start(a)
> a<-table.element(a, 'Multiple Linear Regression - Estimated Regression Equation', 1, TRUE)
> a<-table.row.end(a)
> myeq <- colnames(x)[1]
> myeq <- paste(myeq, '[t] = ', sep='')
> for (i in 1:k){
+ if (mysum$coefficients[i,1] > 0) myeq <- paste(myeq, '+', '')
+ myeq <- paste(myeq, mysum$coefficients[i,1], sep=' ')
+ if (rownames(mysum$coefficients)[i] != '(Intercept)') {
+ myeq <- paste(myeq, rownames(mysum$coefficients)[i], sep='')
+ if (rownames(mysum$coefficients)[i] != 't') myeq <- paste(myeq, '[t]', sep='')
+ }
+ }
> myeq <- paste(myeq, ' + e[t]')
> a<-table.row.start(a)
> a<-table.element(a, myeq)
> a<-table.row.end(a)
> a<-table.end(a)
> table.save(a,file="/var/www/html/rcomp/tmp/11wze51291303170.tab")
> a<-table.start()
> a<-table.row.start(a)
> a<-table.element(a,hyperlink('http://www.xycoon.com/ols1.htm','Multiple Linear Regression - Ordinary Least Squares',''), 6, TRUE)
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a,'Variable',header=TRUE)
> a<-table.element(a,'Parameter',header=TRUE)
> a<-table.element(a,'S.D.',header=TRUE)
> a<-table.element(a,'T-STAT
H0: parameter = 0',header=TRUE)
> a<-table.element(a,'2-tail p-value',header=TRUE)
> a<-table.element(a,'1-tail p-value',header=TRUE)
> a<-table.row.end(a)
> for (i in 1:k){
+ a<-table.row.start(a)
+ a<-table.element(a,rownames(mysum$coefficients)[i],header=TRUE)
+ a<-table.element(a,mysum$coefficients[i,1])
+ a<-table.element(a, round(mysum$coefficients[i,2],6))
+ a<-table.element(a, round(mysum$coefficients[i,3],4))
+ a<-table.element(a, round(mysum$coefficients[i,4],6))
+ a<-table.element(a, round(mysum$coefficients[i,4]/2,6))
+ a<-table.row.end(a)
+ }
> a<-table.end(a)
> table.save(a,file="/var/www/html/rcomp/tmp/12zhdb1291303170.tab")
> a<-table.start()
> a<-table.row.start(a)
> a<-table.element(a, 'Multiple Linear Regression - Regression Statistics', 2, TRUE)
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a, 'Multiple R',1,TRUE)
> a<-table.element(a, sqrt(mysum$r.squared))
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a, 'R-squared',1,TRUE)
> a<-table.element(a, mysum$r.squared)
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a, 'Adjusted R-squared',1,TRUE)
> a<-table.element(a, mysum$adj.r.squared)
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a, 'F-TEST (value)',1,TRUE)
> a<-table.element(a, mysum$fstatistic[1])
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a, 'F-TEST (DF numerator)',1,TRUE)
> a<-table.element(a, mysum$fstatistic[2])
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a, 'F-TEST (DF denominator)',1,TRUE)
> a<-table.element(a, mysum$fstatistic[3])
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a, 'p-value',1,TRUE)
> a<-table.element(a, 1-pf(mysum$fstatistic[1],mysum$fstatistic[2],mysum$fstatistic[3]))
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a, 'Multiple Linear Regression - Residual Statistics', 2, TRUE)
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a, 'Residual Standard Deviation',1,TRUE)
> a<-table.element(a, mysum$sigma)
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a, 'Sum Squared Residuals',1,TRUE)
> a<-table.element(a, sum(myerror*myerror))
> a<-table.row.end(a)
> a<-table.end(a)
> table.save(a,file="/var/www/html/rcomp/tmp/136ir41291303170.tab")
> a<-table.start()
> a<-table.row.start(a)
> a<-table.element(a, 'Multiple Linear Regression - Actuals, Interpolation, and Residuals', 4, TRUE)
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a, 'Time or Index', 1, TRUE)
> a<-table.element(a, 'Actuals', 1, TRUE)
> a<-table.element(a, 'Interpolation
Forecast', 1, TRUE)
> a<-table.element(a, 'Residuals
Prediction Error', 1, TRUE)
> a<-table.row.end(a)
> for (i in 1:n) {
+ a<-table.row.start(a)
+ a<-table.element(a,i, 1, TRUE)
+ a<-table.element(a,x[i])
+ a<-table.element(a,x[i]-mysum$resid[i])
+ a<-table.element(a,mysum$resid[i])
+ a<-table.row.end(a)
+ }
> a<-table.end(a)
> table.save(a,file="/var/www/html/rcomp/tmp/14ha971291303170.tab")
> if (n > n25) {
+ a<-table.start()
+ a<-table.row.start(a)
+ a<-table.element(a,'Goldfeld-Quandt test for Heteroskedasticity',4,TRUE)
+ a<-table.row.end(a)
+ a<-table.row.start(a)
+ a<-table.element(a,'p-values',header=TRUE)
+ a<-table.element(a,'Alternative Hypothesis',3,header=TRUE)
+ a<-table.row.end(a)
+ a<-table.row.start(a)
+ a<-table.element(a,'breakpoint index',header=TRUE)
+ a<-table.element(a,'greater',header=TRUE)
+ a<-table.element(a,'2-sided',header=TRUE)
+ a<-table.element(a,'less',header=TRUE)
+ a<-table.row.end(a)
+ for (mypoint in kp3:nmkm3) {
+ a<-table.row.start(a)
+ a<-table.element(a,mypoint,header=TRUE)
+ a<-table.element(a,gqarr[mypoint-kp3+1,1])
+ a<-table.element(a,gqarr[mypoint-kp3+1,2])
+ a<-table.element(a,gqarr[mypoint-kp3+1,3])
+ a<-table.row.end(a)
+ }
+ a<-table.end(a)
+ table.save(a,file="/var/www/html/rcomp/tmp/152spd1291303170.tab")
+ a<-table.start()
+ a<-table.row.start(a)
+ a<-table.element(a,'Meta Analysis of Goldfeld-Quandt test for Heteroskedasticity',4,TRUE)
+ a<-table.row.end(a)
+ a<-table.row.start(a)
+ a<-table.element(a,'Description',header=TRUE)
+ a<-table.element(a,'# significant tests',header=TRUE)
+ a<-table.element(a,'% significant tests',header=TRUE)
+ a<-table.element(a,'OK/NOK',header=TRUE)
+ a<-table.row.end(a)
+ a<-table.row.start(a)
+ a<-table.element(a,'1% type I error level',header=TRUE)
+ a<-table.element(a,numsignificant1)
+ a<-table.element(a,numsignificant1/numgqtests)
+ if (numsignificant1/numgqtests < 0.01) dum <- 'OK' else dum <- 'NOK'
+ a<-table.element(a,dum)
+ a<-table.row.end(a)
+ a<-table.row.start(a)
+ a<-table.element(a,'5% type I error level',header=TRUE)
+ a<-table.element(a,numsignificant5)
+ a<-table.element(a,numsignificant5/numgqtests)
+ if (numsignificant5/numgqtests < 0.05) dum <- 'OK' else dum <- 'NOK'
+ a<-table.element(a,dum)
+ a<-table.row.end(a)
+ a<-table.row.start(a)
+ a<-table.element(a,'10% type I error level',header=TRUE)
+ a<-table.element(a,numsignificant10)
+ a<-table.element(a,numsignificant10/numgqtests)
+ if (numsignificant10/numgqtests < 0.1) dum <- 'OK' else dum <- 'NOK'
+ a<-table.element(a,dum)
+ a<-table.row.end(a)
+ a<-table.end(a)
+ table.save(a,file="/var/www/html/rcomp/tmp/16gk5m1291303170.tab")
+ }
> try(system("convert tmp/1x7iq1291303170.ps tmp/1x7iq1291303170.png",intern=TRUE))
character(0)
> try(system("convert tmp/2x7iq1291303170.ps tmp/2x7iq1291303170.png",intern=TRUE))
character(0)
> try(system("convert tmp/3x7iq1291303170.ps tmp/3x7iq1291303170.png",intern=TRUE))
character(0)
> try(system("convert tmp/47gzb1291303170.ps tmp/47gzb1291303170.png",intern=TRUE))
character(0)
> try(system("convert tmp/57gzb1291303170.ps tmp/57gzb1291303170.png",intern=TRUE))
character(0)
> try(system("convert tmp/67gzb1291303170.ps tmp/67gzb1291303170.png",intern=TRUE))
character(0)
> try(system("convert tmp/7i7gw1291303170.ps tmp/7i7gw1291303170.png",intern=TRUE))
character(0)
> try(system("convert tmp/8i7gw1291303170.ps tmp/8i7gw1291303170.png",intern=TRUE))
character(0)
> try(system("convert tmp/9bhgz1291303170.ps tmp/9bhgz1291303170.png",intern=TRUE))
character(0)
> try(system("convert tmp/10bhgz1291303170.ps tmp/10bhgz1291303170.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
4.115 1.751 8.932