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 + ,0 + ,1 + ,1 + ,4 + ,1 + ,1 + ,0 + ,1 + ,1 + ,1 + ,0 + ,4 + ,1 + ,1 + ,0 + ,0 + ,0 + ,0 + ,0 + ,4 + ,0 + ,2 + ,0 + ,0 + ,0 + ,0 + ,1 + ,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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]) + } + } > par20 = '' > par19 = '' > par18 = '' > par17 = '' > par16 = '' > par15 = '' > par14 = '' > par13 = '' > par12 = '' > par11 = '' > par10 = '' > par9 = '' > par8 = '' > par7 = '' > par6 = '' > par5 = '' > par4 = '' > par3 = 'No Linear Trend' > par2 = 'Do not include Seasonal Dummies' > par1 = '6' > 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 CorrectAnalysis Weeks UseLimit T40 T20 Used Useful Outcome 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 0 4 0 2 0 1 1 0 14 0 4 1 1 0 0 0 0 15 0 4 0 2 0 1 1 1 16 0 4 0 1 0 1 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 0 4 1 2 0 1 1 1 23 0 4 0 2 0 0 1 1 24 0 4 1 2 0 0 1 1 25 0 4 0 1 0 1 0 1 26 0 4 0 2 0 1 1 0 27 0 4 1 2 0 0 0 1 28 0 4 0 2 0 1 0 0 29 0 4 0 2 0 0 0 1 30 0 4 0 2 0 0 1 0 31 0 4 0 2 0 0 0 0 32 0 4 1 2 0 0 0 0 33 0 4 1 2 0 0 1 0 34 0 4 0 1 0 0 0 1 35 0 4 0 2 0 0 0 0 36 0 4 0 2 0 0 0 0 37 0 4 1 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0 0 2 0 0 0 95 0 2 0 0 1 0 0 0 96 0 2 0 0 2 0 0 1 97 0 2 1 0 1 0 0 0 98 0 2 0 0 2 0 0 0 99 0 2 1 0 2 0 0 0 100 0 2 0 0 2 0 0 1 101 0 2 1 0 2 0 0 1 102 0 2 0 0 2 0 0 0 103 0 2 0 0 2 0 0 0 104 0 2 0 0 2 0 0 0 105 0 2 0 0 1 1 0 0 106 0 2 0 0 2 0 0 0 107 0 2 0 0 2 0 0 0 108 0 2 1 0 1 1 0 0 109 0 2 0 0 2 0 0 0 110 0 2 1 0 2 0 0 0 111 0 2 1 0 1 1 1 0 112 0 2 0 0 1 0 0 0 113 0 2 0 0 2 1 0 0 114 0 2 1 0 1 1 0 0 115 0 2 1 0 2 0 0 0 116 0 2 0 0 2 0 0 0 117 0 2 1 0 2 0 0 1 118 0 2 1 0 2 0 0 0 119 0 2 0 0 2 0 0 0 120 0 2 0 0 2 0 0 1 121 0 2 1 0 2 0 0 0 122 0 2 0 0 2 0 0 0 123 0 2 1 0 1 1 0 0 124 0 2 0 0 2 1 1 1 125 0 2 0 0 2 0 0 1 126 0 2 0 0 1 0 0 0 127 0 2 0 0 2 0 1 0 128 0 2 0 0 2 0 0 1 129 0 2 0 0 2 0 0 0 130 0 2 0 0 2 0 0 1 131 0 2 1 0 2 0 0 0 132 0 2 1 0 2 0 0 1 133 0 2 1 0 2 1 0 0 134 0 2 0 0 2 0 0 0 135 0 2 0 0 2 0 0 0 136 0 2 0 0 2 0 0 0 137 0 2 1 0 2 1 1 1 138 0 2 1 0 1 1 1 1 139 0 2 0 0 1 0 0 0 140 0 2 0 0 2 0 0 0 141 1 2 0 0 2 1 0 1 142 0 2 0 0 1 1 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 0 2 0 0 1 1 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 0 2 1 0 2 1 0 0 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) Weeks UseLimit T40 T20 Used -0.873143 0.292012 -0.008643 -0.156530 0.157197 0.263764 Useful Outcome 0.040381 -0.035707 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -0.43388 -0.11807 -0.01663 0.02136 0.75439 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) -0.873143 0.263274 -3.316 0.001150 ** Weeks 0.292012 0.079092 3.692 0.000314 *** UseLimit -0.008643 0.041496 -0.208 0.835293 T40 -0.156530 0.058477 -2.677 0.008284 ** T20 0.157197 0.067800 2.319 0.021808 * Used 0.263764 0.044810 5.886 2.6e-08 *** Useful 0.040381 0.045562 0.886 0.376919 Outcome -0.035707 0.039538 -0.903 0.367957 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 0.2329 on 146 degrees of freedom Multiple R-squared: 0.284, Adjusted R-squared: 0.2497 F-statistic: 8.274 on 7 and 146 DF, p-value: 1.741e-08 > if (n > n25) { + kp3 <- k + 3 + nmkm3 <- n - k - 3 + gqarr <- array(NA, dim=c(nmkm3-kp3+1,3)) + numgqtests <- 0 + numsignificant1 <- 0 + numsignificant5 <- 0 + numsignificant10 <- 0 + for (mypoint in kp3:nmkm3) { + j <- 0 + numgqtests <- numgqtests + 1 + for (myalt in c('greater', 'two.sided', 'less')) { + j <- j + 1 + gqarr[mypoint-kp3+1,j] <- gqtest(mylm, point=mypoint, alternative=myalt)$p.value + } + if (gqarr[mypoint-kp3+1,2] < 0.01) numsignificant1 <- numsignificant1 + 1 + if (gqarr[mypoint-kp3+1,2] < 0.05) numsignificant5 <- numsignificant5 + 1 + if (gqarr[mypoint-kp3+1,2] < 0.10) numsignificant10 <- numsignificant10 + 1 + } + gqarr + } [,1] [,2] [,3] [1,] 0.0000000000 0.000000000 1.000000000 [2,] 0.0000000000 0.000000000 1.000000000 [3,] 0.0000000000 0.000000000 1.000000000 [4,] 0.0000000000 0.000000000 1.000000000 [5,] 0.0000000000 0.000000000 1.000000000 [6,] 0.0000000000 0.000000000 1.000000000 [7,] 0.5523333815 0.895333237 0.447666618 [8,] 0.4988084336 0.997616867 0.501191566 [9,] 0.4590338641 0.918067728 0.540966136 [10,] 0.8982567134 0.203486573 0.101743287 [11,] 0.8583044430 0.283391114 0.141695557 [12,] 0.8473365983 0.305326803 0.152663402 [13,] 0.7976021755 0.404795649 0.202397825 [14,] 0.7415485238 0.516902952 0.258451476 [15,] 0.7445444510 0.510911098 0.255455549 [16,] 0.7466036189 0.506792762 0.253396381 [17,] 0.7091237549 0.581752490 0.290876245 [18,] 0.6616193109 0.676761378 0.338380689 [19,] 0.6103462328 0.779307534 0.389653767 [20,] 0.5525276735 0.894944653 0.447472327 [21,] 0.4910988760 0.982197752 0.508901124 [22,] 0.4308111729 0.861622346 0.569188827 [23,] 0.3730625175 0.746125035 0.626937483 [24,] 0.3256477874 0.651295575 0.674352213 [25,] 0.2741575243 0.548315049 0.725842476 [26,] 0.2271280343 0.454256069 0.772871966 [27,] 0.3078687087 0.615737417 0.692131291 [28,] 0.2686946015 0.537389203 0.731305399 [29,] 0.2228094778 0.445618956 0.777190522 [30,] 0.2155302899 0.431060580 0.784469710 [31,] 0.7569086795 0.486182641 0.243091321 [32,] 0.7325202231 0.534959554 0.267479777 [33,] 0.6871915204 0.625616959 0.312808480 [34,] 0.6517964632 0.696407074 0.348203537 [35,] 0.6020677141 0.795864572 0.397932286 [36,] 0.5516443232 0.896711354 0.448355677 [37,] 0.5001761344 0.999647731 0.499823866 [38,] 0.4488654745 0.897730949 0.551134526 [39,] 0.3991407817 0.798281563 0.600859218 [40,] 0.3505868151 0.701173630 0.649413185 [41,] 0.4301763542 0.860352708 0.569823646 [42,] 0.7010426663 0.597914667 0.298957334 [43,] 0.6593231633 0.681353673 0.340676837 [44,] 0.9475304379 0.104939124 0.052469562 [45,] 0.9328010927 0.134397815 0.067198907 [46,] 0.9612014508 0.077597098 0.038798549 [47,] 0.9608453898 0.078309220 0.039154610 [48,] 0.9504103154 0.099179369 0.049589685 [49,] 0.9378469327 0.124306135 0.062153067 [50,] 0.9823656071 0.035268786 0.017634393 [51,] 0.9796657861 0.040668428 0.020334214 [52,] 0.9812268563 0.037546287 0.018773144 [53,] 0.9750304891 0.049939022 0.024969511 [54,] 0.9739696868 0.052060626 0.026030313 [55,] 0.9658798832 0.068240234 0.034120117 [56,] 0.9558212912 0.088357418 0.044178709 [57,] 0.9835133464 0.032973307 0.016486654 [58,] 0.9779495510 0.044100898 0.022050449 [59,] 0.9713953240 0.057209352 0.028604676 [60,] 0.9721837280 0.055632544 0.027816272 [61,] 0.9636559022 0.072688196 0.036344098 [62,] 0.9537002210 0.092599558 0.046299779 [63,] 0.9532315650 0.093536870 0.046768435 [64,] 0.9564050656 0.087189869 0.043594934 [65,] 0.9447983962 0.110403208 0.055201604 [66,] 0.9428792058 0.114241588 0.057120794 [67,] 0.9286201347 0.142759731 0.071379865 [68,] 0.9346838434 0.130632313 0.065316157 [69,] 0.9839701953 0.032059609 0.016029805 [70,] 0.9800563359 0.039887328 0.019943664 [71,] 0.9746382968 0.050723406 0.025361703 [72,] 0.9806367598 0.038726480 0.019363240 [73,] 0.9787858770 0.042428246 0.021214123 [74,] 0.9980797548 0.003840490 0.001920245 [75,] 0.9971720817 0.005655837 0.002827918 [76,] 0.9958918117 0.008216377 0.004108188 [77,] 0.9941020867 0.011795827 0.005897913 [78,] 0.9920758431 0.015848314 0.007924157 [79,] 0.9889564548 0.022087090 0.011043545 [80,] 0.9847468332 0.030506334 0.015253167 [81,] 0.9794112454 0.041177509 0.020588755 [82,] 0.9749279702 0.050144060 0.025072030 [83,] 0.9666797868 0.066640426 0.033320213 [84,] 0.9561894822 0.087621036 0.043810518 [85,] 0.9468635576 0.106272885 0.053136442 [86,] 0.9317005482 0.136598904 0.068299452 [87,] 0.9197238524 0.160552295 0.080276148 [88,] 0.8989070582 0.202185884 0.101092942 [89,] 0.8741146388 0.251770722 0.125885361 [90,] 0.8455326680 0.308934664 0.154467332 [91,] 0.8127446868 0.374510626 0.187255313 [92,] 0.7758857491 0.448228502 0.224114251 [93,] 0.7350833720 0.529833256 0.264916628 [94,] 0.6906624786 0.618675043 0.309337521 [95,] 0.6604520531 0.679095894 0.339547947 [96,] 0.6111542501 0.777691500 0.388845750 [97,] 0.5598492398 0.880301520 0.440150760 [98,] 0.5206753369 0.958649326 0.479324663 [99,] 0.4675849246 0.935169849 0.532415075 [100,] 0.4138453111 0.827690622 0.586154689 [101,] 0.3761257724 0.752251545 0.623874228 [102,] 0.3398021267 0.679604253 0.660197873 [103,] 0.3871091110 0.774218222 0.612890889 [104,] 0.3512368859 0.702473772 0.648763114 [105,] 0.2999936728 0.599987346 0.700006327 [106,] 0.2541314528 0.508262906 0.745868547 [107,] 0.2106758722 0.421351744 0.789324128 [108,] 0.1710330705 0.342066141 0.828966930 [109,] 0.1379845483 0.275969097 0.862015452 [110,] 0.1079358619 0.215871724 0.892064138 [111,] 0.0826669413 0.165333883 0.917333059 [112,] 0.0631268739 0.126253748 0.936873126 [113,] 0.0527508146 0.105501629 0.947249185 [114,] 0.0674250306 0.134850061 0.932574969 [115,] 0.0492769259 0.098553852 0.950723074 [116,] 0.0392307560 0.078461512 0.960769244 [117,] 0.0278069383 0.055613877 0.972193062 [118,] 0.0189054148 0.037810830 0.981094585 [119,] 0.0128448348 0.025689670 0.987155165 [120,] 0.0082640315 0.016528063 0.991735969 [121,] 0.0050626498 0.010125300 0.994937350 [122,] 0.0030672851 0.006134570 0.996932715 [123,] 0.0060803120 0.012160624 0.993919688 [124,] 0.0038472606 0.007694521 0.996152739 [125,] 0.0024307008 0.004861402 0.997569299 [126,] 0.0015759700 0.003151940 0.998424030 [127,] 0.0028786984 0.005757397 0.997121302 [128,] 0.0023137579 0.004627516 0.997686242 [129,] 0.0018032681 0.003606536 0.998196732 [130,] 0.0008144158 0.001628832 0.999185584 [131,] 0.0126092641 0.025218528 0.987390736 [132,] 0.0093783337 0.018756667 0.990621666 [133,] 0.0043546948 0.008709390 0.995645305 > postscript(file="/var/fisher/rcomp/tmp/13bhl1356025045.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/2jtuu1356025045.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/32b7x1356025045.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/494ms1356025045.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/59j4l1356025045.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.09402503 0.01815461 0.01815461 0.01815461 0.01815461 0.02212414 7 8 9 10 11 12 0.01815461 -0.13837554 0.05386193 0.02679780 -0.12973235 0.01815461 13 14 15 16 17 18 -0.28599077 -0.12973235 -0.25028345 -0.40681360 0.56612227 -0.12973235 19 20 21 22 23 24 0.05386193 0.59318640 -0.01358318 -0.24164026 0.01348096 0.02212414 25 26 27 28 29 30 -0.36643262 -0.28599077 0.06250512 -0.24560979 0.05386193 -0.02222636 31 32 33 34 35 36 0.01815461 0.02679780 -0.01358318 -0.10266822 0.01815461 0.01815461 37 38 39 40 41 42 -0.43387773 -0.20990247 0.01348096 -0.17875652 0.74971655 -0.20990247 43 44 45 46 47 48 0.02212414 -0.12973235 -0.02222636 0.01348096 0.01815461 0.05386193 49 50 51 52 53 54 0.01348096 0.01815461 -0.40213994 0.56612227 0.05386193 0.75439021 55 56 57 58 59 60 0.01815461 -0.36643262 -0.25028345 0.05386193 0.05386193 0.60182959 61 62 63 64 65 66 -0.09402503 -0.28599077 0.01815461 -0.09402503 0.01815461 0.01815461 67 68 69 70 71 72 0.55747908 0.02679780 0.05386193 -0.24560979 0.01815461 0.05386193 73 74 75 76 77 78 -0.20990247 -0.23696660 0.05386193 -0.14304920 0.05386193 -0.25028345 79 80 81 82 83 84 0.63356738 -0.17875652 0.01815461 -0.20125928 0.01815461 0.75439021 85 86 87 88 89 90 0.01348096 0.02679780 0.01907486 -0.08749232 -0.02527564 0.01043168 91 92 93 94 95 96 -0.06565662 0.14056476 -0.05701343 -0.02527564 0.13192158 0.01043168 97 98 99 100 101 102 0.14056476 -0.02527564 -0.01663246 0.01043168 0.01907486 -0.02527564 103 104 105 106 107 108 -0.02527564 -0.02527564 -0.13184283 -0.02527564 -0.02527564 -0.12319964 109 110 111 112 113 114 -0.02527564 -0.01663246 -0.16358062 0.13192158 -0.28904005 -0.12319964 115 116 117 118 119 120 -0.01663246 -0.02527564 0.01907486 -0.01663246 -0.02527564 0.01043168 121 122 123 124 125 126 -0.01663246 -0.02527564 -0.12319964 -0.29371370 0.01043168 0.13192158 127 128 129 130 131 132 -0.06565662 0.01043168 -0.02527564 0.01043168 -0.01663246 0.01907486 133 134 135 136 137 138 -0.28039686 -0.02527564 -0.02527564 -0.02527564 -0.28507052 -0.12787330 139 140 141 142 143 144 0.13192158 -0.02527564 0.74666727 -0.09613551 -0.01663246 -0.02994930 145 146 147 148 149 150 -0.06565662 0.16762890 -0.13184283 0.13192158 -0.01663246 -0.02994930 151 152 153 154 0.01043168 0.71960314 0.67922217 -0.28039686 > postscript(file="/var/fisher/rcomp/tmp/6lq491356025045.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.09402503 NA 1 0.01815461 -0.09402503 2 0.01815461 0.01815461 3 0.01815461 0.01815461 4 0.01815461 0.01815461 5 0.02212414 0.01815461 6 0.01815461 0.02212414 7 -0.13837554 0.01815461 8 0.05386193 -0.13837554 9 0.02679780 0.05386193 10 -0.12973235 0.02679780 11 0.01815461 -0.12973235 12 -0.28599077 0.01815461 13 -0.12973235 -0.28599077 14 -0.25028345 -0.12973235 15 -0.40681360 -0.25028345 16 0.56612227 -0.40681360 17 -0.12973235 0.56612227 18 0.05386193 -0.12973235 19 0.59318640 0.05386193 20 -0.01358318 0.59318640 21 -0.24164026 -0.01358318 22 0.01348096 -0.24164026 23 0.02212414 0.01348096 24 -0.36643262 0.02212414 25 -0.28599077 -0.36643262 26 0.06250512 -0.28599077 27 -0.24560979 0.06250512 28 0.05386193 -0.24560979 29 -0.02222636 0.05386193 30 0.01815461 -0.02222636 31 0.02679780 0.01815461 32 -0.01358318 0.02679780 33 -0.10266822 -0.01358318 34 0.01815461 -0.10266822 35 0.01815461 0.01815461 36 -0.43387773 0.01815461 37 -0.20990247 -0.43387773 38 0.01348096 -0.20990247 39 -0.17875652 0.01348096 40 0.74971655 -0.17875652 41 -0.20990247 0.74971655 42 0.02212414 -0.20990247 43 -0.12973235 0.02212414 44 -0.02222636 -0.12973235 45 0.01348096 -0.02222636 46 0.01815461 0.01348096 47 0.05386193 0.01815461 48 0.01348096 0.05386193 49 0.01815461 0.01348096 50 -0.40213994 0.01815461 51 0.56612227 -0.40213994 52 0.05386193 0.56612227 53 0.75439021 0.05386193 54 0.01815461 0.75439021 55 -0.36643262 0.01815461 56 -0.25028345 -0.36643262 57 0.05386193 -0.25028345 58 0.05386193 0.05386193 59 0.60182959 0.05386193 60 -0.09402503 0.60182959 61 -0.28599077 -0.09402503 62 0.01815461 -0.28599077 63 -0.09402503 0.01815461 64 0.01815461 -0.09402503 65 0.01815461 0.01815461 66 0.55747908 0.01815461 67 0.02679780 0.55747908 68 0.05386193 0.02679780 69 -0.24560979 0.05386193 70 0.01815461 -0.24560979 71 0.05386193 0.01815461 72 -0.20990247 0.05386193 73 -0.23696660 -0.20990247 74 0.05386193 -0.23696660 75 -0.14304920 0.05386193 76 0.05386193 -0.14304920 77 -0.25028345 0.05386193 78 0.63356738 -0.25028345 79 -0.17875652 0.63356738 80 0.01815461 -0.17875652 81 -0.20125928 0.01815461 82 0.01815461 -0.20125928 83 0.75439021 0.01815461 84 0.01348096 0.75439021 85 0.02679780 0.01348096 86 0.01907486 0.02679780 87 -0.08749232 0.01907486 88 -0.02527564 -0.08749232 89 0.01043168 -0.02527564 90 -0.06565662 0.01043168 91 0.14056476 -0.06565662 92 -0.05701343 0.14056476 93 -0.02527564 -0.05701343 94 0.13192158 -0.02527564 95 0.01043168 0.13192158 96 0.14056476 0.01043168 97 -0.02527564 0.14056476 98 -0.01663246 -0.02527564 99 0.01043168 -0.01663246 100 0.01907486 0.01043168 101 -0.02527564 0.01907486 102 -0.02527564 -0.02527564 103 -0.02527564 -0.02527564 104 -0.13184283 -0.02527564 105 -0.02527564 -0.13184283 106 -0.02527564 -0.02527564 107 -0.12319964 -0.02527564 108 -0.02527564 -0.12319964 109 -0.01663246 -0.02527564 110 -0.16358062 -0.01663246 111 0.13192158 -0.16358062 112 -0.28904005 0.13192158 113 -0.12319964 -0.28904005 114 -0.01663246 -0.12319964 115 -0.02527564 -0.01663246 116 0.01907486 -0.02527564 117 -0.01663246 0.01907486 118 -0.02527564 -0.01663246 119 0.01043168 -0.02527564 120 -0.01663246 0.01043168 121 -0.02527564 -0.01663246 122 -0.12319964 -0.02527564 123 -0.29371370 -0.12319964 124 0.01043168 -0.29371370 125 0.13192158 0.01043168 126 -0.06565662 0.13192158 127 0.01043168 -0.06565662 128 -0.02527564 0.01043168 129 0.01043168 -0.02527564 130 -0.01663246 0.01043168 131 0.01907486 -0.01663246 132 -0.28039686 0.01907486 133 -0.02527564 -0.28039686 134 -0.02527564 -0.02527564 135 -0.02527564 -0.02527564 136 -0.28507052 -0.02527564 137 -0.12787330 -0.28507052 138 0.13192158 -0.12787330 139 -0.02527564 0.13192158 140 0.74666727 -0.02527564 141 -0.09613551 0.74666727 142 -0.01663246 -0.09613551 143 -0.02994930 -0.01663246 144 -0.06565662 -0.02994930 145 0.16762890 -0.06565662 146 -0.13184283 0.16762890 147 0.13192158 -0.13184283 148 -0.01663246 0.13192158 149 -0.02994930 -0.01663246 150 0.01043168 -0.02994930 151 0.71960314 0.01043168 152 0.67922217 0.71960314 153 -0.28039686 0.67922217 154 NA -0.28039686 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] 0.01815461 -0.09402503 [2,] 0.01815461 0.01815461 [3,] 0.01815461 0.01815461 [4,] 0.01815461 0.01815461 [5,] 0.02212414 0.01815461 [6,] 0.01815461 0.02212414 [7,] -0.13837554 0.01815461 [8,] 0.05386193 -0.13837554 [9,] 0.02679780 0.05386193 [10,] -0.12973235 0.02679780 [11,] 0.01815461 -0.12973235 [12,] -0.28599077 0.01815461 [13,] -0.12973235 -0.28599077 [14,] -0.25028345 -0.12973235 [15,] -0.40681360 -0.25028345 [16,] 0.56612227 -0.40681360 [17,] -0.12973235 0.56612227 [18,] 0.05386193 -0.12973235 [19,] 0.59318640 0.05386193 [20,] -0.01358318 0.59318640 [21,] -0.24164026 -0.01358318 [22,] 0.01348096 -0.24164026 [23,] 0.02212414 0.01348096 [24,] -0.36643262 0.02212414 [25,] -0.28599077 -0.36643262 [26,] 0.06250512 -0.28599077 [27,] -0.24560979 0.06250512 [28,] 0.05386193 -0.24560979 [29,] -0.02222636 0.05386193 [30,] 0.01815461 -0.02222636 [31,] 0.02679780 0.01815461 [32,] -0.01358318 0.02679780 [33,] -0.10266822 -0.01358318 [34,] 0.01815461 -0.10266822 [35,] 0.01815461 0.01815461 [36,] -0.43387773 0.01815461 [37,] -0.20990247 -0.43387773 [38,] 0.01348096 -0.20990247 [39,] -0.17875652 0.01348096 [40,] 0.74971655 -0.17875652 [41,] -0.20990247 0.74971655 [42,] 0.02212414 -0.20990247 [43,] -0.12973235 0.02212414 [44,] -0.02222636 -0.12973235 [45,] 0.01348096 -0.02222636 [46,] 0.01815461 0.01348096 [47,] 0.05386193 0.01815461 [48,] 0.01348096 0.05386193 [49,] 0.01815461 0.01348096 [50,] -0.40213994 0.01815461 [51,] 0.56612227 -0.40213994 [52,] 0.05386193 0.56612227 [53,] 0.75439021 0.05386193 [54,] 0.01815461 0.75439021 [55,] -0.36643262 0.01815461 [56,] -0.25028345 -0.36643262 [57,] 0.05386193 -0.25028345 [58,] 0.05386193 0.05386193 [59,] 0.60182959 0.05386193 [60,] -0.09402503 0.60182959 [61,] -0.28599077 -0.09402503 [62,] 0.01815461 -0.28599077 [63,] -0.09402503 0.01815461 [64,] 0.01815461 -0.09402503 [65,] 0.01815461 0.01815461 [66,] 0.55747908 0.01815461 [67,] 0.02679780 0.55747908 [68,] 0.05386193 0.02679780 [69,] -0.24560979 0.05386193 [70,] 0.01815461 -0.24560979 [71,] 0.05386193 0.01815461 [72,] -0.20990247 0.05386193 [73,] -0.23696660 -0.20990247 [74,] 0.05386193 -0.23696660 [75,] -0.14304920 0.05386193 [76,] 0.05386193 -0.14304920 [77,] -0.25028345 0.05386193 [78,] 0.63356738 -0.25028345 [79,] -0.17875652 0.63356738 [80,] 0.01815461 -0.17875652 [81,] -0.20125928 0.01815461 [82,] 0.01815461 -0.20125928 [83,] 0.75439021 0.01815461 [84,] 0.01348096 0.75439021 [85,] 0.02679780 0.01348096 [86,] 0.01907486 0.02679780 [87,] -0.08749232 0.01907486 [88,] -0.02527564 -0.08749232 [89,] 0.01043168 -0.02527564 [90,] -0.06565662 0.01043168 [91,] 0.14056476 -0.06565662 [92,] -0.05701343 0.14056476 [93,] -0.02527564 -0.05701343 [94,] 0.13192158 -0.02527564 [95,] 0.01043168 0.13192158 [96,] 0.14056476 0.01043168 [97,] -0.02527564 0.14056476 [98,] -0.01663246 -0.02527564 [99,] 0.01043168 -0.01663246 [100,] 0.01907486 0.01043168 [101,] -0.02527564 0.01907486 [102,] -0.02527564 -0.02527564 [103,] -0.02527564 -0.02527564 [104,] -0.13184283 -0.02527564 [105,] -0.02527564 -0.13184283 [106,] -0.02527564 -0.02527564 [107,] -0.12319964 -0.02527564 [108,] -0.02527564 -0.12319964 [109,] -0.01663246 -0.02527564 [110,] -0.16358062 -0.01663246 [111,] 0.13192158 -0.16358062 [112,] -0.28904005 0.13192158 [113,] -0.12319964 -0.28904005 [114,] -0.01663246 -0.12319964 [115,] -0.02527564 -0.01663246 [116,] 0.01907486 -0.02527564 [117,] -0.01663246 0.01907486 [118,] -0.02527564 -0.01663246 [119,] 0.01043168 -0.02527564 [120,] -0.01663246 0.01043168 [121,] -0.02527564 -0.01663246 [122,] -0.12319964 -0.02527564 [123,] -0.29371370 -0.12319964 [124,] 0.01043168 -0.29371370 [125,] 0.13192158 0.01043168 [126,] -0.06565662 0.13192158 [127,] 0.01043168 -0.06565662 [128,] -0.02527564 0.01043168 [129,] 0.01043168 -0.02527564 [130,] -0.01663246 0.01043168 [131,] 0.01907486 -0.01663246 [132,] -0.28039686 0.01907486 [133,] -0.02527564 -0.28039686 [134,] -0.02527564 -0.02527564 [135,] -0.02527564 -0.02527564 [136,] -0.28507052 -0.02527564 [137,] -0.12787330 -0.28507052 [138,] 0.13192158 -0.12787330 [139,] -0.02527564 0.13192158 [140,] 0.74666727 -0.02527564 [141,] -0.09613551 0.74666727 [142,] -0.01663246 -0.09613551 [143,] -0.02994930 -0.01663246 [144,] -0.06565662 -0.02994930 [145,] 0.16762890 -0.06565662 [146,] -0.13184283 0.16762890 [147,] 0.13192158 -0.13184283 [148,] -0.01663246 0.13192158 [149,] -0.02994930 -0.01663246 [150,] 0.01043168 -0.02994930 [151,] 0.71960314 0.01043168 [152,] 0.67922217 0.71960314 [153,] -0.28039686 0.67922217 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 0.01815461 -0.09402503 2 0.01815461 0.01815461 3 0.01815461 0.01815461 4 0.01815461 0.01815461 5 0.02212414 0.01815461 6 0.01815461 0.02212414 7 -0.13837554 0.01815461 8 0.05386193 -0.13837554 9 0.02679780 0.05386193 10 -0.12973235 0.02679780 11 0.01815461 -0.12973235 12 -0.28599077 0.01815461 13 -0.12973235 -0.28599077 14 -0.25028345 -0.12973235 15 -0.40681360 -0.25028345 16 0.56612227 -0.40681360 17 -0.12973235 0.56612227 18 0.05386193 -0.12973235 19 0.59318640 0.05386193 20 -0.01358318 0.59318640 21 -0.24164026 -0.01358318 22 0.01348096 -0.24164026 23 0.02212414 0.01348096 24 -0.36643262 0.02212414 25 -0.28599077 -0.36643262 26 0.06250512 -0.28599077 27 -0.24560979 0.06250512 28 0.05386193 -0.24560979 29 -0.02222636 0.05386193 30 0.01815461 -0.02222636 31 0.02679780 0.01815461 32 -0.01358318 0.02679780 33 -0.10266822 -0.01358318 34 0.01815461 -0.10266822 35 0.01815461 0.01815461 36 -0.43387773 0.01815461 37 -0.20990247 -0.43387773 38 0.01348096 -0.20990247 39 -0.17875652 0.01348096 40 0.74971655 -0.17875652 41 -0.20990247 0.74971655 42 0.02212414 -0.20990247 43 -0.12973235 0.02212414 44 -0.02222636 -0.12973235 45 0.01348096 -0.02222636 46 0.01815461 0.01348096 47 0.05386193 0.01815461 48 0.01348096 0.05386193 49 0.01815461 0.01348096 50 -0.40213994 0.01815461 51 0.56612227 -0.40213994 52 0.05386193 0.56612227 53 0.75439021 0.05386193 54 0.01815461 0.75439021 55 -0.36643262 0.01815461 56 -0.25028345 -0.36643262 57 0.05386193 -0.25028345 58 0.05386193 0.05386193 59 0.60182959 0.05386193 60 -0.09402503 0.60182959 61 -0.28599077 -0.09402503 62 0.01815461 -0.28599077 63 -0.09402503 0.01815461 64 0.01815461 -0.09402503 65 0.01815461 0.01815461 66 0.55747908 0.01815461 67 0.02679780 0.55747908 68 0.05386193 0.02679780 69 -0.24560979 0.05386193 70 0.01815461 -0.24560979 71 0.05386193 0.01815461 72 -0.20990247 0.05386193 73 -0.23696660 -0.20990247 74 0.05386193 -0.23696660 75 -0.14304920 0.05386193 76 0.05386193 -0.14304920 77 -0.25028345 0.05386193 78 0.63356738 -0.25028345 79 -0.17875652 0.63356738 80 0.01815461 -0.17875652 81 -0.20125928 0.01815461 82 0.01815461 -0.20125928 83 0.75439021 0.01815461 84 0.01348096 0.75439021 85 0.02679780 0.01348096 86 0.01907486 0.02679780 87 -0.08749232 0.01907486 88 -0.02527564 -0.08749232 89 0.01043168 -0.02527564 90 -0.06565662 0.01043168 91 0.14056476 -0.06565662 92 -0.05701343 0.14056476 93 -0.02527564 -0.05701343 94 0.13192158 -0.02527564 95 0.01043168 0.13192158 96 0.14056476 0.01043168 97 -0.02527564 0.14056476 98 -0.01663246 -0.02527564 99 0.01043168 -0.01663246 100 0.01907486 0.01043168 101 -0.02527564 0.01907486 102 -0.02527564 -0.02527564 103 -0.02527564 -0.02527564 104 -0.13184283 -0.02527564 105 -0.02527564 -0.13184283 106 -0.02527564 -0.02527564 107 -0.12319964 -0.02527564 108 -0.02527564 -0.12319964 109 -0.01663246 -0.02527564 110 -0.16358062 -0.01663246 111 0.13192158 -0.16358062 112 -0.28904005 0.13192158 113 -0.12319964 -0.28904005 114 -0.01663246 -0.12319964 115 -0.02527564 -0.01663246 116 0.01907486 -0.02527564 117 -0.01663246 0.01907486 118 -0.02527564 -0.01663246 119 0.01043168 -0.02527564 120 -0.01663246 0.01043168 121 -0.02527564 -0.01663246 122 -0.12319964 -0.02527564 123 -0.29371370 -0.12319964 124 0.01043168 -0.29371370 125 0.13192158 0.01043168 126 -0.06565662 0.13192158 127 0.01043168 -0.06565662 128 -0.02527564 0.01043168 129 0.01043168 -0.02527564 130 -0.01663246 0.01043168 131 0.01907486 -0.01663246 132 -0.28039686 0.01907486 133 -0.02527564 -0.28039686 134 -0.02527564 -0.02527564 135 -0.02527564 -0.02527564 136 -0.28507052 -0.02527564 137 -0.12787330 -0.28507052 138 0.13192158 -0.12787330 139 -0.02527564 0.13192158 140 0.74666727 -0.02527564 141 -0.09613551 0.74666727 142 -0.01663246 -0.09613551 143 -0.02994930 -0.01663246 144 -0.06565662 -0.02994930 145 0.16762890 -0.06565662 146 -0.13184283 0.16762890 147 0.13192158 -0.13184283 148 -0.01663246 0.13192158 149 -0.02994930 -0.01663246 150 0.01043168 -0.02994930 151 0.71960314 0.01043168 152 0.67922217 0.71960314 153 -0.28039686 0.67922217 > 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/71sak1356025045.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/8osdc1356025045.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/9ki501356025045.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/10cu0u1356025045.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/116j5e1356025045.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/1295c01356025045.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/13jv7l1356025045.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/1470y41356025046.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/15rbgh1356025046.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/16wq4w1356025046.tab") + } > > try(system("convert tmp/13bhl1356025045.ps tmp/13bhl1356025045.png",intern=TRUE)) character(0) > try(system("convert tmp/2jtuu1356025045.ps tmp/2jtuu1356025045.png",intern=TRUE)) character(0) > try(system("convert tmp/32b7x1356025045.ps tmp/32b7x1356025045.png",intern=TRUE)) character(0) > try(system("convert tmp/494ms1356025045.ps tmp/494ms1356025045.png",intern=TRUE)) character(0) > try(system("convert tmp/59j4l1356025045.ps tmp/59j4l1356025045.png",intern=TRUE)) character(0) > try(system("convert tmp/6lq491356025045.ps tmp/6lq491356025045.png",intern=TRUE)) character(0) > try(system("convert tmp/71sak1356025045.ps tmp/71sak1356025045.png",intern=TRUE)) character(0) > try(system("convert tmp/8osdc1356025045.ps tmp/8osdc1356025045.png",intern=TRUE)) character(0) > try(system("convert tmp/9ki501356025045.ps tmp/9ki501356025045.png",intern=TRUE)) character(0) > try(system("convert tmp/10cu0u1356025045.ps tmp/10cu0u1356025045.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 7.964 1.748 9.718