R version 2.9.0 (2009-04-17) Copyright (C) 2009 The R Foundation for Statistical Computing ISBN 3-900051-07-0 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 + ,27071 + ,-13 + ,4 + ,29462 + ,-18 + ,5 + ,26105 + ,-11 + ,-7 + ,22397 + ,-9 + ,-2 + ,23843 + ,-10 + ,1 + ,21705 + ,-13 + ,3 + ,18089 + ,-11 + ,-2 + ,20764 + ,-5 + ,-6 + ,25316 + ,-15 + ,10 + ,17704 + ,-6 + ,-9 + ,15548 + ,-6 + ,0 + ,28029 + ,-3 + ,-3 + ,29383 + ,-1 + ,-2 + ,36438 + ,-3 + ,2 + ,32034 + ,-4 + ,1 + ,22679 + ,-6 + ,2 + ,24319 + ,0 + ,-6 + ,18004 + ,-4 + ,4 + ,17537 + ,-2 + ,-2 + ,20366 + ,-2 + ,0 + ,22782 + ,-6 + ,4 + ,19169 + ,-7 + ,1 + ,13807 + ,-6 + ,-1 + ,29743 + ,-6 + ,0 + ,25591 + ,-3 + ,-3 + ,29096 + ,-2 + ,-1 + ,26482 + ,-5 + ,3 + ,22405 + ,-11 + ,6 + ,27044 + ,-11 + ,0 + ,17970 + ,-11 + ,0 + ,18730 + ,-10 + ,-1 + ,19684 + ,-14 + ,4 + ,19785 + ,-8 + ,-6 + ,18479 + ,-9 + ,1 + ,10698 + ,-5 + ,-4 + ,31956 + ,-1 + ,-4 + ,29506 + ,-2 + ,1 + ,34506 + ,-5 + ,3 + ,27165 + ,-4 + ,-1 + ,26736 + ,-6 + ,2 + ,23691 + ,-2 + ,-4 + ,18157 + ,-2 + ,0 + ,17328 + ,-2 + ,0 + ,18205 + ,-2 + ,0 + ,20995 + ,2 + ,-4 + ,17382 + ,1 + ,1 + ,9367 + ,-8 + ,9 + ,31124 + ,-1 + ,-7 + ,26551 + ,1 + ,-2 + ,30651 + ,-1 + ,2 + ,25859 + ,2 + ,-3 + ,25100 + ,2 + ,0 + ,25778 + ,1 + ,1 + ,20418 + ,-1 + ,2 + ,18688 + ,-2 + ,1 + ,20424 + ,-2 + ,0 + ,24776 + ,-1 + ,-1 + ,19814 + ,-8 + ,7 + ,12738 + ,-4 + ,-4 + ,31566 + ,-6 + ,2 + ,30111 + ,-3 + ,-3 + ,30019 + ,-3 + ,0 + ,31934 + ,-7 + ,4 + ,25826 + ,-9 + ,2 + ,26835 + ,-11 + ,2 + ,20205 + ,-13 + ,2 + ,17789 + ,-11 + ,-2 + ,20520 + ,-9 + ,-2 + ,22518 + ,-17 + ,8 + ,15572 + ,-22 + ,5 + ,11509 + ,-25 + ,3 + ,25447 + ,-20 + ,-5 + ,24090 + ,-24 + ,4 + ,27786 + ,-24 + ,0 + ,26195 + ,-22 + ,-2 + ,20516 + ,-19 + ,-3 + ,22759 + ,-18 + ,-1 + ,19028 + ,-17 + ,-1 + ,16971 + ,-11 + ,-6 + ,20036 + ,-11 + ,0 + ,22485 + ,-12 + ,1 + ,18730 + ,-10 + ,-2 + ,14538 + ,-15 + ,5) + ,dim=c(3 + ,84) + ,dimnames=list(c('Inschrijvingen' + ,'Consumentenvertrouwen' + ,'Evolutie_consumentenvertrouwen') + ,1:84)) > y <- array(NA,dim=c(3,84),dimnames=list(c('Inschrijvingen','Consumentenvertrouwen','Evolutie_consumentenvertrouwen'),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 Attaching package: 'zoo' The following object(s) are masked from package:base : 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 Inschrijvingen Consumentenvertrouwen Evolutie_consumentenvertrouwen M1 M2 M3 1 31514 -9 0 1 0 0 2 27071 -13 4 0 1 0 3 29462 -18 5 0 0 1 4 26105 -11 -7 0 0 0 5 22397 -9 -2 0 0 0 6 23843 -10 1 0 0 0 7 21705 -13 3 0 0 0 8 18089 -11 -2 0 0 0 9 20764 -5 -6 0 0 0 10 25316 -15 10 0 0 0 11 17704 -6 -9 0 0 0 12 15548 -6 0 0 0 0 13 28029 -3 -3 1 0 0 14 29383 -1 -2 0 1 0 15 36438 -3 2 0 0 1 16 32034 -4 1 0 0 0 17 22679 -6 2 0 0 0 18 24319 0 -6 0 0 0 19 18004 -4 4 0 0 0 20 17537 -2 -2 0 0 0 21 20366 -2 0 0 0 0 22 22782 -6 4 0 0 0 23 19169 -7 1 0 0 0 24 13807 -6 -1 0 0 0 25 29743 -6 0 1 0 0 26 25591 -3 -3 0 1 0 27 29096 -2 -1 0 0 1 28 26482 -5 3 0 0 0 29 22405 -11 6 0 0 0 30 27044 -11 0 0 0 0 31 17970 -11 0 0 0 0 32 18730 -10 -1 0 0 0 33 19684 -14 4 0 0 0 34 19785 -8 -6 0 0 0 35 18479 -9 1 0 0 0 36 10698 -5 -4 0 0 0 37 31956 -1 -4 1 0 0 38 29506 -2 1 0 1 0 39 34506 -5 3 0 0 1 40 27165 -4 -1 0 0 0 41 26736 -6 2 0 0 0 42 23691 -2 -4 0 0 0 43 18157 -2 0 0 0 0 44 17328 -2 0 0 0 0 45 18205 -2 0 0 0 0 46 20995 2 -4 0 0 0 47 17382 1 1 0 0 0 48 9367 -8 9 0 0 0 49 31124 -1 -7 1 0 0 50 26551 1 -2 0 1 0 51 30651 -1 2 0 0 1 52 25859 2 -3 0 0 0 53 25100 2 0 0 0 0 54 25778 1 1 0 0 0 55 20418 -1 2 0 0 0 56 18688 -2 1 0 0 0 57 20424 -2 0 0 0 0 58 24776 -1 -1 0 0 0 59 19814 -8 7 0 0 0 60 12738 -4 -4 0 0 0 61 31566 -6 2 1 0 0 62 30111 -3 -3 0 1 0 63 30019 -3 0 0 0 1 64 31934 -7 4 0 0 0 65 25826 -9 2 0 0 0 66 26835 -11 2 0 0 0 67 20205 -13 2 0 0 0 68 17789 -11 -2 0 0 0 69 20520 -9 -2 0 0 0 70 22518 -17 8 0 0 0 71 15572 -22 5 0 0 0 72 11509 -25 3 0 0 0 73 25447 -20 -5 1 0 0 74 24090 -24 4 0 1 0 75 27786 -24 0 0 0 1 76 26195 -22 -2 0 0 0 77 20516 -19 -3 0 0 0 78 22759 -18 -1 0 0 0 79 19028 -17 -1 0 0 0 80 16971 -11 -6 0 0 0 81 20036 -11 0 0 0 0 82 22485 -12 1 0 0 0 83 18730 -10 -2 0 0 0 84 14538 -15 5 0 0 0 M4 M5 M6 M7 M8 M9 M10 M11 1 0 0 0 0 0 0 0 0 2 0 0 0 0 0 0 0 0 3 0 0 0 0 0 0 0 0 4 1 0 0 0 0 0 0 0 5 0 1 0 0 0 0 0 0 6 0 0 1 0 0 0 0 0 7 0 0 0 1 0 0 0 0 8 0 0 0 0 1 0 0 0 9 0 0 0 0 0 1 0 0 10 0 0 0 0 0 0 1 0 11 0 0 0 0 0 0 0 1 12 0 0 0 0 0 0 0 0 13 0 0 0 0 0 0 0 0 14 0 0 0 0 0 0 0 0 15 0 0 0 0 0 0 0 0 16 1 0 0 0 0 0 0 0 17 0 1 0 0 0 0 0 0 18 0 0 1 0 0 0 0 0 19 0 0 0 1 0 0 0 0 20 0 0 0 0 1 0 0 0 21 0 0 0 0 0 1 0 0 22 0 0 0 0 0 0 1 0 23 0 0 0 0 0 0 0 1 24 0 0 0 0 0 0 0 0 25 0 0 0 0 0 0 0 0 26 0 0 0 0 0 0 0 0 27 0 0 0 0 0 0 0 0 28 1 0 0 0 0 0 0 0 29 0 1 0 0 0 0 0 0 30 0 0 1 0 0 0 0 0 31 0 0 0 1 0 0 0 0 32 0 0 0 0 1 0 0 0 33 0 0 0 0 0 1 0 0 34 0 0 0 0 0 0 1 0 35 0 0 0 0 0 0 0 1 36 0 0 0 0 0 0 0 0 37 0 0 0 0 0 0 0 0 38 0 0 0 0 0 0 0 0 39 0 0 0 0 0 0 0 0 40 1 0 0 0 0 0 0 0 41 0 1 0 0 0 0 0 0 42 0 0 1 0 0 0 0 0 43 0 0 0 1 0 0 0 0 44 0 0 0 0 1 0 0 0 45 0 0 0 0 0 1 0 0 46 0 0 0 0 0 0 1 0 47 0 0 0 0 0 0 0 1 48 0 0 0 0 0 0 0 0 49 0 0 0 0 0 0 0 0 50 0 0 0 0 0 0 0 0 51 0 0 0 0 0 0 0 0 52 1 0 0 0 0 0 0 0 53 0 1 0 0 0 0 0 0 54 0 0 1 0 0 0 0 0 55 0 0 0 1 0 0 0 0 56 0 0 0 0 1 0 0 0 57 0 0 0 0 0 1 0 0 58 0 0 0 0 0 0 1 0 59 0 0 0 0 0 0 0 1 60 0 0 0 0 0 0 0 0 61 0 0 0 0 0 0 0 0 62 0 0 0 0 0 0 0 0 63 0 0 0 0 0 0 0 0 64 1 0 0 0 0 0 0 0 65 0 1 0 0 0 0 0 0 66 0 0 1 0 0 0 0 0 67 0 0 0 1 0 0 0 0 68 0 0 0 0 1 0 0 0 69 0 0 0 0 0 1 0 0 70 0 0 0 0 0 0 1 0 71 0 0 0 0 0 0 0 1 72 0 0 0 0 0 0 0 0 73 0 0 0 0 0 0 0 0 74 0 0 0 0 0 0 0 0 75 0 0 0 0 0 0 0 0 76 1 0 0 0 0 0 0 0 77 0 1 0 0 0 0 0 0 78 0 0 1 0 0 0 0 0 79 0 0 0 1 0 0 0 0 80 0 0 0 0 1 0 0 0 81 0 0 0 0 0 1 0 0 82 0 0 0 0 0 0 1 0 83 0 0 0 0 0 0 0 1 84 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 13517.2 113.7 Evolutie_consumentenvertrouwen M1 179.0 17576.0 M2 M3 14711.3 18248.2 M4 M5 15406.9 10911.7 M6 M7 12385.9 6573.5 M8 M9 5461.6 7316.0 M10 M11 9767.4 5493.0 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -4851.0 -1370.3 -210.8 1219.9 4655.8 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 13517.23 770.19 17.550 < 2e-16 *** Consumentenvertrouwen 113.73 32.43 3.506 0.000797 *** Evolutie_consumentenvertrouwen 178.95 62.77 2.851 0.005726 ** M1 17576.01 1022.26 17.193 < 2e-16 *** M2 14711.30 1005.10 14.637 < 2e-16 *** M3 18248.24 1000.68 18.236 < 2e-16 *** M4 15406.90 1005.74 15.319 < 2e-16 *** M5 10911.71 999.29 10.919 < 2e-16 *** M6 12385.88 1007.58 12.293 < 2e-16 *** M7 6573.47 999.10 6.579 7.23e-09 *** M8 5461.64 1013.92 5.387 9.11e-07 *** M9 7315.99 1006.83 7.266 4.07e-10 *** M10 9767.35 1000.79 9.760 1.09e-14 *** M11 5493.00 999.05 5.498 5.87e-07 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 1867 on 70 degrees of freedom Multiple R-squared: 0.9097, Adjusted R-squared: 0.893 F-statistic: 54.27 on 13 and 70 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.8348550 0.330290076 0.1651450382 [2,] 0.7248248 0.550350393 0.2751751965 [3,] 0.9604964 0.079007154 0.0395035772 [4,] 0.9477416 0.104516775 0.0522583875 [5,] 0.9263722 0.147255619 0.0736278093 [6,] 0.9148927 0.170214658 0.0851073288 [7,] 0.8719149 0.256170232 0.1280851161 [8,] 0.8371401 0.325719821 0.1628599105 [9,] 0.7759488 0.448102310 0.2240511551 [10,] 0.7651656 0.469668767 0.2348343834 [11,] 0.8207316 0.358536725 0.1792683627 [12,] 0.8757379 0.248524282 0.1242621411 [13,] 0.8598803 0.280239469 0.1401197347 [14,] 0.8740729 0.251854211 0.1259271056 [15,] 0.8367631 0.326473861 0.1632369305 [16,] 0.7940604 0.411879155 0.2059395774 [17,] 0.7457374 0.508525236 0.2542626178 [18,] 0.7130442 0.573911598 0.2869557991 [19,] 0.6517241 0.696551815 0.3482759075 [20,] 0.6578979 0.684204214 0.3421021069 [21,] 0.6475418 0.704916313 0.3524581564 [22,] 0.6053976 0.789204821 0.3946024103 [23,] 0.6790986 0.641802777 0.3209013885 [24,] 0.6308509 0.738298127 0.3691490637 [25,] 0.6938642 0.612271662 0.3061358310 [26,] 0.6519873 0.696025332 0.3480126662 [27,] 0.6356461 0.728707881 0.3643539404 [28,] 0.5982134 0.803573129 0.4017865646 [29,] 0.6296977 0.740604574 0.3703022872 [30,] 0.6285628 0.742874425 0.3714372127 [31,] 0.6282730 0.743453960 0.3717269800 [32,] 0.9254554 0.149089107 0.0745445536 [33,] 0.9170906 0.165818839 0.0829094197 [34,] 0.9101608 0.179678325 0.0898391625 [35,] 0.8822554 0.235489269 0.1177446344 [36,] 0.9787057 0.042588607 0.0212943036 [37,] 0.9718684 0.056263114 0.0281315572 [38,] 0.9739071 0.052185792 0.0260928959 [39,] 0.9819357 0.036128656 0.0180643281 [40,] 0.9816698 0.036660347 0.0183301737 [41,] 0.9834848 0.033030312 0.0165151558 [42,] 0.9733828 0.053234392 0.0266171958 [43,] 0.9571707 0.085658552 0.0428292760 [44,] 0.9778646 0.044270802 0.0221354010 [45,] 0.9618560 0.076287919 0.0381439593 [46,] 0.9600216 0.079956793 0.0399783966 [47,] 0.9992758 0.001448330 0.0007241648 [48,] 0.9985441 0.002911711 0.0014558554 [49,] 0.9963546 0.007290747 0.0036453734 [50,] 0.9982068 0.003586375 0.0017931875 [51,] 0.9922676 0.015464722 0.0077323608 > postscript(file="/var/www/html/rcomp/tmp/1d9j61292678252.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/html/rcomp/tmp/2d9j61292678252.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/html/rcomp/tmp/3d9j61292678252.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/html/rcomp/tmp/46i0r1292678252.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/html/rcomp/tmp/56i0r1292678252.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 1444.31419 -394.87196 -1151.12392 -315.45535 -650.48161 -1101.78412 7 8 9 10 11 12 2555.91099 719.04197 1573.12655 1947.82154 986.70482 2713.13605 13 14 15 16 17 18 -2186.19977 1626.10012 4655.80812 3385.83277 -1425.47344 -510.40381 19 20 21 22 23 24 -2347.59479 -856.51203 -239.76886 -536.02171 775.91514 1151.08784 25 26 27 28 29 30 -667.87047 -1759.49164 -2263.06473 -2410.34259 -1846.63949 2391.89589 31 32 33 34 35 36 -869.69008 1067.36196 -272.83736 -1516.04736 313.37158 -1534.78501 37 38 39 40 41 42 1692.29558 1325.97297 2772.31278 -1125.26365 2631.52656 -1268.85094 43 44 45 46 47 48 -1706.24407 -1423.41561 -2400.76886 -1801.23316 -1920.91063 -4850.97362 49 50 51 52 53 54 1397.15095 -1433.35632 -1358.64832 -2755.72939 443.60437 -417.79456 55 56 57 58 59 60 83.12412 -242.36740 -181.76886 1784.09613 460.93262 391.48677 61 62 63 64 65 66 797.22594 2760.50836 -1405.28829 3090.16207 2062.71122 1824.99231 67 68 69 70 71 72 1234.86278 419.04197 1068.23227 -264.81843 -1830.96870 298.11689 73 74 75 76 77 78 -2476.91642 -2124.86152 -1249.99564 130.79613 -1215.24761 -918.05477 79 80 81 82 83 84 1049.63104 316.84913 453.78513 386.20299 1214.95517 1831.93109 > postscript(file="/var/www/html/rcomp/tmp/66i0r1292678252.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 1444.31419 NA 1 -394.87196 1444.31419 2 -1151.12392 -394.87196 3 -315.45535 -1151.12392 4 -650.48161 -315.45535 5 -1101.78412 -650.48161 6 2555.91099 -1101.78412 7 719.04197 2555.91099 8 1573.12655 719.04197 9 1947.82154 1573.12655 10 986.70482 1947.82154 11 2713.13605 986.70482 12 -2186.19977 2713.13605 13 1626.10012 -2186.19977 14 4655.80812 1626.10012 15 3385.83277 4655.80812 16 -1425.47344 3385.83277 17 -510.40381 -1425.47344 18 -2347.59479 -510.40381 19 -856.51203 -2347.59479 20 -239.76886 -856.51203 21 -536.02171 -239.76886 22 775.91514 -536.02171 23 1151.08784 775.91514 24 -667.87047 1151.08784 25 -1759.49164 -667.87047 26 -2263.06473 -1759.49164 27 -2410.34259 -2263.06473 28 -1846.63949 -2410.34259 29 2391.89589 -1846.63949 30 -869.69008 2391.89589 31 1067.36196 -869.69008 32 -272.83736 1067.36196 33 -1516.04736 -272.83736 34 313.37158 -1516.04736 35 -1534.78501 313.37158 36 1692.29558 -1534.78501 37 1325.97297 1692.29558 38 2772.31278 1325.97297 39 -1125.26365 2772.31278 40 2631.52656 -1125.26365 41 -1268.85094 2631.52656 42 -1706.24407 -1268.85094 43 -1423.41561 -1706.24407 44 -2400.76886 -1423.41561 45 -1801.23316 -2400.76886 46 -1920.91063 -1801.23316 47 -4850.97362 -1920.91063 48 1397.15095 -4850.97362 49 -1433.35632 1397.15095 50 -1358.64832 -1433.35632 51 -2755.72939 -1358.64832 52 443.60437 -2755.72939 53 -417.79456 443.60437 54 83.12412 -417.79456 55 -242.36740 83.12412 56 -181.76886 -242.36740 57 1784.09613 -181.76886 58 460.93262 1784.09613 59 391.48677 460.93262 60 797.22594 391.48677 61 2760.50836 797.22594 62 -1405.28829 2760.50836 63 3090.16207 -1405.28829 64 2062.71122 3090.16207 65 1824.99231 2062.71122 66 1234.86278 1824.99231 67 419.04197 1234.86278 68 1068.23227 419.04197 69 -264.81843 1068.23227 70 -1830.96870 -264.81843 71 298.11689 -1830.96870 72 -2476.91642 298.11689 73 -2124.86152 -2476.91642 74 -1249.99564 -2124.86152 75 130.79613 -1249.99564 76 -1215.24761 130.79613 77 -918.05477 -1215.24761 78 1049.63104 -918.05477 79 316.84913 1049.63104 80 453.78513 316.84913 81 386.20299 453.78513 82 1214.95517 386.20299 83 1831.93109 1214.95517 84 NA 1831.93109 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -394.87196 1444.31419 [2,] -1151.12392 -394.87196 [3,] -315.45535 -1151.12392 [4,] -650.48161 -315.45535 [5,] -1101.78412 -650.48161 [6,] 2555.91099 -1101.78412 [7,] 719.04197 2555.91099 [8,] 1573.12655 719.04197 [9,] 1947.82154 1573.12655 [10,] 986.70482 1947.82154 [11,] 2713.13605 986.70482 [12,] -2186.19977 2713.13605 [13,] 1626.10012 -2186.19977 [14,] 4655.80812 1626.10012 [15,] 3385.83277 4655.80812 [16,] -1425.47344 3385.83277 [17,] -510.40381 -1425.47344 [18,] -2347.59479 -510.40381 [19,] -856.51203 -2347.59479 [20,] -239.76886 -856.51203 [21,] -536.02171 -239.76886 [22,] 775.91514 -536.02171 [23,] 1151.08784 775.91514 [24,] -667.87047 1151.08784 [25,] -1759.49164 -667.87047 [26,] -2263.06473 -1759.49164 [27,] -2410.34259 -2263.06473 [28,] -1846.63949 -2410.34259 [29,] 2391.89589 -1846.63949 [30,] -869.69008 2391.89589 [31,] 1067.36196 -869.69008 [32,] -272.83736 1067.36196 [33,] -1516.04736 -272.83736 [34,] 313.37158 -1516.04736 [35,] -1534.78501 313.37158 [36,] 1692.29558 -1534.78501 [37,] 1325.97297 1692.29558 [38,] 2772.31278 1325.97297 [39,] -1125.26365 2772.31278 [40,] 2631.52656 -1125.26365 [41,] -1268.85094 2631.52656 [42,] -1706.24407 -1268.85094 [43,] -1423.41561 -1706.24407 [44,] -2400.76886 -1423.41561 [45,] -1801.23316 -2400.76886 [46,] -1920.91063 -1801.23316 [47,] -4850.97362 -1920.91063 [48,] 1397.15095 -4850.97362 [49,] -1433.35632 1397.15095 [50,] -1358.64832 -1433.35632 [51,] -2755.72939 -1358.64832 [52,] 443.60437 -2755.72939 [53,] -417.79456 443.60437 [54,] 83.12412 -417.79456 [55,] -242.36740 83.12412 [56,] -181.76886 -242.36740 [57,] 1784.09613 -181.76886 [58,] 460.93262 1784.09613 [59,] 391.48677 460.93262 [60,] 797.22594 391.48677 [61,] 2760.50836 797.22594 [62,] -1405.28829 2760.50836 [63,] 3090.16207 -1405.28829 [64,] 2062.71122 3090.16207 [65,] 1824.99231 2062.71122 [66,] 1234.86278 1824.99231 [67,] 419.04197 1234.86278 [68,] 1068.23227 419.04197 [69,] -264.81843 1068.23227 [70,] -1830.96870 -264.81843 [71,] 298.11689 -1830.96870 [72,] -2476.91642 298.11689 [73,] -2124.86152 -2476.91642 [74,] -1249.99564 -2124.86152 [75,] 130.79613 -1249.99564 [76,] -1215.24761 130.79613 [77,] -918.05477 -1215.24761 [78,] 1049.63104 -918.05477 [79,] 316.84913 1049.63104 [80,] 453.78513 316.84913 [81,] 386.20299 453.78513 [82,] 1214.95517 386.20299 [83,] 1831.93109 1214.95517 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -394.87196 1444.31419 2 -1151.12392 -394.87196 3 -315.45535 -1151.12392 4 -650.48161 -315.45535 5 -1101.78412 -650.48161 6 2555.91099 -1101.78412 7 719.04197 2555.91099 8 1573.12655 719.04197 9 1947.82154 1573.12655 10 986.70482 1947.82154 11 2713.13605 986.70482 12 -2186.19977 2713.13605 13 1626.10012 -2186.19977 14 4655.80812 1626.10012 15 3385.83277 4655.80812 16 -1425.47344 3385.83277 17 -510.40381 -1425.47344 18 -2347.59479 -510.40381 19 -856.51203 -2347.59479 20 -239.76886 -856.51203 21 -536.02171 -239.76886 22 775.91514 -536.02171 23 1151.08784 775.91514 24 -667.87047 1151.08784 25 -1759.49164 -667.87047 26 -2263.06473 -1759.49164 27 -2410.34259 -2263.06473 28 -1846.63949 -2410.34259 29 2391.89589 -1846.63949 30 -869.69008 2391.89589 31 1067.36196 -869.69008 32 -272.83736 1067.36196 33 -1516.04736 -272.83736 34 313.37158 -1516.04736 35 -1534.78501 313.37158 36 1692.29558 -1534.78501 37 1325.97297 1692.29558 38 2772.31278 1325.97297 39 -1125.26365 2772.31278 40 2631.52656 -1125.26365 41 -1268.85094 2631.52656 42 -1706.24407 -1268.85094 43 -1423.41561 -1706.24407 44 -2400.76886 -1423.41561 45 -1801.23316 -2400.76886 46 -1920.91063 -1801.23316 47 -4850.97362 -1920.91063 48 1397.15095 -4850.97362 49 -1433.35632 1397.15095 50 -1358.64832 -1433.35632 51 -2755.72939 -1358.64832 52 443.60437 -2755.72939 53 -417.79456 443.60437 54 83.12412 -417.79456 55 -242.36740 83.12412 56 -181.76886 -242.36740 57 1784.09613 -181.76886 58 460.93262 1784.09613 59 391.48677 460.93262 60 797.22594 391.48677 61 2760.50836 797.22594 62 -1405.28829 2760.50836 63 3090.16207 -1405.28829 64 2062.71122 3090.16207 65 1824.99231 2062.71122 66 1234.86278 1824.99231 67 419.04197 1234.86278 68 1068.23227 419.04197 69 -264.81843 1068.23227 70 -1830.96870 -264.81843 71 298.11689 -1830.96870 72 -2476.91642 298.11689 73 -2124.86152 -2476.91642 74 -1249.99564 -2124.86152 75 130.79613 -1249.99564 76 -1215.24761 130.79613 77 -918.05477 -1215.24761 78 1049.63104 -918.05477 79 316.84913 1049.63104 80 453.78513 316.84913 81 386.20299 453.78513 82 1214.95517 386.20299 83 1831.93109 1214.95517 > 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/html/rcomp/tmp/7hrhc1292678252.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/html/rcomp/tmp/89jgf1292678252.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/html/rcomp/tmp/99jgf1292678252.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/html/rcomp/tmp/109jgf1292678252.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/html/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/html/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/html/rcomp/tmp/11v1fl1292678252.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/html/rcomp/tmp/12ykdq1292678252.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/html/rcomp/tmp/1353a21292678252.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/html/rcomp/tmp/14fcan1292678252.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/html/rcomp/tmp/15juqt1292678252.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/html/rcomp/tmp/16kpv81292678252.tab") + } > > try(system("convert tmp/1d9j61292678252.ps tmp/1d9j61292678252.png",intern=TRUE)) character(0) > try(system("convert tmp/2d9j61292678252.ps tmp/2d9j61292678252.png",intern=TRUE)) character(0) > try(system("convert tmp/3d9j61292678252.ps tmp/3d9j61292678252.png",intern=TRUE)) character(0) > try(system("convert tmp/46i0r1292678252.ps tmp/46i0r1292678252.png",intern=TRUE)) character(0) > try(system("convert tmp/56i0r1292678252.ps tmp/56i0r1292678252.png",intern=TRUE)) character(0) > try(system("convert tmp/66i0r1292678252.ps tmp/66i0r1292678252.png",intern=TRUE)) character(0) > try(system("convert tmp/7hrhc1292678252.ps tmp/7hrhc1292678252.png",intern=TRUE)) character(0) > try(system("convert tmp/89jgf1292678252.ps tmp/89jgf1292678252.png",intern=TRUE)) character(0) > try(system("convert tmp/99jgf1292678252.ps tmp/99jgf1292678252.png",intern=TRUE)) character(0) > try(system("convert tmp/109jgf1292678252.ps tmp/109jgf1292678252.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.783 1.685 6.851