R version 2.12.0 (2010-10-15) Copyright (C) 2010 The R Foundation for Statistical Computing ISBN 3-900051-07-0 Platform: i486-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(31514 + ,-9 + ,0 + ,8.3 + ,1.2 + ,27071 + ,-13 + ,4 + ,8.2 + ,1.7 + ,29462 + ,-18 + ,5 + ,8 + ,1.8 + ,26105 + ,-11 + ,-7 + ,7.9 + ,1.5 + ,22397 + ,-9 + ,-2 + ,7.6 + ,1 + ,23843 + ,-10 + ,1 + ,7.6 + ,1.6 + ,21705 + ,-13 + ,3 + ,8.3 + ,1.5 + ,18089 + ,-11 + ,-2 + ,8.4 + ,1.8 + ,20764 + ,-5 + ,-6 + ,8.4 + ,1.8 + ,25316 + ,-15 + ,10 + ,8.4 + ,1.6 + ,17704 + ,-6 + ,-9 + ,8.4 + ,1.9 + ,15548 + ,-6 + ,0 + ,8.6 + ,1.7 + ,28029 + ,-3 + ,-3 + ,8.9 + ,1.6 + ,29383 + ,-1 + ,-2 + ,8.8 + ,1.3 + ,36438 + ,-3 + ,2 + ,8.3 + ,1.1 + ,32034 + ,-4 + ,1 + ,7.5 + ,1.9 + ,22679 + ,-6 + ,2 + ,7.2 + ,2.6 + ,24319 + ,0 + ,-6 + ,7.4 + ,2.3 + ,18004 + ,-4 + ,4 + ,8.8 + ,2.4 + ,17537 + ,-2 + ,-2 + ,9.3 + ,2.2 + ,20366 + ,-2 + ,0 + ,9.3 + ,2 + ,22782 + ,-6 + ,4 + ,8.7 + ,2.9 + ,19169 + ,-7 + ,1 + ,8.2 + ,2.6 + ,13807 + ,-6 + ,-1 + ,8.3 + ,2.3 + ,29743 + ,-6 + ,0 + ,8.5 + ,2.3 + ,25591 + ,-3 + ,-3 + ,8.6 + ,2.6 + ,29096 + ,-2 + ,-1 + ,8.5 + ,3.1 + ,26482 + ,-5 + ,3 + ,8.2 + ,2.8 + ,22405 + ,-11 + ,6 + ,8.1 + ,2.5 + ,27044 + ,-11 + ,0 + ,7.9 + ,2.9 + ,17970 + ,-11 + ,0 + ,8.6 + ,3.1 + ,18730 + ,-10 + ,-1 + ,8.7 + ,3.1 + ,19684 + ,-14 + ,4 + ,8.7 + ,3.2 + ,19785 + ,-8 + ,-6 + ,8.5 + ,2.5 + ,18479 + ,-9 + ,1 + ,8.4 + ,2.6 + ,10698 + ,-5 + ,-4 + ,8.5 + ,2.9 + ,31956 + ,-1 + ,-4 + ,8.7 + ,2.6 + ,29506 + ,-2 + ,1 + ,8.7 + ,2.4 + ,34506 + ,-5 + ,3 + ,8.6 + ,1.7 + ,27165 + ,-4 + ,-1 + ,8.5 + ,2 + ,26736 + ,-6 + ,2 + ,8.3 + ,2.2 + ,23691 + ,-2 + ,-4 + ,8 + ,1.9 + ,18157 + ,-2 + ,0 + ,8.2 + ,1.6 + ,17328 + ,-2 + ,0 + ,8.1 + ,1.6 + ,18205 + ,-2 + ,0 + ,8.1 + ,1.2 + ,20995 + ,2 + ,-4 + ,8 + ,1.2 + ,17382 + ,1 + ,1 + ,7.9 + ,1.5 + ,9367 + ,-8 + ,9 + ,7.9 + ,1.6 + ,31124 + ,-1 + ,-7 + ,8 + ,1.7 + ,26551 + ,1 + ,-2 + ,8 + ,1.8 + ,30651 + ,-1 + ,2 + ,7.9 + ,1.8 + ,25859 + ,2 + ,-3 + ,8 + ,1.8 + ,25100 + ,2 + ,0 + ,7.7 + ,1.3 + ,25778 + ,1 + ,1 + ,7.2 + ,1.3 + ,20418 + ,-1 + ,2 + ,7.5 + ,1.4 + ,18688 + ,-2 + ,1 + ,7.3 + ,1.1 + ,20424 + ,-2 + ,0 + ,7 + ,1.5 + ,24776 + ,-1 + ,-1 + ,7 + ,2.2 + ,19814 + ,-8 + ,7 + ,7 + ,2.9 + ,12738 + ,-4 + ,-4 + ,7.2 + ,3.1 + ,31566 + ,-6 + ,2 + ,7.3 + ,3.5 + ,30111 + ,-3 + ,-3 + ,7.1 + ,3.6 + ,30019 + ,-3 + ,0 + ,6.8 + ,4.4 + ,31934 + ,-7 + ,4 + ,6.4 + ,4.2 + ,25826 + ,-9 + ,2 + ,6.1 + ,5.2 + ,26835 + ,-11 + ,2 + ,6.5 + ,5.8 + ,20205 + ,-13 + ,2 + ,7.7 + ,5.9 + ,17789 + ,-11 + ,-2 + ,7.9 + ,5.4 + ,20520 + ,-9 + ,-2 + ,7.5 + ,5.5 + ,22518 + ,-17 + ,8 + ,6.9 + ,4.7 + ,15572 + ,-22 + ,5 + ,6.6 + ,3.1 + ,11509 + ,-25 + ,3 + ,6.9 + ,2.6 + ,25447 + ,-20 + ,-5 + ,7.7 + ,2.3 + ,24090 + ,-24 + ,4 + ,8 + ,1.9 + ,27786 + ,-24 + ,0 + ,8 + ,0.6 + ,26195 + ,-22 + ,-2 + ,7.7 + ,0.6 + ,20516 + ,-19 + ,-3 + ,7.3 + ,-0.4 + ,22759 + ,-18 + ,-1 + ,7.4 + ,-1.1 + ,19028 + ,-17 + ,-1 + ,8.1 + ,-1.7 + ,16971 + ,-11 + ,-6 + ,8.3 + ,-0.8 + ,20036 + ,-11 + ,0 + ,8.1 + ,-1.2 + ,22485 + ,-12 + ,1 + ,7.9 + ,-1 + ,18730 + ,-10 + ,-2 + ,7.9 + ,-0.1 + ,14538 + ,-15 + ,5 + ,8.3 + ,0.3) + ,dim=c(5 + ,84) + ,dimnames=list(c('Inschrijvingen' + ,'Consumentenvertrouwen' + ,'Evolutie_consumentenvertrouwen' + ,'Totaal_Werkloosheid' + ,'Algemene_index') + ,1:84)) > y <- array(NA,dim=c(5,84),dimnames=list(c('Inschrijvingen','Consumentenvertrouwen','Evolutie_consumentenvertrouwen','Totaal_Werkloosheid','Algemene_index'),1:84)) > 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 = 'Include Monthly Dummies' > par1 = '1' > #'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 > 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 Inschrijvingen Consumentenvertrouwen Evolutie_consumentenvertrouwen 1 31514 -9 0 2 27071 -13 4 3 29462 -18 5 4 26105 -11 -7 5 22397 -9 -2 6 23843 -10 1 7 21705 -13 3 8 18089 -11 -2 9 20764 -5 -6 10 25316 -15 10 11 17704 -6 -9 12 15548 -6 0 13 28029 -3 -3 14 29383 -1 -2 15 36438 -3 2 16 32034 -4 1 17 22679 -6 2 18 24319 0 -6 19 18004 -4 4 20 17537 -2 -2 21 20366 -2 0 22 22782 -6 4 23 19169 -7 1 24 13807 -6 -1 25 29743 -6 0 26 25591 -3 -3 27 29096 -2 -1 28 26482 -5 3 29 22405 -11 6 30 27044 -11 0 31 17970 -11 0 32 18730 -10 -1 33 19684 -14 4 34 19785 -8 -6 35 18479 -9 1 36 10698 -5 -4 37 31956 -1 -4 38 29506 -2 1 39 34506 -5 3 40 27165 -4 -1 41 26736 -6 2 42 23691 -2 -4 43 18157 -2 0 44 17328 -2 0 45 18205 -2 0 46 20995 2 -4 47 17382 1 1 48 9367 -8 9 49 31124 -1 -7 50 26551 1 -2 51 30651 -1 2 52 25859 2 -3 53 25100 2 0 54 25778 1 1 55 20418 -1 2 56 18688 -2 1 57 20424 -2 0 58 24776 -1 -1 59 19814 -8 7 60 12738 -4 -4 61 31566 -6 2 62 30111 -3 -3 63 30019 -3 0 64 31934 -7 4 65 25826 -9 2 66 26835 -11 2 67 20205 -13 2 68 17789 -11 -2 69 20520 -9 -2 70 22518 -17 8 71 15572 -22 5 72 11509 -25 3 73 25447 -20 -5 74 24090 -24 4 75 27786 -24 0 76 26195 -22 -2 77 20516 -19 -3 78 22759 -18 -1 79 19028 -17 -1 80 16971 -11 -6 81 20036 -11 0 82 22485 -12 1 83 18730 -10 -2 84 14538 -15 5 Totaal_Werkloosheid Algemene_index M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 1 8.3 1.2 1 0 0 0 0 0 0 0 0 0 0 2 8.2 1.7 0 1 0 0 0 0 0 0 0 0 0 3 8.0 1.8 0 0 1 0 0 0 0 0 0 0 0 4 7.9 1.5 0 0 0 1 0 0 0 0 0 0 0 5 7.6 1.0 0 0 0 0 1 0 0 0 0 0 0 6 7.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9 4.7 0 0 0 0 0 0 0 0 0 1 0 71 6.6 3.1 0 0 0 0 0 0 0 0 0 0 1 72 6.9 2.6 0 0 0 0 0 0 0 0 0 0 0 73 7.7 2.3 1 0 0 0 0 0 0 0 0 0 0 74 8.0 1.9 0 1 0 0 0 0 0 0 0 0 0 75 8.0 0.6 0 0 1 0 0 0 0 0 0 0 0 76 7.7 0.6 0 0 0 1 0 0 0 0 0 0 0 77 7.3 -0.4 0 0 0 0 1 0 0 0 0 0 0 78 7.4 -1.1 0 0 0 0 0 1 0 0 0 0 0 79 8.1 -1.7 0 0 0 0 0 0 1 0 0 0 0 80 8.3 -0.8 0 0 0 0 0 0 0 1 0 0 0 81 8.1 -1.2 0 0 0 0 0 0 0 0 1 0 0 82 7.9 -1.0 0 0 0 0 0 0 0 0 0 1 0 83 7.9 -0.1 0 0 0 0 0 0 0 0 0 0 1 84 8.3 0.3 0 0 0 0 0 0 0 0 0 0 0 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) Consumentenvertrouwen 15316.89 114.50 Evolutie_consumentenvertrouwen Totaal_Werkloosheid 165.69 -244.27 Algemene_index M1 80.52 17577.39 M2 M3 14741.72 18266.44 M4 M5 15324.49 10791.10 M6 M7 12224.07 6632.16 M8 M9 5502.96 7345.22 M10 M11 9767.73 5439.17 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -4724.2 -1376.6 -99.5 1310.3 4805.6 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 15316.89 3262.83 4.694 1.34e-05 *** Consumentenvertrouwen 114.50 33.61 3.407 0.00111 ** Evolutie_consumentenvertrouwen 165.69 64.83 2.556 0.01283 * Totaal_Werkloosheid -244.27 375.12 -0.651 0.51714 Algemene_index 80.52 152.77 0.527 0.59986 M1 17577.39 1032.41 17.026 < 2e-16 *** M2 14741.72 1014.78 14.527 < 2e-16 *** M3 18266.44 1007.97 18.122 < 2e-16 *** M4 15324.49 1018.30 15.049 < 2e-16 *** M5 10791.10 1024.90 10.529 6.37e-16 *** M6 12224.07 1039.11 11.764 < 2e-16 *** M7 6632.16 1008.91 6.574 8.25e-09 *** M8 5502.96 1025.57 5.366 1.05e-06 *** M9 7345.22 1014.88 7.238 5.29e-10 *** M10 9767.73 1008.58 9.685 1.99e-14 *** M11 5439.17 1009.30 5.389 9.58e-07 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 1881 on 68 degrees of freedom Multiple R-squared: 0.9111, Adjusted R-squared: 0.8914 F-statistic: 46.43 on 15 and 68 DF, p-value: < 2.2e-16 > 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.163851061 0.327702121 0.836148939 [2,] 0.193343765 0.386687530 0.806656235 [3,] 0.128648286 0.257296573 0.871351714 [4,] 0.092753383 0.185506766 0.907246617 [5,] 0.047505001 0.095010002 0.952494999 [6,] 0.027363003 0.054726006 0.972636997 [7,] 0.033432314 0.066864627 0.966567686 [8,] 0.019486987 0.038973975 0.980513013 [9,] 0.010284170 0.020568340 0.989715830 [10,] 0.005357645 0.010715290 0.994642355 [11,] 0.052912347 0.105824695 0.947087653 [12,] 0.596251450 0.807497101 0.403748550 [13,] 0.547805839 0.904388323 0.452194161 [14,] 0.550665286 0.898669428 0.449334714 [15,] 0.467721879 0.935443758 0.532278121 [16,] 0.404841254 0.809682507 0.595158746 [17,] 0.331727806 0.663455613 0.668272194 [18,] 0.294705279 0.589410559 0.705294721 [19,] 0.381562246 0.763124492 0.618437754 [20,] 0.372721943 0.745443887 0.627278057 [21,] 0.529229668 0.941540664 0.470770332 [22,] 0.453218427 0.906436853 0.546781573 [23,] 0.706007248 0.587985505 0.293992752 [24,] 0.659064342 0.681871316 0.340935658 [25,] 0.672032064 0.655935872 0.327967936 [26,] 0.663915199 0.672169602 0.336084801 [27,] 0.701101444 0.597797112 0.298898556 [28,] 0.692621376 0.614757247 0.307378624 [29,] 0.676133637 0.647732727 0.323866363 [30,] 0.911294018 0.177411964 0.088705982 [31,] 0.909190602 0.181618795 0.090809398 [32,] 0.891246093 0.217507814 0.108753907 [33,] 0.849401053 0.301197894 0.150598947 [34,] 0.966983985 0.066032029 0.033016015 [35,] 0.958121369 0.083757263 0.041878631 [36,] 0.963534516 0.072930968 0.036465484 [37,] 0.971091914 0.057816172 0.028908086 [38,] 0.960747780 0.078504440 0.039252220 [39,] 0.956014051 0.087971898 0.043985949 [40,] 0.936313954 0.127372092 0.063686046 [41,] 0.904141430 0.191717141 0.095858570 [42,] 0.937536002 0.124927995 0.062463998 [43,] 0.901226127 0.197547745 0.098773873 [44,] 0.897539463 0.204921075 0.102460537 [45,] 0.995806151 0.008387697 0.004193849 [46,] 0.997221925 0.005556149 0.002778075 [47,] 0.989120005 0.021759990 0.010879995 > postscript(file="/var/www/rcomp/tmp/1u2wl1292677520.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/www/rcomp/tmp/2ntdo1292677520.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/www/rcomp/tmp/3ntdo1292677520.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/www/rcomp/tmp/4ntdo1292677520.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/www/rcomp/tmp/5glur1292677520.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 = 84 Frequency = 1 1 2 3 4 5 6 1581.03721 -295.75365 -1079.56656 -308.06592 -573.17288 -991.03416 7 8 9 10 11 12 2654.02704 766.97073 1575.47876 2214.97711 1025.05550 2881.93734 13 14 15 16 17 18 -1979.53936 1815.15835 4805.63268 3363.95006 -1523.99722 -605.41125 19 20 21 22 23 24 -2193.52022 -627.91455 43.54307 -386.77150 842.39528 1185.03872 25 26 27 28 29 30 -573.18855 -1735.67457 -2265.97524 -2306.41877 -1660.37229 2458.76467 31 32 33 34 35 36 -868.44756 1096.37695 -170.39721 -1514.46882 430.25263 -1540.83938 37 38 39 40 41 42 1754.77638 1442.57698 2961.90960 -937.44594 2833.90541 -1157.02719 43 44 45 46 47 48 -1688.88997 -1413.11138 -2346.16074 -1798.33292 -1845.32697 -4724.24322 49 50 51 52 53 54 1321.34151 -1481.52007 -1364.44305 -2705.09822 539.18744 -389.10600 55 56 57 58 59 60 -28.66356 -373.95901 -420.01123 1504.30109 290.45372 51.00684 61 62 63 64 65 66 528.67630 2337.40308 -1914.09991 2656.47964 1488.45910 1342.88984 67 68 69 70 71 72 818.86729 54.96038 608.93956 -638.64734 -2130.94166 33.66725 73 74 75 76 77 78 -2633.10348 -2082.19011 -1143.45752 236.59916 -1104.00956 -659.07591 79 80 81 82 83 84 1306.62696 496.67688 708.60778 618.94239 1388.11150 2113.43246 > postscript(file="/var/www/rcomp/tmp/6glur1292677520.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 = 84 Frequency = 1 lag(myerror, k = 1) myerror 0 1581.03721 NA 1 -295.75365 1581.03721 2 -1079.56656 -295.75365 3 -308.06592 -1079.56656 4 -573.17288 -308.06592 5 -991.03416 -573.17288 6 2654.02704 -991.03416 7 766.97073 2654.02704 8 1575.47876 766.97073 9 2214.97711 1575.47876 10 1025.05550 2214.97711 11 2881.93734 1025.05550 12 -1979.53936 2881.93734 13 1815.15835 -1979.53936 14 4805.63268 1815.15835 15 3363.95006 4805.63268 16 -1523.99722 3363.95006 17 -605.41125 -1523.99722 18 -2193.52022 -605.41125 19 -627.91455 -2193.52022 20 43.54307 -627.91455 21 -386.77150 43.54307 22 842.39528 -386.77150 23 1185.03872 842.39528 24 -573.18855 1185.03872 25 -1735.67457 -573.18855 26 -2265.97524 -1735.67457 27 -2306.41877 -2265.97524 28 -1660.37229 -2306.41877 29 2458.76467 -1660.37229 30 -868.44756 2458.76467 31 1096.37695 -868.44756 32 -170.39721 1096.37695 33 -1514.46882 -170.39721 34 430.25263 -1514.46882 35 -1540.83938 430.25263 36 1754.77638 -1540.83938 37 1442.57698 1754.77638 38 2961.90960 1442.57698 39 -937.44594 2961.90960 40 2833.90541 -937.44594 41 -1157.02719 2833.90541 42 -1688.88997 -1157.02719 43 -1413.11138 -1688.88997 44 -2346.16074 -1413.11138 45 -1798.33292 -2346.16074 46 -1845.32697 -1798.33292 47 -4724.24322 -1845.32697 48 1321.34151 -4724.24322 49 -1481.52007 1321.34151 50 -1364.44305 -1481.52007 51 -2705.09822 -1364.44305 52 539.18744 -2705.09822 53 -389.10600 539.18744 54 -28.66356 -389.10600 55 -373.95901 -28.66356 56 -420.01123 -373.95901 57 1504.30109 -420.01123 58 290.45372 1504.30109 59 51.00684 290.45372 60 528.67630 51.00684 61 2337.40308 528.67630 62 -1914.09991 2337.40308 63 2656.47964 -1914.09991 64 1488.45910 2656.47964 65 1342.88984 1488.45910 66 818.86729 1342.88984 67 54.96038 818.86729 68 608.93956 54.96038 69 -638.64734 608.93956 70 -2130.94166 -638.64734 71 33.66725 -2130.94166 72 -2633.10348 33.66725 73 -2082.19011 -2633.10348 74 -1143.45752 -2082.19011 75 236.59916 -1143.45752 76 -1104.00956 236.59916 77 -659.07591 -1104.00956 78 1306.62696 -659.07591 79 496.67688 1306.62696 80 708.60778 496.67688 81 618.94239 708.60778 82 1388.11150 618.94239 83 2113.43246 1388.11150 84 NA 2113.43246 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -295.75365 1581.03721 [2,] -1079.56656 -295.75365 [3,] -308.06592 -1079.56656 [4,] -573.17288 -308.06592 [5,] -991.03416 -573.17288 [6,] 2654.02704 -991.03416 [7,] 766.97073 2654.02704 [8,] 1575.47876 766.97073 [9,] 2214.97711 1575.47876 [10,] 1025.05550 2214.97711 [11,] 2881.93734 1025.05550 [12,] -1979.53936 2881.93734 [13,] 1815.15835 -1979.53936 [14,] 4805.63268 1815.15835 [15,] 3363.95006 4805.63268 [16,] -1523.99722 3363.95006 [17,] -605.41125 -1523.99722 [18,] -2193.52022 -605.41125 [19,] -627.91455 -2193.52022 [20,] 43.54307 -627.91455 [21,] -386.77150 43.54307 [22,] 842.39528 -386.77150 [23,] 1185.03872 842.39528 [24,] -573.18855 1185.03872 [25,] -1735.67457 -573.18855 [26,] -2265.97524 -1735.67457 [27,] -2306.41877 -2265.97524 [28,] -1660.37229 -2306.41877 [29,] 2458.76467 -1660.37229 [30,] -868.44756 2458.76467 [31,] 1096.37695 -868.44756 [32,] -170.39721 1096.37695 [33,] -1514.46882 -170.39721 [34,] 430.25263 -1514.46882 [35,] -1540.83938 430.25263 [36,] 1754.77638 -1540.83938 [37,] 1442.57698 1754.77638 [38,] 2961.90960 1442.57698 [39,] -937.44594 2961.90960 [40,] 2833.90541 -937.44594 [41,] -1157.02719 2833.90541 [42,] -1688.88997 -1157.02719 [43,] -1413.11138 -1688.88997 [44,] -2346.16074 -1413.11138 [45,] -1798.33292 -2346.16074 [46,] -1845.32697 -1798.33292 [47,] -4724.24322 -1845.32697 [48,] 1321.34151 -4724.24322 [49,] -1481.52007 1321.34151 [50,] -1364.44305 -1481.52007 [51,] -2705.09822 -1364.44305 [52,] 539.18744 -2705.09822 [53,] -389.10600 539.18744 [54,] -28.66356 -389.10600 [55,] -373.95901 -28.66356 [56,] -420.01123 -373.95901 [57,] 1504.30109 -420.01123 [58,] 290.45372 1504.30109 [59,] 51.00684 290.45372 [60,] 528.67630 51.00684 [61,] 2337.40308 528.67630 [62,] -1914.09991 2337.40308 [63,] 2656.47964 -1914.09991 [64,] 1488.45910 2656.47964 [65,] 1342.88984 1488.45910 [66,] 818.86729 1342.88984 [67,] 54.96038 818.86729 [68,] 608.93956 54.96038 [69,] -638.64734 608.93956 [70,] -2130.94166 -638.64734 [71,] 33.66725 -2130.94166 [72,] -2633.10348 33.66725 [73,] -2082.19011 -2633.10348 [74,] -1143.45752 -2082.19011 [75,] 236.59916 -1143.45752 [76,] -1104.00956 236.59916 [77,] -659.07591 -1104.00956 [78,] 1306.62696 -659.07591 [79,] 496.67688 1306.62696 [80,] 708.60778 496.67688 [81,] 618.94239 708.60778 [82,] 1388.11150 618.94239 [83,] 2113.43246 1388.11150 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -295.75365 1581.03721 2 -1079.56656 -295.75365 3 -308.06592 -1079.56656 4 -573.17288 -308.06592 5 -991.03416 -573.17288 6 2654.02704 -991.03416 7 766.97073 2654.02704 8 1575.47876 766.97073 9 2214.97711 1575.47876 10 1025.05550 2214.97711 11 2881.93734 1025.05550 12 -1979.53936 2881.93734 13 1815.15835 -1979.53936 14 4805.63268 1815.15835 15 3363.95006 4805.63268 16 -1523.99722 3363.95006 17 -605.41125 -1523.99722 18 -2193.52022 -605.41125 19 -627.91455 -2193.52022 20 43.54307 -627.91455 21 -386.77150 43.54307 22 842.39528 -386.77150 23 1185.03872 842.39528 24 -573.18855 1185.03872 25 -1735.67457 -573.18855 26 -2265.97524 -1735.67457 27 -2306.41877 -2265.97524 28 -1660.37229 -2306.41877 29 2458.76467 -1660.37229 30 -868.44756 2458.76467 31 1096.37695 -868.44756 32 -170.39721 1096.37695 33 -1514.46882 -170.39721 34 430.25263 -1514.46882 35 -1540.83938 430.25263 36 1754.77638 -1540.83938 37 1442.57698 1754.77638 38 2961.90960 1442.57698 39 -937.44594 2961.90960 40 2833.90541 -937.44594 41 -1157.02719 2833.90541 42 -1688.88997 -1157.02719 43 -1413.11138 -1688.88997 44 -2346.16074 -1413.11138 45 -1798.33292 -2346.16074 46 -1845.32697 -1798.33292 47 -4724.24322 -1845.32697 48 1321.34151 -4724.24322 49 -1481.52007 1321.34151 50 -1364.44305 -1481.52007 51 -2705.09822 -1364.44305 52 539.18744 -2705.09822 53 -389.10600 539.18744 54 -28.66356 -389.10600 55 -373.95901 -28.66356 56 -420.01123 -373.95901 57 1504.30109 -420.01123 58 290.45372 1504.30109 59 51.00684 290.45372 60 528.67630 51.00684 61 2337.40308 528.67630 62 -1914.09991 2337.40308 63 2656.47964 -1914.09991 64 1488.45910 2656.47964 65 1342.88984 1488.45910 66 818.86729 1342.88984 67 54.96038 818.86729 68 608.93956 54.96038 69 -638.64734 608.93956 70 -2130.94166 -638.64734 71 33.66725 -2130.94166 72 -2633.10348 33.66725 73 -2082.19011 -2633.10348 74 -1143.45752 -2082.19011 75 236.59916 -1143.45752 76 -1104.00956 236.59916 77 -659.07591 -1104.00956 78 1306.62696 -659.07591 79 496.67688 1306.62696 80 708.60778 496.67688 81 618.94239 708.60778 82 1388.11150 618.94239 83 2113.43246 1388.11150 > 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/www/rcomp/tmp/7qcuc1292677520.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/www/rcomp/tmp/8qcuc1292677520.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/www/rcomp/tmp/9j3tf1292677520.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/www/rcomp/tmp/10j3tf1292677520.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/www/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/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/www/rcomp/tmp/1154931292677520.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/www/rcomp/tmp/1284q91292677520.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/www/rcomp/tmp/13mwn01292677520.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/www/rcomp/tmp/14ipoi1292677521.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/www/rcomp/tmp/15l7no1292677521.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/www/rcomp/tmp/16zz3x1292677521.tab") + } > > try(system("convert tmp/1u2wl1292677520.ps tmp/1u2wl1292677520.png",intern=TRUE)) character(0) > try(system("convert tmp/2ntdo1292677520.ps tmp/2ntdo1292677520.png",intern=TRUE)) character(0) > try(system("convert tmp/3ntdo1292677520.ps tmp/3ntdo1292677520.png",intern=TRUE)) character(0) > try(system("convert tmp/4ntdo1292677520.ps tmp/4ntdo1292677520.png",intern=TRUE)) character(0) > try(system("convert tmp/5glur1292677520.ps tmp/5glur1292677520.png",intern=TRUE)) character(0) > try(system("convert tmp/6glur1292677520.ps tmp/6glur1292677520.png",intern=TRUE)) character(0) > try(system("convert tmp/7qcuc1292677520.ps tmp/7qcuc1292677520.png",intern=TRUE)) character(0) > try(system("convert tmp/8qcuc1292677520.ps tmp/8qcuc1292677520.png",intern=TRUE)) character(0) > try(system("convert tmp/9j3tf1292677520.ps tmp/9j3tf1292677520.png",intern=TRUE)) character(0) > try(system("convert tmp/10j3tf1292677520.ps tmp/10j3tf1292677520.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 3.400 1.650 5.077