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
+ ,0
+ ,0
+ ,0
+ ,0
+ ,1
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,1
+ ,0
+ ,0
+ ,0
+ ,1
+ ,1
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,1
+ ,1
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,1
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,1
+ ,0
+ ,1
+ ,0
+ ,1
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,1
+ ,0
+ ,1
+ ,1
+ ,0
+ ,0
+ ,1
+ ,0
+ ,1
+ ,1
+ ,1
+ ,0
+ ,1
+ ,1
+ ,1
+ ,0
+ ,1
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,1
+ ,0
+ ,0
+ ,1
+ ,1
+ ,1
+ ,1
+ ,1
+ ,0
+ ,0
+ ,0
+ ,1
+ ,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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
ca UseLim T20 used Useful Outcome
1 0 1 0 0 0 1
2 0 0 0 0 0 0
3 0 0 0 0 0 0
4 0 0 0 0 0 0
5 0 0 0 0 0 0
6 0 1 0 0 1 1
7 0 0 0 0 0 0
8 0 0 0 0 0 0
9 0 0 0 0 0 1
10 0 1 0 0 0 0
11 0 1 0 0 0 0
12 0 0 0 0 0 0
13 0 0 0 1 1 0
14 0 1 0 0 0 0
15 0 0 0 1 1 1
16 0 0 0 1 1 1
17 1 1 0 1 1 0
18 0 1 0 0 0 0
19 0 0 0 0 0 1
20 1 0 0 1 1 1
21 0 1 0 0 1 0
22 0 1 0 1 1 1
23 0 0 0 0 1 1
24 0 1 0 0 1 1
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0 0 0 0 0 0
99 0 1 0 0 0 0
100 0 0 0 0 0 1
101 0 1 0 0 0 1
102 0 0 0 0 0 0
103 0 0 0 0 0 0
104 0 0 0 0 0 0
105 0 0 1 1 0 0
106 0 0 0 0 0 0
107 0 0 0 0 0 0
108 0 1 1 1 0 0
109 0 0 0 0 0 0
110 0 1 0 0 0 0
111 0 1 1 1 1 0
112 0 0 1 0 0 0
113 0 0 0 1 0 0
114 0 1 1 1 0 0
115 0 1 0 0 0 0
116 0 0 0 0 0 0
117 0 1 0 0 0 1
118 0 1 0 0 0 0
119 0 0 0 0 0 0
120 0 0 0 0 0 1
121 0 1 0 0 0 0
122 0 0 0 0 0 0
123 0 1 1 1 0 0
124 0 0 0 1 1 1
125 0 0 0 0 0 1
126 0 0 1 0 0 0
127 0 0 0 0 1 0
128 0 0 0 0 0 1
129 0 0 0 0 0 0
130 0 0 0 0 0 1
131 0 1 0 0 0 0
132 0 1 0 0 0 1
133 0 1 0 1 0 0
134 0 0 0 0 0 0
135 0 0 0 0 0 0
136 0 0 0 0 0 0
137 0 1 0 1 1 1
138 0 1 1 1 1 1
139 0 0 1 0 0 0
140 0 0 0 0 0 0
141 1 0 0 1 0 1
142 0 0 1 1 0 1
143 0 1 0 0 0 0
144 0 0 0 0 1 1
145 0 0 0 0 1 0
146 0 0 1 0 0 1
147 0 0 1 1 0 0
148 0 0 1 0 0 0
149 0 1 0 0 0 0
150 0 0 0 0 1 1
151 0 0 0 0 0 1
152 1 1 0 1 0 0
153 1 1 0 1 1 0
154 0 1 0 1 0 0
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) UseLim T20 used Useful Outcome
0.01295 0.01151 -0.16261 0.27829 0.04480 -0.03548
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-0.34754 -0.05774 -0.01295 0.02254 0.74425
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 0.01295 0.03129 0.414 0.6797
UseLim 0.01151 0.04137 0.278 0.7811
T20 -0.16261 0.06361 -2.556 0.0116 *
used 0.27829 0.04485 6.204 5.23e-09 ***
Useful 0.04480 0.04592 0.976 0.3309
Outcome -0.03548 0.04009 -0.885 0.3775
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.237 on 148 degrees of freedom
Multiple R-squared: 0.2488, Adjusted R-squared: 0.2235
F-statistic: 9.806 on 5 and 148 DF, p-value: 4.12e-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.000000000 0.000000000 1.0000000000
[2,] 0.000000000 0.000000000 1.0000000000
[3,] 0.000000000 0.000000000 1.0000000000
[4,] 0.000000000 0.000000000 1.0000000000
[5,] 0.000000000 0.000000000 1.0000000000
[6,] 0.000000000 0.000000000 1.0000000000
[7,] 0.000000000 0.000000000 1.0000000000
[8,] 0.000000000 0.000000000 1.0000000000
[9,] 0.354788247 0.709576495 0.6452117526
[10,] 0.306362518 0.612725035 0.6936374824
[11,] 0.275432772 0.550865544 0.7245672278
[12,] 0.851340400 0.297319200 0.1486596002
[13,] 0.803096395 0.393807209 0.1969036045
[14,] 0.870310992 0.259378016 0.1296890078
[15,] 0.831865229 0.336269542 0.1681347711
[16,] 0.783736055 0.432527889 0.2162639445
[17,] 0.772304136 0.455391728 0.2276958640
[18,] 0.800950703 0.398098593 0.1990492967
[19,] 0.751300826 0.497398348 0.2486991739
[20,] 0.738512251 0.522975498 0.2614877490
[21,] 0.687516429 0.624967143 0.3124835714
[22,] 0.631401583 0.737196834 0.3685984170
[23,] 0.571601966 0.856796068 0.4283980339
[24,] 0.510760807 0.978478385 0.4892391926
[25,] 0.458137250 0.916274499 0.5418627505
[26,] 0.400918281 0.801836561 0.5990817193
[27,] 0.344579839 0.689159678 0.6554201610
[28,] 0.291872845 0.583745691 0.7081271546
[29,] 0.318394948 0.636789897 0.6816050516
[30,] 0.295203044 0.590406089 0.7047969556
[31,] 0.248006348 0.496012697 0.7519936515
[32,] 0.206795222 0.413590444 0.7932047778
[33,] 0.662113178 0.675773644 0.3378868222
[34,] 0.648519226 0.702961548 0.3514807741
[35,] 0.601415635 0.797168730 0.3985843651
[36,] 0.549137151 0.901725698 0.4508628492
[37,] 0.499219079 0.998438159 0.5007809206
[38,] 0.448404870 0.896809739 0.5515951303
[39,] 0.397491026 0.794982052 0.6025089739
[40,] 0.348143902 0.696287804 0.6518560979
[41,] 0.302628264 0.605256528 0.6973717361
[42,] 0.259361635 0.518723270 0.7406383650
[43,] 0.257068208 0.514136417 0.7429317916
[44,] 0.598166340 0.803667321 0.4018336605
[45,] 0.551122812 0.897754375 0.4488771875
[46,] 0.871704750 0.256590501 0.1282952503
[47,] 0.844044648 0.311910704 0.1559553521
[48,] 0.844569583 0.310860834 0.1554304170
[49,] 0.857976045 0.284047910 0.1420239550
[50,] 0.830384468 0.339231064 0.1696155320
[51,] 0.799412822 0.401174356 0.2005871780
[52,] 0.952315770 0.095368460 0.0476842302
[53,] 0.939162832 0.121674335 0.0608371677
[54,] 0.950593241 0.098813519 0.0494067594
[55,] 0.937491867 0.125016266 0.0625081328
[56,] 0.921780527 0.156438946 0.0782194731
[57,] 0.903359808 0.193280383 0.0966401916
[58,] 0.881971423 0.236057154 0.1180285772
[59,] 0.977681835 0.044636330 0.0223181649
[60,] 0.970664631 0.058670739 0.0293353693
[61,] 0.962210513 0.075578973 0.0377894867
[62,] 0.967433191 0.065133619 0.0325668093
[63,] 0.958097551 0.083804898 0.0419024491
[64,] 0.946815137 0.106369725 0.0531848627
[65,] 0.951301446 0.097397107 0.0486985537
[66,] 0.959374122 0.081251756 0.0406258780
[67,] 0.948361315 0.103277369 0.0516386846
[68,] 0.934932312 0.130135376 0.0650676881
[69,] 0.919098225 0.161803550 0.0809017750
[70,] 0.930117897 0.139764205 0.0698821026
[71,] 0.993369829 0.013260342 0.0066301711
[72,] 0.990842170 0.018315660 0.0091578298
[73,] 0.987556511 0.024886979 0.0124434894
[74,] 0.989010413 0.021979175 0.0109895874
[75,] 0.985145791 0.029708417 0.0148542085
[76,] 0.999278580 0.001442840 0.0007214202
[77,] 0.998904378 0.002191245 0.0010956223
[78,] 0.998367714 0.003264572 0.0016322860
[79,] 0.997588157 0.004823686 0.0024118428
[80,] 0.996680881 0.006638238 0.0033191190
[81,] 0.995223528 0.009552944 0.0047764721
[82,] 0.993231104 0.013537792 0.0067688962
[83,] 0.990536310 0.018927379 0.0094636895
[84,] 0.988373200 0.023253601 0.0116268005
[85,] 0.984201982 0.031596036 0.0157980182
[86,] 0.978571053 0.042857894 0.0214289470
[87,] 0.973779481 0.052441038 0.0262205192
[88,] 0.965217262 0.069565476 0.0347827379
[89,] 0.958266970 0.083466059 0.0417330296
[90,] 0.945719829 0.108560341 0.0542801706
[91,] 0.930218817 0.139562367 0.0697811833
[92,] 0.911644490 0.176711019 0.0883555096
[93,] 0.889198415 0.221603171 0.1108015853
[94,] 0.863078917 0.273842165 0.1369210827
[95,] 0.832943188 0.334113623 0.1670568116
[96,] 0.798729742 0.402540515 0.2012702576
[97,] 0.774242314 0.451515372 0.2257576860
[98,] 0.733492538 0.533014924 0.2665074619
[99,] 0.689207083 0.621585834 0.3107929172
[100,] 0.656056238 0.687887523 0.3439437615
[101,] 0.606630867 0.786738265 0.3933691325
[102,] 0.554364023 0.891271954 0.4456359771
[103,] 0.518384616 0.963230768 0.4816153840
[104,] 0.482885186 0.965770371 0.5171148144
[105,] 0.537422977 0.925154046 0.4625770230
[106,] 0.501663853 0.996672294 0.4983361469
[107,] 0.445940703 0.891881406 0.5540592970
[108,] 0.393351516 0.786703033 0.6066484836
[109,] 0.340169744 0.680339487 0.6598302565
[110,] 0.289338953 0.578677905 0.7106610473
[111,] 0.244510523 0.489021046 0.7554894768
[112,] 0.201193047 0.402386094 0.7988069528
[113,] 0.162537939 0.325075878 0.8374620612
[114,] 0.130807314 0.261614627 0.8691926864
[115,] 0.113786107 0.227572214 0.8862138930
[116,] 0.143105433 0.286210866 0.8568945672
[117,] 0.111222884 0.222445767 0.8887771164
[118,] 0.093618512 0.187237024 0.9063814879
[119,] 0.071062557 0.142125114 0.9289374430
[120,] 0.051875384 0.103750768 0.9481246159
[121,] 0.037854564 0.075709128 0.9621454360
[122,] 0.026330013 0.052660025 0.9736699874
[123,] 0.017570110 0.035140220 0.9824298900
[124,] 0.011574935 0.023149871 0.9884250647
[125,] 0.021972178 0.043944357 0.9780278216
[126,] 0.015200173 0.030400346 0.9847998271
[127,] 0.010521405 0.021042811 0.9894785945
[128,] 0.007469504 0.014939008 0.9925304961
[129,] 0.013505224 0.027010448 0.9864947758
[130,] 0.011755740 0.023511481 0.9882442595
[131,] 0.010055937 0.020111875 0.9899440625
[132,] 0.005439065 0.010878130 0.9945609348
[133,] 0.052500846 0.105001691 0.9474991544
[134,] 0.045111357 0.090222714 0.9548886431
[135,] 0.027504673 0.055009347 0.9724953266
[136,] 0.015119306 0.030238612 0.9848806938
[137,] 0.006243364 0.012486729 0.9937566355
> postscript(file="/var/fisher/rcomp/tmp/1xchv1356107400.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/2x8vr1356107400.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/306xx1356107400.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/4ve3z1356107400.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/58c4j1356107400.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> qqnorm(mysum$resid, main='Residual Normal Q-Q Plot')
> qqline(mysum$resid)
> grid()
> dev.off()
null device
1
> (myerror <- as.ts(mysum$resid))
Time Series:
Start = 1
End = 154
Frequency = 1
1 2 3 4 5 6
0.01102373 -0.01294597 -0.01294597 -0.01294597 -0.01294597 -0.03377194
7 8 9 10 11 12
-0.01294597 -0.01294597 0.02253840 -0.02446064 -0.02446064 -0.01294597
13 14 15 16 17 18
-0.33602952 -0.02446064 -0.30054515 -0.30054515 0.65245581 -0.02446064
19 20 21 22 23 24
0.02253840 0.69945485 -0.06925631 -0.31205982 -0.02225727 -0.03377194
25 26 27 28 29 30
-0.25574948 -0.33602952 0.01102373 -0.29123385 0.02253840 -0.05774164
31 32 33 34 35 36
-0.01294597 -0.02446064 -0.06925631 0.02253840 -0.01294597 -0.01294597
37 38 39 40 41 42
-0.34754419 -0.25574948 -0.02225727 -0.05774164 0.69945485 -0.25574948
43 44 45 46 47 48
-0.03377194 -0.02446064 -0.05774164 -0.02225727 -0.01294597 0.02253840
49 50 51 52 53 54
-0.02225727 -0.01294597 -0.29123385 0.65245581 0.02253840 0.70876615
55 56 57 58 59 60
-0.01294597 -0.25574948 -0.30054515 0.02253840 0.02253840 0.68794018
61 62 63 64 65 66
0.01102373 -0.33602952 -0.01294597 0.01102373 -0.01294597 -0.01294597
67 68 69 70 71 72
0.66397048 -0.02446064 0.02253840 -0.29123385 -0.01294597 0.02253840
73 74 75 76 77 78
-0.25574948 -0.30274852 0.02253840 -0.02225727 0.02253840 -0.30054515
79 80 81 82 83 84
0.74425052 -0.05774164 -0.01294597 -0.26726415 -0.01294597 0.70876615
85 86 87 88 89 90
-0.02225727 -0.02446064 0.01102373 -0.10464982 -0.01294597 0.02253840
91 92 93 94 95 96
-0.05774164 0.13815369 -0.06925631 -0.01294597 0.14966836 0.02253840
97 98 99 100 101 102
0.13815369 -0.01294597 -0.02446064 0.02253840 0.01102373 -0.01294597
103 104 105 106 107 108
-0.01294597 -0.01294597 -0.12861952 -0.01294597 -0.01294597 -0.14013419
109 110 111 112 113 114
-0.01294597 -0.02446064 -0.18492985 0.14966836 -0.29123385 -0.14013419
115 116 117 118 119 120
-0.02446064 -0.01294597 0.01102373 -0.02446064 -0.01294597 0.02253840
121 122 123 124 125 126
-0.02446064 -0.01294597 -0.14013419 -0.30054515 0.02253840 0.14966836
127 128 129 130 131 132
-0.05774164 0.02253840 -0.01294597 0.02253840 -0.02446064 0.01102373
133 134 135 136 137 138
-0.30274852 -0.01294597 -0.01294597 -0.01294597 -0.31205982 -0.14944548
139 140 141 142 143 144
0.14966836 -0.01294597 0.74425052 -0.09313515 -0.02446064 -0.02225727
145 146 147 148 149 150
-0.05774164 0.18515273 -0.12861952 0.14966836 -0.02446064 -0.02225727
151 152 153 154
0.02253840 0.69725148 0.65245581 -0.30274852
> postscript(file="/var/fisher/rcomp/tmp/65lqf1356107400.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> dum <- cbind(lag(myerror,k=1),myerror)
> dum
Time Series:
Start = 0
End = 154
Frequency = 1
lag(myerror, k = 1) myerror
0 0.01102373 NA
1 -0.01294597 0.01102373
2 -0.01294597 -0.01294597
3 -0.01294597 -0.01294597
4 -0.01294597 -0.01294597
5 -0.03377194 -0.01294597
6 -0.01294597 -0.03377194
7 -0.01294597 -0.01294597
8 0.02253840 -0.01294597
9 -0.02446064 0.02253840
10 -0.02446064 -0.02446064
11 -0.01294597 -0.02446064
12 -0.33602952 -0.01294597
13 -0.02446064 -0.33602952
14 -0.30054515 -0.02446064
15 -0.30054515 -0.30054515
16 0.65245581 -0.30054515
17 -0.02446064 0.65245581
18 0.02253840 -0.02446064
19 0.69945485 0.02253840
20 -0.06925631 0.69945485
21 -0.31205982 -0.06925631
22 -0.02225727 -0.31205982
23 -0.03377194 -0.02225727
24 -0.25574948 -0.03377194
25 -0.33602952 -0.25574948
26 0.01102373 -0.33602952
27 -0.29123385 0.01102373
28 0.02253840 -0.29123385
29 -0.05774164 0.02253840
30 -0.01294597 -0.05774164
31 -0.02446064 -0.01294597
32 -0.06925631 -0.02446064
33 0.02253840 -0.06925631
34 -0.01294597 0.02253840
35 -0.01294597 -0.01294597
36 -0.34754419 -0.01294597
37 -0.25574948 -0.34754419
38 -0.02225727 -0.25574948
39 -0.05774164 -0.02225727
40 0.69945485 -0.05774164
41 -0.25574948 0.69945485
42 -0.03377194 -0.25574948
43 -0.02446064 -0.03377194
44 -0.05774164 -0.02446064
45 -0.02225727 -0.05774164
46 -0.01294597 -0.02225727
47 0.02253840 -0.01294597
48 -0.02225727 0.02253840
49 -0.01294597 -0.02225727
50 -0.29123385 -0.01294597
51 0.65245581 -0.29123385
52 0.02253840 0.65245581
53 0.70876615 0.02253840
54 -0.01294597 0.70876615
55 -0.25574948 -0.01294597
56 -0.30054515 -0.25574948
57 0.02253840 -0.30054515
58 0.02253840 0.02253840
59 0.68794018 0.02253840
60 0.01102373 0.68794018
61 -0.33602952 0.01102373
62 -0.01294597 -0.33602952
63 0.01102373 -0.01294597
64 -0.01294597 0.01102373
65 -0.01294597 -0.01294597
66 0.66397048 -0.01294597
67 -0.02446064 0.66397048
68 0.02253840 -0.02446064
69 -0.29123385 0.02253840
70 -0.01294597 -0.29123385
71 0.02253840 -0.01294597
72 -0.25574948 0.02253840
73 -0.30274852 -0.25574948
74 0.02253840 -0.30274852
75 -0.02225727 0.02253840
76 0.02253840 -0.02225727
77 -0.30054515 0.02253840
78 0.74425052 -0.30054515
79 -0.05774164 0.74425052
80 -0.01294597 -0.05774164
81 -0.26726415 -0.01294597
82 -0.01294597 -0.26726415
83 0.70876615 -0.01294597
84 -0.02225727 0.70876615
85 -0.02446064 -0.02225727
86 0.01102373 -0.02446064
87 -0.10464982 0.01102373
88 -0.01294597 -0.10464982
89 0.02253840 -0.01294597
90 -0.05774164 0.02253840
91 0.13815369 -0.05774164
92 -0.06925631 0.13815369
93 -0.01294597 -0.06925631
94 0.14966836 -0.01294597
95 0.02253840 0.14966836
96 0.13815369 0.02253840
97 -0.01294597 0.13815369
98 -0.02446064 -0.01294597
99 0.02253840 -0.02446064
100 0.01102373 0.02253840
101 -0.01294597 0.01102373
102 -0.01294597 -0.01294597
103 -0.01294597 -0.01294597
104 -0.12861952 -0.01294597
105 -0.01294597 -0.12861952
106 -0.01294597 -0.01294597
107 -0.14013419 -0.01294597
108 -0.01294597 -0.14013419
109 -0.02446064 -0.01294597
110 -0.18492985 -0.02446064
111 0.14966836 -0.18492985
112 -0.29123385 0.14966836
113 -0.14013419 -0.29123385
114 -0.02446064 -0.14013419
115 -0.01294597 -0.02446064
116 0.01102373 -0.01294597
117 -0.02446064 0.01102373
118 -0.01294597 -0.02446064
119 0.02253840 -0.01294597
120 -0.02446064 0.02253840
121 -0.01294597 -0.02446064
122 -0.14013419 -0.01294597
123 -0.30054515 -0.14013419
124 0.02253840 -0.30054515
125 0.14966836 0.02253840
126 -0.05774164 0.14966836
127 0.02253840 -0.05774164
128 -0.01294597 0.02253840
129 0.02253840 -0.01294597
130 -0.02446064 0.02253840
131 0.01102373 -0.02446064
132 -0.30274852 0.01102373
133 -0.01294597 -0.30274852
134 -0.01294597 -0.01294597
135 -0.01294597 -0.01294597
136 -0.31205982 -0.01294597
137 -0.14944548 -0.31205982
138 0.14966836 -0.14944548
139 -0.01294597 0.14966836
140 0.74425052 -0.01294597
141 -0.09313515 0.74425052
142 -0.02446064 -0.09313515
143 -0.02225727 -0.02446064
144 -0.05774164 -0.02225727
145 0.18515273 -0.05774164
146 -0.12861952 0.18515273
147 0.14966836 -0.12861952
148 -0.02446064 0.14966836
149 -0.02225727 -0.02446064
150 0.02253840 -0.02225727
151 0.69725148 0.02253840
152 0.65245581 0.69725148
153 -0.30274852 0.65245581
154 NA -0.30274852
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -0.01294597 0.01102373
[2,] -0.01294597 -0.01294597
[3,] -0.01294597 -0.01294597
[4,] -0.01294597 -0.01294597
[5,] -0.03377194 -0.01294597
[6,] -0.01294597 -0.03377194
[7,] -0.01294597 -0.01294597
[8,] 0.02253840 -0.01294597
[9,] -0.02446064 0.02253840
[10,] -0.02446064 -0.02446064
[11,] -0.01294597 -0.02446064
[12,] -0.33602952 -0.01294597
[13,] -0.02446064 -0.33602952
[14,] -0.30054515 -0.02446064
[15,] -0.30054515 -0.30054515
[16,] 0.65245581 -0.30054515
[17,] -0.02446064 0.65245581
[18,] 0.02253840 -0.02446064
[19,] 0.69945485 0.02253840
[20,] -0.06925631 0.69945485
[21,] -0.31205982 -0.06925631
[22,] -0.02225727 -0.31205982
[23,] -0.03377194 -0.02225727
[24,] -0.25574948 -0.03377194
[25,] -0.33602952 -0.25574948
[26,] 0.01102373 -0.33602952
[27,] -0.29123385 0.01102373
[28,] 0.02253840 -0.29123385
[29,] -0.05774164 0.02253840
[30,] -0.01294597 -0.05774164
[31,] -0.02446064 -0.01294597
[32,] -0.06925631 -0.02446064
[33,] 0.02253840 -0.06925631
[34,] -0.01294597 0.02253840
[35,] -0.01294597 -0.01294597
[36,] -0.34754419 -0.01294597
[37,] -0.25574948 -0.34754419
[38,] -0.02225727 -0.25574948
[39,] -0.05774164 -0.02225727
[40,] 0.69945485 -0.05774164
[41,] -0.25574948 0.69945485
[42,] -0.03377194 -0.25574948
[43,] -0.02446064 -0.03377194
[44,] -0.05774164 -0.02446064
[45,] -0.02225727 -0.05774164
[46,] -0.01294597 -0.02225727
[47,] 0.02253840 -0.01294597
[48,] -0.02225727 0.02253840
[49,] -0.01294597 -0.02225727
[50,] -0.29123385 -0.01294597
[51,] 0.65245581 -0.29123385
[52,] 0.02253840 0.65245581
[53,] 0.70876615 0.02253840
[54,] -0.01294597 0.70876615
[55,] -0.25574948 -0.01294597
[56,] -0.30054515 -0.25574948
[57,] 0.02253840 -0.30054515
[58,] 0.02253840 0.02253840
[59,] 0.68794018 0.02253840
[60,] 0.01102373 0.68794018
[61,] -0.33602952 0.01102373
[62,] -0.01294597 -0.33602952
[63,] 0.01102373 -0.01294597
[64,] -0.01294597 0.01102373
[65,] -0.01294597 -0.01294597
[66,] 0.66397048 -0.01294597
[67,] -0.02446064 0.66397048
[68,] 0.02253840 -0.02446064
[69,] -0.29123385 0.02253840
[70,] -0.01294597 -0.29123385
[71,] 0.02253840 -0.01294597
[72,] -0.25574948 0.02253840
[73,] -0.30274852 -0.25574948
[74,] 0.02253840 -0.30274852
[75,] -0.02225727 0.02253840
[76,] 0.02253840 -0.02225727
[77,] -0.30054515 0.02253840
[78,] 0.74425052 -0.30054515
[79,] -0.05774164 0.74425052
[80,] -0.01294597 -0.05774164
[81,] -0.26726415 -0.01294597
[82,] -0.01294597 -0.26726415
[83,] 0.70876615 -0.01294597
[84,] -0.02225727 0.70876615
[85,] -0.02446064 -0.02225727
[86,] 0.01102373 -0.02446064
[87,] -0.10464982 0.01102373
[88,] -0.01294597 -0.10464982
[89,] 0.02253840 -0.01294597
[90,] -0.05774164 0.02253840
[91,] 0.13815369 -0.05774164
[92,] -0.06925631 0.13815369
[93,] -0.01294597 -0.06925631
[94,] 0.14966836 -0.01294597
[95,] 0.02253840 0.14966836
[96,] 0.13815369 0.02253840
[97,] -0.01294597 0.13815369
[98,] -0.02446064 -0.01294597
[99,] 0.02253840 -0.02446064
[100,] 0.01102373 0.02253840
[101,] -0.01294597 0.01102373
[102,] -0.01294597 -0.01294597
[103,] -0.01294597 -0.01294597
[104,] -0.12861952 -0.01294597
[105,] -0.01294597 -0.12861952
[106,] -0.01294597 -0.01294597
[107,] -0.14013419 -0.01294597
[108,] -0.01294597 -0.14013419
[109,] -0.02446064 -0.01294597
[110,] -0.18492985 -0.02446064
[111,] 0.14966836 -0.18492985
[112,] -0.29123385 0.14966836
[113,] -0.14013419 -0.29123385
[114,] -0.02446064 -0.14013419
[115,] -0.01294597 -0.02446064
[116,] 0.01102373 -0.01294597
[117,] -0.02446064 0.01102373
[118,] -0.01294597 -0.02446064
[119,] 0.02253840 -0.01294597
[120,] -0.02446064 0.02253840
[121,] -0.01294597 -0.02446064
[122,] -0.14013419 -0.01294597
[123,] -0.30054515 -0.14013419
[124,] 0.02253840 -0.30054515
[125,] 0.14966836 0.02253840
[126,] -0.05774164 0.14966836
[127,] 0.02253840 -0.05774164
[128,] -0.01294597 0.02253840
[129,] 0.02253840 -0.01294597
[130,] -0.02446064 0.02253840
[131,] 0.01102373 -0.02446064
[132,] -0.30274852 0.01102373
[133,] -0.01294597 -0.30274852
[134,] -0.01294597 -0.01294597
[135,] -0.01294597 -0.01294597
[136,] -0.31205982 -0.01294597
[137,] -0.14944548 -0.31205982
[138,] 0.14966836 -0.14944548
[139,] -0.01294597 0.14966836
[140,] 0.74425052 -0.01294597
[141,] -0.09313515 0.74425052
[142,] -0.02446064 -0.09313515
[143,] -0.02225727 -0.02446064
[144,] -0.05774164 -0.02225727
[145,] 0.18515273 -0.05774164
[146,] -0.12861952 0.18515273
[147,] 0.14966836 -0.12861952
[148,] -0.02446064 0.14966836
[149,] -0.02225727 -0.02446064
[150,] 0.02253840 -0.02225727
[151,] 0.69725148 0.02253840
[152,] 0.65245581 0.69725148
[153,] -0.30274852 0.65245581
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -0.01294597 0.01102373
2 -0.01294597 -0.01294597
3 -0.01294597 -0.01294597
4 -0.01294597 -0.01294597
5 -0.03377194 -0.01294597
6 -0.01294597 -0.03377194
7 -0.01294597 -0.01294597
8 0.02253840 -0.01294597
9 -0.02446064 0.02253840
10 -0.02446064 -0.02446064
11 -0.01294597 -0.02446064
12 -0.33602952 -0.01294597
13 -0.02446064 -0.33602952
14 -0.30054515 -0.02446064
15 -0.30054515 -0.30054515
16 0.65245581 -0.30054515
17 -0.02446064 0.65245581
18 0.02253840 -0.02446064
19 0.69945485 0.02253840
20 -0.06925631 0.69945485
21 -0.31205982 -0.06925631
22 -0.02225727 -0.31205982
23 -0.03377194 -0.02225727
24 -0.25574948 -0.03377194
25 -0.33602952 -0.25574948
26 0.01102373 -0.33602952
27 -0.29123385 0.01102373
28 0.02253840 -0.29123385
29 -0.05774164 0.02253840
30 -0.01294597 -0.05774164
31 -0.02446064 -0.01294597
32 -0.06925631 -0.02446064
33 0.02253840 -0.06925631
34 -0.01294597 0.02253840
35 -0.01294597 -0.01294597
36 -0.34754419 -0.01294597
37 -0.25574948 -0.34754419
38 -0.02225727 -0.25574948
39 -0.05774164 -0.02225727
40 0.69945485 -0.05774164
41 -0.25574948 0.69945485
42 -0.03377194 -0.25574948
43 -0.02446064 -0.03377194
44 -0.05774164 -0.02446064
45 -0.02225727 -0.05774164
46 -0.01294597 -0.02225727
47 0.02253840 -0.01294597
48 -0.02225727 0.02253840
49 -0.01294597 -0.02225727
50 -0.29123385 -0.01294597
51 0.65245581 -0.29123385
52 0.02253840 0.65245581
53 0.70876615 0.02253840
54 -0.01294597 0.70876615
55 -0.25574948 -0.01294597
56 -0.30054515 -0.25574948
57 0.02253840 -0.30054515
58 0.02253840 0.02253840
59 0.68794018 0.02253840
60 0.01102373 0.68794018
61 -0.33602952 0.01102373
62 -0.01294597 -0.33602952
63 0.01102373 -0.01294597
64 -0.01294597 0.01102373
65 -0.01294597 -0.01294597
66 0.66397048 -0.01294597
67 -0.02446064 0.66397048
68 0.02253840 -0.02446064
69 -0.29123385 0.02253840
70 -0.01294597 -0.29123385
71 0.02253840 -0.01294597
72 -0.25574948 0.02253840
73 -0.30274852 -0.25574948
74 0.02253840 -0.30274852
75 -0.02225727 0.02253840
76 0.02253840 -0.02225727
77 -0.30054515 0.02253840
78 0.74425052 -0.30054515
79 -0.05774164 0.74425052
80 -0.01294597 -0.05774164
81 -0.26726415 -0.01294597
82 -0.01294597 -0.26726415
83 0.70876615 -0.01294597
84 -0.02225727 0.70876615
85 -0.02446064 -0.02225727
86 0.01102373 -0.02446064
87 -0.10464982 0.01102373
88 -0.01294597 -0.10464982
89 0.02253840 -0.01294597
90 -0.05774164 0.02253840
91 0.13815369 -0.05774164
92 -0.06925631 0.13815369
93 -0.01294597 -0.06925631
94 0.14966836 -0.01294597
95 0.02253840 0.14966836
96 0.13815369 0.02253840
97 -0.01294597 0.13815369
98 -0.02446064 -0.01294597
99 0.02253840 -0.02446064
100 0.01102373 0.02253840
101 -0.01294597 0.01102373
102 -0.01294597 -0.01294597
103 -0.01294597 -0.01294597
104 -0.12861952 -0.01294597
105 -0.01294597 -0.12861952
106 -0.01294597 -0.01294597
107 -0.14013419 -0.01294597
108 -0.01294597 -0.14013419
109 -0.02446064 -0.01294597
110 -0.18492985 -0.02446064
111 0.14966836 -0.18492985
112 -0.29123385 0.14966836
113 -0.14013419 -0.29123385
114 -0.02446064 -0.14013419
115 -0.01294597 -0.02446064
116 0.01102373 -0.01294597
117 -0.02446064 0.01102373
118 -0.01294597 -0.02446064
119 0.02253840 -0.01294597
120 -0.02446064 0.02253840
121 -0.01294597 -0.02446064
122 -0.14013419 -0.01294597
123 -0.30054515 -0.14013419
124 0.02253840 -0.30054515
125 0.14966836 0.02253840
126 -0.05774164 0.14966836
127 0.02253840 -0.05774164
128 -0.01294597 0.02253840
129 0.02253840 -0.01294597
130 -0.02446064 0.02253840
131 0.01102373 -0.02446064
132 -0.30274852 0.01102373
133 -0.01294597 -0.30274852
134 -0.01294597 -0.01294597
135 -0.01294597 -0.01294597
136 -0.31205982 -0.01294597
137 -0.14944548 -0.31205982
138 0.14966836 -0.14944548
139 -0.01294597 0.14966836
140 0.74425052 -0.01294597
141 -0.09313515 0.74425052
142 -0.02446064 -0.09313515
143 -0.02225727 -0.02446064
144 -0.05774164 -0.02225727
145 0.18515273 -0.05774164
146 -0.12861952 0.18515273
147 0.14966836 -0.12861952
148 -0.02446064 0.14966836
149 -0.02225727 -0.02446064
150 0.02253840 -0.02225727
151 0.69725148 0.02253840
152 0.65245581 0.69725148
153 -0.30274852 0.65245581
> 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/7mskn1356107400.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/8z43j1356107400.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/9blv01356107400.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/10cuz21356107400.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/115qfv1356107400.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/1226gn1356107400.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/132tyx1356107400.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/14eihz1356107400.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/15a6781356107400.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/161l8w1356107400.tab")
+ }
>
> try(system("convert tmp/1xchv1356107400.ps tmp/1xchv1356107400.png",intern=TRUE))
character(0)
> try(system("convert tmp/2x8vr1356107400.ps tmp/2x8vr1356107400.png",intern=TRUE))
character(0)
> try(system("convert tmp/306xx1356107400.ps tmp/306xx1356107400.png",intern=TRUE))
character(0)
> try(system("convert tmp/4ve3z1356107400.ps tmp/4ve3z1356107400.png",intern=TRUE))
character(0)
> try(system("convert tmp/58c4j1356107400.ps tmp/58c4j1356107400.png",intern=TRUE))
character(0)
> try(system("convert tmp/65lqf1356107400.ps tmp/65lqf1356107400.png",intern=TRUE))
character(0)
> try(system("convert tmp/7mskn1356107400.ps tmp/7mskn1356107400.png",intern=TRUE))
character(0)
> try(system("convert tmp/8z43j1356107400.ps tmp/8z43j1356107400.png",intern=TRUE))
character(0)
> try(system("convert tmp/9blv01356107400.ps tmp/9blv01356107400.png",intern=TRUE))
character(0)
> try(system("convert tmp/10cuz21356107400.ps tmp/10cuz21356107400.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
11.497 2.323 13.839