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
+ ,2
+ ,2
+ ,2
+ ,1
+ ,4
+ ,2
+ ,2
+ ,0
+ ,2
+ ,2
+ ,2
+ ,2
+ ,4
+ ,2
+ ,2
+ ,0
+ ,2
+ ,2
+ ,2
+ ,2
+ ,4
+ ,2
+ ,2
+ ,0
+ ,2
+ ,2
+ ,2
+ ,2
+ ,4
+ ,2
+ ,2
+ ,0
+ ,2
+ ,2
+ ,2
+ ,2
+ ,4
+ ,1
+ ,2
+ ,0
+ ,2
+ ,2
+ ,1
+ ,1
+ ,4
+ ,2
+ ,2
+ ,0
+ ,2
+ ,2
+ ,2
+ ,2
+ ,4
+ ,2
+ ,1
+ ,0
+ ,2
+ ,2
+ ,2
+ ,2
+ ,4
+ ,2
+ ,2
+ ,0
+ ,2
+ ,2
+ ,2
+ ,1
+ ,4
+ ,1
+ ,2
+ ,0
+ ,2
+ ,2
+ ,2
+ ,2
+ ,4
+ ,1
+ ,1
+ ,0
+ ,2
+ ,2
+ ,2
+ ,2
+ ,4
+ ,2
+ ,2
+ ,0
+ ,2
+ ,2
+ ,2
+ ,2
+ ,4
+ ,2
+ ,2
+ ,0
+ ,1
+ ,2
+ ,1
+ ,2
+ ,4
+ ,1
+ ,1
+ ,0
+ ,2
+ ,2
+ ,2
+ ,2
+ ,4
+ ,2
+ ,2
+ ,0
+ ,1
+ ,2
+ ,1
+ ,1
+ ,4
+ ,2
+ ,1
+ ,0
+ ,1
+ ,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2
+ ,1
+ ,1
+ ,2
+ ,2
+ ,0
+ ,2
+ ,2
+ ,2
+ ,1
+ ,2
+ ,2
+ ,2
+ ,0
+ ,1
+ ,2
+ ,2
+ ,2
+ ,1
+ ,2
+ ,2
+ ,0
+ ,1
+ ,1
+ ,2
+ ,2
+ ,2
+ ,2
+ ,2
+ ,0
+ ,1
+ ,2
+ ,2
+ ,2
+ ,2
+ ,2
+ ,1
+ ,0
+ ,2
+ ,2
+ ,2
+ ,2
+ ,2
+ ,2
+ ,2
+ ,0
+ ,2
+ ,2
+ ,2
+ ,1
+ ,1
+ ,2
+ ,2
+ ,0
+ ,2
+ ,2
+ ,2
+ ,2
+ ,1
+ ,2
+ ,1
+ ,0
+ ,2
+ ,1
+ ,1
+ ,2
+ ,2
+ ,2
+ ,1
+ ,0
+ ,2
+ ,1
+ ,1
+ ,1
+ ,2
+ ,2
+ ,1
+ ,0
+ ,2
+ ,1
+ ,2
+ ,2
+ ,2)
+ ,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 = '8'
> par3 <- 'No Linear Trend'
> par2 <- 'Do not include Seasonal Dummies'
> par1 <- '8'
> #'GNU S' R Code compiled by R2WASP v. 1.0.44 ()
> #Author: Prof. Dr. P. Wessa
> #To cite this work: AUTHOR(S), (YEAR), YOUR SOFTWARE TITLE (vNUMBER) in Free Statistics Software (v$_version), Office for Research Development and Education, URL http://www.wessa.net/rwasp_YOURPAGE.wasp/
> #Source of accompanying publication: Office for Research, Development, and Education
> #Technical description: Write here your technical program description (don't use hard returns!)
> library(lattice)
> library(lmtest)
Loading required package: zoo
Attaching package: 'zoo'
The following object(s) are masked from 'package:base':
as.Date, 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
Outcome Weeks UseLimit T40 T20 Used CorrectAnalysis Useful
1 1 4 1 1 0 2 2 2
2 2 4 2 2 0 2 2 2
3 2 4 2 2 0 2 2 2
4 2 4 2 2 0 2 2 2
5 2 4 2 2 0 2 2 2
6 1 4 1 2 0 2 2 1
7 2 4 2 2 0 2 2 2
8 2 4 2 1 0 2 2 2
9 1 4 2 2 0 2 2 2
10 2 4 1 2 0 2 2 2
11 2 4 1 1 0 2 2 2
12 2 4 2 2 0 2 2 2
13 2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
127 2 2 2 0 2 2 2 1
128 1 2 2 0 2 2 2 2
129 2 2 2 0 2 2 2 2
130 1 2 2 0 2 2 2 2
131 2 2 1 0 2 2 2 2
132 1 2 1 0 2 2 2 2
133 2 2 1 0 2 1 2 2
134 2 2 2 0 2 2 2 2
135 2 2 2 0 2 2 2 2
136 2 2 2 0 2 2 2 2
137 1 2 1 0 2 1 2 1
138 1 2 1 0 1 1 2 1
139 2 2 2 0 1 2 2 2
140 2 2 2 0 2 2 2 2
141 1 2 2 0 2 1 1 2
142 1 2 2 0 1 1 2 2
143 2 2 1 0 2 2 2 2
144 1 2 2 0 2 2 2 1
145 2 2 2 0 2 2 2 1
146 1 2 2 0 1 2 2 2
147 2 2 2 0 1 1 2 2
148 2 2 2 0 1 2 2 2
149 2 2 1 0 2 2 2 2
150 1 2 2 0 2 2 2 1
151 1 2 2 0 2 2 2 2
152 2 2 1 0 2 1 1 2
153 2 2 1 0 2 1 1 1
154 2 2 1 0 2 1 2 2
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) Weeks UseLimit T40
2.28301 -0.20302 -0.08170 0.03118
T20 Used CorrectAnalysis Useful
-0.13246 0.11742 -0.15558 0.15068
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-0.8062 -0.5252 0.2446 0.4051 0.6732
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 2.28301 0.71064 3.213 0.00162 **
Weeks -0.20302 0.17181 -1.182 0.23925
UseLimit -0.08170 0.08637 -0.946 0.34575
T40 0.03118 0.12499 0.249 0.80334
T20 -0.13246 0.14369 -0.922 0.35812
Used 0.11742 0.10359 1.134 0.25884
CorrectAnalysis -0.15558 0.17227 -0.903 0.36796
Useful 0.15068 0.09454 1.594 0.11314
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.4862 on 146 degrees of freedom
Multiple R-squared: 0.06298, Adjusted R-squared: 0.01805
F-statistic: 1.402 on 7 and 146 DF, p-value: 0.2088
> 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.8968382 0.2063236 0.1031618
[2,] 0.8187887 0.3624227 0.1812113
[3,] 0.7236976 0.5526049 0.2763024
[4,] 0.6542912 0.6914177 0.3457088
[5,] 0.7288266 0.5423469 0.2711734
[6,] 0.6641435 0.6717130 0.3358565
[7,] 0.5723517 0.8552965 0.4276483
[8,] 0.5057190 0.9885621 0.4942810
[9,] 0.6569774 0.6860452 0.3430226
[10,] 0.6680995 0.6638010 0.3319005
[11,] 0.7242249 0.5515502 0.2757751
[12,] 0.7180520 0.5638961 0.2819480
[13,] 0.6742223 0.6515554 0.3257777
[14,] 0.6405040 0.7189921 0.3594960
[15,] 0.6601099 0.6797802 0.3398901
[16,] 0.7333859 0.5332283 0.2666141
[17,] 0.8016196 0.3967609 0.1983804
[18,] 0.7752850 0.4494299 0.2247150
[19,] 0.8092999 0.3814003 0.1907001
[20,] 0.8246963 0.3506073 0.1753037
[21,] 0.7979558 0.4040883 0.2020442
[22,] 0.7664098 0.4671805 0.2335902
[23,] 0.7644117 0.4711766 0.2355883
[24,] 0.7723256 0.4553488 0.2276744
[25,] 0.7444161 0.5111678 0.2555839
[26,] 0.7146025 0.5707949 0.2853975
[27,] 0.7462242 0.5075517 0.2537758
[28,] 0.7606405 0.4787190 0.2393595
[29,] 0.7521744 0.4956512 0.2478256
[30,] 0.7669128 0.4661745 0.2330872
[31,] 0.7522374 0.4955253 0.2477626
[32,] 0.7445807 0.5108386 0.2554193
[33,] 0.7535163 0.4929675 0.2464837
[34,] 0.7292670 0.5414659 0.2707330
[35,] 0.7299337 0.5401326 0.2700663
[36,] 0.7274935 0.5450131 0.2725065
[37,] 0.7083980 0.5832039 0.2916020
[38,] 0.7299608 0.5400783 0.2700392
[39,] 0.7226667 0.5546667 0.2773333
[40,] 0.7053337 0.5893326 0.2946663
[41,] 0.7182806 0.5634388 0.2817194
[42,] 0.7233458 0.5533084 0.2766542
[43,] 0.7422600 0.5154800 0.2577400
[44,] 0.7213782 0.5572436 0.2786218
[45,] 0.7050724 0.5898552 0.2949276
[46,] 0.6980802 0.6038396 0.3019198
[47,] 0.6696827 0.6606346 0.3303173
[48,] 0.6906255 0.6187489 0.3093745
[49,] 0.7103861 0.5792278 0.2896139
[50,] 0.7148648 0.5702704 0.2851352
[51,] 0.7367169 0.5265663 0.2632831
[52,] 0.7649770 0.4700459 0.2350230
[53,] 0.7510270 0.4979461 0.2489730
[54,] 0.7713194 0.4573613 0.2286806
[55,] 0.7583099 0.4833803 0.2416901
[56,] 0.7459948 0.5080103 0.2540052
[57,] 0.7541946 0.4916108 0.2458054
[58,] 0.7344614 0.5310772 0.2655386
[59,] 0.7478079 0.5043841 0.2521921
[60,] 0.7559760 0.4880480 0.2440240
[61,] 0.7480164 0.5039672 0.2519836
[62,] 0.7579143 0.4841715 0.2420857
[63,] 0.7506732 0.4986537 0.2493268
[64,] 0.7486535 0.5026929 0.2513465
[65,] 0.7588895 0.4822210 0.2411105
[66,] 0.7408280 0.5183440 0.2591720
[67,] 0.7574237 0.4851526 0.2425763
[68,] 0.7369011 0.5261977 0.2630989
[69,] 0.7798313 0.4403374 0.2201687
[70,] 0.7684925 0.4630150 0.2315075
[71,] 0.7529571 0.4940858 0.2470429
[72,] 0.7693378 0.4613244 0.2306622
[73,] 0.7493769 0.5012463 0.2506231
[74,] 0.7310600 0.5378799 0.2689400
[75,] 0.7299885 0.5400231 0.2700115
[76,] 0.6959621 0.6080758 0.3040379
[77,] 0.7177052 0.5645896 0.2822948
[78,] 0.7463429 0.5073142 0.2536571
[79,] 0.7530648 0.4938705 0.2469352
[80,] 0.7696355 0.4607290 0.2303645
[81,] 0.7885674 0.4228653 0.2114326
[82,] 0.7717986 0.4564029 0.2282014
[83,] 0.7669233 0.4661534 0.2330767
[84,] 0.7455346 0.5089307 0.2544654
[85,] 0.7163660 0.5672679 0.2836340
[86,] 0.7504157 0.4991686 0.2495843
[87,] 0.7119952 0.5760096 0.2880048
[88,] 0.6885112 0.6229777 0.3114888
[89,] 0.6524847 0.6950305 0.3475153
[90,] 0.6924131 0.6151738 0.3075869
[91,] 0.7580394 0.4839212 0.2419606
[92,] 0.7360558 0.5278884 0.2639442
[93,] 0.7121287 0.5757426 0.2878713
[94,] 0.6867874 0.6264252 0.3132126
[95,] 0.6582286 0.6835427 0.3417714
[96,] 0.6312260 0.7375479 0.3687740
[97,] 0.6041482 0.7917036 0.3958518
[98,] 0.5575871 0.8848258 0.4424129
[99,] 0.5299134 0.9401732 0.4700866
[100,] 0.4830345 0.9660690 0.5169655
[101,] 0.4651484 0.9302968 0.5348516
[102,] 0.4242649 0.8485298 0.5757351
[103,] 0.4195681 0.8391362 0.5804319
[104,] 0.3761242 0.7522484 0.6238758
[105,] 0.3297576 0.6595153 0.6702424
[106,] 0.3050542 0.6101084 0.6949458
[107,] 0.4048480 0.8096960 0.5951520
[108,] 0.3525669 0.7051339 0.6474331
[109,] 0.3287661 0.6575322 0.6712339
[110,] 0.3604633 0.7209265 0.6395367
[111,] 0.3084001 0.6168002 0.6915999
[112,] 0.2836618 0.5673236 0.7163382
[113,] 0.2440396 0.4880792 0.7559604
[114,] 0.2070959 0.4141919 0.7929041
[115,] 0.2331303 0.4662606 0.7668697
[116,] 0.2037496 0.4074991 0.7962504
[117,] 0.2265392 0.4530785 0.7734608
[118,] 0.2599550 0.5199100 0.7400450
[119,] 0.2273351 0.4546703 0.7726649
[120,] 0.2696489 0.5392977 0.7303511
[121,] 0.2154402 0.4308804 0.7845598
[122,] 0.3872121 0.7744243 0.6127879
[123,] 0.3276212 0.6552425 0.6723788
[124,] 0.2750662 0.5501324 0.7249338
[125,] 0.2301657 0.4603314 0.7698343
[126,] 0.1953765 0.3907531 0.8046235
[127,] 0.1698384 0.3396769 0.8301616
[128,] 0.2538320 0.5076640 0.7461680
[129,] 0.2167256 0.4334512 0.7832744
[130,] 0.3036003 0.6072006 0.6963997
[131,] 0.2126993 0.4253986 0.7873007
[132,] 0.2554098 0.5108196 0.7445902
[133,] 0.1520763 0.3041526 0.8479237
> postscript(file="/var/fisher/rcomp/tmp/1vu4i1356009081.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/2mr261356009081.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/339jt1356009081.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/4nros1356009081.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/56pnn1356009081.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 7
-0.6454478 0.4050643 0.4050643 0.4050643 0.4050643 -0.5259533 0.4050643
8 9 10 11 12 13 14
0.4362479 -0.5949357 0.3233685 0.3545522 0.4050643 0.6731640 0.3545522
15 16 17 18 19 20 21
-0.3268360 -0.2956524 0.4670739 0.3545522 -0.5949357 -0.4512303 0.4740467
22 23 24 25 26 27 28
-0.4085318 -0.4442575 -0.5259533 -0.4463306 0.6731640 -0.6766315 0.5224858
29 30 31 32 33 34 35
-0.5949357 0.5557425 0.4050643 0.3233685 0.4740467 -0.5637521 0.4050643
36 37 38 39 40 41 42
0.4050643 0.6226519 -0.4775142 -0.4442575 0.5869261 -0.4824140 -0.4775142
43 44 45 46 47 48 49
-0.5259533 0.3545522 0.5557425 -0.4442575 0.4050643 -0.5949357 -0.4442575
50 51 52 53 54 55 56
0.4050643 0.5536694 0.4670739 -0.5949357 0.3669078 0.4050643 -0.4463306
57 58 59 60 61 62 63
-0.3268360 -0.5949357 -0.5949357 -0.5329261 -0.6454478 0.6731640 0.4050643
64 65 66 67 68 69 70
-0.6454478 0.4050643 0.4050643 0.5487697 0.3233685 -0.5949357 0.5224858
71 72 73 74 75 76 77
0.4050643 -0.5949357 -0.4775142 0.4407900 -0.5949357 -0.4130739 -0.5949357
78 79 80 81 82 83 84
-0.3268360 -0.6019085 0.5869261 0.4050643 -0.5592100 0.4050643 0.3669078
85 86 87 88 89 90 91
-0.4442575 0.3233685 -0.7553863 -0.7704262 0.3263094 -0.6736906 0.4769876
92 93 94 95 96 97 98
0.1121523 0.3952919 0.3263094 0.1938480 -0.6736906 0.1121523 0.3263094
99 100 101 102 103 104 105
0.2446137 -0.6736906 -0.7553863 0.3263094 0.3263094 0.3263094 0.3112695
106 107 108 109 110 111 112
0.3263094 0.3263094 0.2295738 0.3263094 0.2446137 0.3802520 0.1938480
113 114 115 116 117 118 119
0.4437309 0.2295738 0.2446137 0.3263094 -0.7553863 0.2446137 0.3263094
120 121 122 123 124 125 126
-0.6736906 0.2446137 0.3263094 0.2295738 -0.4055909 -0.6736906 0.1938480
127 128 129 130 131 132 133
0.4769876 -0.6736906 0.3263094 -0.6736906 0.2446137 -0.7553863 0.3620352
134 135 136 137 138 139 140
0.3263094 0.3263094 0.3263094 -0.4872866 -0.6197480 0.1938480 0.3263094
141 142 143 144 145 146 147
-0.7118470 -0.6887305 0.2446137 -0.5230124 0.4769876 -0.8061520 0.3112695
148 149 150 151 152 153 154
0.1938480 0.2446137 -0.5230124 -0.6736906 0.2064573 0.3571355 0.3620352
> postscript(file="/var/fisher/rcomp/tmp/6d61e1356009081.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.6454478 NA
1 0.4050643 -0.6454478
2 0.4050643 0.4050643
3 0.4050643 0.4050643
4 0.4050643 0.4050643
5 -0.5259533 0.4050643
6 0.4050643 -0.5259533
7 0.4362479 0.4050643
8 -0.5949357 0.4362479
9 0.3233685 -0.5949357
10 0.3545522 0.3233685
11 0.4050643 0.3545522
12 0.6731640 0.4050643
13 0.3545522 0.6731640
14 -0.3268360 0.3545522
15 -0.2956524 -0.3268360
16 0.4670739 -0.2956524
17 0.3545522 0.4670739
18 -0.5949357 0.3545522
19 -0.4512303 -0.5949357
20 0.4740467 -0.4512303
21 -0.4085318 0.4740467
22 -0.4442575 -0.4085318
23 -0.5259533 -0.4442575
24 -0.4463306 -0.5259533
25 0.6731640 -0.4463306
26 -0.6766315 0.6731640
27 0.5224858 -0.6766315
28 -0.5949357 0.5224858
29 0.5557425 -0.5949357
30 0.4050643 0.5557425
31 0.3233685 0.4050643
32 0.4740467 0.3233685
33 -0.5637521 0.4740467
34 0.4050643 -0.5637521
35 0.4050643 0.4050643
36 0.6226519 0.4050643
37 -0.4775142 0.6226519
38 -0.4442575 -0.4775142
39 0.5869261 -0.4442575
40 -0.4824140 0.5869261
41 -0.4775142 -0.4824140
42 -0.5259533 -0.4775142
43 0.3545522 -0.5259533
44 0.5557425 0.3545522
45 -0.4442575 0.5557425
46 0.4050643 -0.4442575
47 -0.5949357 0.4050643
48 -0.4442575 -0.5949357
49 0.4050643 -0.4442575
50 0.5536694 0.4050643
51 0.4670739 0.5536694
52 -0.5949357 0.4670739
53 0.3669078 -0.5949357
54 0.4050643 0.3669078
55 -0.4463306 0.4050643
56 -0.3268360 -0.4463306
57 -0.5949357 -0.3268360
58 -0.5949357 -0.5949357
59 -0.5329261 -0.5949357
60 -0.6454478 -0.5329261
61 0.6731640 -0.6454478
62 0.4050643 0.6731640
63 -0.6454478 0.4050643
64 0.4050643 -0.6454478
65 0.4050643 0.4050643
66 0.5487697 0.4050643
67 0.3233685 0.5487697
68 -0.5949357 0.3233685
69 0.5224858 -0.5949357
70 0.4050643 0.5224858
71 -0.5949357 0.4050643
72 -0.4775142 -0.5949357
73 0.4407900 -0.4775142
74 -0.5949357 0.4407900
75 -0.4130739 -0.5949357
76 -0.5949357 -0.4130739
77 -0.3268360 -0.5949357
78 -0.6019085 -0.3268360
79 0.5869261 -0.6019085
80 0.4050643 0.5869261
81 -0.5592100 0.4050643
82 0.4050643 -0.5592100
83 0.3669078 0.4050643
84 -0.4442575 0.3669078
85 0.3233685 -0.4442575
86 -0.7553863 0.3233685
87 -0.7704262 -0.7553863
88 0.3263094 -0.7704262
89 -0.6736906 0.3263094
90 0.4769876 -0.6736906
91 0.1121523 0.4769876
92 0.3952919 0.1121523
93 0.3263094 0.3952919
94 0.1938480 0.3263094
95 -0.6736906 0.1938480
96 0.1121523 -0.6736906
97 0.3263094 0.1121523
98 0.2446137 0.3263094
99 -0.6736906 0.2446137
100 -0.7553863 -0.6736906
101 0.3263094 -0.7553863
102 0.3263094 0.3263094
103 0.3263094 0.3263094
104 0.3112695 0.3263094
105 0.3263094 0.3112695
106 0.3263094 0.3263094
107 0.2295738 0.3263094
108 0.3263094 0.2295738
109 0.2446137 0.3263094
110 0.3802520 0.2446137
111 0.1938480 0.3802520
112 0.4437309 0.1938480
113 0.2295738 0.4437309
114 0.2446137 0.2295738
115 0.3263094 0.2446137
116 -0.7553863 0.3263094
117 0.2446137 -0.7553863
118 0.3263094 0.2446137
119 -0.6736906 0.3263094
120 0.2446137 -0.6736906
121 0.3263094 0.2446137
122 0.2295738 0.3263094
123 -0.4055909 0.2295738
124 -0.6736906 -0.4055909
125 0.1938480 -0.6736906
126 0.4769876 0.1938480
127 -0.6736906 0.4769876
128 0.3263094 -0.6736906
129 -0.6736906 0.3263094
130 0.2446137 -0.6736906
131 -0.7553863 0.2446137
132 0.3620352 -0.7553863
133 0.3263094 0.3620352
134 0.3263094 0.3263094
135 0.3263094 0.3263094
136 -0.4872866 0.3263094
137 -0.6197480 -0.4872866
138 0.1938480 -0.6197480
139 0.3263094 0.1938480
140 -0.7118470 0.3263094
141 -0.6887305 -0.7118470
142 0.2446137 -0.6887305
143 -0.5230124 0.2446137
144 0.4769876 -0.5230124
145 -0.8061520 0.4769876
146 0.3112695 -0.8061520
147 0.1938480 0.3112695
148 0.2446137 0.1938480
149 -0.5230124 0.2446137
150 -0.6736906 -0.5230124
151 0.2064573 -0.6736906
152 0.3571355 0.2064573
153 0.3620352 0.3571355
154 NA 0.3620352
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 0.4050643 -0.6454478
[2,] 0.4050643 0.4050643
[3,] 0.4050643 0.4050643
[4,] 0.4050643 0.4050643
[5,] -0.5259533 0.4050643
[6,] 0.4050643 -0.5259533
[7,] 0.4362479 0.4050643
[8,] -0.5949357 0.4362479
[9,] 0.3233685 -0.5949357
[10,] 0.3545522 0.3233685
[11,] 0.4050643 0.3545522
[12,] 0.6731640 0.4050643
[13,] 0.3545522 0.6731640
[14,] -0.3268360 0.3545522
[15,] -0.2956524 -0.3268360
[16,] 0.4670739 -0.2956524
[17,] 0.3545522 0.4670739
[18,] -0.5949357 0.3545522
[19,] -0.4512303 -0.5949357
[20,] 0.4740467 -0.4512303
[21,] -0.4085318 0.4740467
[22,] -0.4442575 -0.4085318
[23,] -0.5259533 -0.4442575
[24,] -0.4463306 -0.5259533
[25,] 0.6731640 -0.4463306
[26,] -0.6766315 0.6731640
[27,] 0.5224858 -0.6766315
[28,] -0.5949357 0.5224858
[29,] 0.5557425 -0.5949357
[30,] 0.4050643 0.5557425
[31,] 0.3233685 0.4050643
[32,] 0.4740467 0.3233685
[33,] -0.5637521 0.4740467
[34,] 0.4050643 -0.5637521
[35,] 0.4050643 0.4050643
[36,] 0.6226519 0.4050643
[37,] -0.4775142 0.6226519
[38,] -0.4442575 -0.4775142
[39,] 0.5869261 -0.4442575
[40,] -0.4824140 0.5869261
[41,] -0.4775142 -0.4824140
[42,] -0.5259533 -0.4775142
[43,] 0.3545522 -0.5259533
[44,] 0.5557425 0.3545522
[45,] -0.4442575 0.5557425
[46,] 0.4050643 -0.4442575
[47,] -0.5949357 0.4050643
[48,] -0.4442575 -0.5949357
[49,] 0.4050643 -0.4442575
[50,] 0.5536694 0.4050643
[51,] 0.4670739 0.5536694
[52,] -0.5949357 0.4670739
[53,] 0.3669078 -0.5949357
[54,] 0.4050643 0.3669078
[55,] -0.4463306 0.4050643
[56,] -0.3268360 -0.4463306
[57,] -0.5949357 -0.3268360
[58,] -0.5949357 -0.5949357
[59,] -0.5329261 -0.5949357
[60,] -0.6454478 -0.5329261
[61,] 0.6731640 -0.6454478
[62,] 0.4050643 0.6731640
[63,] -0.6454478 0.4050643
[64,] 0.4050643 -0.6454478
[65,] 0.4050643 0.4050643
[66,] 0.5487697 0.4050643
[67,] 0.3233685 0.5487697
[68,] -0.5949357 0.3233685
[69,] 0.5224858 -0.5949357
[70,] 0.4050643 0.5224858
[71,] -0.5949357 0.4050643
[72,] -0.4775142 -0.5949357
[73,] 0.4407900 -0.4775142
[74,] -0.5949357 0.4407900
[75,] -0.4130739 -0.5949357
[76,] -0.5949357 -0.4130739
[77,] -0.3268360 -0.5949357
[78,] -0.6019085 -0.3268360
[79,] 0.5869261 -0.6019085
[80,] 0.4050643 0.5869261
[81,] -0.5592100 0.4050643
[82,] 0.4050643 -0.5592100
[83,] 0.3669078 0.4050643
[84,] -0.4442575 0.3669078
[85,] 0.3233685 -0.4442575
[86,] -0.7553863 0.3233685
[87,] -0.7704262 -0.7553863
[88,] 0.3263094 -0.7704262
[89,] -0.6736906 0.3263094
[90,] 0.4769876 -0.6736906
[91,] 0.1121523 0.4769876
[92,] 0.3952919 0.1121523
[93,] 0.3263094 0.3952919
[94,] 0.1938480 0.3263094
[95,] -0.6736906 0.1938480
[96,] 0.1121523 -0.6736906
[97,] 0.3263094 0.1121523
[98,] 0.2446137 0.3263094
[99,] -0.6736906 0.2446137
[100,] -0.7553863 -0.6736906
[101,] 0.3263094 -0.7553863
[102,] 0.3263094 0.3263094
[103,] 0.3263094 0.3263094
[104,] 0.3112695 0.3263094
[105,] 0.3263094 0.3112695
[106,] 0.3263094 0.3263094
[107,] 0.2295738 0.3263094
[108,] 0.3263094 0.2295738
[109,] 0.2446137 0.3263094
[110,] 0.3802520 0.2446137
[111,] 0.1938480 0.3802520
[112,] 0.4437309 0.1938480
[113,] 0.2295738 0.4437309
[114,] 0.2446137 0.2295738
[115,] 0.3263094 0.2446137
[116,] -0.7553863 0.3263094
[117,] 0.2446137 -0.7553863
[118,] 0.3263094 0.2446137
[119,] -0.6736906 0.3263094
[120,] 0.2446137 -0.6736906
[121,] 0.3263094 0.2446137
[122,] 0.2295738 0.3263094
[123,] -0.4055909 0.2295738
[124,] -0.6736906 -0.4055909
[125,] 0.1938480 -0.6736906
[126,] 0.4769876 0.1938480
[127,] -0.6736906 0.4769876
[128,] 0.3263094 -0.6736906
[129,] -0.6736906 0.3263094
[130,] 0.2446137 -0.6736906
[131,] -0.7553863 0.2446137
[132,] 0.3620352 -0.7553863
[133,] 0.3263094 0.3620352
[134,] 0.3263094 0.3263094
[135,] 0.3263094 0.3263094
[136,] -0.4872866 0.3263094
[137,] -0.6197480 -0.4872866
[138,] 0.1938480 -0.6197480
[139,] 0.3263094 0.1938480
[140,] -0.7118470 0.3263094
[141,] -0.6887305 -0.7118470
[142,] 0.2446137 -0.6887305
[143,] -0.5230124 0.2446137
[144,] 0.4769876 -0.5230124
[145,] -0.8061520 0.4769876
[146,] 0.3112695 -0.8061520
[147,] 0.1938480 0.3112695
[148,] 0.2446137 0.1938480
[149,] -0.5230124 0.2446137
[150,] -0.6736906 -0.5230124
[151,] 0.2064573 -0.6736906
[152,] 0.3571355 0.2064573
[153,] 0.3620352 0.3571355
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 0.4050643 -0.6454478
2 0.4050643 0.4050643
3 0.4050643 0.4050643
4 0.4050643 0.4050643
5 -0.5259533 0.4050643
6 0.4050643 -0.5259533
7 0.4362479 0.4050643
8 -0.5949357 0.4362479
9 0.3233685 -0.5949357
10 0.3545522 0.3233685
11 0.4050643 0.3545522
12 0.6731640 0.4050643
13 0.3545522 0.6731640
14 -0.3268360 0.3545522
15 -0.2956524 -0.3268360
16 0.4670739 -0.2956524
17 0.3545522 0.4670739
18 -0.5949357 0.3545522
19 -0.4512303 -0.5949357
20 0.4740467 -0.4512303
21 -0.4085318 0.4740467
22 -0.4442575 -0.4085318
23 -0.5259533 -0.4442575
24 -0.4463306 -0.5259533
25 0.6731640 -0.4463306
26 -0.6766315 0.6731640
27 0.5224858 -0.6766315
28 -0.5949357 0.5224858
29 0.5557425 -0.5949357
30 0.4050643 0.5557425
31 0.3233685 0.4050643
32 0.4740467 0.3233685
33 -0.5637521 0.4740467
34 0.4050643 -0.5637521
35 0.4050643 0.4050643
36 0.6226519 0.4050643
37 -0.4775142 0.6226519
38 -0.4442575 -0.4775142
39 0.5869261 -0.4442575
40 -0.4824140 0.5869261
41 -0.4775142 -0.4824140
42 -0.5259533 -0.4775142
43 0.3545522 -0.5259533
44 0.5557425 0.3545522
45 -0.4442575 0.5557425
46 0.4050643 -0.4442575
47 -0.5949357 0.4050643
48 -0.4442575 -0.5949357
49 0.4050643 -0.4442575
50 0.5536694 0.4050643
51 0.4670739 0.5536694
52 -0.5949357 0.4670739
53 0.3669078 -0.5949357
54 0.4050643 0.3669078
55 -0.4463306 0.4050643
56 -0.3268360 -0.4463306
57 -0.5949357 -0.3268360
58 -0.5949357 -0.5949357
59 -0.5329261 -0.5949357
60 -0.6454478 -0.5329261
61 0.6731640 -0.6454478
62 0.4050643 0.6731640
63 -0.6454478 0.4050643
64 0.4050643 -0.6454478
65 0.4050643 0.4050643
66 0.5487697 0.4050643
67 0.3233685 0.5487697
68 -0.5949357 0.3233685
69 0.5224858 -0.5949357
70 0.4050643 0.5224858
71 -0.5949357 0.4050643
72 -0.4775142 -0.5949357
73 0.4407900 -0.4775142
74 -0.5949357 0.4407900
75 -0.4130739 -0.5949357
76 -0.5949357 -0.4130739
77 -0.3268360 -0.5949357
78 -0.6019085 -0.3268360
79 0.5869261 -0.6019085
80 0.4050643 0.5869261
81 -0.5592100 0.4050643
82 0.4050643 -0.5592100
83 0.3669078 0.4050643
84 -0.4442575 0.3669078
85 0.3233685 -0.4442575
86 -0.7553863 0.3233685
87 -0.7704262 -0.7553863
88 0.3263094 -0.7704262
89 -0.6736906 0.3263094
90 0.4769876 -0.6736906
91 0.1121523 0.4769876
92 0.3952919 0.1121523
93 0.3263094 0.3952919
94 0.1938480 0.3263094
95 -0.6736906 0.1938480
96 0.1121523 -0.6736906
97 0.3263094 0.1121523
98 0.2446137 0.3263094
99 -0.6736906 0.2446137
100 -0.7553863 -0.6736906
101 0.3263094 -0.7553863
102 0.3263094 0.3263094
103 0.3263094 0.3263094
104 0.3112695 0.3263094
105 0.3263094 0.3112695
106 0.3263094 0.3263094
107 0.2295738 0.3263094
108 0.3263094 0.2295738
109 0.2446137 0.3263094
110 0.3802520 0.2446137
111 0.1938480 0.3802520
112 0.4437309 0.1938480
113 0.2295738 0.4437309
114 0.2446137 0.2295738
115 0.3263094 0.2446137
116 -0.7553863 0.3263094
117 0.2446137 -0.7553863
118 0.3263094 0.2446137
119 -0.6736906 0.3263094
120 0.2446137 -0.6736906
121 0.3263094 0.2446137
122 0.2295738 0.3263094
123 -0.4055909 0.2295738
124 -0.6736906 -0.4055909
125 0.1938480 -0.6736906
126 0.4769876 0.1938480
127 -0.6736906 0.4769876
128 0.3263094 -0.6736906
129 -0.6736906 0.3263094
130 0.2446137 -0.6736906
131 -0.7553863 0.2446137
132 0.3620352 -0.7553863
133 0.3263094 0.3620352
134 0.3263094 0.3263094
135 0.3263094 0.3263094
136 -0.4872866 0.3263094
137 -0.6197480 -0.4872866
138 0.1938480 -0.6197480
139 0.3263094 0.1938480
140 -0.7118470 0.3263094
141 -0.6887305 -0.7118470
142 0.2446137 -0.6887305
143 -0.5230124 0.2446137
144 0.4769876 -0.5230124
145 -0.8061520 0.4769876
146 0.3112695 -0.8061520
147 0.1938480 0.3112695
148 0.2446137 0.1938480
149 -0.5230124 0.2446137
150 -0.6736906 -0.5230124
151 0.2064573 -0.6736906
152 0.3571355 0.2064573
153 0.3620352 0.3571355
> 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/7ya2w1356009081.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/8dxo41356009081.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/92p311356009081.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/10cpp01356009081.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/116dgr1356009081.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/12l2j91356009081.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/13xwwo1356009081.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/14cy3i1356009081.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/15pmar1356009081.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/165zqb1356009081.tab")
+ }
>
> try(system("convert tmp/1vu4i1356009081.ps tmp/1vu4i1356009081.png",intern=TRUE))
character(0)
> try(system("convert tmp/2mr261356009081.ps tmp/2mr261356009081.png",intern=TRUE))
character(0)
> try(system("convert tmp/339jt1356009081.ps tmp/339jt1356009081.png",intern=TRUE))
character(0)
> try(system("convert tmp/4nros1356009081.ps tmp/4nros1356009081.png",intern=TRUE))
character(0)
> try(system("convert tmp/56pnn1356009081.ps tmp/56pnn1356009081.png",intern=TRUE))
character(0)
> try(system("convert tmp/6d61e1356009081.ps tmp/6d61e1356009081.png",intern=TRUE))
character(0)
> try(system("convert tmp/7ya2w1356009081.ps tmp/7ya2w1356009081.png",intern=TRUE))
character(0)
> try(system("convert tmp/8dxo41356009081.ps tmp/8dxo41356009081.png",intern=TRUE))
character(0)
> try(system("convert tmp/92p311356009081.ps tmp/92p311356009081.png",intern=TRUE))
character(0)
> try(system("convert tmp/10cpp01356009081.ps tmp/10cpp01356009081.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
7.807 1.686 9.574