R version 3.0.2 (2013-09-25) -- "Frisbee Sailing"
Copyright (C) 2013 The R Foundation for Statistical Computing
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
+ ,4
+ ,20
+ ,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,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 = '7'
> library(lattice)
> library(lmtest)
Loading required package: zoo
Attaching package: 'zoo'
The following objects 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 I1 I2 I3 E1 E2 E3
1 4 26 21 21 23 17 23
2 4 20 16 15 24 17 20
3 6 19 19 18 22 18 20
4 8 19 18 11 20 21 21
5 8 20 16 8 24 20 24
6 4 25 23 19 27 28 22
7 4 25 17 4 28 19 23
8 8 22 12 20 27 22 20
9 5 26 19 16 24 16 25
10 4 22 16 14 23 18 23
11 4 17 19 10 24 25 27
12 4 22 20 13 27 17 27
13 4 19 13 14 27 14 22
14 4 24 20 8 28 11 24
15 4 26 27 23 27 27 25
16 8 21 17 11 23 20 22
17 4 13 8 9 24 22 28
18 4 26 25 24 28 22 28
19 4 20 26 5 27 21 27
20 8 22 13 15 25 23 25
21 4 14 19 5 19 17 16
22 7 21 15 19 24 24 28
23 4 7 5 6 20 14 21
24 4 23 16 13 28 17 24
25 5 17 14 11 26 23 27
26 4 25 24 17 23 24 14
27 4 25 24 17 23 24 14
28 4 19 9 5 20 8 27
29 4 20 19 9 11 22 20
30 4 23 19 15 24 23 21
31 4 22 25 17 25 25 22
32 4 22 19 17 23 21 21
33 15 21 18 20 18 24 12
34 10 15 15 12 20 15 20
35 4 20 12 7 20 22 24
36 8 22 21 16 24 21 19
37 4 18 12 7 23 25 28
38 4 20 15 14 25 16 23
39 4 28 28 24 28 28 27
40 4 22 25 15 26 23 22
41 7 18 19 15 26 21 27
42 4 23 20 10 23 21 26
43 6 20 24 14 22 26 22
44 5 25 26 18 24 22 21
45 4 26 25 12 21 21 19
46 16 15 12 9 20 18 24
47 5 17 12 9 22 12 19
48 12 23 15 8 20 25 26
49 6 21 17 18 25 17 22
50 9 13 14 10 20 24 28
51 9 18 16 17 22 15 21
52 4 19 11 14 23 13 23
53 5 22 20 16 25 26 28
54 4 16 11 10 23 16 10
55 4 24 22 19 23 24 24
56 5 18 20 10 22 21 21
57 4 20 19 14 24 20 21
58 4 24 17 10 25 14 24
59 4 14 21 4 21 25 24
60 5 22 23 19 12 25 25
61 4 24 18 9 17 20 25
62 6 18 17 12 20 22 23
63 4 21 27 16 23 20 21
64 4 23 25 11 23 26 16
65 18 17 19 18 20 18 17
66 4 22 22 11 28 22 25
67 6 24 24 24 24 24 24
68 4 21 20 17 24 17 23
69 4 22 19 18 24 24 25
70 5 16 11 9 24 20 23
71 4 21 22 19 28 19 28
72 4 23 22 18 25 20 26
73 5 22 16 12 21 15 22
74 10 24 20 23 25 23 19
75 5 24 24 22 25 26 26
76 8 16 16 14 18 22 18
77 8 16 16 14 17 20 18
78 5 21 22 16 26 24 25
79 4 26 24 23 28 26 27
80 4 15 16 7 21 21 12
81 4 25 27 10 27 25 15
82 5 18 11 12 22 13 21
83 4 23 21 12 21 20 23
84 4 20 20 12 25 22 22
85 8 17 20 17 22 23 21
86 4 25 27 21 23 28 24
87 5 24 20 16 26 22 27
88 14 17 12 11 19 20 22
89 8 19 8 14 25 6 28
90 8 20 21 13 21 21 26
91 4 15 18 9 13 20 10
92 4 27 24 19 24 18 19
93 6 22 16 13 25 23 22
94 4 23 18 19 26 20 21
95 7 16 20 13 25 24 24
96 7 19 20 13 25 22 25
97 4 25 19 13 22 21 21
98 6 19 17 14 21 18 20
99 4 19 16 12 23 21 21
100 7 26 26 22 25 23 24
101 4 21 15 11 24 23 23
102 4 20 22 5 21 15 18
103 8 24 17 18 21 21 24
104 4 22 23 19 25 24 24
105 4 20 21 14 22 23 19
106 10 18 19 15 20 21 20
107 8 18 14 12 20 21 18
108 6 24 17 19 23 20 20
109 4 24 12 15 28 11 27
110 4 22 24 17 23 22 23
111 4 23 18 8 28 27 26
112 5 22 20 10 24 25 23
113 4 20 16 12 18 18 17
114 6 18 20 12 20 20 21
115 4 25 22 20 28 24 25
116 5 18 12 12 21 10 23
117 7 16 16 12 21 27 27
118 8 20 17 14 25 21 24
119 5 19 22 6 19 21 20
120 8 15 12 10 18 18 27
121 10 19 14 18 21 15 21
122 8 19 23 18 22 24 24
123 5 16 15 7 24 22 21
124 12 17 17 18 15 14 15
125 4 28 28 9 28 28 25
126 5 23 20 17 26 18 25
127 4 25 23 22 23 26 22
128 6 20 13 11 26 17 24
129 4 17 18 15 20 19 21
130 4 23 23 17 22 22 22
131 7 16 19 15 20 18 23
132 7 23 23 22 23 24 22
133 10 11 12 9 22 15 20
134 4 18 16 13 24 18 23
135 5 24 23 20 23 26 25
136 8 23 13 14 22 11 23
137 11 21 22 14 26 26 22
138 7 16 18 12 23 21 25
139 4 24 23 20 27 23 26
140 8 23 20 20 23 23 22
141 6 18 10 8 21 15 24
142 7 20 17 17 26 22 24
143 5 9 18 9 23 26 25
144 4 24 15 18 21 16 20
145 8 25 23 22 27 20 26
146 4 20 17 10 19 18 21
147 8 21 17 13 23 22 26
148 6 25 22 15 25 16 21
149 4 22 20 18 23 19 22
150 9 21 20 18 22 20 16
151 5 21 19 12 22 19 26
152 6 22 18 12 25 23 28
153 4 27 22 20 25 24 18
154 4 24 20 12 28 25 25
155 4 24 22 16 28 21 23
156 5 21 18 16 20 21 21
157 6 18 16 18 25 23 20
158 16 16 16 16 19 27 25
159 6 22 16 13 25 23 22
160 6 20 16 17 22 18 21
161 4 18 17 13 18 16 16
162 4 20 18 17 20 16 18
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) I1 I2 I3 E1 E2
11.925870 -0.186689 -0.158781 0.204516 -0.177385 0.090059
E3
-0.000071
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-4.7639 -1.4921 -0.3932 0.8590 10.5112
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 11.925870 1.678528 7.105 4.11e-11 ***
I1 -0.186689 0.073758 -2.531 0.0124 *
I2 -0.158781 0.063618 -2.496 0.0136 *
I3 0.204516 0.048027 4.258 3.56e-05 ***
E1 -0.177385 0.071453 -2.483 0.0141 *
E2 0.090059 0.055303 1.628 0.1055
E3 -0.000071 0.057395 -0.001 0.9990
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 2.343 on 155 degrees of freedom
Multiple R-squared: 0.2338, Adjusted R-squared: 0.2042
F-statistic: 7.884 on 6 and 155 DF, p-value: 2.012e-07
> 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.407905401 0.815810802 0.592094599
[2,] 0.353869341 0.707738682 0.646130659
[3,] 0.312976766 0.625953532 0.687023234
[4,] 0.215691502 0.431383005 0.784308498
[5,] 0.181139446 0.362278893 0.818860554
[6,] 0.124625207 0.249250414 0.875374793
[7,] 0.113770330 0.227540660 0.886229670
[8,] 0.100623259 0.201246518 0.899376741
[9,] 0.083982022 0.167964044 0.916017978
[10,] 0.054797908 0.109595817 0.945202092
[11,] 0.058014898 0.116029796 0.941985102
[12,] 0.054303227 0.108606455 0.945696773
[13,] 0.037163078 0.074326157 0.962836922
[14,] 0.031358943 0.062717886 0.968641057
[15,] 0.020105352 0.040210705 0.979894648
[16,] 0.012289176 0.024578352 0.987710824
[17,] 0.011734464 0.023468928 0.988265536
[18,] 0.008416190 0.016832380 0.991583810
[19,] 0.009203058 0.018406116 0.990796942
[20,] 0.011576584 0.023153168 0.988423416
[21,] 0.009128647 0.018257295 0.990871353
[22,] 0.005696544 0.011393088 0.994303456
[23,] 0.004053176 0.008106351 0.995946824
[24,] 0.306352975 0.612705949 0.693647025
[25,] 0.458787811 0.917575621 0.541212189
[26,] 0.443036173 0.886072346 0.556963827
[27,] 0.446932051 0.893864102 0.553067949
[28,] 0.413262759 0.826525517 0.586737241
[29,] 0.378573757 0.757147514 0.621426243
[30,] 0.325830361 0.651660723 0.674169639
[31,] 0.276993710 0.553987420 0.723006290
[32,] 0.279426623 0.558853246 0.720573377
[33,] 0.234416588 0.468833176 0.765583412
[34,] 0.197834666 0.395669331 0.802165334
[35,] 0.162656575 0.325313149 0.837343425
[36,] 0.134510881 0.269021762 0.865489119
[37,] 0.827289898 0.345420204 0.172710102
[38,] 0.799780211 0.400439578 0.200219789
[39,] 0.938637655 0.122724690 0.061362345
[40,] 0.922138249 0.155723501 0.077861751
[41,] 0.910403192 0.179193616 0.089596808
[42,] 0.908080676 0.183838648 0.091919324
[43,] 0.909288884 0.181422233 0.090711116
[44,] 0.889400163 0.221199673 0.110599837
[45,] 0.894478133 0.211043735 0.105521867
[46,] 0.886412174 0.227175652 0.113587826
[47,] 0.861901697 0.276196606 0.138098303
[48,] 0.845001332 0.309997336 0.154998668
[49,] 0.814960227 0.370079546 0.185039773
[50,] 0.790672357 0.418655287 0.209327643
[51,] 0.811199402 0.377601196 0.188800598
[52,] 0.788892924 0.422214152 0.211107076
[53,] 0.755386528 0.489226945 0.244613472
[54,] 0.718235435 0.563529130 0.281764565
[55,] 0.679531343 0.640937313 0.320468657
[56,] 0.996382073 0.007235855 0.003617927
[57,] 0.994953070 0.010093860 0.005046930
[58,] 0.993015151 0.013969697 0.006984849
[59,] 0.991541403 0.016917193 0.008458597
[60,] 0.991675504 0.016648992 0.008324496
[61,] 0.990311905 0.019376191 0.009688095
[62,] 0.987835446 0.024329108 0.012164554
[63,] 0.984904181 0.030191637 0.015095819
[64,] 0.980004547 0.039990906 0.019995453
[65,] 0.986376420 0.027247160 0.013623580
[66,] 0.982929697 0.034140607 0.017070303
[67,] 0.977373284 0.045253433 0.022626716
[68,] 0.970365742 0.059268517 0.029634258
[69,] 0.962107629 0.075784741 0.037892371
[70,] 0.956130262 0.087739476 0.043869738
[71,] 0.953475426 0.093049149 0.046524574
[72,] 0.952722778 0.094554445 0.047277222
[73,] 0.946093754 0.107812493 0.053906246
[74,] 0.934331855 0.131336291 0.065668145
[75,] 0.920778006 0.158443989 0.079221994
[76,] 0.904505981 0.190988039 0.095494019
[77,] 0.896727396 0.206545208 0.103272604
[78,] 0.875775742 0.248448515 0.124224258
[79,] 0.973589269 0.052821462 0.026410731
[80,] 0.969343063 0.061313874 0.030656937
[81,] 0.967081929 0.065836142 0.032918071
[82,] 0.973525935 0.052948130 0.026474065
[83,] 0.965515630 0.068968739 0.034484370
[84,] 0.955891490 0.088217021 0.044108510
[85,] 0.950923118 0.098153764 0.049076882
[86,] 0.939082611 0.121834778 0.060917389
[87,] 0.929397073 0.141205854 0.070602927
[88,] 0.913799963 0.172400073 0.086200037
[89,] 0.893647679 0.212704641 0.106352321
[90,] 0.888763529 0.222472941 0.111236471
[91,] 0.879105836 0.241788327 0.120894164
[92,] 0.869469141 0.261061718 0.130530859
[93,] 0.847579209 0.304841583 0.152420791
[94,] 0.825534709 0.348930581 0.174465291
[95,] 0.815528788 0.368942424 0.184471212
[96,] 0.803658647 0.392682706 0.196341353
[97,] 0.825433521 0.349132959 0.174566479
[98,] 0.796535720 0.406928561 0.203464280
[99,] 0.759502829 0.480994341 0.240497171
[100,] 0.723890300 0.552219400 0.276109700
[101,] 0.697351846 0.605296308 0.302648154
[102,] 0.653330215 0.693339570 0.346669785
[103,] 0.605162141 0.789675718 0.394837859
[104,] 0.602081539 0.795836921 0.397918461
[105,] 0.551002081 0.897995837 0.448997919
[106,] 0.517843667 0.964312666 0.482156333
[107,] 0.481636421 0.963272843 0.518363579
[108,] 0.443609068 0.887218135 0.556390932
[109,] 0.422897062 0.845794124 0.577102938
[110,] 0.373314822 0.746629645 0.626685178
[111,] 0.324977733 0.649955467 0.675022267
[112,] 0.328169221 0.656338442 0.671830779
[113,] 0.289256327 0.578512654 0.710743673
[114,] 0.251978817 0.503957635 0.748021183
[115,] 0.413992542 0.827985083 0.586007458
[116,] 0.390512738 0.781025476 0.609487262
[117,] 0.336346068 0.672692137 0.663653932
[118,] 0.340419825 0.680839650 0.659580175
[119,] 0.289050056 0.578100111 0.710949944
[120,] 0.303862808 0.607725615 0.696137192
[121,] 0.267503352 0.535006705 0.732496648
[122,] 0.219279109 0.438558218 0.780720891
[123,] 0.176294541 0.352589081 0.823705459
[124,] 0.231581997 0.463163995 0.768418003
[125,] 0.206848453 0.413696906 0.793151547
[126,] 0.230004865 0.460009731 0.769995135
[127,] 0.327005955 0.654011911 0.672994045
[128,] 0.595924012 0.808151976 0.404075988
[129,] 0.534368638 0.931262725 0.465631362
[130,] 0.571091678 0.857816644 0.428908322
[131,] 0.498191363 0.996382726 0.501808637
[132,] 0.499511149 0.999022299 0.500488851
[133,] 0.424952804 0.849905609 0.575047196
[134,] 0.561964208 0.876071583 0.438035792
[135,] 0.513026671 0.973946657 0.486973329
[136,] 0.444164103 0.888328206 0.555835897
[137,] 0.369996075 0.739992150 0.630003925
[138,] 0.315502908 0.631005816 0.684497092
[139,] 0.660677661 0.678644678 0.339322339
[140,] 0.574579139 0.850841722 0.425420861
[141,] 0.789441058 0.421117883 0.210558942
[142,] 0.669930358 0.660139285 0.330069642
[143,] 0.557375021 0.885249958 0.442624979
> postscript(file="/var/fisher/rcomp/tmp/136pi1384697612.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/2cw2b1384697612.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/3zjgt1384697612.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/4hea41384697612.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/58bhv1384697612.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
-1.481915985 -1.991684132 -0.760407921 1.887545158 3.170033288 -1.223193249
7 8 9 10 11 12
1.879850226 0.805849959 0.490688466 -1.681022507 -1.772805454 -0.041499082
13 14 15 16 17 18
-1.647723572 2.071985614 -1.129172749 2.724427757 -3.791383935 -1.023355536
19 20 21 22 23 24
1.813698384 1.542735392 -1.477525061 -0.411686797 -4.763874328 -0.312761319
25 26 27 28 29 30
-1.236336172 -1.005252668 -1.005252668 -1.143189913 -3.044551381 -1.495560529
31 32 33 34 35 36
-1.141258519 -2.088547670 6.794691994 3.000217021 -2.150233624 2.610773067
37 38 39 40 41 42
-2.261348914 -1.678291466 -0.714062577 -0.374722898 1.106311389 -0.311111982
43 44 45 46 47 48
0.317915990 0.465793859 0.278558525 8.867528508 -0.864322991 6.411622928
49 50 51 52 53 54
-0.082235106 1.067125234 2.051325814 -2.584695962 -0.820279829 -2.597799173
55 56 57 58 59 60
-1.917824650 -0.422295467 -1.580932717 0.384277804 -1.320583271 -3.173647442
61 62 63 64 65 66
-1.211792390 -0.752357439 -0.710414843 -0.172730359 10.511231244 0.412041149
67 68 69 70 71 72
-0.445457269 -1.578691126 -2.385572122 -1.575212102 -1.140383792 -1.184847725
73 74 75 76 77 78
-0.356654431 3.391025023 -1.039016764 -0.048672851 -0.045939565 -0.332116067
79 80 81 82 83 84
-1.337928551 -2.181961146 1.522253765 -1.539880094 -0.826287256 -1.015782427
85 86 87 88 89 90
0.779286080 -1.706500983 0.090648845 6.474228164 1.924502196 2.319284655
91 92 93 94 95 96
-3.602596278 -0.322811210 0.427896533 -1.847456500 0.852970562 1.593226044
97 98 99 100 101 102
-0.887803451 -0.437291196 -2.102376485 1.921957927 -1.685855380 0.653980254
103 104 105 106 107 108
1.408194600 -1.777650595 -1.888461536 3.041502730 0.861004472 -0.351775471
109 110 111 112 113 114
-0.629658927 -1.384561013 0.126928924 0.319134527 -2.532720385 -0.096038522
115 116 117 118 119 120
-1.048654529 -1.288164738 -0.557142625 2.189044710 0.367791495 0.308455071
121 122 123 124 125 126
2.538551713 1.334643553 -0.711317733 3.666838415 2.353533818 0.059539428
127 128 129 130 131 132
-2.366163467 0.705091637 -3.123777136 -1.534109436 -0.061483706 0.440577813
133 134 135 136 137 138
2.745438328 -2.045875901 -1.143607315 2.482353459 5.896584155 0.655403174
139 140 141 142 143 144
-1.163817375 1.463326519 -0.237888137 0.662823024 -2.488166029 -2.459354580
145 146 147 148 149 150
2.884017319 -1.787238530 2.135561418 2.161959347 -1.954093215 2.591347580
151 152 153 154 155 156
-0.249568550 0.950400011 -1.207930084 -0.006836877 -0.147243760 -1.761657028
157 158 159 160 161 162
-1.341579498 7.269881250 0.427896533 -0.845474746 -2.771785214 -2.702778166
> postscript(file="/var/fisher/rcomp/tmp/6kton1384697612.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 -1.481915985 NA
1 -1.991684132 -1.481915985
2 -0.760407921 -1.991684132
3 1.887545158 -0.760407921
4 3.170033288 1.887545158
5 -1.223193249 3.170033288
6 1.879850226 -1.223193249
7 0.805849959 1.879850226
8 0.490688466 0.805849959
9 -1.681022507 0.490688466
10 -1.772805454 -1.681022507
11 -0.041499082 -1.772805454
12 -1.647723572 -0.041499082
13 2.071985614 -1.647723572
14 -1.129172749 2.071985614
15 2.724427757 -1.129172749
16 -3.791383935 2.724427757
17 -1.023355536 -3.791383935
18 1.813698384 -1.023355536
19 1.542735392 1.813698384
20 -1.477525061 1.542735392
21 -0.411686797 -1.477525061
22 -4.763874328 -0.411686797
23 -0.312761319 -4.763874328
24 -1.236336172 -0.312761319
25 -1.005252668 -1.236336172
26 -1.005252668 -1.005252668
27 -1.143189913 -1.005252668
28 -3.044551381 -1.143189913
29 -1.495560529 -3.044551381
30 -1.141258519 -1.495560529
31 -2.088547670 -1.141258519
32 6.794691994 -2.088547670
33 3.000217021 6.794691994
34 -2.150233624 3.000217021
35 2.610773067 -2.150233624
36 -2.261348914 2.610773067
37 -1.678291466 -2.261348914
38 -0.714062577 -1.678291466
39 -0.374722898 -0.714062577
40 1.106311389 -0.374722898
41 -0.311111982 1.106311389
42 0.317915990 -0.311111982
43 0.465793859 0.317915990
44 0.278558525 0.465793859
45 8.867528508 0.278558525
46 -0.864322991 8.867528508
47 6.411622928 -0.864322991
48 -0.082235106 6.411622928
49 1.067125234 -0.082235106
50 2.051325814 1.067125234
51 -2.584695962 2.051325814
52 -0.820279829 -2.584695962
53 -2.597799173 -0.820279829
54 -1.917824650 -2.597799173
55 -0.422295467 -1.917824650
56 -1.580932717 -0.422295467
57 0.384277804 -1.580932717
58 -1.320583271 0.384277804
59 -3.173647442 -1.320583271
60 -1.211792390 -3.173647442
61 -0.752357439 -1.211792390
62 -0.710414843 -0.752357439
63 -0.172730359 -0.710414843
64 10.511231244 -0.172730359
65 0.412041149 10.511231244
66 -0.445457269 0.412041149
67 -1.578691126 -0.445457269
68 -2.385572122 -1.578691126
69 -1.575212102 -2.385572122
70 -1.140383792 -1.575212102
71 -1.184847725 -1.140383792
72 -0.356654431 -1.184847725
73 3.391025023 -0.356654431
74 -1.039016764 3.391025023
75 -0.048672851 -1.039016764
76 -0.045939565 -0.048672851
77 -0.332116067 -0.045939565
78 -1.337928551 -0.332116067
79 -2.181961146 -1.337928551
80 1.522253765 -2.181961146
81 -1.539880094 1.522253765
82 -0.826287256 -1.539880094
83 -1.015782427 -0.826287256
84 0.779286080 -1.015782427
85 -1.706500983 0.779286080
86 0.090648845 -1.706500983
87 6.474228164 0.090648845
88 1.924502196 6.474228164
89 2.319284655 1.924502196
90 -3.602596278 2.319284655
91 -0.322811210 -3.602596278
92 0.427896533 -0.322811210
93 -1.847456500 0.427896533
94 0.852970562 -1.847456500
95 1.593226044 0.852970562
96 -0.887803451 1.593226044
97 -0.437291196 -0.887803451
98 -2.102376485 -0.437291196
99 1.921957927 -2.102376485
100 -1.685855380 1.921957927
101 0.653980254 -1.685855380
102 1.408194600 0.653980254
103 -1.777650595 1.408194600
104 -1.888461536 -1.777650595
105 3.041502730 -1.888461536
106 0.861004472 3.041502730
107 -0.351775471 0.861004472
108 -0.629658927 -0.351775471
109 -1.384561013 -0.629658927
110 0.126928924 -1.384561013
111 0.319134527 0.126928924
112 -2.532720385 0.319134527
113 -0.096038522 -2.532720385
114 -1.048654529 -0.096038522
115 -1.288164738 -1.048654529
116 -0.557142625 -1.288164738
117 2.189044710 -0.557142625
118 0.367791495 2.189044710
119 0.308455071 0.367791495
120 2.538551713 0.308455071
121 1.334643553 2.538551713
122 -0.711317733 1.334643553
123 3.666838415 -0.711317733
124 2.353533818 3.666838415
125 0.059539428 2.353533818
126 -2.366163467 0.059539428
127 0.705091637 -2.366163467
128 -3.123777136 0.705091637
129 -1.534109436 -3.123777136
130 -0.061483706 -1.534109436
131 0.440577813 -0.061483706
132 2.745438328 0.440577813
133 -2.045875901 2.745438328
134 -1.143607315 -2.045875901
135 2.482353459 -1.143607315
136 5.896584155 2.482353459
137 0.655403174 5.896584155
138 -1.163817375 0.655403174
139 1.463326519 -1.163817375
140 -0.237888137 1.463326519
141 0.662823024 -0.237888137
142 -2.488166029 0.662823024
143 -2.459354580 -2.488166029
144 2.884017319 -2.459354580
145 -1.787238530 2.884017319
146 2.135561418 -1.787238530
147 2.161959347 2.135561418
148 -1.954093215 2.161959347
149 2.591347580 -1.954093215
150 -0.249568550 2.591347580
151 0.950400011 -0.249568550
152 -1.207930084 0.950400011
153 -0.006836877 -1.207930084
154 -0.147243760 -0.006836877
155 -1.761657028 -0.147243760
156 -1.341579498 -1.761657028
157 7.269881250 -1.341579498
158 0.427896533 7.269881250
159 -0.845474746 0.427896533
160 -2.771785214 -0.845474746
161 -2.702778166 -2.771785214
162 NA -2.702778166
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -1.991684132 -1.481915985
[2,] -0.760407921 -1.991684132
[3,] 1.887545158 -0.760407921
[4,] 3.170033288 1.887545158
[5,] -1.223193249 3.170033288
[6,] 1.879850226 -1.223193249
[7,] 0.805849959 1.879850226
[8,] 0.490688466 0.805849959
[9,] -1.681022507 0.490688466
[10,] -1.772805454 -1.681022507
[11,] -0.041499082 -1.772805454
[12,] -1.647723572 -0.041499082
[13,] 2.071985614 -1.647723572
[14,] -1.129172749 2.071985614
[15,] 2.724427757 -1.129172749
[16,] -3.791383935 2.724427757
[17,] -1.023355536 -3.791383935
[18,] 1.813698384 -1.023355536
[19,] 1.542735392 1.813698384
[20,] -1.477525061 1.542735392
[21,] -0.411686797 -1.477525061
[22,] -4.763874328 -0.411686797
[23,] -0.312761319 -4.763874328
[24,] -1.236336172 -0.312761319
[25,] -1.005252668 -1.236336172
[26,] -1.005252668 -1.005252668
[27,] -1.143189913 -1.005252668
[28,] -3.044551381 -1.143189913
[29,] -1.495560529 -3.044551381
[30,] -1.141258519 -1.495560529
[31,] -2.088547670 -1.141258519
[32,] 6.794691994 -2.088547670
[33,] 3.000217021 6.794691994
[34,] -2.150233624 3.000217021
[35,] 2.610773067 -2.150233624
[36,] -2.261348914 2.610773067
[37,] -1.678291466 -2.261348914
[38,] -0.714062577 -1.678291466
[39,] -0.374722898 -0.714062577
[40,] 1.106311389 -0.374722898
[41,] -0.311111982 1.106311389
[42,] 0.317915990 -0.311111982
[43,] 0.465793859 0.317915990
[44,] 0.278558525 0.465793859
[45,] 8.867528508 0.278558525
[46,] -0.864322991 8.867528508
[47,] 6.411622928 -0.864322991
[48,] -0.082235106 6.411622928
[49,] 1.067125234 -0.082235106
[50,] 2.051325814 1.067125234
[51,] -2.584695962 2.051325814
[52,] -0.820279829 -2.584695962
[53,] -2.597799173 -0.820279829
[54,] -1.917824650 -2.597799173
[55,] -0.422295467 -1.917824650
[56,] -1.580932717 -0.422295467
[57,] 0.384277804 -1.580932717
[58,] -1.320583271 0.384277804
[59,] -3.173647442 -1.320583271
[60,] -1.211792390 -3.173647442
[61,] -0.752357439 -1.211792390
[62,] -0.710414843 -0.752357439
[63,] -0.172730359 -0.710414843
[64,] 10.511231244 -0.172730359
[65,] 0.412041149 10.511231244
[66,] -0.445457269 0.412041149
[67,] -1.578691126 -0.445457269
[68,] -2.385572122 -1.578691126
[69,] -1.575212102 -2.385572122
[70,] -1.140383792 -1.575212102
[71,] -1.184847725 -1.140383792
[72,] -0.356654431 -1.184847725
[73,] 3.391025023 -0.356654431
[74,] -1.039016764 3.391025023
[75,] -0.048672851 -1.039016764
[76,] -0.045939565 -0.048672851
[77,] -0.332116067 -0.045939565
[78,] -1.337928551 -0.332116067
[79,] -2.181961146 -1.337928551
[80,] 1.522253765 -2.181961146
[81,] -1.539880094 1.522253765
[82,] -0.826287256 -1.539880094
[83,] -1.015782427 -0.826287256
[84,] 0.779286080 -1.015782427
[85,] -1.706500983 0.779286080
[86,] 0.090648845 -1.706500983
[87,] 6.474228164 0.090648845
[88,] 1.924502196 6.474228164
[89,] 2.319284655 1.924502196
[90,] -3.602596278 2.319284655
[91,] -0.322811210 -3.602596278
[92,] 0.427896533 -0.322811210
[93,] -1.847456500 0.427896533
[94,] 0.852970562 -1.847456500
[95,] 1.593226044 0.852970562
[96,] -0.887803451 1.593226044
[97,] -0.437291196 -0.887803451
[98,] -2.102376485 -0.437291196
[99,] 1.921957927 -2.102376485
[100,] -1.685855380 1.921957927
[101,] 0.653980254 -1.685855380
[102,] 1.408194600 0.653980254
[103,] -1.777650595 1.408194600
[104,] -1.888461536 -1.777650595
[105,] 3.041502730 -1.888461536
[106,] 0.861004472 3.041502730
[107,] -0.351775471 0.861004472
[108,] -0.629658927 -0.351775471
[109,] -1.384561013 -0.629658927
[110,] 0.126928924 -1.384561013
[111,] 0.319134527 0.126928924
[112,] -2.532720385 0.319134527
[113,] -0.096038522 -2.532720385
[114,] -1.048654529 -0.096038522
[115,] -1.288164738 -1.048654529
[116,] -0.557142625 -1.288164738
[117,] 2.189044710 -0.557142625
[118,] 0.367791495 2.189044710
[119,] 0.308455071 0.367791495
[120,] 2.538551713 0.308455071
[121,] 1.334643553 2.538551713
[122,] -0.711317733 1.334643553
[123,] 3.666838415 -0.711317733
[124,] 2.353533818 3.666838415
[125,] 0.059539428 2.353533818
[126,] -2.366163467 0.059539428
[127,] 0.705091637 -2.366163467
[128,] -3.123777136 0.705091637
[129,] -1.534109436 -3.123777136
[130,] -0.061483706 -1.534109436
[131,] 0.440577813 -0.061483706
[132,] 2.745438328 0.440577813
[133,] -2.045875901 2.745438328
[134,] -1.143607315 -2.045875901
[135,] 2.482353459 -1.143607315
[136,] 5.896584155 2.482353459
[137,] 0.655403174 5.896584155
[138,] -1.163817375 0.655403174
[139,] 1.463326519 -1.163817375
[140,] -0.237888137 1.463326519
[141,] 0.662823024 -0.237888137
[142,] -2.488166029 0.662823024
[143,] -2.459354580 -2.488166029
[144,] 2.884017319 -2.459354580
[145,] -1.787238530 2.884017319
[146,] 2.135561418 -1.787238530
[147,] 2.161959347 2.135561418
[148,] -1.954093215 2.161959347
[149,] 2.591347580 -1.954093215
[150,] -0.249568550 2.591347580
[151,] 0.950400011 -0.249568550
[152,] -1.207930084 0.950400011
[153,] -0.006836877 -1.207930084
[154,] -0.147243760 -0.006836877
[155,] -1.761657028 -0.147243760
[156,] -1.341579498 -1.761657028
[157,] 7.269881250 -1.341579498
[158,] 0.427896533 7.269881250
[159,] -0.845474746 0.427896533
[160,] -2.771785214 -0.845474746
[161,] -2.702778166 -2.771785214
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -1.991684132 -1.481915985
2 -0.760407921 -1.991684132
3 1.887545158 -0.760407921
4 3.170033288 1.887545158
5 -1.223193249 3.170033288
6 1.879850226 -1.223193249
7 0.805849959 1.879850226
8 0.490688466 0.805849959
9 -1.681022507 0.490688466
10 -1.772805454 -1.681022507
11 -0.041499082 -1.772805454
12 -1.647723572 -0.041499082
13 2.071985614 -1.647723572
14 -1.129172749 2.071985614
15 2.724427757 -1.129172749
16 -3.791383935 2.724427757
17 -1.023355536 -3.791383935
18 1.813698384 -1.023355536
19 1.542735392 1.813698384
20 -1.477525061 1.542735392
21 -0.411686797 -1.477525061
22 -4.763874328 -0.411686797
23 -0.312761319 -4.763874328
24 -1.236336172 -0.312761319
25 -1.005252668 -1.236336172
26 -1.005252668 -1.005252668
27 -1.143189913 -1.005252668
28 -3.044551381 -1.143189913
29 -1.495560529 -3.044551381
30 -1.141258519 -1.495560529
31 -2.088547670 -1.141258519
32 6.794691994 -2.088547670
33 3.000217021 6.794691994
34 -2.150233624 3.000217021
35 2.610773067 -2.150233624
36 -2.261348914 2.610773067
37 -1.678291466 -2.261348914
38 -0.714062577 -1.678291466
39 -0.374722898 -0.714062577
40 1.106311389 -0.374722898
41 -0.311111982 1.106311389
42 0.317915990 -0.311111982
43 0.465793859 0.317915990
44 0.278558525 0.465793859
45 8.867528508 0.278558525
46 -0.864322991 8.867528508
47 6.411622928 -0.864322991
48 -0.082235106 6.411622928
49 1.067125234 -0.082235106
50 2.051325814 1.067125234
51 -2.584695962 2.051325814
52 -0.820279829 -2.584695962
53 -2.597799173 -0.820279829
54 -1.917824650 -2.597799173
55 -0.422295467 -1.917824650
56 -1.580932717 -0.422295467
57 0.384277804 -1.580932717
58 -1.320583271 0.384277804
59 -3.173647442 -1.320583271
60 -1.211792390 -3.173647442
61 -0.752357439 -1.211792390
62 -0.710414843 -0.752357439
63 -0.172730359 -0.710414843
64 10.511231244 -0.172730359
65 0.412041149 10.511231244
66 -0.445457269 0.412041149
67 -1.578691126 -0.445457269
68 -2.385572122 -1.578691126
69 -1.575212102 -2.385572122
70 -1.140383792 -1.575212102
71 -1.184847725 -1.140383792
72 -0.356654431 -1.184847725
73 3.391025023 -0.356654431
74 -1.039016764 3.391025023
75 -0.048672851 -1.039016764
76 -0.045939565 -0.048672851
77 -0.332116067 -0.045939565
78 -1.337928551 -0.332116067
79 -2.181961146 -1.337928551
80 1.522253765 -2.181961146
81 -1.539880094 1.522253765
82 -0.826287256 -1.539880094
83 -1.015782427 -0.826287256
84 0.779286080 -1.015782427
85 -1.706500983 0.779286080
86 0.090648845 -1.706500983
87 6.474228164 0.090648845
88 1.924502196 6.474228164
89 2.319284655 1.924502196
90 -3.602596278 2.319284655
91 -0.322811210 -3.602596278
92 0.427896533 -0.322811210
93 -1.847456500 0.427896533
94 0.852970562 -1.847456500
95 1.593226044 0.852970562
96 -0.887803451 1.593226044
97 -0.437291196 -0.887803451
98 -2.102376485 -0.437291196
99 1.921957927 -2.102376485
100 -1.685855380 1.921957927
101 0.653980254 -1.685855380
102 1.408194600 0.653980254
103 -1.777650595 1.408194600
104 -1.888461536 -1.777650595
105 3.041502730 -1.888461536
106 0.861004472 3.041502730
107 -0.351775471 0.861004472
108 -0.629658927 -0.351775471
109 -1.384561013 -0.629658927
110 0.126928924 -1.384561013
111 0.319134527 0.126928924
112 -2.532720385 0.319134527
113 -0.096038522 -2.532720385
114 -1.048654529 -0.096038522
115 -1.288164738 -1.048654529
116 -0.557142625 -1.288164738
117 2.189044710 -0.557142625
118 0.367791495 2.189044710
119 0.308455071 0.367791495
120 2.538551713 0.308455071
121 1.334643553 2.538551713
122 -0.711317733 1.334643553
123 3.666838415 -0.711317733
124 2.353533818 3.666838415
125 0.059539428 2.353533818
126 -2.366163467 0.059539428
127 0.705091637 -2.366163467
128 -3.123777136 0.705091637
129 -1.534109436 -3.123777136
130 -0.061483706 -1.534109436
131 0.440577813 -0.061483706
132 2.745438328 0.440577813
133 -2.045875901 2.745438328
134 -1.143607315 -2.045875901
135 2.482353459 -1.143607315
136 5.896584155 2.482353459
137 0.655403174 5.896584155
138 -1.163817375 0.655403174
139 1.463326519 -1.163817375
140 -0.237888137 1.463326519
141 0.662823024 -0.237888137
142 -2.488166029 0.662823024
143 -2.459354580 -2.488166029
144 2.884017319 -2.459354580
145 -1.787238530 2.884017319
146 2.135561418 -1.787238530
147 2.161959347 2.135561418
148 -1.954093215 2.161959347
149 2.591347580 -1.954093215
150 -0.249568550 2.591347580
151 0.950400011 -0.249568550
152 -1.207930084 0.950400011
153 -0.006836877 -1.207930084
154 -0.147243760 -0.006836877
155 -1.761657028 -0.147243760
156 -1.341579498 -1.761657028
157 7.269881250 -1.341579498
158 0.427896533 7.269881250
159 -0.845474746 0.427896533
160 -2.771785214 -0.845474746
161 -2.702778166 -2.771785214
> 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/7ghx61384697612.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/8sfvr1384697612.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/916k71384697612.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/10uutg1384697612.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/11q9xr1384697612.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/12e8lt1384697612.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/1389nd1384697612.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/1470hz1384697613.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/15rs4o1384697613.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/16r1mm1384697613.tab")
+ }
>
> try(system("convert tmp/136pi1384697612.ps tmp/136pi1384697612.png",intern=TRUE))
character(0)
> try(system("convert tmp/2cw2b1384697612.ps tmp/2cw2b1384697612.png",intern=TRUE))
character(0)
> try(system("convert tmp/3zjgt1384697612.ps tmp/3zjgt1384697612.png",intern=TRUE))
character(0)
> try(system("convert tmp/4hea41384697612.ps tmp/4hea41384697612.png",intern=TRUE))
character(0)
> try(system("convert tmp/58bhv1384697612.ps tmp/58bhv1384697612.png",intern=TRUE))
character(0)
> try(system("convert tmp/6kton1384697612.ps tmp/6kton1384697612.png",intern=TRUE))
character(0)
> try(system("convert tmp/7ghx61384697612.ps tmp/7ghx61384697612.png",intern=TRUE))
character(0)
> try(system("convert tmp/8sfvr1384697612.ps tmp/8sfvr1384697612.png",intern=TRUE))
character(0)
> try(system("convert tmp/916k71384697612.ps tmp/916k71384697612.png",intern=TRUE))
character(0)
> try(system("convert tmp/10uutg1384697612.ps tmp/10uutg1384697612.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
8.586 1.598 10.176