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
+ ,2
+ ,0
+ ,0
+ ,0
+ ,1
+ ,4
+ ,0
+ ,1
+ ,0
+ ,0
+ ,0
+ ,0
+ ,4
+ ,0
+ ,1
+ ,0
+ ,0
+ ,0
+ ,0
+ ,4
+ ,0
+ ,1
+ ,0
+ ,0
+ ,0
+ ,0
+ ,4
+ ,0
+ ,1
+ ,0
+ ,0
+ ,0
+ ,0
+ ,4
+ ,1
+ ,1
+ ,0
+ ,0
+ ,1
+ ,1
+ ,4
+ ,0
+ ,1
+ ,0
+ ,0
+ ,0
+ ,0
+ ,4
+ ,0
+ ,2
+ ,0
+ ,0
+ ,0
+ ,0
+ ,4
+ ,0
+ ,1
+ ,0
+ ,0
+ ,0
+ ,1
+ ,4
+ ,1
+ ,1
+ ,0
+ ,0
+ ,0
+ ,0
+ ,4
+ ,1
+ ,2
+ ,0
+ ,0
+ ,0
+ ,0
+ ,4
+ ,0
+ ,1
+ ,0
+ ,0
+ ,0
+ ,0
+ ,4
+ ,0
+ ,1
+ ,1
+ ,0
+ ,1
+ ,0
+ ,4
+ ,1
+ ,2
+ ,0
+ ,0
+ ,0
+ ,0
+ ,4
+ ,0
+ ,1
+ ,1
+ ,0
+ ,1
+ ,1
+ ,4
+ ,0
+ ,2
+ ,1
+ ,0
+ ,1
+ ,1
+ ,4
+ ,1
+ ,2
+ ,1
+ ,1
+ ,1
+ ,0
+ ,4
+ ,1
+ ,2
+ ,0
+ ,0
+ ,0
+ ,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+ ,0
+ ,2
+ ,0
+ ,4
+ ,1
+ ,1
+ ,0
+ ,1
+ ,2
+ ,0
+ ,3
+ ,1
+ ,0
+ ,0
+ ,1
+ ,2
+ ,1
+ ,4
+ ,0
+ ,0
+ ,0
+ ,0
+ ,2
+ ,0
+ ,4
+ ,0
+ ,0
+ ,1
+ ,1
+ ,2
+ ,0
+ ,4
+ ,0
+ ,0
+ ,1
+ ,0
+ ,2
+ ,0
+ ,3
+ ,0
+ ,0
+ ,0
+ ,1
+ ,2
+ ,0
+ ,3
+ ,1
+ ,0
+ ,0
+ ,0
+ ,2
+ ,0
+ ,3
+ ,0
+ ,0
+ ,0
+ ,0
+ ,2
+ ,1
+ ,4
+ ,0
+ ,0
+ ,0
+ ,0
+ ,2
+ ,0
+ ,4
+ ,0
+ ,0
+ ,1
+ ,1
+ ,2
+ ,0
+ ,4
+ ,0
+ ,0
+ ,0
+ ,1
+ ,2
+ ,1
+ ,4
+ ,1
+ ,1
+ ,0
+ ,0
+ ,2
+ ,1
+ ,4
+ ,1
+ ,1
+ ,1
+ ,0
+ ,2
+ ,1
+ ,4
+ ,1
+ ,0
+ ,0
+ ,0)
+ ,dim=c(7
+ ,154)
+ ,dimnames=list(c('Weeks'
+ ,'UseLimit'
+ ,'T40enT20'
+ ,'Used'
+ ,'CorrectAnalysis'
+ ,'Useful'
+ ,'Outcome')
+ ,1:154))
> y <- array(NA,dim=c(7,154),dimnames=list(c('Weeks','UseLimit','T40enT20','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 = '7'
> par3 <- 'No Linear Trend'
> par2 <- 'Do not include Seasonal Dummies'
> par1 <- '7'
> #'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 T40enT20 Used CorrectAnalysis Useful
1 1 4 1 2 0 0 0
2 0 4 0 1 0 0 0
3 0 4 0 1 0 0 0
4 0 4 0 1 0 0 0
5 0 4 0 1 0 0 0
6 1 4 1 1 0 0 1
7 0 4 0 1 0 0 0
8 0 4 0 2 0 0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 0
137 1 2 1 4 1 0 1
138 1 2 1 3 1 0 1
139 0 2 0 3 0 0 0
140 0 2 0 4 0 0 0
141 1 2 0 4 1 1 0
142 1 2 0 3 1 0 0
143 0 2 1 4 0 0 0
144 1 2 0 4 0 0 1
145 0 2 0 4 0 0 1
146 1 2 0 3 0 0 0
147 0 2 0 3 1 0 0
148 0 2 0 3 0 0 0
149 0 2 1 4 0 0 0
150 1 2 0 4 0 0 1
151 1 2 0 4 0 0 0
152 0 2 1 4 1 1 0
153 0 2 1 4 1 1 1
154 0 2 1 4 1 0 0
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) Weeks UseLimit T40enT20
-0.28741 0.15286 -0.08900 0.07482
Used CorrectAnalysis Useful
0.10423 -0.15582 0.15326
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-0.6563 -0.3988 -0.2504 0.5284 0.7714
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -0.28741 0.60196 -0.477 0.634
Weeks 0.15286 0.12457 1.227 0.222
UseLimit -0.08900 0.08506 -1.046 0.297
T40enT20 0.07482 0.09403 0.796 0.428
Used 0.10423 0.10032 1.039 0.301
CorrectAnalysis -0.15582 0.17185 -0.907 0.366
Useful 0.15326 0.09418 1.627 0.106
Residual standard error: 0.485 on 147 degrees of freedom
Multiple R-squared: 0.06116, Adjusted R-squared: 0.02284
F-statistic: 1.596 on 6 and 147 DF, p-value: 0.1522
> 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.8466588 0.3066823 0.1533412
[2,] 0.8178586 0.3642829 0.1821414
[3,] 0.7224935 0.5550129 0.2775065
[4,] 0.6171145 0.7657710 0.3828855
[5,] 0.5500165 0.8999671 0.4499835
[6,] 0.6434051 0.7131899 0.3565949
[7,] 0.5773041 0.8453918 0.4226959
[8,] 0.4862213 0.9724426 0.5137787
[9,] 0.4245026 0.8490052 0.5754974
[10,] 0.5868179 0.8263642 0.4131821
[11,] 0.6022796 0.7954409 0.3977204
[12,] 0.6667376 0.6665247 0.3332624
[13,] 0.6633806 0.6732389 0.3366194
[14,] 0.6187336 0.7625329 0.3812664
[15,] 0.5857529 0.8284942 0.4142471
[16,] 0.6083164 0.7833671 0.3916836
[17,] 0.6884371 0.6231258 0.3115629
[18,] 0.7658555 0.4682889 0.2341445
[19,] 0.7375468 0.5249063 0.2624532
[20,] 0.7768263 0.4463475 0.2231737
[21,] 0.7948181 0.4103638 0.2051819
[22,] 0.7661625 0.4676750 0.2338375
[23,] 0.7324917 0.5350166 0.2675083
[24,] 0.7306102 0.5387796 0.2693898
[25,] 0.7367665 0.5264669 0.2632335
[26,] 0.7069018 0.5861964 0.2930982
[27,] 0.6751925 0.6496150 0.3248075
[28,] 0.7133293 0.5733413 0.2866707
[29,] 0.7309015 0.5381970 0.2690985
[30,] 0.7233424 0.5533152 0.2766576
[31,] 0.7434078 0.5131844 0.2565922
[32,] 0.7295553 0.5408894 0.2704447
[33,] 0.7227658 0.5544683 0.2772342
[34,] 0.7332209 0.5335583 0.2667791
[35,] 0.7083121 0.5833757 0.2916879
[36,] 0.7101182 0.5797635 0.2898818
[37,] 0.7082338 0.5835323 0.2917662
[38,] 0.6893670 0.6212661 0.3106330
[39,] 0.7123615 0.5752771 0.2876385
[40,] 0.7052129 0.5895743 0.2947871
[41,] 0.6883102 0.6233796 0.3116898
[42,] 0.6982857 0.6034286 0.3017143
[43,] 0.7007084 0.5985832 0.2992916
[44,] 0.7196151 0.5607697 0.2803849
[45,] 0.7004268 0.5991465 0.2995732
[46,] 0.6852940 0.6294121 0.3147060
[47,] 0.6808201 0.6383597 0.3191799
[48,] 0.6506564 0.6986872 0.3493436
[49,] 0.6710256 0.6579488 0.3289744
[50,] 0.6897457 0.6205086 0.3102543
[51,] 0.6988270 0.6023459 0.3011730
[52,] 0.7272257 0.5455487 0.2727743
[53,] 0.7579915 0.4840170 0.2420085
[54,] 0.7445197 0.5109607 0.2554803
[55,] 0.7625663 0.4748674 0.2374337
[56,] 0.7487694 0.5024611 0.2512306
[57,] 0.7353521 0.5292958 0.2646479
[58,] 0.7498321 0.5003357 0.2501679
[59,] 0.7300932 0.5398137 0.2699068
[60,] 0.7446769 0.5106463 0.2553231
[61,] 0.7527896 0.4944208 0.2472104
[62,] 0.7442666 0.5114668 0.2557334
[63,] 0.7559157 0.4881686 0.2440843
[64,] 0.7497306 0.5005389 0.2502694
[65,] 0.7471942 0.5056116 0.2528058
[66,] 0.7591624 0.4816753 0.2408376
[67,] 0.7374840 0.5250319 0.2625160
[68,] 0.7573783 0.4852435 0.2426217
[69,] 0.7385524 0.5228953 0.2614476
[70,] 0.7549721 0.4900558 0.2450279
[71,] 0.7717196 0.4565607 0.2282804
[72,] 0.7567426 0.4865148 0.2432574
[73,] 0.7736347 0.4527306 0.2263653
[74,] 0.7542891 0.4914218 0.2457109
[75,] 0.7366070 0.5267860 0.2633930
[76,] 0.7361282 0.5277437 0.2638718
[77,] 0.7028354 0.5943291 0.2971646
[78,] 0.7251065 0.5497871 0.2748935
[79,] 0.7542729 0.4914541 0.2457271
[80,] 0.7681094 0.4637812 0.2318906
[81,] 0.7813990 0.4372020 0.2186010
[82,] 0.8050876 0.3898248 0.1949124
[83,] 0.7815553 0.4368895 0.2184447
[84,] 0.7783480 0.4433040 0.2216520
[85,] 0.7592566 0.4814868 0.2407434
[86,] 0.7288426 0.5423149 0.2711574
[87,] 0.7635630 0.4728739 0.2364370
[88,] 0.7283169 0.5433661 0.2716831
[89,] 0.7045963 0.5908075 0.2954037
[90,] 0.6689516 0.6620969 0.3310484
[91,] 0.7103151 0.5793697 0.2896849
[92,] 0.7775300 0.4449399 0.2224700
[93,] 0.7557306 0.4885389 0.2442694
[94,] 0.7323118 0.5353765 0.2676882
[95,] 0.7076910 0.5846180 0.2923090
[96,] 0.6840384 0.6319232 0.3159616
[97,] 0.6573912 0.6852175 0.3426088
[98,] 0.6307785 0.7384431 0.3692215
[99,] 0.5879199 0.8241603 0.4120801
[100,] 0.5603851 0.8792297 0.4396149
[101,] 0.5131251 0.9737498 0.4868749
[102,] 0.4987233 0.9974467 0.5012767
[103,] 0.4596847 0.9193695 0.5403153
[104,] 0.4537801 0.9075602 0.5462199
[105,] 0.4113273 0.8226545 0.5886727
[106,] 0.3631556 0.7263113 0.6368444
[107,] 0.3377698 0.6755396 0.6622302
[108,] 0.4464035 0.8928069 0.5535965
[109,] 0.3922648 0.7845297 0.6077352
[110,] 0.3679894 0.7359788 0.6320106
[111,] 0.4040131 0.8080262 0.5959869
[112,] 0.3495206 0.6990412 0.6504794
[113,] 0.3239853 0.6479705 0.6760147
[114,] 0.2833628 0.5667256 0.7166372
[115,] 0.2458833 0.4917666 0.7541167
[116,] 0.2771482 0.5542964 0.7228518
[117,] 0.2467844 0.4935688 0.7532156
[118,] 0.2731675 0.5463349 0.7268325
[119,] 0.3130824 0.6261648 0.6869176
[120,] 0.2779483 0.5558966 0.7220517
[121,] 0.3281083 0.6562166 0.6718917
[122,] 0.2683829 0.5367658 0.7316171
[123,] 0.4613304 0.9226607 0.5386696
[124,] 0.3984103 0.7968206 0.6015897
[125,] 0.3432673 0.6865346 0.6567327
[126,] 0.2951977 0.5903953 0.7048023
[127,] 0.2576096 0.5152192 0.7423904
[128,] 0.2322166 0.4644333 0.7677834
[129,] 0.3342845 0.6685690 0.6657155
[130,] 0.2972309 0.5944618 0.7027691
[131,] 0.4069163 0.8138326 0.5930837
[132,] 0.3105483 0.6210966 0.6894517
[133,] 0.3745632 0.7491265 0.6254368
[134,] 0.2567330 0.5134659 0.7432670
[135,] 0.1906328 0.3812657 0.8093672
> postscript(file="/var/fisher/rcomp/tmp/1vtpq1356085985.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/2z5md1356085985.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/3xh011356085985.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/4705a1356085985.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/5lkpk1356085985.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.6153284 -0.3988542 -0.3988542 -0.3988542 -0.3988542 0.5368855 -0.3988542
8 9 10 11 12 13 14
-0.4736709 0.6011458 -0.3098550 -0.3846716 -0.3988542 -0.6563409 -0.3846716
15 16 17 18 19 20 21
0.3436591 0.2688424 -0.4863348 -0.3846716 0.6011458 0.4246659 -0.4631145
22 23 24 25 26 27 28
0.4326583 0.4478862 0.5368855 0.4221020 -0.6563409 0.6901450 -0.5030814
29 30 31 32 33 34 35
0.6011458 -0.5521138 -0.3988542 -0.3098550 -0.4631145 0.5263291 -0.3988542
36 37 38 39 40 41 42
-0.3988542 -0.6421583 0.4969186 0.4478862 -0.6269304 0.4994826 0.4969186
43 44 45 46 47 48 49
0.5368855 -0.3846716 -0.5521138 0.4478862 -0.3988542 0.6011458 0.4478862
50 51 52 53 54 55 56
-0.3988542 -0.5778980 -0.4863348 0.6011458 -0.3472579 -0.3988542 0.4221020
57 58 59 60 61 62 63
0.3436591 0.6011458 0.6011458 0.5136652 0.6153284 -0.6563409 -0.3988542
64 65 66 67 68 69 70
0.6153284 -0.3988542 -0.3988542 -0.5753341 -0.3098550 0.6011458 -0.5030814
71 72 73 74 75 76 77
-0.3988542 0.6011458 0.4969186 -0.4140821 0.6011458 0.3730696 0.6011458
78 79 80 81 82 83 84
0.3436591 0.5779255 -0.6269304 -0.3988542 0.5859179 -0.3988542 -0.3472579
85 86 87 88 89 90 91
0.4478862 -0.3098550 0.7714167 0.7420061 -0.3175826 0.6824174 -0.4708422
92 93 94 95 96 97 98
-0.1537667 -0.3818429 -0.3175826 -0.2427660 0.6824174 -0.1537667 -0.3175826
99 100 101 102 103 104 105
-0.2285833 0.6824174 0.7714167 -0.3175826 -0.3175826 -0.3175826 -0.3469931
106 107 108 109 110 111 112
-0.3175826 -0.3175826 -0.2579939 -0.3175826 -0.2285833 -0.4112534 -0.2427660
113 114 115 116 117 118 119
-0.4218098 -0.2579939 -0.2285833 -0.3175826 0.7714167 -0.2285833 -0.3175826
120 121 122 123 124 125 126
0.6824174 -0.2285833 -0.3175826 -0.2579939 0.4249307 0.6824174 -0.2427660
127 128 129 130 131 132 133
-0.4708422 0.6824174 -0.3175826 0.6824174 -0.2285833 0.7714167 -0.3328105
134 135 136 137 138 139 140
-0.3175826 -0.3175826 -0.3175826 0.5139300 0.5887466 -0.2427660 -0.3175826
141 142 143 144 145 146 147
0.7340137 0.6530069 -0.2285833 0.5291578 -0.4708422 0.7572340 -0.3469931
148 149 150 151 152 153 154
-0.2427660 -0.2285833 0.5291578 0.6824174 -0.1769870 -0.3302465 -0.3328105
> postscript(file="/var/fisher/rcomp/tmp/6o5t91356085985.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.6153284 NA
1 -0.3988542 0.6153284
2 -0.3988542 -0.3988542
3 -0.3988542 -0.3988542
4 -0.3988542 -0.3988542
5 0.5368855 -0.3988542
6 -0.3988542 0.5368855
7 -0.4736709 -0.3988542
8 0.6011458 -0.4736709
9 -0.3098550 0.6011458
10 -0.3846716 -0.3098550
11 -0.3988542 -0.3846716
12 -0.6563409 -0.3988542
13 -0.3846716 -0.6563409
14 0.3436591 -0.3846716
15 0.2688424 0.3436591
16 -0.4863348 0.2688424
17 -0.3846716 -0.4863348
18 0.6011458 -0.3846716
19 0.4246659 0.6011458
20 -0.4631145 0.4246659
21 0.4326583 -0.4631145
22 0.4478862 0.4326583
23 0.5368855 0.4478862
24 0.4221020 0.5368855
25 -0.6563409 0.4221020
26 0.6901450 -0.6563409
27 -0.5030814 0.6901450
28 0.6011458 -0.5030814
29 -0.5521138 0.6011458
30 -0.3988542 -0.5521138
31 -0.3098550 -0.3988542
32 -0.4631145 -0.3098550
33 0.5263291 -0.4631145
34 -0.3988542 0.5263291
35 -0.3988542 -0.3988542
36 -0.6421583 -0.3988542
37 0.4969186 -0.6421583
38 0.4478862 0.4969186
39 -0.6269304 0.4478862
40 0.4994826 -0.6269304
41 0.4969186 0.4994826
42 0.5368855 0.4969186
43 -0.3846716 0.5368855
44 -0.5521138 -0.3846716
45 0.4478862 -0.5521138
46 -0.3988542 0.4478862
47 0.6011458 -0.3988542
48 0.4478862 0.6011458
49 -0.3988542 0.4478862
50 -0.5778980 -0.3988542
51 -0.4863348 -0.5778980
52 0.6011458 -0.4863348
53 -0.3472579 0.6011458
54 -0.3988542 -0.3472579
55 0.4221020 -0.3988542
56 0.3436591 0.4221020
57 0.6011458 0.3436591
58 0.6011458 0.6011458
59 0.5136652 0.6011458
60 0.6153284 0.5136652
61 -0.6563409 0.6153284
62 -0.3988542 -0.6563409
63 0.6153284 -0.3988542
64 -0.3988542 0.6153284
65 -0.3988542 -0.3988542
66 -0.5753341 -0.3988542
67 -0.3098550 -0.5753341
68 0.6011458 -0.3098550
69 -0.5030814 0.6011458
70 -0.3988542 -0.5030814
71 0.6011458 -0.3988542
72 0.4969186 0.6011458
73 -0.4140821 0.4969186
74 0.6011458 -0.4140821
75 0.3730696 0.6011458
76 0.6011458 0.3730696
77 0.3436591 0.6011458
78 0.5779255 0.3436591
79 -0.6269304 0.5779255
80 -0.3988542 -0.6269304
81 0.5859179 -0.3988542
82 -0.3988542 0.5859179
83 -0.3472579 -0.3988542
84 0.4478862 -0.3472579
85 -0.3098550 0.4478862
86 0.7714167 -0.3098550
87 0.7420061 0.7714167
88 -0.3175826 0.7420061
89 0.6824174 -0.3175826
90 -0.4708422 0.6824174
91 -0.1537667 -0.4708422
92 -0.3818429 -0.1537667
93 -0.3175826 -0.3818429
94 -0.2427660 -0.3175826
95 0.6824174 -0.2427660
96 -0.1537667 0.6824174
97 -0.3175826 -0.1537667
98 -0.2285833 -0.3175826
99 0.6824174 -0.2285833
100 0.7714167 0.6824174
101 -0.3175826 0.7714167
102 -0.3175826 -0.3175826
103 -0.3175826 -0.3175826
104 -0.3469931 -0.3175826
105 -0.3175826 -0.3469931
106 -0.3175826 -0.3175826
107 -0.2579939 -0.3175826
108 -0.3175826 -0.2579939
109 -0.2285833 -0.3175826
110 -0.4112534 -0.2285833
111 -0.2427660 -0.4112534
112 -0.4218098 -0.2427660
113 -0.2579939 -0.4218098
114 -0.2285833 -0.2579939
115 -0.3175826 -0.2285833
116 0.7714167 -0.3175826
117 -0.2285833 0.7714167
118 -0.3175826 -0.2285833
119 0.6824174 -0.3175826
120 -0.2285833 0.6824174
121 -0.3175826 -0.2285833
122 -0.2579939 -0.3175826
123 0.4249307 -0.2579939
124 0.6824174 0.4249307
125 -0.2427660 0.6824174
126 -0.4708422 -0.2427660
127 0.6824174 -0.4708422
128 -0.3175826 0.6824174
129 0.6824174 -0.3175826
130 -0.2285833 0.6824174
131 0.7714167 -0.2285833
132 -0.3328105 0.7714167
133 -0.3175826 -0.3328105
134 -0.3175826 -0.3175826
135 -0.3175826 -0.3175826
136 0.5139300 -0.3175826
137 0.5887466 0.5139300
138 -0.2427660 0.5887466
139 -0.3175826 -0.2427660
140 0.7340137 -0.3175826
141 0.6530069 0.7340137
142 -0.2285833 0.6530069
143 0.5291578 -0.2285833
144 -0.4708422 0.5291578
145 0.7572340 -0.4708422
146 -0.3469931 0.7572340
147 -0.2427660 -0.3469931
148 -0.2285833 -0.2427660
149 0.5291578 -0.2285833
150 0.6824174 0.5291578
151 -0.1769870 0.6824174
152 -0.3302465 -0.1769870
153 -0.3328105 -0.3302465
154 NA -0.3328105
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -0.3988542 0.6153284
[2,] -0.3988542 -0.3988542
[3,] -0.3988542 -0.3988542
[4,] -0.3988542 -0.3988542
[5,] 0.5368855 -0.3988542
[6,] -0.3988542 0.5368855
[7,] -0.4736709 -0.3988542
[8,] 0.6011458 -0.4736709
[9,] -0.3098550 0.6011458
[10,] -0.3846716 -0.3098550
[11,] -0.3988542 -0.3846716
[12,] -0.6563409 -0.3988542
[13,] -0.3846716 -0.6563409
[14,] 0.3436591 -0.3846716
[15,] 0.2688424 0.3436591
[16,] -0.4863348 0.2688424
[17,] -0.3846716 -0.4863348
[18,] 0.6011458 -0.3846716
[19,] 0.4246659 0.6011458
[20,] -0.4631145 0.4246659
[21,] 0.4326583 -0.4631145
[22,] 0.4478862 0.4326583
[23,] 0.5368855 0.4478862
[24,] 0.4221020 0.5368855
[25,] -0.6563409 0.4221020
[26,] 0.6901450 -0.6563409
[27,] -0.5030814 0.6901450
[28,] 0.6011458 -0.5030814
[29,] -0.5521138 0.6011458
[30,] -0.3988542 -0.5521138
[31,] -0.3098550 -0.3988542
[32,] -0.4631145 -0.3098550
[33,] 0.5263291 -0.4631145
[34,] -0.3988542 0.5263291
[35,] -0.3988542 -0.3988542
[36,] -0.6421583 -0.3988542
[37,] 0.4969186 -0.6421583
[38,] 0.4478862 0.4969186
[39,] -0.6269304 0.4478862
[40,] 0.4994826 -0.6269304
[41,] 0.4969186 0.4994826
[42,] 0.5368855 0.4969186
[43,] -0.3846716 0.5368855
[44,] -0.5521138 -0.3846716
[45,] 0.4478862 -0.5521138
[46,] -0.3988542 0.4478862
[47,] 0.6011458 -0.3988542
[48,] 0.4478862 0.6011458
[49,] -0.3988542 0.4478862
[50,] -0.5778980 -0.3988542
[51,] -0.4863348 -0.5778980
[52,] 0.6011458 -0.4863348
[53,] -0.3472579 0.6011458
[54,] -0.3988542 -0.3472579
[55,] 0.4221020 -0.3988542
[56,] 0.3436591 0.4221020
[57,] 0.6011458 0.3436591
[58,] 0.6011458 0.6011458
[59,] 0.5136652 0.6011458
[60,] 0.6153284 0.5136652
[61,] -0.6563409 0.6153284
[62,] -0.3988542 -0.6563409
[63,] 0.6153284 -0.3988542
[64,] -0.3988542 0.6153284
[65,] -0.3988542 -0.3988542
[66,] -0.5753341 -0.3988542
[67,] -0.3098550 -0.5753341
[68,] 0.6011458 -0.3098550
[69,] -0.5030814 0.6011458
[70,] -0.3988542 -0.5030814
[71,] 0.6011458 -0.3988542
[72,] 0.4969186 0.6011458
[73,] -0.4140821 0.4969186
[74,] 0.6011458 -0.4140821
[75,] 0.3730696 0.6011458
[76,] 0.6011458 0.3730696
[77,] 0.3436591 0.6011458
[78,] 0.5779255 0.3436591
[79,] -0.6269304 0.5779255
[80,] -0.3988542 -0.6269304
[81,] 0.5859179 -0.3988542
[82,] -0.3988542 0.5859179
[83,] -0.3472579 -0.3988542
[84,] 0.4478862 -0.3472579
[85,] -0.3098550 0.4478862
[86,] 0.7714167 -0.3098550
[87,] 0.7420061 0.7714167
[88,] -0.3175826 0.7420061
[89,] 0.6824174 -0.3175826
[90,] -0.4708422 0.6824174
[91,] -0.1537667 -0.4708422
[92,] -0.3818429 -0.1537667
[93,] -0.3175826 -0.3818429
[94,] -0.2427660 -0.3175826
[95,] 0.6824174 -0.2427660
[96,] -0.1537667 0.6824174
[97,] -0.3175826 -0.1537667
[98,] -0.2285833 -0.3175826
[99,] 0.6824174 -0.2285833
[100,] 0.7714167 0.6824174
[101,] -0.3175826 0.7714167
[102,] -0.3175826 -0.3175826
[103,] -0.3175826 -0.3175826
[104,] -0.3469931 -0.3175826
[105,] -0.3175826 -0.3469931
[106,] -0.3175826 -0.3175826
[107,] -0.2579939 -0.3175826
[108,] -0.3175826 -0.2579939
[109,] -0.2285833 -0.3175826
[110,] -0.4112534 -0.2285833
[111,] -0.2427660 -0.4112534
[112,] -0.4218098 -0.2427660
[113,] -0.2579939 -0.4218098
[114,] -0.2285833 -0.2579939
[115,] -0.3175826 -0.2285833
[116,] 0.7714167 -0.3175826
[117,] -0.2285833 0.7714167
[118,] -0.3175826 -0.2285833
[119,] 0.6824174 -0.3175826
[120,] -0.2285833 0.6824174
[121,] -0.3175826 -0.2285833
[122,] -0.2579939 -0.3175826
[123,] 0.4249307 -0.2579939
[124,] 0.6824174 0.4249307
[125,] -0.2427660 0.6824174
[126,] -0.4708422 -0.2427660
[127,] 0.6824174 -0.4708422
[128,] -0.3175826 0.6824174
[129,] 0.6824174 -0.3175826
[130,] -0.2285833 0.6824174
[131,] 0.7714167 -0.2285833
[132,] -0.3328105 0.7714167
[133,] -0.3175826 -0.3328105
[134,] -0.3175826 -0.3175826
[135,] -0.3175826 -0.3175826
[136,] 0.5139300 -0.3175826
[137,] 0.5887466 0.5139300
[138,] -0.2427660 0.5887466
[139,] -0.3175826 -0.2427660
[140,] 0.7340137 -0.3175826
[141,] 0.6530069 0.7340137
[142,] -0.2285833 0.6530069
[143,] 0.5291578 -0.2285833
[144,] -0.4708422 0.5291578
[145,] 0.7572340 -0.4708422
[146,] -0.3469931 0.7572340
[147,] -0.2427660 -0.3469931
[148,] -0.2285833 -0.2427660
[149,] 0.5291578 -0.2285833
[150,] 0.6824174 0.5291578
[151,] -0.1769870 0.6824174
[152,] -0.3302465 -0.1769870
[153,] -0.3328105 -0.3302465
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -0.3988542 0.6153284
2 -0.3988542 -0.3988542
3 -0.3988542 -0.3988542
4 -0.3988542 -0.3988542
5 0.5368855 -0.3988542
6 -0.3988542 0.5368855
7 -0.4736709 -0.3988542
8 0.6011458 -0.4736709
9 -0.3098550 0.6011458
10 -0.3846716 -0.3098550
11 -0.3988542 -0.3846716
12 -0.6563409 -0.3988542
13 -0.3846716 -0.6563409
14 0.3436591 -0.3846716
15 0.2688424 0.3436591
16 -0.4863348 0.2688424
17 -0.3846716 -0.4863348
18 0.6011458 -0.3846716
19 0.4246659 0.6011458
20 -0.4631145 0.4246659
21 0.4326583 -0.4631145
22 0.4478862 0.4326583
23 0.5368855 0.4478862
24 0.4221020 0.5368855
25 -0.6563409 0.4221020
26 0.6901450 -0.6563409
27 -0.5030814 0.6901450
28 0.6011458 -0.5030814
29 -0.5521138 0.6011458
30 -0.3988542 -0.5521138
31 -0.3098550 -0.3988542
32 -0.4631145 -0.3098550
33 0.5263291 -0.4631145
34 -0.3988542 0.5263291
35 -0.3988542 -0.3988542
36 -0.6421583 -0.3988542
37 0.4969186 -0.6421583
38 0.4478862 0.4969186
39 -0.6269304 0.4478862
40 0.4994826 -0.6269304
41 0.4969186 0.4994826
42 0.5368855 0.4969186
43 -0.3846716 0.5368855
44 -0.5521138 -0.3846716
45 0.4478862 -0.5521138
46 -0.3988542 0.4478862
47 0.6011458 -0.3988542
48 0.4478862 0.6011458
49 -0.3988542 0.4478862
50 -0.5778980 -0.3988542
51 -0.4863348 -0.5778980
52 0.6011458 -0.4863348
53 -0.3472579 0.6011458
54 -0.3988542 -0.3472579
55 0.4221020 -0.3988542
56 0.3436591 0.4221020
57 0.6011458 0.3436591
58 0.6011458 0.6011458
59 0.5136652 0.6011458
60 0.6153284 0.5136652
61 -0.6563409 0.6153284
62 -0.3988542 -0.6563409
63 0.6153284 -0.3988542
64 -0.3988542 0.6153284
65 -0.3988542 -0.3988542
66 -0.5753341 -0.3988542
67 -0.3098550 -0.5753341
68 0.6011458 -0.3098550
69 -0.5030814 0.6011458
70 -0.3988542 -0.5030814
71 0.6011458 -0.3988542
72 0.4969186 0.6011458
73 -0.4140821 0.4969186
74 0.6011458 -0.4140821
75 0.3730696 0.6011458
76 0.6011458 0.3730696
77 0.3436591 0.6011458
78 0.5779255 0.3436591
79 -0.6269304 0.5779255
80 -0.3988542 -0.6269304
81 0.5859179 -0.3988542
82 -0.3988542 0.5859179
83 -0.3472579 -0.3988542
84 0.4478862 -0.3472579
85 -0.3098550 0.4478862
86 0.7714167 -0.3098550
87 0.7420061 0.7714167
88 -0.3175826 0.7420061
89 0.6824174 -0.3175826
90 -0.4708422 0.6824174
91 -0.1537667 -0.4708422
92 -0.3818429 -0.1537667
93 -0.3175826 -0.3818429
94 -0.2427660 -0.3175826
95 0.6824174 -0.2427660
96 -0.1537667 0.6824174
97 -0.3175826 -0.1537667
98 -0.2285833 -0.3175826
99 0.6824174 -0.2285833
100 0.7714167 0.6824174
101 -0.3175826 0.7714167
102 -0.3175826 -0.3175826
103 -0.3175826 -0.3175826
104 -0.3469931 -0.3175826
105 -0.3175826 -0.3469931
106 -0.3175826 -0.3175826
107 -0.2579939 -0.3175826
108 -0.3175826 -0.2579939
109 -0.2285833 -0.3175826
110 -0.4112534 -0.2285833
111 -0.2427660 -0.4112534
112 -0.4218098 -0.2427660
113 -0.2579939 -0.4218098
114 -0.2285833 -0.2579939
115 -0.3175826 -0.2285833
116 0.7714167 -0.3175826
117 -0.2285833 0.7714167
118 -0.3175826 -0.2285833
119 0.6824174 -0.3175826
120 -0.2285833 0.6824174
121 -0.3175826 -0.2285833
122 -0.2579939 -0.3175826
123 0.4249307 -0.2579939
124 0.6824174 0.4249307
125 -0.2427660 0.6824174
126 -0.4708422 -0.2427660
127 0.6824174 -0.4708422
128 -0.3175826 0.6824174
129 0.6824174 -0.3175826
130 -0.2285833 0.6824174
131 0.7714167 -0.2285833
132 -0.3328105 0.7714167
133 -0.3175826 -0.3328105
134 -0.3175826 -0.3175826
135 -0.3175826 -0.3175826
136 0.5139300 -0.3175826
137 0.5887466 0.5139300
138 -0.2427660 0.5887466
139 -0.3175826 -0.2427660
140 0.7340137 -0.3175826
141 0.6530069 0.7340137
142 -0.2285833 0.6530069
143 0.5291578 -0.2285833
144 -0.4708422 0.5291578
145 0.7572340 -0.4708422
146 -0.3469931 0.7572340
147 -0.2427660 -0.3469931
148 -0.2285833 -0.2427660
149 0.5291578 -0.2285833
150 0.6824174 0.5291578
151 -0.1769870 0.6824174
152 -0.3302465 -0.1769870
153 -0.3328105 -0.3302465
> 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/7rywi1356085985.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/8lbub1356085985.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/93bvp1356085985.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/10yd4o1356085985.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/118edg1356085985.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/12m6uv1356085985.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/13cwuo1356085985.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/14p5k91356085985.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/15mmmr1356085985.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/16nrdx1356085985.tab")
+ }
>
> try(system("convert tmp/1vtpq1356085985.ps tmp/1vtpq1356085985.png",intern=TRUE))
character(0)
> try(system("convert tmp/2z5md1356085985.ps tmp/2z5md1356085985.png",intern=TRUE))
character(0)
> try(system("convert tmp/3xh011356085985.ps tmp/3xh011356085985.png",intern=TRUE))
character(0)
> try(system("convert tmp/4705a1356085985.ps tmp/4705a1356085985.png",intern=TRUE))
character(0)
> try(system("convert tmp/5lkpk1356085985.ps tmp/5lkpk1356085985.png",intern=TRUE))
character(0)
> try(system("convert tmp/6o5t91356085985.ps tmp/6o5t91356085985.png",intern=TRUE))
character(0)
> try(system("convert tmp/7rywi1356085985.ps tmp/7rywi1356085985.png",intern=TRUE))
character(0)
> try(system("convert tmp/8lbub1356085985.ps tmp/8lbub1356085985.png",intern=TRUE))
character(0)
> try(system("convert tmp/93bvp1356085985.ps tmp/93bvp1356085985.png",intern=TRUE))
character(0)
> try(system("convert tmp/10yd4o1356085985.ps tmp/10yd4o1356085985.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
8.116 1.777 9.888