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(13 + ,13 + ,14 + ,13 + ,3 + ,4 + ,4 + ,12 + ,12 + ,8 + ,13 + ,5 + ,5 + ,5 + ,15 + ,10 + ,12 + ,16 + ,6 + ,1 + ,9 + ,12 + ,9 + ,7 + ,12 + ,6 + ,9 + ,11 + ,10 + ,10 + ,10 + ,11 + ,5 + ,19 + ,3 + ,12 + ,12 + ,7 + ,12 + ,3 + ,11 + ,4 + ,15 + ,13 + ,16 + ,18 + ,8 + ,3 + ,5 + ,9 + ,12 + ,11 + ,11 + ,4 + ,5 + ,7 + ,12 + ,12 + ,14 + ,14 + ,4 + ,8 + ,8 + ,11 + ,6 + ,6 + ,9 + ,4 + ,9 + ,9 + ,11 + ,5 + ,16 + ,14 + ,6 + ,11 + ,10 + ,11 + ,12 + ,11 + ,12 + ,6 + ,1 + ,5 + ,15 + ,11 + ,16 + ,11 + ,5 + ,4 + ,4 + ,7 + ,14 + ,12 + ,12 + ,4 + ,5 + ,3 + ,11 + ,14 + ,7 + ,13 + ,6 + ,6 + ,6 + ,11 + ,12 + ,13 + ,11 + ,4 + ,8 + ,7 + ,10 + ,12 + ,11 + ,12 + ,6 + ,9 + ,9 + ,14 + ,11 + ,15 + ,16 + ,6 + ,4 + ,18 + ,10 + ,11 + ,7 + ,9 + ,4 + ,5 + ,8 + ,6 + ,7 + ,9 + ,11 + ,4 + ,8 + ,3 + ,11 + ,9 + ,7 + ,13 + ,2 + ,13 + ,5 + ,15 + ,11 + ,14 + ,15 + ,7 + ,4 + ,8 + ,11 + ,11 + ,15 + ,10 + ,5 + ,15 + ,7 + ,12 + ,12 + ,7 + ,11 + ,4 + ,3 + ,9 + ,14 + ,12 + ,15 + ,13 + ,6 + ,6 + ,4 + ,15 + ,11 + ,17 + ,16 + ,6 + ,9 + ,6 + ,9 + ,11 + ,15 + ,15 + ,7 + ,19 + ,8 + ,13 + ,8 + ,14 + ,14 + ,5 + ,4 + ,7 + ,13 + ,9 + ,14 + ,14 + ,6 + ,15 + ,4 + ,16 + ,12 + ,8 + ,14 + ,4 + ,4 + ,6 + ,13 + ,10 + ,8 + ,8 + ,4 + ,7 + ,12 + ,12 + ,10 + ,14 + ,13 + ,7 + ,4 + ,3 + ,14 + ,12 + ,14 + ,15 + ,7 + ,9 + ,5 + ,11 + ,8 + ,8 + ,13 + ,4 + ,8 + ,7 + ,9 + ,12 + ,11 + ,11 + ,4 + ,3 + ,9 + ,16 + ,11 + ,16 + ,15 + ,6 + ,13 + ,8 + ,12 + ,12 + ,10 + ,15 + ,6 + ,5 + ,7 + ,10 + ,7 + ,8 + ,9 + ,5 + ,9 + ,4 + ,13 + ,11 + ,14 + ,13 + ,6 + ,11 + ,5 + ,16 + ,11 + ,16 + ,16 + ,7 + ,13 + ,12 + ,14 + ,12 + ,13 + ,13 + ,6 + ,5 + ,15 + ,15 + ,9 + ,5 + ,11 + ,3 + ,7 + ,3 + ,5 + ,15 + ,8 + ,12 + ,3 + ,6 + ,5 + ,8 + ,11 + ,10 + ,12 + ,4 + ,4 + ,13 + ,11 + ,11 + ,8 + ,12 + ,6 + ,17 + ,8 + ,16 + ,11 + ,13 + ,14 + ,7 + ,6 + ,9 + ,17 + ,11 + ,15 + ,14 + ,5 + ,1 + ,5 + ,9 + ,15 + ,6 + ,8 + ,4 + ,9 + ,13 + ,9 + ,11 + ,12 + ,13 + ,5 + ,19 + ,4 + ,13 + ,12 + ,16 + ,16 + ,6 + ,13 + ,5 + ,10 + ,12 + ,5 + ,13 + ,6 + ,18 + ,7 + ,6 + ,9 + ,15 + ,11 + ,6 + ,6 + ,8 + ,12 + ,12 + ,12 + ,14 + ,5 + ,5 + ,9 + ,8 + ,12 + ,8 + ,13 + ,4 + ,3 + ,11 + ,14 + ,13 + ,13 + ,13 + ,5 + ,7 + ,4 + ,12 + ,11 + ,14 + ,13 + ,5 + ,8 + ,6 + ,11 + ,9 + ,12 + ,12 + ,4 + ,9 + ,8 + ,16 + ,9 + ,16 + ,16 + ,6 + ,13 + ,10 + ,8 + ,11 + ,10 + ,15 + ,2 + ,12 + ,4 + ,15 + ,11 + ,15 + ,15 + ,8 + ,2 + ,4 + ,7 + ,12 + ,8 + ,12 + ,3 + ,4 + ,2 + ,16 + ,12 + ,16 + ,14 + ,6 + ,6 + ,12 + ,14 + ,9 + ,19 + ,12 + ,6 + ,8 + ,11 + ,16 + ,11 + ,14 + ,15 + ,6 + ,9 + ,4 + ,9 + ,9 + ,6 + ,12 + ,5 + ,10 + ,7 + ,14 + ,12 + ,13 + ,13 + ,5 + ,9 + ,7 + ,11 + ,12 + ,15 + ,12 + ,6 + ,3 + ,9 + ,13 + ,12 + ,7 + ,12 + ,5 + ,5 + ,19 + ,15 + ,12 + ,13 + ,13 + ,6 + ,6 + ,3 + ,5 + ,14 + ,4 + ,5 + ,2 + ,2 + ,5 + ,15 + ,11 + ,14 + ,13 + ,5 + ,3 + ,3 + ,13 + ,12 + ,13 + ,13 + ,5 + ,4 + ,11 + ,11 + ,11 + ,11 + ,14 + ,5 + ,2 + ,5 + ,11 + ,6 + ,14 + ,17 + ,6 + ,11 + ,6 + ,12 + ,10 + ,12 + ,13 + ,6 + ,8 + ,8 + ,12 + ,12 + ,15 + ,13 + ,6 + ,11 + ,9 + ,12 + ,13 + ,14 + ,12 + ,5 + ,17 + ,11 + ,12 + ,8 + ,13 + ,13 + ,5 + ,4 + ,7 + ,14 + ,12 + ,8 + ,14 + ,4 + ,5 + ,4 + ,6 + ,12 + ,6 + ,11 + ,2 + ,8 + ,5 + ,7 + ,12 + ,7 + ,12 + ,4 + ,9 + ,7 + ,14 + ,6 + ,13 + ,12 + ,6 + ,4 + ,11 + ,14 + ,11 + ,13 + ,16 + ,6 + ,6 + ,13 + ,10 + ,10 + ,11 + ,12 + ,5 + ,7 + ,3 + ,13 + ,12 + ,5 + ,12 + ,3 + ,9 + ,5 + ,12 + ,13 + ,12 + ,12 + ,6 + ,11 + ,7 + ,9 + ,11 + ,8 + ,10 + ,4 + ,12 + ,8 + ,12 + ,7 + ,11 + ,15 + ,5 + ,9 + ,11 + ,16 + ,11 + ,14 + ,15 + ,8 + ,4 + ,12 + ,10 + ,11 + ,9 + ,12 + ,4 + ,3 + ,8) + ,dim=c(7 + ,90) + ,dimnames=list(c('KansOverwinning' + ,'GeboekteOverwinning' + ,'Gevoel' + ,'EigenGevoel' + ,'Beste' + ,'2deBeste' + ,'3debeste') + ,1:90)) > y <- array(NA,dim=c(7,90),dimnames=list(c('KansOverwinning','GeboekteOverwinning','Gevoel','EigenGevoel','Beste','2deBeste','3debeste'),1:90)) > 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 = 'Linear Trend' > par2 = 'Do not include Seasonal Dummies' > par1 = '1' > 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 KansOverwinning GeboekteOverwinning Gevoel EigenGevoel Beste 2deBeste 1 13 13 14 13 3 4 2 12 12 8 13 5 5 3 15 10 12 16 6 1 4 12 9 7 12 6 9 5 10 10 10 11 5 19 6 12 12 7 12 3 11 7 15 13 16 18 8 3 8 9 12 11 11 4 5 9 12 12 14 14 4 8 10 11 6 6 9 4 9 11 11 5 16 14 6 11 12 11 12 11 12 6 1 13 15 11 16 11 5 4 14 7 14 12 12 4 5 15 11 14 7 13 6 6 16 11 12 13 11 4 8 17 10 12 11 12 6 9 18 14 11 15 16 6 4 19 10 11 7 9 4 5 20 6 7 9 11 4 8 21 11 9 7 13 2 13 22 15 11 14 15 7 4 23 11 11 15 10 5 15 24 12 12 7 11 4 3 25 14 12 15 13 6 6 26 15 11 17 16 6 9 27 9 11 15 15 7 19 28 13 8 14 14 5 4 29 13 9 14 14 6 15 30 16 12 8 14 4 4 31 13 10 8 8 4 7 32 12 10 14 13 7 4 33 14 12 14 15 7 9 34 11 8 8 13 4 8 35 9 12 11 11 4 3 36 16 11 16 15 6 13 37 12 12 10 15 6 5 38 10 7 8 9 5 9 39 13 11 14 13 6 11 40 16 11 16 16 7 13 41 14 12 13 13 6 5 42 15 9 5 11 3 7 43 5 15 8 12 3 6 44 8 11 10 12 4 4 45 11 11 8 12 6 17 46 16 11 13 14 7 6 47 17 11 15 14 5 1 48 9 15 6 8 4 9 49 9 11 12 13 5 19 50 13 12 16 16 6 13 51 10 12 5 13 6 18 52 6 9 15 11 6 6 53 12 12 12 14 5 5 54 8 12 8 13 4 3 55 14 13 13 13 5 7 56 12 11 14 13 5 8 57 11 9 12 12 4 9 58 16 9 16 16 6 13 59 8 11 10 15 2 12 60 15 11 15 15 8 2 61 7 12 8 12 3 4 62 16 12 16 14 6 6 63 14 9 19 12 6 8 64 16 11 14 15 6 9 65 9 9 6 12 5 10 66 14 12 13 13 5 9 67 11 12 15 12 6 3 68 13 12 7 12 5 5 69 15 12 13 13 6 6 70 5 14 4 5 2 2 71 15 11 14 13 5 3 72 13 12 13 13 5 4 73 11 11 11 14 5 2 74 11 6 14 17 6 11 75 12 10 12 13 6 8 76 12 12 15 13 6 11 77 12 13 14 12 5 17 78 12 8 13 13 5 4 79 14 12 8 14 4 5 80 6 12 6 11 2 8 81 7 12 7 12 4 9 82 14 6 13 12 6 4 83 14 11 13 16 6 6 84 10 10 11 12 5 7 85 13 12 5 12 3 9 86 12 13 12 12 6 11 87 9 11 8 10 4 12 88 12 7 11 15 5 9 89 16 11 14 15 8 4 90 10 11 9 12 4 3 3debeste t 1 4 1 2 5 2 3 9 3 4 11 4 5 3 5 6 4 6 7 5 7 8 7 8 9 8 9 10 9 10 11 10 11 12 5 12 13 4 13 14 3 14 15 6 15 16 7 16 17 9 17 18 18 18 19 8 19 20 3 20 21 5 21 22 8 22 23 7 23 24 9 24 25 4 25 26 6 26 27 8 27 28 7 28 29 4 29 30 6 30 31 12 31 32 3 32 33 5 33 34 7 34 35 9 35 36 8 36 37 7 37 38 4 38 39 5 39 40 12 40 41 15 41 42 3 42 43 5 43 44 13 44 45 8 45 46 9 46 47 5 47 48 13 48 49 4 49 50 5 50 51 7 51 52 8 52 53 9 53 54 11 54 55 4 55 56 6 56 57 8 57 58 10 58 59 4 59 60 4 60 61 2 61 62 12 62 63 11 63 64 4 64 65 7 65 66 7 66 67 9 67 68 19 68 69 3 69 70 5 70 71 3 71 72 11 72 73 5 73 74 6 74 75 8 75 76 9 76 77 11 77 78 7 78 79 4 79 80 5 80 81 7 81 82 11 82 83 13 83 84 3 84 85 5 85 86 7 86 87 8 87 88 11 88 89 12 89 90 8 90 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) GeboekteOverwinning Gevoel 3.274123 -0.036585 0.141736 EigenGevoel Beste `2deBeste` 0.406011 0.519932 -0.097117 `3debeste` t 0.051275 -0.002926 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -6.3320 -1.4125 0.2032 1.3523 5.9694 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 3.274123 2.265635 1.445 0.15223 GeboekteOverwinning -0.036585 0.125769 -0.291 0.77187 Gevoel 0.141736 0.093568 1.515 0.13367 EigenGevoel 0.406011 0.145403 2.792 0.00651 ** Beste 0.519932 0.248454 2.093 0.03947 * `2deBeste` -0.097117 0.055824 -1.740 0.08566 . `3debeste` 0.051275 0.073659 0.696 0.48833 t -0.002926 0.009271 -0.316 0.75315 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 2.263 on 82 degrees of freedom Multiple R-squared: 0.4118, Adjusted R-squared: 0.3616 F-statistic: 8.201 on 7 and 82 DF, p-value: 1.515e-07 > 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.15637459 0.3127492 0.84362541 [2,] 0.06855737 0.1371147 0.93144263 [3,] 0.40655095 0.8131019 0.59344905 [4,] 0.56425427 0.8714915 0.43574573 [5,] 0.51433646 0.9713271 0.48566354 [6,] 0.44572126 0.8914425 0.55427874 [7,] 0.34942958 0.6988592 0.65057042 [8,] 0.29357710 0.5871542 0.70642290 [9,] 0.22116093 0.4423219 0.77883907 [10,] 0.23092463 0.4618493 0.76907537 [11,] 0.30529565 0.6105913 0.69470435 [12,] 0.35391425 0.7078285 0.64608575 [13,] 0.29981775 0.5996355 0.70018225 [14,] 0.26741128 0.5348226 0.73258872 [15,] 0.26324616 0.5264923 0.73675384 [16,] 0.22369176 0.4473835 0.77630824 [17,] 0.29809923 0.5961985 0.70190077 [18,] 0.23619945 0.4723989 0.76380055 [19,] 0.20961221 0.4192244 0.79038779 [20,] 0.31639776 0.6327955 0.68360224 [21,] 0.37933418 0.7586684 0.62066582 [22,] 0.33393505 0.6678701 0.66606495 [23,] 0.27938576 0.5587715 0.72061424 [24,] 0.23707935 0.4741587 0.76292065 [25,] 0.27235137 0.5447027 0.72764863 [26,] 0.29816280 0.5963256 0.70183720 [27,] 0.26761517 0.5352303 0.73238483 [28,] 0.21610041 0.4322008 0.78389959 [29,] 0.17333762 0.3466752 0.82666238 [30,] 0.14787776 0.2957555 0.85212224 [31,] 0.11430857 0.2286171 0.88569143 [32,] 0.41124959 0.8224992 0.58875041 [33,] 0.75102177 0.4979565 0.24897823 [34,] 0.80393673 0.3921265 0.19606327 [35,] 0.76358033 0.4728393 0.23641967 [36,] 0.76546202 0.4690760 0.23453798 [37,] 0.84867269 0.3026546 0.15132731 [38,] 0.81587101 0.3682580 0.18412899 [39,] 0.79004501 0.4199100 0.20995499 [40,] 0.75166734 0.4966653 0.24833266 [41,] 0.69584425 0.6083115 0.30415575 [42,] 0.93278260 0.1344348 0.06721740 [43,] 0.90948964 0.1810207 0.09051036 [44,] 0.93778886 0.1244223 0.06221114 [45,] 0.92946161 0.1410768 0.07053839 [46,] 0.90263282 0.1947344 0.09736718 [47,] 0.87102954 0.2579409 0.12897046 [48,] 0.86414619 0.2717076 0.13585381 [49,] 0.85497588 0.2900482 0.14502412 [50,] 0.81806028 0.3638794 0.18193972 [51,] 0.85456943 0.2908611 0.14543057 [52,] 0.83064796 0.3387041 0.16935204 [53,] 0.78818044 0.4236391 0.21181956 [54,] 0.78844250 0.4231150 0.21155750 [55,] 0.74387673 0.5122465 0.25612327 [56,] 0.73141908 0.5371618 0.26858092 [57,] 0.73377835 0.5324433 0.26622165 [58,] 0.69784339 0.6043132 0.30215661 [59,] 0.68670985 0.6265803 0.31329015 [60,] 0.62461819 0.7507636 0.37538181 [61,] 0.67047006 0.6590599 0.32952994 [62,] 0.58443767 0.8311247 0.41556233 [63,] 0.51019752 0.9796050 0.48980248 [64,] 0.51799397 0.9640121 0.48200603 [65,] 0.42544834 0.8508967 0.57455166 [66,] 0.32150725 0.6430145 0.67849275 [67,] 0.32212009 0.6442402 0.67787991 [68,] 0.21326357 0.4265271 0.78673643 [69,] 0.18742500 0.3748500 0.81257500 > postscript(file="/var/fisher/rcomp/tmp/1jafq1356105137.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/2or2x1356105137.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/36fhw1356105137.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/458e41356105137.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/5cdp01356105137.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 = 90 Frequency = 1 1 2 3 4 5 6 1.56552173 0.38825641 0.41953407 0.39298779 0.31460211 2.62154776 7 8 9 10 11 12 -1.47850856 -1.78999294 -0.19023378 1.80297142 -2.57501154 -1.51008576 13 14 15 16 17 18 3.01614431 -4.04191883 -0.83289648 0.24129007 -1.92362106 -1.09532858 19 20 21 22 23 24 0.53329542 -4.15788830 1.81255637 0.45693630 0.50760997 1.52697598 25 26 27 28 29 30 1.09185000 0.74548571 -4.21341682 -0.13811386 0.60357560 4.43569989 31 32 33 34 35 36 3.78522717 -1.48199656 0.16511113 0.04426769 -2.00778772 2.60840695 37 38 39 40 41 42 -1.22732773 0.37443978 0.67226885 1.48906604 0.76099087 5.96940219 43 44 45 46 47 48 -4.83905000 -3.39030031 0.37512773 2.21785542 3.69668753 0.44431614 49 50 51 52 53 54 -1.66686048 -0.56623829 -0.40314586 -6.33199160 -0.64059736 -3.44156723 55 56 57 58 59 60 2.11672171 -0.10069089 0.03304863 2.09103767 -2.28617810 -0.08269772 61 62 63 64 65 66 -2.93655482 2.24214823 0.76764297 2.79042441 -1.46467140 2.15272733 67 68 69 70 71 72 -1.92699196 1.41124098 2.55531945 -1.25615701 2.61143096 0.47959619 73 74 75 76 77 78 -1.56318781 -3.08358272 -0.42070072 -0.52973761 1.05760525 -0.44409072 79 80 81 82 83 84 2.77871653 -2.43691025 -3.02702962 1.17542179 -0.17109025 -1.16743433 85 86 87 88 89 90 3.89062653 0.46987153 -0.13569814 -0.69948509 0.92791411 -0.95473387 > postscript(file="/var/fisher/rcomp/tmp/6c65y1356105137.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 = 90 Frequency = 1 lag(myerror, k = 1) myerror 0 1.56552173 NA 1 0.38825641 1.56552173 2 0.41953407 0.38825641 3 0.39298779 0.41953407 4 0.31460211 0.39298779 5 2.62154776 0.31460211 6 -1.47850856 2.62154776 7 -1.78999294 -1.47850856 8 -0.19023378 -1.78999294 9 1.80297142 -0.19023378 10 -2.57501154 1.80297142 11 -1.51008576 -2.57501154 12 3.01614431 -1.51008576 13 -4.04191883 3.01614431 14 -0.83289648 -4.04191883 15 0.24129007 -0.83289648 16 -1.92362106 0.24129007 17 -1.09532858 -1.92362106 18 0.53329542 -1.09532858 19 -4.15788830 0.53329542 20 1.81255637 -4.15788830 21 0.45693630 1.81255637 22 0.50760997 0.45693630 23 1.52697598 0.50760997 24 1.09185000 1.52697598 25 0.74548571 1.09185000 26 -4.21341682 0.74548571 27 -0.13811386 -4.21341682 28 0.60357560 -0.13811386 29 4.43569989 0.60357560 30 3.78522717 4.43569989 31 -1.48199656 3.78522717 32 0.16511113 -1.48199656 33 0.04426769 0.16511113 34 -2.00778772 0.04426769 35 2.60840695 -2.00778772 36 -1.22732773 2.60840695 37 0.37443978 -1.22732773 38 0.67226885 0.37443978 39 1.48906604 0.67226885 40 0.76099087 1.48906604 41 5.96940219 0.76099087 42 -4.83905000 5.96940219 43 -3.39030031 -4.83905000 44 0.37512773 -3.39030031 45 2.21785542 0.37512773 46 3.69668753 2.21785542 47 0.44431614 3.69668753 48 -1.66686048 0.44431614 49 -0.56623829 -1.66686048 50 -0.40314586 -0.56623829 51 -6.33199160 -0.40314586 52 -0.64059736 -6.33199160 53 -3.44156723 -0.64059736 54 2.11672171 -3.44156723 55 -0.10069089 2.11672171 56 0.03304863 -0.10069089 57 2.09103767 0.03304863 58 -2.28617810 2.09103767 59 -0.08269772 -2.28617810 60 -2.93655482 -0.08269772 61 2.24214823 -2.93655482 62 0.76764297 2.24214823 63 2.79042441 0.76764297 64 -1.46467140 2.79042441 65 2.15272733 -1.46467140 66 -1.92699196 2.15272733 67 1.41124098 -1.92699196 68 2.55531945 1.41124098 69 -1.25615701 2.55531945 70 2.61143096 -1.25615701 71 0.47959619 2.61143096 72 -1.56318781 0.47959619 73 -3.08358272 -1.56318781 74 -0.42070072 -3.08358272 75 -0.52973761 -0.42070072 76 1.05760525 -0.52973761 77 -0.44409072 1.05760525 78 2.77871653 -0.44409072 79 -2.43691025 2.77871653 80 -3.02702962 -2.43691025 81 1.17542179 -3.02702962 82 -0.17109025 1.17542179 83 -1.16743433 -0.17109025 84 3.89062653 -1.16743433 85 0.46987153 3.89062653 86 -0.13569814 0.46987153 87 -0.69948509 -0.13569814 88 0.92791411 -0.69948509 89 -0.95473387 0.92791411 90 NA -0.95473387 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] 0.38825641 1.56552173 [2,] 0.41953407 0.38825641 [3,] 0.39298779 0.41953407 [4,] 0.31460211 0.39298779 [5,] 2.62154776 0.31460211 [6,] -1.47850856 2.62154776 [7,] -1.78999294 -1.47850856 [8,] -0.19023378 -1.78999294 [9,] 1.80297142 -0.19023378 [10,] -2.57501154 1.80297142 [11,] -1.51008576 -2.57501154 [12,] 3.01614431 -1.51008576 [13,] -4.04191883 3.01614431 [14,] -0.83289648 -4.04191883 [15,] 0.24129007 -0.83289648 [16,] -1.92362106 0.24129007 [17,] -1.09532858 -1.92362106 [18,] 0.53329542 -1.09532858 [19,] -4.15788830 0.53329542 [20,] 1.81255637 -4.15788830 [21,] 0.45693630 1.81255637 [22,] 0.50760997 0.45693630 [23,] 1.52697598 0.50760997 [24,] 1.09185000 1.52697598 [25,] 0.74548571 1.09185000 [26,] -4.21341682 0.74548571 [27,] -0.13811386 -4.21341682 [28,] 0.60357560 -0.13811386 [29,] 4.43569989 0.60357560 [30,] 3.78522717 4.43569989 [31,] -1.48199656 3.78522717 [32,] 0.16511113 -1.48199656 [33,] 0.04426769 0.16511113 [34,] -2.00778772 0.04426769 [35,] 2.60840695 -2.00778772 [36,] -1.22732773 2.60840695 [37,] 0.37443978 -1.22732773 [38,] 0.67226885 0.37443978 [39,] 1.48906604 0.67226885 [40,] 0.76099087 1.48906604 [41,] 5.96940219 0.76099087 [42,] -4.83905000 5.96940219 [43,] -3.39030031 -4.83905000 [44,] 0.37512773 -3.39030031 [45,] 2.21785542 0.37512773 [46,] 3.69668753 2.21785542 [47,] 0.44431614 3.69668753 [48,] -1.66686048 0.44431614 [49,] -0.56623829 -1.66686048 [50,] -0.40314586 -0.56623829 [51,] -6.33199160 -0.40314586 [52,] -0.64059736 -6.33199160 [53,] -3.44156723 -0.64059736 [54,] 2.11672171 -3.44156723 [55,] -0.10069089 2.11672171 [56,] 0.03304863 -0.10069089 [57,] 2.09103767 0.03304863 [58,] -2.28617810 2.09103767 [59,] -0.08269772 -2.28617810 [60,] -2.93655482 -0.08269772 [61,] 2.24214823 -2.93655482 [62,] 0.76764297 2.24214823 [63,] 2.79042441 0.76764297 [64,] -1.46467140 2.79042441 [65,] 2.15272733 -1.46467140 [66,] -1.92699196 2.15272733 [67,] 1.41124098 -1.92699196 [68,] 2.55531945 1.41124098 [69,] -1.25615701 2.55531945 [70,] 2.61143096 -1.25615701 [71,] 0.47959619 2.61143096 [72,] -1.56318781 0.47959619 [73,] -3.08358272 -1.56318781 [74,] -0.42070072 -3.08358272 [75,] -0.52973761 -0.42070072 [76,] 1.05760525 -0.52973761 [77,] -0.44409072 1.05760525 [78,] 2.77871653 -0.44409072 [79,] -2.43691025 2.77871653 [80,] -3.02702962 -2.43691025 [81,] 1.17542179 -3.02702962 [82,] -0.17109025 1.17542179 [83,] -1.16743433 -0.17109025 [84,] 3.89062653 -1.16743433 [85,] 0.46987153 3.89062653 [86,] -0.13569814 0.46987153 [87,] -0.69948509 -0.13569814 [88,] 0.92791411 -0.69948509 [89,] -0.95473387 0.92791411 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 0.38825641 1.56552173 2 0.41953407 0.38825641 3 0.39298779 0.41953407 4 0.31460211 0.39298779 5 2.62154776 0.31460211 6 -1.47850856 2.62154776 7 -1.78999294 -1.47850856 8 -0.19023378 -1.78999294 9 1.80297142 -0.19023378 10 -2.57501154 1.80297142 11 -1.51008576 -2.57501154 12 3.01614431 -1.51008576 13 -4.04191883 3.01614431 14 -0.83289648 -4.04191883 15 0.24129007 -0.83289648 16 -1.92362106 0.24129007 17 -1.09532858 -1.92362106 18 0.53329542 -1.09532858 19 -4.15788830 0.53329542 20 1.81255637 -4.15788830 21 0.45693630 1.81255637 22 0.50760997 0.45693630 23 1.52697598 0.50760997 24 1.09185000 1.52697598 25 0.74548571 1.09185000 26 -4.21341682 0.74548571 27 -0.13811386 -4.21341682 28 0.60357560 -0.13811386 29 4.43569989 0.60357560 30 3.78522717 4.43569989 31 -1.48199656 3.78522717 32 0.16511113 -1.48199656 33 0.04426769 0.16511113 34 -2.00778772 0.04426769 35 2.60840695 -2.00778772 36 -1.22732773 2.60840695 37 0.37443978 -1.22732773 38 0.67226885 0.37443978 39 1.48906604 0.67226885 40 0.76099087 1.48906604 41 5.96940219 0.76099087 42 -4.83905000 5.96940219 43 -3.39030031 -4.83905000 44 0.37512773 -3.39030031 45 2.21785542 0.37512773 46 3.69668753 2.21785542 47 0.44431614 3.69668753 48 -1.66686048 0.44431614 49 -0.56623829 -1.66686048 50 -0.40314586 -0.56623829 51 -6.33199160 -0.40314586 52 -0.64059736 -6.33199160 53 -3.44156723 -0.64059736 54 2.11672171 -3.44156723 55 -0.10069089 2.11672171 56 0.03304863 -0.10069089 57 2.09103767 0.03304863 58 -2.28617810 2.09103767 59 -0.08269772 -2.28617810 60 -2.93655482 -0.08269772 61 2.24214823 -2.93655482 62 0.76764297 2.24214823 63 2.79042441 0.76764297 64 -1.46467140 2.79042441 65 2.15272733 -1.46467140 66 -1.92699196 2.15272733 67 1.41124098 -1.92699196 68 2.55531945 1.41124098 69 -1.25615701 2.55531945 70 2.61143096 -1.25615701 71 0.47959619 2.61143096 72 -1.56318781 0.47959619 73 -3.08358272 -1.56318781 74 -0.42070072 -3.08358272 75 -0.52973761 -0.42070072 76 1.05760525 -0.52973761 77 -0.44409072 1.05760525 78 2.77871653 -0.44409072 79 -2.43691025 2.77871653 80 -3.02702962 -2.43691025 81 1.17542179 -3.02702962 82 -0.17109025 1.17542179 83 -1.16743433 -0.17109025 84 3.89062653 -1.16743433 85 0.46987153 3.89062653 86 -0.13569814 0.46987153 87 -0.69948509 -0.13569814 88 0.92791411 -0.69948509 89 -0.95473387 0.92791411 > 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/7f37l1356105137.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/88yq01356105137.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/9ev0k1356105137.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/10z3jo1356105137.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/11qws41356105137.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/12pm3v1356105137.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/131hwg1356105137.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/14n0we1356105137.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/15fsqx1356105137.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/16bj811356105137.tab") + } > > try(system("convert tmp/1jafq1356105137.ps tmp/1jafq1356105137.png",intern=TRUE)) character(0) > try(system("convert tmp/2or2x1356105137.ps tmp/2or2x1356105137.png",intern=TRUE)) character(0) > try(system("convert tmp/36fhw1356105137.ps tmp/36fhw1356105137.png",intern=TRUE)) character(0) > try(system("convert tmp/458e41356105137.ps tmp/458e41356105137.png",intern=TRUE)) character(0) > try(system("convert tmp/5cdp01356105137.ps tmp/5cdp01356105137.png",intern=TRUE)) character(0) > try(system("convert tmp/6c65y1356105137.ps tmp/6c65y1356105137.png",intern=TRUE)) character(0) > try(system("convert tmp/7f37l1356105137.ps tmp/7f37l1356105137.png",intern=TRUE)) character(0) > try(system("convert tmp/88yq01356105137.ps tmp/88yq01356105137.png",intern=TRUE)) character(0) > try(system("convert tmp/9ev0k1356105137.ps tmp/9ev0k1356105137.png",intern=TRUE)) character(0) > try(system("convert tmp/10z3jo1356105137.ps tmp/10z3jo1356105137.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 7.106 1.853 8.976