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
+ ,1
+ ,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
+ ,1
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,1
+ ,1
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,1
+ ,1
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,1
+ ,0
+ ,1
+ ,0
+ ,1
+ ,1
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,1
+ ,0
+ ,1
+ ,1
+ ,0
+ ,1
+ ,1
+ ,0
+ ,1
+ ,1
+ ,1
+ ,1
+ ,1
+ ,1
+ ,1
+ ,0
+ ,1
+ ,1
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,1
+ ,0
+ ,1
+ ,1
+ ,1
+ ,1
+ ,1
+ ,1
+ ,0
+ ,0
+ ,0
+ ,1
+ ,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par7 = ''
> par6 = ''
> par5 = ''
> par4 = ''
> par3 = 'No Linear Trend'
> par2 = 'Do not include Seasonal Dummies'
> par1 = '4'
> library(lattice)
> library(lmtest)
Loading required package: zoo
Attaching package: 'zoo'
The following object(s) are masked from 'package:base':
as.Date, as.Date.numeric
> n25 <- 25 #minimum number of obs. for Goldfeld-Quandt test
> par1 <- as.numeric(par1)
> x <- t(y)
> k <- length(x[1,])
> n <- length(x[,1])
> x1 <- cbind(x[,par1], x[,1:k!=par1])
> mycolnames <- c(colnames(x)[par1], colnames(x)[1:k!=par1])
> colnames(x1) <- mycolnames #colnames(x)[par1]
> x <- x1
> if (par3 == 'First Differences'){
+ x2 <- array(0, dim=c(n-1,k), dimnames=list(1:(n-1), paste('(1-B)',colnames(x),sep='')))
+ for (i in 1:n-1) {
+ for (j in 1:k) {
+ x2[i,j] <- x[i+1,j] - x[i,j]
+ }
+ }
+ x <- x2
+ }
> if (par2 == 'Include Monthly Dummies'){
+ x2 <- array(0, dim=c(n,11), dimnames=list(1:n, paste('M', seq(1:11), sep ='')))
+ for (i in 1:11){
+ x2[seq(i,n,12),i] <- 1
+ }
+ x <- cbind(x, x2)
+ }
> if (par2 == 'Include Quarterly Dummies'){
+ x2 <- array(0, dim=c(n,3), dimnames=list(1:n, paste('Q', seq(1:3), sep ='')))
+ for (i in 1:3){
+ x2[seq(i,n,4),i] <- 1
+ }
+ x <- cbind(x, x2)
+ }
> k <- length(x[1,])
> if (par3 == 'Linear Trend'){
+ x <- cbind(x, c(1:n))
+ colnames(x)[k+1] <- 't'
+ }
> x
CA Uselim T40 used Useful Outcome\r
1 0 1 1 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 1 0 0 0
9 0 0 0 0 0 1
10 0 1 0 0 0 0
11 0 1 1 0 0 0
12 0 0 0 0 0 0
13 0 0 0 1 1 0
14 0 1 1 0 0 0
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0 1 0 1 0 1
89 0 0 0 0 0 0
90 0 0 0 0 0 1
91 0 0 0 0 1 0
92 0 1 0 0 0 0
93 0 1 0 0 1 0
94 0 0 0 0 0 0
95 0 0 0 0 0 0
96 0 0 0 0 0 1
97 0 1 0 0 0 0
98 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 0 1 0 0
106 0 0 0 0 0 0
107 0 0 0 0 0 0
108 0 1 0 1 0 0
109 0 0 0 0 0 0
110 0 1 0 0 0 0
111 0 1 0 1 1 0
112 0 0 0 0 0 0
113 0 0 0 1 0 0
114 0 1 0 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 0 1 0 0
124 0 0 0 1 1 1
125 0 0 0 0 0 1
126 0 0 0 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 0 1 1 1
139 0 0 0 0 0 0
140 0 0 0 0 0 0
141 1 0 0 1 0 1
142 0 0 0 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 0 0 0 1
147 0 0 0 1 0 0
148 0 0 0 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 T40 used Useful
-0.01201 -0.01274 0.15863 0.23733 0.04935
`Outcome\\r`
-0.03058
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-0.42057 -0.13389 0.01201 0.02475 0.80526
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -0.01201 0.03056 -0.393 0.69487
Uselim -0.01274 0.04128 -0.308 0.75814
T40 0.15863 0.05493 2.888 0.00446 **
used 0.23733 0.04382 5.416 2.41e-07 ***
Useful 0.04935 0.04533 1.089 0.27810
`Outcome\\r` -0.03058 0.03969 -0.770 0.44225
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.2356 on 148 degrees of freedom
Multiple R-squared: 0.2575, Adjusted R-squared: 0.2324
F-statistic: 10.27 on 5 and 148 DF, p-value: 1.831e-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.0000000000 0.0000000000 1.00000000
[2,] 0.0000000000 0.0000000000 1.00000000
[3,] 0.0000000000 0.0000000000 1.00000000
[4,] 0.0000000000 0.0000000000 1.00000000
[5,] 0.0000000000 0.0000000000 1.00000000
[6,] 0.0000000000 0.0000000000 1.00000000
[7,] 0.0000000000 0.0000000000 1.00000000
[8,] 0.0000000000 0.0000000000 1.00000000
[9,] 0.3551299835 0.7102599670 0.64487002
[10,] 0.3131552940 0.6263105880 0.68684471
[11,] 0.2844006003 0.5688012006 0.71559940
[12,] 0.8024570428 0.3950859145 0.19754296
[13,] 0.7456116272 0.5087767456 0.25438837
[14,] 0.7324541921 0.5350916159 0.26754581
[15,] 0.6685031727 0.6629936546 0.33149683
[16,] 0.6016875627 0.7966248745 0.39831244
[17,] 0.6062879631 0.7874240738 0.39371204
[18,] 0.6094704289 0.7810591421 0.39052957
[19,] 0.5678687624 0.8642624752 0.43213124
[20,] 0.5129674850 0.9740650300 0.48703252
[21,] 0.4604264133 0.9208528266 0.53957359
[22,] 0.4040857548 0.8081715095 0.59591425
[23,] 0.3471751417 0.6943502834 0.65282486
[24,] 0.2943534809 0.5887069617 0.70564652
[25,] 0.2462451933 0.4924903865 0.75375481
[26,] 0.2092965125 0.4185930250 0.79070349
[27,] 0.1701059664 0.3402119328 0.82989403
[28,] 0.1359898594 0.2719797189 0.86401014
[29,] 0.1947990124 0.3895980249 0.80520099
[30,] 0.1631189266 0.3262378532 0.83688107
[31,] 0.1303150783 0.2606301566 0.86968492
[32,] 0.1268348944 0.2536697888 0.87316511
[33,] 0.6390408545 0.7219182911 0.36095915
[34,] 0.6074225812 0.7851548376 0.39257742
[35,] 0.5562625746 0.8874748508 0.44373743
[36,] 0.5183732669 0.9632534662 0.48162673
[37,] 0.4669319144 0.9338638287 0.53306809
[38,] 0.4166001874 0.8332003747 0.58339981
[39,] 0.3676832348 0.7353664696 0.63231677
[40,] 0.3208304836 0.6416609673 0.67916952
[41,] 0.2770616177 0.5541232354 0.72293838
[42,] 0.2364145641 0.4728291282 0.76358544
[43,] 0.2921552184 0.5843104368 0.70784478
[44,] 0.5665433223 0.8669133553 0.43345668
[45,] 0.5205199650 0.9589600700 0.47948004
[46,] 0.9003924566 0.1992150868 0.09960754
[47,] 0.8771440535 0.2457118930 0.12285595
[48,] 0.9155419336 0.1689161328 0.08445807
[49,] 0.9152376959 0.1695246082 0.08476230
[50,] 0.8962790641 0.2074418719 0.10372094
[51,] 0.8742679757 0.2514640486 0.12573202
[52,] 0.9572510859 0.0854978281 0.04274891
[53,] 0.9520262973 0.0959474054 0.04797370
[54,] 0.9548421847 0.0903156307 0.04515782
[55,] 0.9425297858 0.1149404284 0.05747021
[56,] 0.9409996406 0.1180007188 0.05900036
[57,] 0.9258815321 0.1482369358 0.07411847
[58,] 0.9079562005 0.1840875990 0.09204380
[59,] 0.9622233059 0.0755533881 0.03777669
[60,] 0.9513305332 0.0973389337 0.04866947
[61,] 0.9390075448 0.1219849103 0.06099246
[62,] 0.9375987373 0.1248025253 0.06240126
[63,] 0.9218788651 0.1562422698 0.07812113
[64,] 0.9041683151 0.1916633699 0.09583168
[65,] 0.8987105472 0.2025789056 0.10128945
[66,] 0.8944679066 0.2110641869 0.10553209
[67,] 0.8724707198 0.2550585604 0.12752928
[68,] 0.8731464152 0.2537071697 0.12685358
[69,] 0.8481922816 0.3036154367 0.15180772
[70,] 0.8462578532 0.3074842936 0.15374215
[71,] 0.9540564558 0.0918870884 0.04594354
[72,] 0.9451611640 0.1096776719 0.05483884
[73,] 0.9308236369 0.1383527262 0.06917636
[74,] 0.9241941717 0.1516116567 0.07580583
[75,] 0.9058161304 0.1883677393 0.09418387
[76,] 0.9948015205 0.0103969590 0.00519848
[77,] 0.9926607802 0.0146784396 0.00733922
[78,] 0.9897911554 0.0204176891 0.01020884
[79,] 0.9860960462 0.0278079075 0.01390395
[80,] 0.9844942400 0.0310115200 0.01550576
[81,] 0.9790240480 0.0419519040 0.02097595
[82,] 0.9721793657 0.0556412686 0.02782063
[83,] 0.9633777530 0.0732444939 0.03662225
[84,] 0.9523430905 0.0953138190 0.04765691
[85,] 0.9387394552 0.1225210895 0.06126054
[86,] 0.9221588130 0.1556823740 0.07784119
[87,] 0.9023108269 0.1953783461 0.09768917
[88,] 0.8794518560 0.2410962879 0.12054814
[89,] 0.8524679965 0.2950640069 0.14753200
[90,] 0.8214529787 0.3570940425 0.17854702
[91,] 0.7866356696 0.4267286608 0.21336433
[92,] 0.7486499601 0.5027000798 0.25135004
[93,] 0.7076113116 0.5847773769 0.29238869
[94,] 0.6621557508 0.6756884984 0.33784425
[95,] 0.6140012687 0.7719974625 0.38599873
[96,] 0.5638061775 0.8723876449 0.43619382
[97,] 0.5499619471 0.9000761057 0.45003805
[98,] 0.4980401535 0.9960803069 0.50195985
[99,] 0.4459001753 0.8918003506 0.55409982
[100,] 0.4336994155 0.8673988310 0.56630058
[101,] 0.3822205754 0.7644411507 0.61777942
[102,] 0.3327613483 0.6655226965 0.66723865
[103,] 0.3320351259 0.6640702518 0.66796487
[104,] 0.2844534466 0.5689068931 0.71554655
[105,] 0.2802304880 0.5604609760 0.71976951
[106,] 0.2824588328 0.5649176656 0.71754117
[107,] 0.2380593716 0.4761187432 0.76194063
[108,] 0.1971168115 0.3942336229 0.80288319
[109,] 0.1614368293 0.3228736585 0.83856317
[110,] 0.1294544146 0.2589088293 0.87054559
[111,] 0.1017655805 0.2035311610 0.89823442
[112,] 0.0787557028 0.1575114056 0.92124430
[113,] 0.0596780790 0.1193561580 0.94032192
[114,] 0.0442068448 0.0884136896 0.95579316
[115,] 0.0479264176 0.0958528351 0.95207358
[116,] 0.0496117754 0.0992235509 0.95038822
[117,] 0.0360355238 0.0720710475 0.96396448
[118,] 0.0254294817 0.0508589634 0.97457052
[119,] 0.0176141338 0.0352282677 0.98238587
[120,] 0.0118884601 0.0237769203 0.98811154
[121,] 0.0077521244 0.0155042488 0.99224788
[122,] 0.0049542508 0.0099085016 0.99504575
[123,] 0.0030416424 0.0060832847 0.99695836
[124,] 0.0018786122 0.0037572245 0.99812139
[125,] 0.0025468670 0.0050937340 0.99745313
[126,] 0.0014653967 0.0029307934 0.99853460
[127,] 0.0008114924 0.0016229847 0.99918851
[128,] 0.0004316462 0.0008632923 0.99956835
[129,] 0.0005869765 0.0011739531 0.99941302
[130,] 0.0034381038 0.0068762075 0.99656190
[131,] 0.0020754217 0.0041508434 0.99792458
[132,] 0.0013524214 0.0027048429 0.99864758
[133,] 0.0396281219 0.0792562438 0.96037188
[134,] 0.0316042423 0.0632084846 0.96839576
[135,] 0.0186702381 0.0373404763 0.98132976
[136,] 0.0100470963 0.0200941925 0.98995290
[137,] 0.0042106432 0.0084212864 0.99578936
> postscript(file="/var/wessaorg/rcomp/tmp/1r3md1356108146.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> plot(x[,1], type='l', main='Actuals and Interpolation', ylab='value of Actuals and Interpolation (dots)', xlab='time or index')
> points(x[,1]-mysum$resid)
> grid()
> dev.off()
null device
1
> postscript(file="/var/wessaorg/rcomp/tmp/2dcfu1356108146.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> plot(mysum$resid, type='b', pch=19, main='Residuals', ylab='value of Residuals', xlab='time or index')
> grid()
> dev.off()
null device
1
> postscript(file="/var/wessaorg/rcomp/tmp/3rmeb1356108146.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> hist(mysum$resid, main='Residual Histogram', xlab='values of Residuals')
> grid()
> dev.off()
null device
1
> postscript(file="/var/wessaorg/rcomp/tmp/4lgb41356108146.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> densityplot(~mysum$resid,col='black',main='Residual Density Plot', xlab='values of Residuals')
> dev.off()
null device
1
> postscript(file="/var/wessaorg/rcomp/tmp/503rm1356108146.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.103306428 0.012009900 0.012009900 0.012009900 0.012009900 0.005980329
7 8 9 10 11 12
0.012009900 -0.146624275 0.042591863 0.024745783 -0.133888392 0.012009900
13 14 15 16 17 18
-0.274670592 -0.133888392 -0.244088628 -0.402722803 0.579431117 -0.133888392
19 20 21 22 23 24
0.042591863 0.597277197 -0.024601634 -0.231352745 -0.006755554 0.005980329
25 26 27 28 29 30
-0.353375386 -0.274670592 0.055327746 -0.225323175 0.042591863 -0.037337517
31 32 33 34 35 36
0.012009900 0.024745783 -0.024601634 -0.116042312 0.012009900 0.012009900
37 38 39 40 41 42
-0.420568883 -0.194741212 -0.006755554 -0.195971692 0.755911372 -0.194741212
43 44 45 46 47 48
0.005980329 -0.133888392 -0.037337517 -0.006755554 0.012009900 0.042591863
49 50 51 52 53 54
-0.006755554 0.012009900 -0.383957349 0.579431117 0.042591863 0.774676825
55 56 57 58 59 60
0.012009900 -0.353375386 -0.244088628 0.042591863 0.042591863 0.610013080
61 62 63 64 65 66
-0.103306428 -0.274670592 0.012009900 -0.103306428 0.012009900 0.012009900
67 68 69 70 71 72
0.566695234 0.024745783 0.042591863 -0.225323175 0.012009900 0.042591863
73 74 75 76 77 78
-0.194741212 -0.212587292 0.042591863 -0.165389728 0.042591863 -0.244088628
79 80 81 82 83 84
0.646624614 -0.195971692 0.012009900 -0.182005328 0.012009900 0.774676825
85 86 87 88 89 90
-0.006755554 0.024745783 0.055327746 -0.182005328 0.012009900 0.042591863
91 92 93 94 95 96
-0.037337517 0.024745783 -0.024601634 0.012009900 0.012009900 0.042591863
97 98 99 100 101 102
0.024745783 0.012009900 0.024745783 0.042591863 0.055327746 0.012009900
103 104 105 106 107 108
0.012009900 0.012009900 -0.225323175 0.012009900 0.012009900 -0.212587292
109 110 111 112 113 114
0.012009900 0.024745783 -0.261934709 0.012009900 -0.225323175 -0.212587292
115 116 117 118 119 120
0.024745783 0.012009900 0.055327746 0.024745783 0.012009900 0.042591863
121 122 123 124 125 126
0.024745783 0.012009900 -0.212587292 -0.244088628 0.042591863 0.012009900
127 128 129 130 131 132
-0.037337517 0.042591863 0.012009900 0.042591863 0.024745783 0.055327746
133 134 135 136 137 138
-0.212587292 0.012009900 0.012009900 0.012009900 -0.231352745 -0.231352745
139 140 141 142 143 144
0.012009900 0.012009900 0.805258788 -0.194741212 0.024745783 -0.006755554
145 146 147 148 149 150
-0.037337517 0.042591863 -0.225323175 0.012009900 0.024745783 -0.006755554
151 152 153 154
0.042591863 0.787412708 0.738065291 -0.212587292
> postscript(file="/var/wessaorg/rcomp/tmp/69j0s1356108146.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.103306428 NA
1 0.012009900 -0.103306428
2 0.012009900 0.012009900
3 0.012009900 0.012009900
4 0.012009900 0.012009900
5 0.005980329 0.012009900
6 0.012009900 0.005980329
7 -0.146624275 0.012009900
8 0.042591863 -0.146624275
9 0.024745783 0.042591863
10 -0.133888392 0.024745783
11 0.012009900 -0.133888392
12 -0.274670592 0.012009900
13 -0.133888392 -0.274670592
14 -0.244088628 -0.133888392
15 -0.402722803 -0.244088628
16 0.579431117 -0.402722803
17 -0.133888392 0.579431117
18 0.042591863 -0.133888392
19 0.597277197 0.042591863
20 -0.024601634 0.597277197
21 -0.231352745 -0.024601634
22 -0.006755554 -0.231352745
23 0.005980329 -0.006755554
24 -0.353375386 0.005980329
25 -0.274670592 -0.353375386
26 0.055327746 -0.274670592
27 -0.225323175 0.055327746
28 0.042591863 -0.225323175
29 -0.037337517 0.042591863
30 0.012009900 -0.037337517
31 0.024745783 0.012009900
32 -0.024601634 0.024745783
33 -0.116042312 -0.024601634
34 0.012009900 -0.116042312
35 0.012009900 0.012009900
36 -0.420568883 0.012009900
37 -0.194741212 -0.420568883
38 -0.006755554 -0.194741212
39 -0.195971692 -0.006755554
40 0.755911372 -0.195971692
41 -0.194741212 0.755911372
42 0.005980329 -0.194741212
43 -0.133888392 0.005980329
44 -0.037337517 -0.133888392
45 -0.006755554 -0.037337517
46 0.012009900 -0.006755554
47 0.042591863 0.012009900
48 -0.006755554 0.042591863
49 0.012009900 -0.006755554
50 -0.383957349 0.012009900
51 0.579431117 -0.383957349
52 0.042591863 0.579431117
53 0.774676825 0.042591863
54 0.012009900 0.774676825
55 -0.353375386 0.012009900
56 -0.244088628 -0.353375386
57 0.042591863 -0.244088628
58 0.042591863 0.042591863
59 0.610013080 0.042591863
60 -0.103306428 0.610013080
61 -0.274670592 -0.103306428
62 0.012009900 -0.274670592
63 -0.103306428 0.012009900
64 0.012009900 -0.103306428
65 0.012009900 0.012009900
66 0.566695234 0.012009900
67 0.024745783 0.566695234
68 0.042591863 0.024745783
69 -0.225323175 0.042591863
70 0.012009900 -0.225323175
71 0.042591863 0.012009900
72 -0.194741212 0.042591863
73 -0.212587292 -0.194741212
74 0.042591863 -0.212587292
75 -0.165389728 0.042591863
76 0.042591863 -0.165389728
77 -0.244088628 0.042591863
78 0.646624614 -0.244088628
79 -0.195971692 0.646624614
80 0.012009900 -0.195971692
81 -0.182005328 0.012009900
82 0.012009900 -0.182005328
83 0.774676825 0.012009900
84 -0.006755554 0.774676825
85 0.024745783 -0.006755554
86 0.055327746 0.024745783
87 -0.182005328 0.055327746
88 0.012009900 -0.182005328
89 0.042591863 0.012009900
90 -0.037337517 0.042591863
91 0.024745783 -0.037337517
92 -0.024601634 0.024745783
93 0.012009900 -0.024601634
94 0.012009900 0.012009900
95 0.042591863 0.012009900
96 0.024745783 0.042591863
97 0.012009900 0.024745783
98 0.024745783 0.012009900
99 0.042591863 0.024745783
100 0.055327746 0.042591863
101 0.012009900 0.055327746
102 0.012009900 0.012009900
103 0.012009900 0.012009900
104 -0.225323175 0.012009900
105 0.012009900 -0.225323175
106 0.012009900 0.012009900
107 -0.212587292 0.012009900
108 0.012009900 -0.212587292
109 0.024745783 0.012009900
110 -0.261934709 0.024745783
111 0.012009900 -0.261934709
112 -0.225323175 0.012009900
113 -0.212587292 -0.225323175
114 0.024745783 -0.212587292
115 0.012009900 0.024745783
116 0.055327746 0.012009900
117 0.024745783 0.055327746
118 0.012009900 0.024745783
119 0.042591863 0.012009900
120 0.024745783 0.042591863
121 0.012009900 0.024745783
122 -0.212587292 0.012009900
123 -0.244088628 -0.212587292
124 0.042591863 -0.244088628
125 0.012009900 0.042591863
126 -0.037337517 0.012009900
127 0.042591863 -0.037337517
128 0.012009900 0.042591863
129 0.042591863 0.012009900
130 0.024745783 0.042591863
131 0.055327746 0.024745783
132 -0.212587292 0.055327746
133 0.012009900 -0.212587292
134 0.012009900 0.012009900
135 0.012009900 0.012009900
136 -0.231352745 0.012009900
137 -0.231352745 -0.231352745
138 0.012009900 -0.231352745
139 0.012009900 0.012009900
140 0.805258788 0.012009900
141 -0.194741212 0.805258788
142 0.024745783 -0.194741212
143 -0.006755554 0.024745783
144 -0.037337517 -0.006755554
145 0.042591863 -0.037337517
146 -0.225323175 0.042591863
147 0.012009900 -0.225323175
148 0.024745783 0.012009900
149 -0.006755554 0.024745783
150 0.042591863 -0.006755554
151 0.787412708 0.042591863
152 0.738065291 0.787412708
153 -0.212587292 0.738065291
154 NA -0.212587292
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 0.012009900 -0.103306428
[2,] 0.012009900 0.012009900
[3,] 0.012009900 0.012009900
[4,] 0.012009900 0.012009900
[5,] 0.005980329 0.012009900
[6,] 0.012009900 0.005980329
[7,] -0.146624275 0.012009900
[8,] 0.042591863 -0.146624275
[9,] 0.024745783 0.042591863
[10,] -0.133888392 0.024745783
[11,] 0.012009900 -0.133888392
[12,] -0.274670592 0.012009900
[13,] -0.133888392 -0.274670592
[14,] -0.244088628 -0.133888392
[15,] -0.402722803 -0.244088628
[16,] 0.579431117 -0.402722803
[17,] -0.133888392 0.579431117
[18,] 0.042591863 -0.133888392
[19,] 0.597277197 0.042591863
[20,] -0.024601634 0.597277197
[21,] -0.231352745 -0.024601634
[22,] -0.006755554 -0.231352745
[23,] 0.005980329 -0.006755554
[24,] -0.353375386 0.005980329
[25,] -0.274670592 -0.353375386
[26,] 0.055327746 -0.274670592
[27,] -0.225323175 0.055327746
[28,] 0.042591863 -0.225323175
[29,] -0.037337517 0.042591863
[30,] 0.012009900 -0.037337517
[31,] 0.024745783 0.012009900
[32,] -0.024601634 0.024745783
[33,] -0.116042312 -0.024601634
[34,] 0.012009900 -0.116042312
[35,] 0.012009900 0.012009900
[36,] -0.420568883 0.012009900
[37,] -0.194741212 -0.420568883
[38,] -0.006755554 -0.194741212
[39,] -0.195971692 -0.006755554
[40,] 0.755911372 -0.195971692
[41,] -0.194741212 0.755911372
[42,] 0.005980329 -0.194741212
[43,] -0.133888392 0.005980329
[44,] -0.037337517 -0.133888392
[45,] -0.006755554 -0.037337517
[46,] 0.012009900 -0.006755554
[47,] 0.042591863 0.012009900
[48,] -0.006755554 0.042591863
[49,] 0.012009900 -0.006755554
[50,] -0.383957349 0.012009900
[51,] 0.579431117 -0.383957349
[52,] 0.042591863 0.579431117
[53,] 0.774676825 0.042591863
[54,] 0.012009900 0.774676825
[55,] -0.353375386 0.012009900
[56,] -0.244088628 -0.353375386
[57,] 0.042591863 -0.244088628
[58,] 0.042591863 0.042591863
[59,] 0.610013080 0.042591863
[60,] -0.103306428 0.610013080
[61,] -0.274670592 -0.103306428
[62,] 0.012009900 -0.274670592
[63,] -0.103306428 0.012009900
[64,] 0.012009900 -0.103306428
[65,] 0.012009900 0.012009900
[66,] 0.566695234 0.012009900
[67,] 0.024745783 0.566695234
[68,] 0.042591863 0.024745783
[69,] -0.225323175 0.042591863
[70,] 0.012009900 -0.225323175
[71,] 0.042591863 0.012009900
[72,] -0.194741212 0.042591863
[73,] -0.212587292 -0.194741212
[74,] 0.042591863 -0.212587292
[75,] -0.165389728 0.042591863
[76,] 0.042591863 -0.165389728
[77,] -0.244088628 0.042591863
[78,] 0.646624614 -0.244088628
[79,] -0.195971692 0.646624614
[80,] 0.012009900 -0.195971692
[81,] -0.182005328 0.012009900
[82,] 0.012009900 -0.182005328
[83,] 0.774676825 0.012009900
[84,] -0.006755554 0.774676825
[85,] 0.024745783 -0.006755554
[86,] 0.055327746 0.024745783
[87,] -0.182005328 0.055327746
[88,] 0.012009900 -0.182005328
[89,] 0.042591863 0.012009900
[90,] -0.037337517 0.042591863
[91,] 0.024745783 -0.037337517
[92,] -0.024601634 0.024745783
[93,] 0.012009900 -0.024601634
[94,] 0.012009900 0.012009900
[95,] 0.042591863 0.012009900
[96,] 0.024745783 0.042591863
[97,] 0.012009900 0.024745783
[98,] 0.024745783 0.012009900
[99,] 0.042591863 0.024745783
[100,] 0.055327746 0.042591863
[101,] 0.012009900 0.055327746
[102,] 0.012009900 0.012009900
[103,] 0.012009900 0.012009900
[104,] -0.225323175 0.012009900
[105,] 0.012009900 -0.225323175
[106,] 0.012009900 0.012009900
[107,] -0.212587292 0.012009900
[108,] 0.012009900 -0.212587292
[109,] 0.024745783 0.012009900
[110,] -0.261934709 0.024745783
[111,] 0.012009900 -0.261934709
[112,] -0.225323175 0.012009900
[113,] -0.212587292 -0.225323175
[114,] 0.024745783 -0.212587292
[115,] 0.012009900 0.024745783
[116,] 0.055327746 0.012009900
[117,] 0.024745783 0.055327746
[118,] 0.012009900 0.024745783
[119,] 0.042591863 0.012009900
[120,] 0.024745783 0.042591863
[121,] 0.012009900 0.024745783
[122,] -0.212587292 0.012009900
[123,] -0.244088628 -0.212587292
[124,] 0.042591863 -0.244088628
[125,] 0.012009900 0.042591863
[126,] -0.037337517 0.012009900
[127,] 0.042591863 -0.037337517
[128,] 0.012009900 0.042591863
[129,] 0.042591863 0.012009900
[130,] 0.024745783 0.042591863
[131,] 0.055327746 0.024745783
[132,] -0.212587292 0.055327746
[133,] 0.012009900 -0.212587292
[134,] 0.012009900 0.012009900
[135,] 0.012009900 0.012009900
[136,] -0.231352745 0.012009900
[137,] -0.231352745 -0.231352745
[138,] 0.012009900 -0.231352745
[139,] 0.012009900 0.012009900
[140,] 0.805258788 0.012009900
[141,] -0.194741212 0.805258788
[142,] 0.024745783 -0.194741212
[143,] -0.006755554 0.024745783
[144,] -0.037337517 -0.006755554
[145,] 0.042591863 -0.037337517
[146,] -0.225323175 0.042591863
[147,] 0.012009900 -0.225323175
[148,] 0.024745783 0.012009900
[149,] -0.006755554 0.024745783
[150,] 0.042591863 -0.006755554
[151,] 0.787412708 0.042591863
[152,] 0.738065291 0.787412708
[153,] -0.212587292 0.738065291
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 0.012009900 -0.103306428
2 0.012009900 0.012009900
3 0.012009900 0.012009900
4 0.012009900 0.012009900
5 0.005980329 0.012009900
6 0.012009900 0.005980329
7 -0.146624275 0.012009900
8 0.042591863 -0.146624275
9 0.024745783 0.042591863
10 -0.133888392 0.024745783
11 0.012009900 -0.133888392
12 -0.274670592 0.012009900
13 -0.133888392 -0.274670592
14 -0.244088628 -0.133888392
15 -0.402722803 -0.244088628
16 0.579431117 -0.402722803
17 -0.133888392 0.579431117
18 0.042591863 -0.133888392
19 0.597277197 0.042591863
20 -0.024601634 0.597277197
21 -0.231352745 -0.024601634
22 -0.006755554 -0.231352745
23 0.005980329 -0.006755554
24 -0.353375386 0.005980329
25 -0.274670592 -0.353375386
26 0.055327746 -0.274670592
27 -0.225323175 0.055327746
28 0.042591863 -0.225323175
29 -0.037337517 0.042591863
30 0.012009900 -0.037337517
31 0.024745783 0.012009900
32 -0.024601634 0.024745783
33 -0.116042312 -0.024601634
34 0.012009900 -0.116042312
35 0.012009900 0.012009900
36 -0.420568883 0.012009900
37 -0.194741212 -0.420568883
38 -0.006755554 -0.194741212
39 -0.195971692 -0.006755554
40 0.755911372 -0.195971692
41 -0.194741212 0.755911372
42 0.005980329 -0.194741212
43 -0.133888392 0.005980329
44 -0.037337517 -0.133888392
45 -0.006755554 -0.037337517
46 0.012009900 -0.006755554
47 0.042591863 0.012009900
48 -0.006755554 0.042591863
49 0.012009900 -0.006755554
50 -0.383957349 0.012009900
51 0.579431117 -0.383957349
52 0.042591863 0.579431117
53 0.774676825 0.042591863
54 0.012009900 0.774676825
55 -0.353375386 0.012009900
56 -0.244088628 -0.353375386
57 0.042591863 -0.244088628
58 0.042591863 0.042591863
59 0.610013080 0.042591863
60 -0.103306428 0.610013080
61 -0.274670592 -0.103306428
62 0.012009900 -0.274670592
63 -0.103306428 0.012009900
64 0.012009900 -0.103306428
65 0.012009900 0.012009900
66 0.566695234 0.012009900
67 0.024745783 0.566695234
68 0.042591863 0.024745783
69 -0.225323175 0.042591863
70 0.012009900 -0.225323175
71 0.042591863 0.012009900
72 -0.194741212 0.042591863
73 -0.212587292 -0.194741212
74 0.042591863 -0.212587292
75 -0.165389728 0.042591863
76 0.042591863 -0.165389728
77 -0.244088628 0.042591863
78 0.646624614 -0.244088628
79 -0.195971692 0.646624614
80 0.012009900 -0.195971692
81 -0.182005328 0.012009900
82 0.012009900 -0.182005328
83 0.774676825 0.012009900
84 -0.006755554 0.774676825
85 0.024745783 -0.006755554
86 0.055327746 0.024745783
87 -0.182005328 0.055327746
88 0.012009900 -0.182005328
89 0.042591863 0.012009900
90 -0.037337517 0.042591863
91 0.024745783 -0.037337517
92 -0.024601634 0.024745783
93 0.012009900 -0.024601634
94 0.012009900 0.012009900
95 0.042591863 0.012009900
96 0.024745783 0.042591863
97 0.012009900 0.024745783
98 0.024745783 0.012009900
99 0.042591863 0.024745783
100 0.055327746 0.042591863
101 0.012009900 0.055327746
102 0.012009900 0.012009900
103 0.012009900 0.012009900
104 -0.225323175 0.012009900
105 0.012009900 -0.225323175
106 0.012009900 0.012009900
107 -0.212587292 0.012009900
108 0.012009900 -0.212587292
109 0.024745783 0.012009900
110 -0.261934709 0.024745783
111 0.012009900 -0.261934709
112 -0.225323175 0.012009900
113 -0.212587292 -0.225323175
114 0.024745783 -0.212587292
115 0.012009900 0.024745783
116 0.055327746 0.012009900
117 0.024745783 0.055327746
118 0.012009900 0.024745783
119 0.042591863 0.012009900
120 0.024745783 0.042591863
121 0.012009900 0.024745783
122 -0.212587292 0.012009900
123 -0.244088628 -0.212587292
124 0.042591863 -0.244088628
125 0.012009900 0.042591863
126 -0.037337517 0.012009900
127 0.042591863 -0.037337517
128 0.012009900 0.042591863
129 0.042591863 0.012009900
130 0.024745783 0.042591863
131 0.055327746 0.024745783
132 -0.212587292 0.055327746
133 0.012009900 -0.212587292
134 0.012009900 0.012009900
135 0.012009900 0.012009900
136 -0.231352745 0.012009900
137 -0.231352745 -0.231352745
138 0.012009900 -0.231352745
139 0.012009900 0.012009900
140 0.805258788 0.012009900
141 -0.194741212 0.805258788
142 0.024745783 -0.194741212
143 -0.006755554 0.024745783
144 -0.037337517 -0.006755554
145 0.042591863 -0.037337517
146 -0.225323175 0.042591863
147 0.012009900 -0.225323175
148 0.024745783 0.012009900
149 -0.006755554 0.024745783
150 0.042591863 -0.006755554
151 0.787412708 0.042591863
152 0.738065291 0.787412708
153 -0.212587292 0.738065291
> plot(z,main=paste('Residual Lag plot, lowess, and regression line'), ylab='values of Residuals', xlab='lagged values of Residuals')
> lines(lowess(z))
> abline(lm(z))
> grid()
> dev.off()
null device
1
> postscript(file="/var/wessaorg/rcomp/tmp/7cv2v1356108146.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> acf(mysum$resid, lag.max=length(mysum$resid)/2, main='Residual Autocorrelation Function')
> grid()
> dev.off()
null device
1
> postscript(file="/var/wessaorg/rcomp/tmp/8btu81356108146.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> pacf(mysum$resid, lag.max=length(mysum$resid)/2, main='Residual Partial Autocorrelation Function')
> grid()
> dev.off()
null device
1
> postscript(file="/var/wessaorg/rcomp/tmp/9kz0m1356108146.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> opar <- par(mfrow = c(2,2), oma = c(0, 0, 1.1, 0))
> plot(mylm, las = 1, sub='Residual Diagnostics')
> par(opar)
> dev.off()
null device
1
> if (n > n25) {
+ postscript(file="/var/wessaorg/rcomp/tmp/10tcak1356108146.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
+ plot(kp3:nmkm3,gqarr[,2], main='Goldfeld-Quandt test',ylab='2-sided p-value',xlab='breakpoint')
+ grid()
+ dev.off()
+ }
null device
1
>
> #Note: the /var/wessaorg/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab
> load(file="/var/wessaorg/rcomp/createtable")
>
> a<-table.start()
> a<-table.row.start(a)
> a<-table.element(a, 'Multiple Linear Regression - Estimated Regression Equation', 1, TRUE)
> a<-table.row.end(a)
> myeq <- colnames(x)[1]
> myeq <- paste(myeq, '[t] = ', sep='')
> for (i in 1:k){
+ if (mysum$coefficients[i,1] > 0) myeq <- paste(myeq, '+', '')
+ myeq <- paste(myeq, mysum$coefficients[i,1], sep=' ')
+ if (rownames(mysum$coefficients)[i] != '(Intercept)') {
+ myeq <- paste(myeq, rownames(mysum$coefficients)[i], sep='')
+ if (rownames(mysum$coefficients)[i] != 't') myeq <- paste(myeq, '[t]', sep='')
+ }
+ }
> myeq <- paste(myeq, ' + e[t]')
> a<-table.row.start(a)
> a<-table.element(a, myeq)
> a<-table.row.end(a)
> a<-table.end(a)
> table.save(a,file="/var/wessaorg/rcomp/tmp/11d2351356108146.tab")
> a<-table.start()
> a<-table.row.start(a)
> a<-table.element(a,hyperlink('http://www.xycoon.com/ols1.htm','Multiple Linear Regression - Ordinary Least Squares',''), 6, TRUE)
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a,'Variable',header=TRUE)
> a<-table.element(a,'Parameter',header=TRUE)
> a<-table.element(a,'S.D.',header=TRUE)
> a<-table.element(a,'T-STAT
H0: parameter = 0',header=TRUE)
> a<-table.element(a,'2-tail p-value',header=TRUE)
> a<-table.element(a,'1-tail p-value',header=TRUE)
> a<-table.row.end(a)
> for (i in 1:k){
+ a<-table.row.start(a)
+ a<-table.element(a,rownames(mysum$coefficients)[i],header=TRUE)
+ a<-table.element(a,mysum$coefficients[i,1])
+ a<-table.element(a, round(mysum$coefficients[i,2],6))
+ a<-table.element(a, round(mysum$coefficients[i,3],4))
+ a<-table.element(a, round(mysum$coefficients[i,4],6))
+ a<-table.element(a, round(mysum$coefficients[i,4]/2,6))
+ a<-table.row.end(a)
+ }
> a<-table.end(a)
> table.save(a,file="/var/wessaorg/rcomp/tmp/12zudz1356108146.tab")
> a<-table.start()
> a<-table.row.start(a)
> a<-table.element(a, 'Multiple Linear Regression - Regression Statistics', 2, TRUE)
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a, 'Multiple R',1,TRUE)
> a<-table.element(a, sqrt(mysum$r.squared))
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a, 'R-squared',1,TRUE)
> a<-table.element(a, mysum$r.squared)
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a, 'Adjusted R-squared',1,TRUE)
> a<-table.element(a, mysum$adj.r.squared)
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a, 'F-TEST (value)',1,TRUE)
> a<-table.element(a, mysum$fstatistic[1])
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a, 'F-TEST (DF numerator)',1,TRUE)
> a<-table.element(a, mysum$fstatistic[2])
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a, 'F-TEST (DF denominator)',1,TRUE)
> a<-table.element(a, mysum$fstatistic[3])
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a, 'p-value',1,TRUE)
> a<-table.element(a, 1-pf(mysum$fstatistic[1],mysum$fstatistic[2],mysum$fstatistic[3]))
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a, 'Multiple Linear Regression - Residual Statistics', 2, TRUE)
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a, 'Residual Standard Deviation',1,TRUE)
> a<-table.element(a, mysum$sigma)
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a, 'Sum Squared Residuals',1,TRUE)
> a<-table.element(a, sum(myerror*myerror))
> a<-table.row.end(a)
> a<-table.end(a)
> table.save(a,file="/var/wessaorg/rcomp/tmp/13gxje1356108146.tab")
> a<-table.start()
> a<-table.row.start(a)
> a<-table.element(a, 'Multiple Linear Regression - Actuals, Interpolation, and Residuals', 4, TRUE)
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a, 'Time or Index', 1, TRUE)
> a<-table.element(a, 'Actuals', 1, TRUE)
> a<-table.element(a, 'Interpolation
Forecast', 1, TRUE)
> a<-table.element(a, 'Residuals
Prediction Error', 1, TRUE)
> a<-table.row.end(a)
> for (i in 1:n) {
+ a<-table.row.start(a)
+ a<-table.element(a,i, 1, TRUE)
+ a<-table.element(a,x[i])
+ a<-table.element(a,x[i]-mysum$resid[i])
+ a<-table.element(a,mysum$resid[i])
+ a<-table.row.end(a)
+ }
> a<-table.end(a)
> table.save(a,file="/var/wessaorg/rcomp/tmp/14utau1356108146.tab")
> if (n > n25) {
+ a<-table.start()
+ a<-table.row.start(a)
+ a<-table.element(a,'Goldfeld-Quandt test for Heteroskedasticity',4,TRUE)
+ a<-table.row.end(a)
+ a<-table.row.start(a)
+ a<-table.element(a,'p-values',header=TRUE)
+ a<-table.element(a,'Alternative Hypothesis',3,header=TRUE)
+ a<-table.row.end(a)
+ a<-table.row.start(a)
+ a<-table.element(a,'breakpoint index',header=TRUE)
+ a<-table.element(a,'greater',header=TRUE)
+ a<-table.element(a,'2-sided',header=TRUE)
+ a<-table.element(a,'less',header=TRUE)
+ a<-table.row.end(a)
+ for (mypoint in kp3:nmkm3) {
+ a<-table.row.start(a)
+ a<-table.element(a,mypoint,header=TRUE)
+ a<-table.element(a,gqarr[mypoint-kp3+1,1])
+ a<-table.element(a,gqarr[mypoint-kp3+1,2])
+ a<-table.element(a,gqarr[mypoint-kp3+1,3])
+ a<-table.row.end(a)
+ }
+ a<-table.end(a)
+ table.save(a,file="/var/wessaorg/rcomp/tmp/15zrfi1356108146.tab")
+ a<-table.start()
+ a<-table.row.start(a)
+ a<-table.element(a,'Meta Analysis of Goldfeld-Quandt test for Heteroskedasticity',4,TRUE)
+ a<-table.row.end(a)
+ a<-table.row.start(a)
+ a<-table.element(a,'Description',header=TRUE)
+ a<-table.element(a,'# significant tests',header=TRUE)
+ a<-table.element(a,'% significant tests',header=TRUE)
+ a<-table.element(a,'OK/NOK',header=TRUE)
+ a<-table.row.end(a)
+ a<-table.row.start(a)
+ a<-table.element(a,'1% type I error level',header=TRUE)
+ a<-table.element(a,numsignificant1)
+ a<-table.element(a,numsignificant1/numgqtests)
+ if (numsignificant1/numgqtests < 0.01) dum <- 'OK' else dum <- 'NOK'
+ a<-table.element(a,dum)
+ a<-table.row.end(a)
+ a<-table.row.start(a)
+ a<-table.element(a,'5% type I error level',header=TRUE)
+ a<-table.element(a,numsignificant5)
+ a<-table.element(a,numsignificant5/numgqtests)
+ if (numsignificant5/numgqtests < 0.05) dum <- 'OK' else dum <- 'NOK'
+ a<-table.element(a,dum)
+ a<-table.row.end(a)
+ a<-table.row.start(a)
+ a<-table.element(a,'10% type I error level',header=TRUE)
+ a<-table.element(a,numsignificant10)
+ a<-table.element(a,numsignificant10/numgqtests)
+ if (numsignificant10/numgqtests < 0.1) dum <- 'OK' else dum <- 'NOK'
+ a<-table.element(a,dum)
+ a<-table.row.end(a)
+ a<-table.end(a)
+ table.save(a,file="/var/wessaorg/rcomp/tmp/16ji6w1356108146.tab")
+ }
>
> try(system("convert tmp/1r3md1356108146.ps tmp/1r3md1356108146.png",intern=TRUE))
character(0)
> try(system("convert tmp/2dcfu1356108146.ps tmp/2dcfu1356108146.png",intern=TRUE))
character(0)
> try(system("convert tmp/3rmeb1356108146.ps tmp/3rmeb1356108146.png",intern=TRUE))
character(0)
> try(system("convert tmp/4lgb41356108146.ps tmp/4lgb41356108146.png",intern=TRUE))
character(0)
> try(system("convert tmp/503rm1356108146.ps tmp/503rm1356108146.png",intern=TRUE))
character(0)
> try(system("convert tmp/69j0s1356108146.ps tmp/69j0s1356108146.png",intern=TRUE))
character(0)
> try(system("convert tmp/7cv2v1356108146.ps tmp/7cv2v1356108146.png",intern=TRUE))
character(0)
> try(system("convert tmp/8btu81356108146.ps tmp/8btu81356108146.png",intern=TRUE))
character(0)
> try(system("convert tmp/9kz0m1356108146.ps tmp/9kz0m1356108146.png",intern=TRUE))
character(0)
> try(system("convert tmp/10tcak1356108146.ps tmp/10tcak1356108146.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
7.837 1.212 9.191