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(4
+ ,1
+ ,1
+ ,0
+ ,0
+ ,0
+ ,0
+ ,1
+ ,4
+ ,0
+ ,2
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,4
+ ,0
+ ,2
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,4
+ ,0
+ ,2
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,4
+ ,0
+ ,2
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,4
+ ,1
+ ,2
+ ,0
+ ,0
+ ,0
+ ,1
+ ,1
+ ,4
+ ,0
+ ,2
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,4
+ ,0
+ ,1
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,4
+ ,0
+ ,2
+ ,0
+ ,0
+ ,0
+ ,0
+ ,1
+ ,4
+ ,1
+ ,2
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,4
+ ,1
+ ,1
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,4
+ ,0
+ ,2
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,4
+ ,0
+ ,2
+ ,0
+ ,1
+ ,0
+ ,1
+ ,0
+ ,4
+ ,1
+ ,1
+ ,0
+ ,0
+ ,0
+ ,0
+ ,0
+ ,4
+ ,0
+ ,2
+ ,0
+ ,1
+ ,0
+ ,1
+ ,1
+ ,4
+ ,0
+ ,1
+ ,0
+ ,1
+ ,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0
+ ,1
+ ,1
+ ,2
+ ,0
+ ,0
+ ,2
+ ,0
+ ,0
+ ,1
+ ,0
+ ,2
+ ,0
+ ,0
+ ,1
+ ,0
+ ,0
+ ,0
+ ,1
+ ,2
+ ,0
+ ,0
+ ,1
+ ,1
+ ,0
+ ,0
+ ,0
+ ,2
+ ,0
+ ,0
+ ,1
+ ,0
+ ,0
+ ,0
+ ,0
+ ,2
+ ,1
+ ,0
+ ,2
+ ,0
+ ,0
+ ,0
+ ,0
+ ,2
+ ,0
+ ,0
+ ,2
+ ,0
+ ,0
+ ,1
+ ,1
+ ,2
+ ,0
+ ,0
+ ,2
+ ,0
+ ,0
+ ,0
+ ,1
+ ,2
+ ,1
+ ,0
+ ,2
+ ,1
+ ,1
+ ,0
+ ,0
+ ,2
+ ,1
+ ,0
+ ,2
+ ,1
+ ,1
+ ,1
+ ,0
+ ,2
+ ,1
+ ,0
+ ,2
+ ,1
+ ,0
+ ,0
+ ,0)
+ ,dim=c(8
+ ,154)
+ ,dimnames=list(c('Weeks'
+ ,'UseLimit'
+ ,'T40'
+ ,'T20'
+ ,'Used'
+ ,'CorrectAnalysis'
+ ,'Useful'
+ ,'Outcome
')
+ ,1:154))
> y <- array(NA,dim=c(8,154),dimnames=list(c('Weeks','UseLimit','T40','T20','Used','CorrectAnalysis','Useful','Outcome
'),1:154))
> 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 = '5'
> 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
Used Weeks UseLimit T40 T20 CorrectAnalysis Useful Outcome\r
1 0 4 1 1 0 0 0 1
2 0 4 0 2 0 0 0 0
3 0 4 0 2 0 0 0 0
4 0 4 0 2 0 0 0 0
5 0 4 0 2 0 0 0 0
6 0 4 1 2 0 0 1 1
7 0 4 0 2 0 0 0 0
8 0 4 0 1 0 0 0 0
9 0 4 0 2 0 0 0 1
10 0 4 1 2 0 0 0 0
11 0 4 1 1 0 0 0 0
12 0 4 0 2 0 0 0 0
13 1 4 0 2 0 0 1 0
14 0 4 1 1 0 0 0 0
15 1 4 0 2 0 0 1 1
16 1 4 0 1 0 0 1 1
17 1 4 1 1 0 1 1 0
18 0 4 1 1 0 0 0 0
19 0 4 0 2 0 0 0 1
20 1 4 0 1 0 1 1 1
21 0 4 1 2 0 0 1 0
22 1 4 1 2 0 0 1 1
23 0 4 0 2 0 0 1 1
24 0 4 1 2 0 0 1 1
25 1 4 0 1 0 0 0 1
26 1 4 0 2 0 0 1 0
27 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0
141 1 2 0 0 2 1 0 1
142 1 2 0 0 1 0 0 1
143 0 2 1 0 2 0 0 0
144 0 2 0 0 2 0 1 1
145 0 2 0 0 2 0 1 0
146 0 2 0 0 1 0 0 1
147 1 2 0 0 1 0 0 0
148 0 2 0 0 1 0 0 0
149 0 2 1 0 2 0 0 0
150 0 2 0 0 2 0 1 1
151 0 2 0 0 2 0 0 1
152 1 2 1 0 2 1 0 0
153 1 2 1 0 2 1 1 0
154 1 2 1 0 2 0 0 0
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) Weeks UseLimit T40
1.61487 -0.36049 0.05226 -0.01806
T20 CorrectAnalysis Useful `Outcome\\r`
-0.42636 0.72716 0.16833 0.07430
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-0.54183 -0.21109 -0.13071 -0.00198 0.95883
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 1.61487 0.43315 3.728 0.000275 ***
Weeks -0.36049 0.13404 -2.690 0.007989 **
UseLimit 0.05226 0.06877 0.760 0.448507
T40 -0.01806 0.09944 -0.182 0.856131
T20 -0.42636 0.10906 -3.909 0.000141 ***
CorrectAnalysis 0.72716 0.12353 5.886 2.6e-08 ***
Useful 0.16833 0.07456 2.258 0.025459 *
`Outcome\\r` 0.07430 0.06554 1.134 0.258845
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.3868 on 146 degrees of freedom
Multiple R-squared: 0.3143, Adjusted R-squared: 0.2814
F-statistic: 9.559 on 7 and 146 DF, p-value: 9.474e-10
> 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.00000000 1.00000000
[2,] 0.000000000 0.00000000 1.00000000
[3,] 0.157463047 0.31492609 0.84253695
[4,] 0.084737202 0.16947440 0.91526280
[5,] 0.111679880 0.22335976 0.88832012
[6,] 0.067818874 0.13563775 0.93218113
[7,] 0.036704550 0.07340910 0.96329545
[8,] 0.019437550 0.03887510 0.98056245
[9,] 0.009834794 0.01966959 0.99016521
[10,] 0.005549151 0.01109830 0.99445085
[11,] 0.015682991 0.03136598 0.98431701
[12,] 0.053029417 0.10605883 0.94697058
[13,] 0.163875368 0.32775074 0.83612463
[14,] 0.172315278 0.34463056 0.82768472
[15,] 0.329702667 0.65940533 0.67029733
[16,] 0.349703622 0.69940724 0.65029638
[17,] 0.320015170 0.64003034 0.67998483
[18,] 0.626636731 0.74672654 0.37336327
[19,] 0.570359314 0.85928137 0.42964069
[20,] 0.649212589 0.70157482 0.35078741
[21,] 0.592207482 0.81558504 0.40779252
[22,] 0.546594861 0.90681028 0.45340514
[23,] 0.520409172 0.95918166 0.47959083
[24,] 0.511828299 0.97634340 0.48817170
[25,] 0.455901249 0.91180250 0.54409875
[26,] 0.401129492 0.80225898 0.59887051
[27,] 0.438034526 0.87606905 0.56196547
[28,] 0.658825285 0.68234943 0.34117472
[29,] 0.704461369 0.59107726 0.29553863
[30,] 0.759735607 0.48052879 0.24026439
[31,] 0.714859803 0.57028039 0.28514020
[32,] 0.828631252 0.34273750 0.17136875
[33,] 0.826846686 0.34630663 0.17315331
[34,] 0.795764943 0.40847011 0.20423506
[35,] 0.790613110 0.41877378 0.20938689
[36,] 0.803234792 0.39353042 0.19676521
[37,] 0.769347149 0.46130570 0.23065285
[38,] 0.742094144 0.51581171 0.25790586
[39,] 0.751717376 0.49656525 0.24828262
[40,] 0.714634767 0.57073047 0.28536523
[41,] 0.834384324 0.33123135 0.16561568
[42,] 0.803699426 0.39260115 0.19630057
[43,] 0.779274507 0.44145099 0.22072549
[44,] 0.751932928 0.49613414 0.24806707
[45,] 0.717310421 0.56537916 0.28268958
[46,] 0.834560788 0.33087842 0.16543921
[47,] 0.863532668 0.27293466 0.13646733
[48,] 0.846131001 0.30773800 0.15386900
[49,] 0.827468779 0.34506244 0.17253122
[50,] 0.797446699 0.40510660 0.20255330
[51,] 0.769179032 0.46164194 0.23082097
[52,] 0.822418688 0.35516262 0.17758131
[53,] 0.794406168 0.41118766 0.20559383
[54,] 0.764851722 0.47029656 0.23514828
[55,] 0.732558415 0.53488317 0.26744159
[56,] 0.698717330 0.60256534 0.30128267
[57,] 0.663579199 0.67284160 0.33642080
[58,] 0.648358337 0.70328333 0.35164166
[59,] 0.624107447 0.75178511 0.37589255
[60,] 0.780137096 0.43972581 0.21986290
[61,] 0.750763155 0.49847369 0.24923685
[62,] 0.730203841 0.53959232 0.26979616
[63,] 0.835301669 0.32939666 0.16469833
[64,] 0.929179512 0.14164098 0.07082049
[65,] 0.917167834 0.16566433 0.08283217
[66,] 0.919175893 0.16164821 0.08082411
[67,] 0.906907389 0.18618522 0.09309261
[68,] 0.932634215 0.13473157 0.06736579
[69,] 0.917043638 0.16591272 0.08295636
[70,] 0.911566553 0.17686689 0.08843345
[71,] 0.892819791 0.21436042 0.10718021
[72,] 0.947957772 0.10408446 0.05204223
[73,] 0.935283036 0.12943393 0.06471696
[74,] 0.927101533 0.14579693 0.07289847
[75,] 0.916944085 0.16611183 0.08305591
[76,] 0.896830089 0.20633982 0.10316991
[77,] 0.880342489 0.23931502 0.11965751
[78,] 0.867538961 0.26492208 0.13246104
[79,] 0.839171157 0.32165769 0.16082884
[80,] 0.807836149 0.38432770 0.19216385
[81,] 0.780252934 0.43949413 0.21974707
[82,] 0.831986384 0.33602723 0.16801362
[83,] 0.829158046 0.34168391 0.17084195
[84,] 0.795510039 0.40897992 0.20448996
[85,] 0.803349333 0.39330133 0.19665067
[86,] 0.766574880 0.46685024 0.23342512
[87,] 0.815340108 0.36931978 0.18465989
[88,] 0.779445685 0.44110863 0.22055432
[89,] 0.752579616 0.49484077 0.24742038
[90,] 0.710286797 0.57942641 0.28971320
[91,] 0.683931611 0.63213678 0.31606839
[92,] 0.636319145 0.72736171 0.36368085
[93,] 0.586245548 0.82750890 0.41375445
[94,] 0.534465846 0.93106831 0.46553415
[95,] 0.604097594 0.79180481 0.39590241
[96,] 0.551946169 0.89610766 0.44805383
[97,] 0.498605620 0.99721124 0.50139438
[98,] 0.506483514 0.98703297 0.49351649
[99,] 0.452318367 0.90463673 0.54768163
[100,] 0.418498892 0.83699778 0.58150111
[101,] 0.379828011 0.75965602 0.62017199
[102,] 0.393451293 0.78690259 0.60654871
[103,] 0.720165640 0.55966872 0.27983436
[104,] 0.716682236 0.56663553 0.28331776
[105,] 0.682536139 0.63492772 0.31746386
[106,] 0.629179385 0.74164123 0.37082062
[107,] 0.619333076 0.76133385 0.38066692
[108,] 0.590089471 0.81982106 0.40991053
[109,] 0.531224735 0.93755053 0.46877526
[110,] 0.471961541 0.94392308 0.52803846
[111,] 0.447677541 0.89535508 0.55232246
[112,] 0.386970167 0.77394033 0.61302983
[113,] 0.369437067 0.73887413 0.63056293
[114,] 0.561684555 0.87663089 0.43831545
[115,] 0.496342170 0.99268434 0.50365783
[116,] 0.494497727 0.98899545 0.50550227
[117,] 0.428765713 0.85753143 0.57123429
[118,] 0.361710746 0.72342149 0.63828925
[119,] 0.297114746 0.59422949 0.70288525
[120,] 0.237903650 0.47580730 0.76209635
[121,] 0.225227834 0.45045567 0.77477217
[122,] 0.284683337 0.56936667 0.71531666
[123,] 0.377631946 0.75526389 0.62236805
[124,] 0.302623265 0.60524653 0.69737674
[125,] 0.234014097 0.46802819 0.76598590
[126,] 0.174288022 0.34857604 0.82571198
[127,] 0.187090306 0.37418061 0.81290969
[128,] 0.137899305 0.27579861 0.86210069
[129,] 0.133433592 0.26686718 0.86656641
[130,] 0.084475110 0.16895022 0.91552489
[131,] 0.052552203 0.10510441 0.94744780
[132,] 0.082252264 0.16450453 0.91774774
[133,] 0.065150199 0.13030040 0.93484980
> postscript(file="/var/fisher/rcomp/tmp/1opu81355428076.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/2pqje1355428076.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/3oom91355428076.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/46yaq1355428076.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/5wo2z1355428076.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.28141376 -0.13679278 -0.13679278 -0.13679278 -0.13679278 -0.43168088
7 8 9 10 11 12
-0.13679278 -0.15485263 -0.21108946 -0.18905724 -0.20711708 -0.13679278
13 14 15 16 17 18
0.69488025 -0.20711708 0.62058357 0.60252373 -0.10260196 -0.20711708
19 20 21 22 23 24
-0.21108946 -0.12463419 -0.35738420 0.56831912 -0.37941643 -0.43168088
25 26 27 28 29 30
0.77085070 0.69488025 -0.26335391 0.86320722 -0.21108946 -0.30511975
31 32 33 34 35 36
-0.13679278 -0.18905724 -0.35738420 -0.22914930 -0.13679278 -0.13679278
37 38 39 40 41 42
0.62455595 0.78891054 -0.37941643 -0.32317959 -0.10657434 0.78891054
43 44 45 46 47 48
-0.43168088 -0.20711708 -0.30511975 -0.37941643 -0.13679278 -0.21108946
49 50 51 52 53 54
-0.37941643 -0.13679278 0.84514737 -0.10260196 -0.21108946 0.13604930
55 56 57 58 59 60
-0.13679278 0.77085070 0.62058357 -0.21108946 -0.21108946 -0.17689864
61 62 63 64 65 66
-0.28141376 0.69488025 -0.13679278 -0.28141376 -0.13679278 -0.13679278
67 68 69 70 71 72
-0.05033751 -0.18905724 -0.21108946 0.86320722 -0.13679278 -0.21108946
73 74 75 76 77 78
0.78891054 0.81094276 -0.21108946 -0.39747627 -0.21108946 0.62058357
79 80 81 82 83 84
0.04369278 -0.32317959 -0.13679278 0.73664609 -0.13679278 0.13604930
85 86 87 88 89 90
-0.37941643 -0.18905724 -0.16773328 0.40590689 -0.04117215 -0.11546883
91 92 93 94 95 96
-0.20949912 -0.51979644 -0.26176357 -0.04117215 -0.46753198 -0.11546883
97 98 99 100 101 102
-0.51979644 -0.04117215 -0.09343661 -0.11546883 -0.16773328 -0.04117215
103 104 105 106 107 108
-0.04117215 -0.04117215 0.53246802 -0.04117215 -0.04117215 0.48020356
109 110 111 112 113 114
-0.04117215 -0.09343661 0.31187660 -0.46753198 0.95882785 0.48020356
115 116 117 118 119 120
-0.09343661 -0.04117215 -0.16773328 -0.09343661 -0.04117215 -0.11546883
121 122 123 124 125 126
-0.09343661 -0.04117215 0.48020356 0.71620420 -0.11546883 -0.46753198
127 128 129 130 131 132
-0.20949912 -0.11546883 -0.04117215 -0.11546883 -0.09343661 -0.16773328
133 134 135 136 137 138
0.90656339 -0.04117215 -0.04117215 -0.04117215 0.66393975 0.23757992
139 140 141 142 143 144
-0.46753198 -0.04117215 0.15737325 0.45817134 -0.09343661 -0.28379580
145 146 147 148 149 150
-0.20949912 -0.54182866 0.53246802 -0.46753198 -0.09343661 -0.28379580
151 152 153 154
-0.11546883 0.17940547 0.01107851 0.90656339
> postscript(file="/var/fisher/rcomp/tmp/6l1ci1355428076.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.28141376 NA
1 -0.13679278 -0.28141376
2 -0.13679278 -0.13679278
3 -0.13679278 -0.13679278
4 -0.13679278 -0.13679278
5 -0.43168088 -0.13679278
6 -0.13679278 -0.43168088
7 -0.15485263 -0.13679278
8 -0.21108946 -0.15485263
9 -0.18905724 -0.21108946
10 -0.20711708 -0.18905724
11 -0.13679278 -0.20711708
12 0.69488025 -0.13679278
13 -0.20711708 0.69488025
14 0.62058357 -0.20711708
15 0.60252373 0.62058357
16 -0.10260196 0.60252373
17 -0.20711708 -0.10260196
18 -0.21108946 -0.20711708
19 -0.12463419 -0.21108946
20 -0.35738420 -0.12463419
21 0.56831912 -0.35738420
22 -0.37941643 0.56831912
23 -0.43168088 -0.37941643
24 0.77085070 -0.43168088
25 0.69488025 0.77085070
26 -0.26335391 0.69488025
27 0.86320722 -0.26335391
28 -0.21108946 0.86320722
29 -0.30511975 -0.21108946
30 -0.13679278 -0.30511975
31 -0.18905724 -0.13679278
32 -0.35738420 -0.18905724
33 -0.22914930 -0.35738420
34 -0.13679278 -0.22914930
35 -0.13679278 -0.13679278
36 0.62455595 -0.13679278
37 0.78891054 0.62455595
38 -0.37941643 0.78891054
39 -0.32317959 -0.37941643
40 -0.10657434 -0.32317959
41 0.78891054 -0.10657434
42 -0.43168088 0.78891054
43 -0.20711708 -0.43168088
44 -0.30511975 -0.20711708
45 -0.37941643 -0.30511975
46 -0.13679278 -0.37941643
47 -0.21108946 -0.13679278
48 -0.37941643 -0.21108946
49 -0.13679278 -0.37941643
50 0.84514737 -0.13679278
51 -0.10260196 0.84514737
52 -0.21108946 -0.10260196
53 0.13604930 -0.21108946
54 -0.13679278 0.13604930
55 0.77085070 -0.13679278
56 0.62058357 0.77085070
57 -0.21108946 0.62058357
58 -0.21108946 -0.21108946
59 -0.17689864 -0.21108946
60 -0.28141376 -0.17689864
61 0.69488025 -0.28141376
62 -0.13679278 0.69488025
63 -0.28141376 -0.13679278
64 -0.13679278 -0.28141376
65 -0.13679278 -0.13679278
66 -0.05033751 -0.13679278
67 -0.18905724 -0.05033751
68 -0.21108946 -0.18905724
69 0.86320722 -0.21108946
70 -0.13679278 0.86320722
71 -0.21108946 -0.13679278
72 0.78891054 -0.21108946
73 0.81094276 0.78891054
74 -0.21108946 0.81094276
75 -0.39747627 -0.21108946
76 -0.21108946 -0.39747627
77 0.62058357 -0.21108946
78 0.04369278 0.62058357
79 -0.32317959 0.04369278
80 -0.13679278 -0.32317959
81 0.73664609 -0.13679278
82 -0.13679278 0.73664609
83 0.13604930 -0.13679278
84 -0.37941643 0.13604930
85 -0.18905724 -0.37941643
86 -0.16773328 -0.18905724
87 0.40590689 -0.16773328
88 -0.04117215 0.40590689
89 -0.11546883 -0.04117215
90 -0.20949912 -0.11546883
91 -0.51979644 -0.20949912
92 -0.26176357 -0.51979644
93 -0.04117215 -0.26176357
94 -0.46753198 -0.04117215
95 -0.11546883 -0.46753198
96 -0.51979644 -0.11546883
97 -0.04117215 -0.51979644
98 -0.09343661 -0.04117215
99 -0.11546883 -0.09343661
100 -0.16773328 -0.11546883
101 -0.04117215 -0.16773328
102 -0.04117215 -0.04117215
103 -0.04117215 -0.04117215
104 0.53246802 -0.04117215
105 -0.04117215 0.53246802
106 -0.04117215 -0.04117215
107 0.48020356 -0.04117215
108 -0.04117215 0.48020356
109 -0.09343661 -0.04117215
110 0.31187660 -0.09343661
111 -0.46753198 0.31187660
112 0.95882785 -0.46753198
113 0.48020356 0.95882785
114 -0.09343661 0.48020356
115 -0.04117215 -0.09343661
116 -0.16773328 -0.04117215
117 -0.09343661 -0.16773328
118 -0.04117215 -0.09343661
119 -0.11546883 -0.04117215
120 -0.09343661 -0.11546883
121 -0.04117215 -0.09343661
122 0.48020356 -0.04117215
123 0.71620420 0.48020356
124 -0.11546883 0.71620420
125 -0.46753198 -0.11546883
126 -0.20949912 -0.46753198
127 -0.11546883 -0.20949912
128 -0.04117215 -0.11546883
129 -0.11546883 -0.04117215
130 -0.09343661 -0.11546883
131 -0.16773328 -0.09343661
132 0.90656339 -0.16773328
133 -0.04117215 0.90656339
134 -0.04117215 -0.04117215
135 -0.04117215 -0.04117215
136 0.66393975 -0.04117215
137 0.23757992 0.66393975
138 -0.46753198 0.23757992
139 -0.04117215 -0.46753198
140 0.15737325 -0.04117215
141 0.45817134 0.15737325
142 -0.09343661 0.45817134
143 -0.28379580 -0.09343661
144 -0.20949912 -0.28379580
145 -0.54182866 -0.20949912
146 0.53246802 -0.54182866
147 -0.46753198 0.53246802
148 -0.09343661 -0.46753198
149 -0.28379580 -0.09343661
150 -0.11546883 -0.28379580
151 0.17940547 -0.11546883
152 0.01107851 0.17940547
153 0.90656339 0.01107851
154 NA 0.90656339
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -0.13679278 -0.28141376
[2,] -0.13679278 -0.13679278
[3,] -0.13679278 -0.13679278
[4,] -0.13679278 -0.13679278
[5,] -0.43168088 -0.13679278
[6,] -0.13679278 -0.43168088
[7,] -0.15485263 -0.13679278
[8,] -0.21108946 -0.15485263
[9,] -0.18905724 -0.21108946
[10,] -0.20711708 -0.18905724
[11,] -0.13679278 -0.20711708
[12,] 0.69488025 -0.13679278
[13,] -0.20711708 0.69488025
[14,] 0.62058357 -0.20711708
[15,] 0.60252373 0.62058357
[16,] -0.10260196 0.60252373
[17,] -0.20711708 -0.10260196
[18,] -0.21108946 -0.20711708
[19,] -0.12463419 -0.21108946
[20,] -0.35738420 -0.12463419
[21,] 0.56831912 -0.35738420
[22,] -0.37941643 0.56831912
[23,] -0.43168088 -0.37941643
[24,] 0.77085070 -0.43168088
[25,] 0.69488025 0.77085070
[26,] -0.26335391 0.69488025
[27,] 0.86320722 -0.26335391
[28,] -0.21108946 0.86320722
[29,] -0.30511975 -0.21108946
[30,] -0.13679278 -0.30511975
[31,] -0.18905724 -0.13679278
[32,] -0.35738420 -0.18905724
[33,] -0.22914930 -0.35738420
[34,] -0.13679278 -0.22914930
[35,] -0.13679278 -0.13679278
[36,] 0.62455595 -0.13679278
[37,] 0.78891054 0.62455595
[38,] -0.37941643 0.78891054
[39,] -0.32317959 -0.37941643
[40,] -0.10657434 -0.32317959
[41,] 0.78891054 -0.10657434
[42,] -0.43168088 0.78891054
[43,] -0.20711708 -0.43168088
[44,] -0.30511975 -0.20711708
[45,] -0.37941643 -0.30511975
[46,] -0.13679278 -0.37941643
[47,] -0.21108946 -0.13679278
[48,] -0.37941643 -0.21108946
[49,] -0.13679278 -0.37941643
[50,] 0.84514737 -0.13679278
[51,] -0.10260196 0.84514737
[52,] -0.21108946 -0.10260196
[53,] 0.13604930 -0.21108946
[54,] -0.13679278 0.13604930
[55,] 0.77085070 -0.13679278
[56,] 0.62058357 0.77085070
[57,] -0.21108946 0.62058357
[58,] -0.21108946 -0.21108946
[59,] -0.17689864 -0.21108946
[60,] -0.28141376 -0.17689864
[61,] 0.69488025 -0.28141376
[62,] -0.13679278 0.69488025
[63,] -0.28141376 -0.13679278
[64,] -0.13679278 -0.28141376
[65,] -0.13679278 -0.13679278
[66,] -0.05033751 -0.13679278
[67,] -0.18905724 -0.05033751
[68,] -0.21108946 -0.18905724
[69,] 0.86320722 -0.21108946
[70,] -0.13679278 0.86320722
[71,] -0.21108946 -0.13679278
[72,] 0.78891054 -0.21108946
[73,] 0.81094276 0.78891054
[74,] -0.21108946 0.81094276
[75,] -0.39747627 -0.21108946
[76,] -0.21108946 -0.39747627
[77,] 0.62058357 -0.21108946
[78,] 0.04369278 0.62058357
[79,] -0.32317959 0.04369278
[80,] -0.13679278 -0.32317959
[81,] 0.73664609 -0.13679278
[82,] -0.13679278 0.73664609
[83,] 0.13604930 -0.13679278
[84,] -0.37941643 0.13604930
[85,] -0.18905724 -0.37941643
[86,] -0.16773328 -0.18905724
[87,] 0.40590689 -0.16773328
[88,] -0.04117215 0.40590689
[89,] -0.11546883 -0.04117215
[90,] -0.20949912 -0.11546883
[91,] -0.51979644 -0.20949912
[92,] -0.26176357 -0.51979644
[93,] -0.04117215 -0.26176357
[94,] -0.46753198 -0.04117215
[95,] -0.11546883 -0.46753198
[96,] -0.51979644 -0.11546883
[97,] -0.04117215 -0.51979644
[98,] -0.09343661 -0.04117215
[99,] -0.11546883 -0.09343661
[100,] -0.16773328 -0.11546883
[101,] -0.04117215 -0.16773328
[102,] -0.04117215 -0.04117215
[103,] -0.04117215 -0.04117215
[104,] 0.53246802 -0.04117215
[105,] -0.04117215 0.53246802
[106,] -0.04117215 -0.04117215
[107,] 0.48020356 -0.04117215
[108,] -0.04117215 0.48020356
[109,] -0.09343661 -0.04117215
[110,] 0.31187660 -0.09343661
[111,] -0.46753198 0.31187660
[112,] 0.95882785 -0.46753198
[113,] 0.48020356 0.95882785
[114,] -0.09343661 0.48020356
[115,] -0.04117215 -0.09343661
[116,] -0.16773328 -0.04117215
[117,] -0.09343661 -0.16773328
[118,] -0.04117215 -0.09343661
[119,] -0.11546883 -0.04117215
[120,] -0.09343661 -0.11546883
[121,] -0.04117215 -0.09343661
[122,] 0.48020356 -0.04117215
[123,] 0.71620420 0.48020356
[124,] -0.11546883 0.71620420
[125,] -0.46753198 -0.11546883
[126,] -0.20949912 -0.46753198
[127,] -0.11546883 -0.20949912
[128,] -0.04117215 -0.11546883
[129,] -0.11546883 -0.04117215
[130,] -0.09343661 -0.11546883
[131,] -0.16773328 -0.09343661
[132,] 0.90656339 -0.16773328
[133,] -0.04117215 0.90656339
[134,] -0.04117215 -0.04117215
[135,] -0.04117215 -0.04117215
[136,] 0.66393975 -0.04117215
[137,] 0.23757992 0.66393975
[138,] -0.46753198 0.23757992
[139,] -0.04117215 -0.46753198
[140,] 0.15737325 -0.04117215
[141,] 0.45817134 0.15737325
[142,] -0.09343661 0.45817134
[143,] -0.28379580 -0.09343661
[144,] -0.20949912 -0.28379580
[145,] -0.54182866 -0.20949912
[146,] 0.53246802 -0.54182866
[147,] -0.46753198 0.53246802
[148,] -0.09343661 -0.46753198
[149,] -0.28379580 -0.09343661
[150,] -0.11546883 -0.28379580
[151,] 0.17940547 -0.11546883
[152,] 0.01107851 0.17940547
[153,] 0.90656339 0.01107851
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -0.13679278 -0.28141376
2 -0.13679278 -0.13679278
3 -0.13679278 -0.13679278
4 -0.13679278 -0.13679278
5 -0.43168088 -0.13679278
6 -0.13679278 -0.43168088
7 -0.15485263 -0.13679278
8 -0.21108946 -0.15485263
9 -0.18905724 -0.21108946
10 -0.20711708 -0.18905724
11 -0.13679278 -0.20711708
12 0.69488025 -0.13679278
13 -0.20711708 0.69488025
14 0.62058357 -0.20711708
15 0.60252373 0.62058357
16 -0.10260196 0.60252373
17 -0.20711708 -0.10260196
18 -0.21108946 -0.20711708
19 -0.12463419 -0.21108946
20 -0.35738420 -0.12463419
21 0.56831912 -0.35738420
22 -0.37941643 0.56831912
23 -0.43168088 -0.37941643
24 0.77085070 -0.43168088
25 0.69488025 0.77085070
26 -0.26335391 0.69488025
27 0.86320722 -0.26335391
28 -0.21108946 0.86320722
29 -0.30511975 -0.21108946
30 -0.13679278 -0.30511975
31 -0.18905724 -0.13679278
32 -0.35738420 -0.18905724
33 -0.22914930 -0.35738420
34 -0.13679278 -0.22914930
35 -0.13679278 -0.13679278
36 0.62455595 -0.13679278
37 0.78891054 0.62455595
38 -0.37941643 0.78891054
39 -0.32317959 -0.37941643
40 -0.10657434 -0.32317959
41 0.78891054 -0.10657434
42 -0.43168088 0.78891054
43 -0.20711708 -0.43168088
44 -0.30511975 -0.20711708
45 -0.37941643 -0.30511975
46 -0.13679278 -0.37941643
47 -0.21108946 -0.13679278
48 -0.37941643 -0.21108946
49 -0.13679278 -0.37941643
50 0.84514737 -0.13679278
51 -0.10260196 0.84514737
52 -0.21108946 -0.10260196
53 0.13604930 -0.21108946
54 -0.13679278 0.13604930
55 0.77085070 -0.13679278
56 0.62058357 0.77085070
57 -0.21108946 0.62058357
58 -0.21108946 -0.21108946
59 -0.17689864 -0.21108946
60 -0.28141376 -0.17689864
61 0.69488025 -0.28141376
62 -0.13679278 0.69488025
63 -0.28141376 -0.13679278
64 -0.13679278 -0.28141376
65 -0.13679278 -0.13679278
66 -0.05033751 -0.13679278
67 -0.18905724 -0.05033751
68 -0.21108946 -0.18905724
69 0.86320722 -0.21108946
70 -0.13679278 0.86320722
71 -0.21108946 -0.13679278
72 0.78891054 -0.21108946
73 0.81094276 0.78891054
74 -0.21108946 0.81094276
75 -0.39747627 -0.21108946
76 -0.21108946 -0.39747627
77 0.62058357 -0.21108946
78 0.04369278 0.62058357
79 -0.32317959 0.04369278
80 -0.13679278 -0.32317959
81 0.73664609 -0.13679278
82 -0.13679278 0.73664609
83 0.13604930 -0.13679278
84 -0.37941643 0.13604930
85 -0.18905724 -0.37941643
86 -0.16773328 -0.18905724
87 0.40590689 -0.16773328
88 -0.04117215 0.40590689
89 -0.11546883 -0.04117215
90 -0.20949912 -0.11546883
91 -0.51979644 -0.20949912
92 -0.26176357 -0.51979644
93 -0.04117215 -0.26176357
94 -0.46753198 -0.04117215
95 -0.11546883 -0.46753198
96 -0.51979644 -0.11546883
97 -0.04117215 -0.51979644
98 -0.09343661 -0.04117215
99 -0.11546883 -0.09343661
100 -0.16773328 -0.11546883
101 -0.04117215 -0.16773328
102 -0.04117215 -0.04117215
103 -0.04117215 -0.04117215
104 0.53246802 -0.04117215
105 -0.04117215 0.53246802
106 -0.04117215 -0.04117215
107 0.48020356 -0.04117215
108 -0.04117215 0.48020356
109 -0.09343661 -0.04117215
110 0.31187660 -0.09343661
111 -0.46753198 0.31187660
112 0.95882785 -0.46753198
113 0.48020356 0.95882785
114 -0.09343661 0.48020356
115 -0.04117215 -0.09343661
116 -0.16773328 -0.04117215
117 -0.09343661 -0.16773328
118 -0.04117215 -0.09343661
119 -0.11546883 -0.04117215
120 -0.09343661 -0.11546883
121 -0.04117215 -0.09343661
122 0.48020356 -0.04117215
123 0.71620420 0.48020356
124 -0.11546883 0.71620420
125 -0.46753198 -0.11546883
126 -0.20949912 -0.46753198
127 -0.11546883 -0.20949912
128 -0.04117215 -0.11546883
129 -0.11546883 -0.04117215
130 -0.09343661 -0.11546883
131 -0.16773328 -0.09343661
132 0.90656339 -0.16773328
133 -0.04117215 0.90656339
134 -0.04117215 -0.04117215
135 -0.04117215 -0.04117215
136 0.66393975 -0.04117215
137 0.23757992 0.66393975
138 -0.46753198 0.23757992
139 -0.04117215 -0.46753198
140 0.15737325 -0.04117215
141 0.45817134 0.15737325
142 -0.09343661 0.45817134
143 -0.28379580 -0.09343661
144 -0.20949912 -0.28379580
145 -0.54182866 -0.20949912
146 0.53246802 -0.54182866
147 -0.46753198 0.53246802
148 -0.09343661 -0.46753198
149 -0.28379580 -0.09343661
150 -0.11546883 -0.28379580
151 0.17940547 -0.11546883
152 0.01107851 0.17940547
153 0.90656339 0.01107851
> 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/7uq551355428076.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/8o1cj1355428076.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/9dir11355428076.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/10ilr51355428076.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/11tysd1355428076.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/12n2ic1355428076.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/13r71s1355428076.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/14mhnk1355428076.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/15jh5u1355428076.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/16ioe61355428076.tab")
+ }
>
> try(system("convert tmp/1opu81355428076.ps tmp/1opu81355428076.png",intern=TRUE))
character(0)
> try(system("convert tmp/2pqje1355428076.ps tmp/2pqje1355428076.png",intern=TRUE))
character(0)
> try(system("convert tmp/3oom91355428076.ps tmp/3oom91355428076.png",intern=TRUE))
character(0)
> try(system("convert tmp/46yaq1355428076.ps tmp/46yaq1355428076.png",intern=TRUE))
character(0)
> try(system("convert tmp/5wo2z1355428076.ps tmp/5wo2z1355428076.png",intern=TRUE))
character(0)
> try(system("convert tmp/6l1ci1355428076.ps tmp/6l1ci1355428076.png",intern=TRUE))
character(0)
> try(system("convert tmp/7uq551355428076.ps tmp/7uq551355428076.png",intern=TRUE))
character(0)
> try(system("convert tmp/8o1cj1355428076.ps tmp/8o1cj1355428076.png",intern=TRUE))
character(0)
> try(system("convert tmp/9dir11355428076.ps tmp/9dir11355428076.png",intern=TRUE))
character(0)
> try(system("convert tmp/10ilr51355428076.ps tmp/10ilr51355428076.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
8.546 1.744 10.342