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(14544.5 + ,94.6 + ,-3.0 + ,14097.8 + ,15116.3 + ,95.9 + ,-3.7 + ,14776.8 + ,17413.2 + ,104.7 + ,-4.7 + ,16833.3 + ,16181.5 + ,102.8 + ,-6.4 + ,15385.5 + ,15607.4 + ,98.1 + ,-7.5 + ,15172.6 + ,17160.9 + ,113.9 + ,-7.8 + ,16858.9 + ,14915.8 + ,80.9 + ,-7.7 + ,14143.5 + ,13768 + ,95.7 + ,-6.6 + ,14731.8 + ,17487.5 + ,113.2 + ,-4.2 + ,16471.6 + ,16198.1 + ,105.9 + ,-2.0 + ,15214 + ,17535.2 + ,108.8 + ,-0.7 + ,17637.4 + ,16571.8 + ,102.3 + ,0.1 + ,17972.4 + ,16198.9 + ,99 + ,0.9 + ,16896.2 + ,16554.2 + ,100.7 + ,2.1 + ,16698 + ,19554.2 + ,115.5 + ,3.5 + ,19691.6 + ,15903.8 + ,100.7 + ,4.9 + ,15930.7 + ,18003.8 + ,109.9 + ,5.7 + ,17444.6 + ,18329.6 + ,114.6 + ,6.2 + ,17699.4 + ,16260.7 + ,85.4 + ,6.5 + ,15189.8 + ,14851.9 + ,100.5 + ,6.5 + ,15672.7 + ,18174.1 + ,114.8 + ,6.3 + ,17180.8 + ,18406.6 + ,116.5 + ,6.2 + ,17664.9 + ,18466.5 + ,112.9 + ,6.4 + ,17862.9 + ,16016.5 + ,102 + ,6.3 + ,16162.3 + ,17428.5 + ,106 + ,5.8 + ,17463.6 + ,17167.2 + ,105.3 + ,5.1 + ,16772.1 + ,19630 + ,118.8 + ,5.1 + ,19106.9 + ,17183.6 + ,106.1 + ,5.8 + ,16721.3 + ,18344.7 + ,109.3 + ,6.7 + ,18161.3 + ,19301.4 + ,117.2 + ,7.1 + ,18509.9 + ,18147.5 + ,92.5 + ,6.7 + ,17802.7 + ,16192.9 + ,104.2 + ,5.5 + ,16409.9 + ,18374.4 + ,112.5 + ,4.2 + ,17967.7 + ,20515.2 + ,122.4 + ,3.0 + ,20286.6 + ,18957.2 + ,113.3 + ,2.2 + ,19537.3 + ,16471.5 + ,100 + ,2.0 + ,18021.9 + ,18746.8 + ,110.7 + ,1.8 + ,20194.3 + ,19009.5 + ,112.8 + ,1.8 + ,19049.6 + ,19211.2 + ,109.8 + ,1.5 + ,20244.7 + ,20547.7 + ,117.3 + ,0.4 + ,21473.3 + ,19325.8 + ,109.1 + ,-0.9 + ,19673.6 + ,20605.5 + ,115.9 + ,-1.7 + ,21053.2 + ,20056.9 + ,96 + ,-2.6 + ,20159.5 + ,16141.4 + ,99.8 + ,-4.4 + ,18203.6 + ,20359.8 + ,116.8 + ,-8.3 + ,21289.5 + ,19711.6 + ,115.7 + ,-14.4 + ,20432.3 + ,15638.6 + ,99.4 + ,-21.3 + ,17180.4 + ,14384.5 + ,94.3 + ,-26.5 + ,15816.8 + ,13855.6 + ,91 + ,-29.2 + ,15071.8 + ,14308.3 + ,93.2 + ,-30.8 + ,14521.1 + ,15290.6 + ,103.1 + ,-30.9 + ,15668.8 + ,14423.8 + ,94.1 + ,-29.5 + ,14346.9 + ,13779.7 + ,91.8 + ,-27.1 + ,13881 + ,15686.3 + ,102.7 + ,-24.4 + ,15465.9 + ,14733.8 + ,82.6 + ,-21.9 + ,14238.2 + ,12522.5 + ,89.1 + ,-19.3 + ,13557.7 + ,16189.4 + ,104.5 + ,-17.0 + ,16127.6 + ,16059.1 + ,105.1 + ,-13.8 + ,16793.9 + ,16007.1 + ,95.1 + ,-9.9 + ,16014 + ,15806.8 + ,88.7 + ,-7.9 + ,16867.9 + ,15160 + ,86.3 + ,-7.2 + ,16014.6 + ,15692.1 + ,91.8 + ,-6.2 + ,15878.6 + ,18908.9 + ,111.5 + ,-4.5 + ,18664.9 + ,16969.9 + ,99.7 + ,-3.9 + ,17962.5 + ,16997.5 + ,97.5 + ,-5.0 + ,17332.7 + ,19858.9 + ,111.7 + ,-6.2 + ,19542.1 + ,17681.2 + ,86.2 + ,-6.1 + ,17203.6 + ,16006.9 + ,95.4 + ,-5.0 + ,16579) + ,dim=c(4 + ,68) + ,dimnames=list(c('uitvoer' + ,'productie' + ,'ondernemersvertrouwen' + ,'invoer') + ,1:68)) > y <- array(NA,dim=c(4,68),dimnames=list(c('uitvoer','productie','ondernemersvertrouwen','invoer'),1:68)) > 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 = '2' > #'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 productie uitvoer ondernemersvertrouwen invoer M1 M2 M3 M4 M5 M6 M7 M8 M9 1 94.6 14544.5 -3.0 14097.8 1 0 0 0 0 0 0 0 0 2 95.9 15116.3 -3.7 14776.8 0 1 0 0 0 0 0 0 0 3 104.7 17413.2 -4.7 16833.3 0 0 1 0 0 0 0 0 0 4 102.8 16181.5 -6.4 15385.5 0 0 0 1 0 0 0 0 0 5 98.1 15607.4 -7.5 15172.6 0 0 0 0 1 0 0 0 0 6 113.9 17160.9 -7.8 16858.9 0 0 0 0 0 1 0 0 0 7 80.9 14915.8 -7.7 14143.5 0 0 0 0 0 0 1 0 0 8 95.7 13768.0 -6.6 14731.8 0 0 0 0 0 0 0 1 0 9 113.2 17487.5 -4.2 16471.6 0 0 0 0 0 0 0 0 1 10 105.9 16198.1 -2.0 15214.0 0 0 0 0 0 0 0 0 0 11 108.8 17535.2 -0.7 17637.4 0 0 0 0 0 0 0 0 0 12 102.3 16571.8 0.1 17972.4 0 0 0 0 0 0 0 0 0 13 99.0 16198.9 0.9 16896.2 1 0 0 0 0 0 0 0 0 14 100.7 16554.2 2.1 16698.0 0 1 0 0 0 0 0 0 0 15 115.5 19554.2 3.5 19691.6 0 0 1 0 0 0 0 0 0 16 100.7 15903.8 4.9 15930.7 0 0 0 1 0 0 0 0 0 17 109.9 18003.8 5.7 17444.6 0 0 0 0 1 0 0 0 0 18 114.6 18329.6 6.2 17699.4 0 0 0 0 0 1 0 0 0 19 85.4 16260.7 6.5 15189.8 0 0 0 0 0 0 1 0 0 20 100.5 14851.9 6.5 15672.7 0 0 0 0 0 0 0 1 0 21 114.8 18174.1 6.3 17180.8 0 0 0 0 0 0 0 0 1 22 116.5 18406.6 6.2 17664.9 0 0 0 0 0 0 0 0 0 23 112.9 18466.5 6.4 17862.9 0 0 0 0 0 0 0 0 0 24 102.0 16016.5 6.3 16162.3 0 0 0 0 0 0 0 0 0 25 106.0 17428.5 5.8 17463.6 1 0 0 0 0 0 0 0 0 26 105.3 17167.2 5.1 16772.1 0 1 0 0 0 0 0 0 0 27 118.8 19630.0 5.1 19106.9 0 0 1 0 0 0 0 0 0 28 106.1 17183.6 5.8 16721.3 0 0 0 1 0 0 0 0 0 29 109.3 18344.7 6.7 18161.3 0 0 0 0 1 0 0 0 0 30 117.2 19301.4 7.1 18509.9 0 0 0 0 0 1 0 0 0 31 92.5 18147.5 6.7 17802.7 0 0 0 0 0 0 1 0 0 32 104.2 16192.9 5.5 16409.9 0 0 0 0 0 0 0 1 0 33 112.5 18374.4 4.2 17967.7 0 0 0 0 0 0 0 0 1 34 122.4 20515.2 3.0 20286.6 0 0 0 0 0 0 0 0 0 35 113.3 18957.2 2.2 19537.3 0 0 0 0 0 0 0 0 0 36 100.0 16471.5 2.0 18021.9 0 0 0 0 0 0 0 0 0 37 110.7 18746.8 1.8 20194.3 1 0 0 0 0 0 0 0 0 38 112.8 19009.5 1.8 19049.6 0 1 0 0 0 0 0 0 0 39 109.8 19211.2 1.5 20244.7 0 0 1 0 0 0 0 0 0 40 117.3 20547.7 0.4 21473.3 0 0 0 1 0 0 0 0 0 41 109.1 19325.8 -0.9 19673.6 0 0 0 0 1 0 0 0 0 42 115.9 20605.5 -1.7 21053.2 0 0 0 0 0 1 0 0 0 43 96.0 20056.9 -2.6 20159.5 0 0 0 0 0 0 1 0 0 44 99.8 16141.4 -4.4 18203.6 0 0 0 0 0 0 0 1 0 45 116.8 20359.8 -8.3 21289.5 0 0 0 0 0 0 0 0 1 46 115.7 19711.6 -14.4 20432.3 0 0 0 0 0 0 0 0 0 47 99.4 15638.6 -21.3 17180.4 0 0 0 0 0 0 0 0 0 48 94.3 14384.5 -26.5 15816.8 0 0 0 0 0 0 0 0 0 49 91.0 13855.6 -29.2 15071.8 1 0 0 0 0 0 0 0 0 50 93.2 14308.3 -30.8 14521.1 0 1 0 0 0 0 0 0 0 51 103.1 15290.6 -30.9 15668.8 0 0 1 0 0 0 0 0 0 52 94.1 14423.8 -29.5 14346.9 0 0 0 1 0 0 0 0 0 53 91.8 13779.7 -27.1 13881.0 0 0 0 0 1 0 0 0 0 54 102.7 15686.3 -24.4 15465.9 0 0 0 0 0 1 0 0 0 55 82.6 14733.8 -21.9 14238.2 0 0 0 0 0 0 1 0 0 56 89.1 12522.5 -19.3 13557.7 0 0 0 0 0 0 0 1 0 57 104.5 16189.4 -17.0 16127.6 0 0 0 0 0 0 0 0 1 58 105.1 16059.1 -13.8 16793.9 0 0 0 0 0 0 0 0 0 59 95.1 16007.1 -9.9 16014.0 0 0 0 0 0 0 0 0 0 60 88.7 15806.8 -7.9 16867.9 0 0 0 0 0 0 0 0 0 61 86.3 15160.0 -7.2 16014.6 1 0 0 0 0 0 0 0 0 62 91.8 15692.1 -6.2 15878.6 0 1 0 0 0 0 0 0 0 63 111.5 18908.9 -4.5 18664.9 0 0 1 0 0 0 0 0 0 64 99.7 16969.9 -3.9 17962.5 0 0 0 1 0 0 0 0 0 65 97.5 16997.5 -5.0 17332.7 0 0 0 0 1 0 0 0 0 66 111.7 19858.9 -6.2 19542.1 0 0 0 0 0 1 0 0 0 67 86.2 17681.2 -6.1 17203.6 0 0 0 0 0 0 1 0 0 68 95.4 16006.9 -5.0 16579.0 0 0 0 0 0 0 0 1 0 M10 M11 1 0 0 2 0 0 3 0 0 4 0 0 5 0 0 6 0 0 7 0 0 8 0 0 9 0 0 10 1 0 11 0 1 12 0 0 13 0 0 14 0 0 15 0 0 16 0 0 17 0 0 18 0 0 19 0 0 20 0 0 21 0 0 22 1 0 23 0 1 24 0 0 25 0 0 26 0 0 27 0 0 28 0 0 29 0 0 30 0 0 31 0 0 32 0 0 33 0 0 34 1 0 35 0 1 36 0 0 37 0 0 38 0 0 39 0 0 40 0 0 41 0 0 42 0 0 43 0 0 44 0 0 45 0 0 46 1 0 47 0 1 48 0 0 49 0 0 50 0 0 51 0 0 52 0 0 53 0 0 54 0 0 55 0 0 56 0 0 57 0 0 58 1 0 59 0 1 60 0 0 61 0 0 62 0 0 63 0 0 64 0 0 65 0 0 66 0 0 67 0 0 68 0 0 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) uitvoer ondernemersvertrouwen 46.155245 0.005052 0.038367 invoer M1 M2 -0.001683 -0.811036 -0.973083 M3 M4 M5 2.905435 0.833636 -0.761321 M6 M7 M8 3.894943 -16.730729 2.802074 M9 M10 M11 4.807897 5.730732 2.131480 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -8.6060 -0.8208 0.4911 1.7876 5.8397 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 4.616e+01 6.365e+00 7.251 1.78e-09 *** uitvoer 5.052e-03 1.218e-03 4.149 0.000122 *** ondernemersvertrouwen 3.837e-02 6.459e-02 0.594 0.555026 invoer -1.683e-03 9.341e-04 -1.802 0.077217 . M1 -8.110e-01 2.032e+00 -0.399 0.691359 M2 -9.731e-01 2.304e+00 -0.422 0.674491 M3 2.905e+00 2.666e+00 1.090 0.280703 M4 8.336e-01 2.319e+00 0.360 0.720626 M5 -7.613e-01 2.424e+00 -0.314 0.754717 M6 3.895e+00 2.885e+00 1.350 0.182668 M7 -1.673e+01 2.655e+00 -6.302 5.96e-08 *** M8 2.802e+00 2.009e+00 1.395 0.168850 M9 4.808e+00 2.836e+00 1.696 0.095832 . M10 5.731e+00 2.742e+00 2.090 0.041403 * M11 2.131e+00 2.368e+00 0.900 0.372146 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 3.258 on 53 degrees of freedom Multiple R-squared: 0.9152, Adjusted R-squared: 0.8928 F-statistic: 40.84 on 14 and 53 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,] 2.042412e-01 0.4084824747 0.7957588 [2,] 9.159027e-02 0.1831805366 0.9084097 [3,] 4.486051e-02 0.0897210124 0.9551395 [4,] 1.772139e-02 0.0354427862 0.9822786 [5,] 7.181356e-03 0.0143627112 0.9928186 [6,] 2.486085e-03 0.0049721707 0.9975139 [7,] 1.461204e-03 0.0029224072 0.9985388 [8,] 5.071770e-04 0.0010143539 0.9994928 [9,] 1.888184e-04 0.0003776368 0.9998112 [10,] 3.599070e-04 0.0007198139 0.9996401 [11,] 1.399965e-04 0.0002799930 0.9998600 [12,] 6.603967e-05 0.0001320793 0.9999340 [13,] 3.460448e-04 0.0006920897 0.9996540 [14,] 1.784334e-04 0.0003568668 0.9998216 [15,] 2.366416e-04 0.0004732832 0.9997634 [16,] 3.238912e-04 0.0006477823 0.9996761 [17,] 2.537530e-04 0.0005075060 0.9997462 [18,] 2.701657e-04 0.0005403314 0.9997298 [19,] 4.572556e-04 0.0009145112 0.9995427 [20,] 2.218002e-03 0.0044360032 0.9977820 [21,] 4.816144e-02 0.0963228881 0.9518386 [22,] 5.069352e-02 0.1013870303 0.9493065 [23,] 1.876737e-01 0.3753473597 0.8123263 [24,] 4.992554e-01 0.9985107514 0.5007446 [25,] 7.060321e-01 0.5879358943 0.2939679 [26,] 6.394711e-01 0.7210577075 0.3605289 [27,] 5.536135e-01 0.8927729707 0.4463865 [28,] 4.590316e-01 0.9180631907 0.5409684 [29,] 3.851887e-01 0.7703773707 0.6148113 [30,] 3.190909e-01 0.6381818769 0.6809091 [31,] 4.788765e-01 0.9577530403 0.5211235 [32,] 6.373747e-01 0.7252506971 0.3626253 [33,] 8.020953e-01 0.3958093180 0.1979047 > postscript(file="/var/www/html/rcomp/tmp/16bga1292686676.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/26bga1292686676.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/36bga1292686676.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/4h2fv1292686676.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/5h2fv1292686676.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 = 68 Frequency = 1 1 2 3 4 5 6 -0.369598058 -0.626156618 -3.807378302 0.214443368 -0.306670104 5.839667364 7 8 9 10 11 12 0.231687714 2.245279760 1.786745286 -2.124031658 1.650458131 2.681914391 13 14 15 16 17 18 0.234296462 -0.078189176 0.674263644 0.001536947 2.705962954 1.513639541 19 20 21 22 23 24 -0.845657373 2.651174702 0.709347612 1.130797745 1.153103900 1.902024988 25 26 27 28 29 30 1.790018216 1.434816226 2.545664084 0.232876041 1.552016053 0.534374564 31 32 33 34 35 36 1.113923877 0.856356938 -1.197229521 0.915192997 2.054152569 0.899023804 37 38 39 40 41 42 4.580887484 3.588855526 -2.285196433 2.645590891 -0.766681550 -2.734337700 43 44 45 46 47 48 -0.707303683 0.115911496 -0.855097116 -0.812477459 1.852367642 3.123054755 49 50 51 52 53 54 2.155322988 1.364828700 4.360022574 -0.468481118 1.203827108 0.380641501 55 56 57 58 59 60 3.555308531 0.447802610 -0.443766261 0.890518375 -6.710082242 -8.606017937 61 62 63 64 65 66 -8.390927092 -5.684154658 -1.487375566 -2.625966129 -4.388454461 -5.533985270 67 68 -3.347959066 -6.316525506 > postscript(file="/var/www/html/rcomp/tmp/6h2fv1292686676.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 = 68 Frequency = 1 lag(myerror, k = 1) myerror 0 -0.369598058 NA 1 -0.626156618 -0.369598058 2 -3.807378302 -0.626156618 3 0.214443368 -3.807378302 4 -0.306670104 0.214443368 5 5.839667364 -0.306670104 6 0.231687714 5.839667364 7 2.245279760 0.231687714 8 1.786745286 2.245279760 9 -2.124031658 1.786745286 10 1.650458131 -2.124031658 11 2.681914391 1.650458131 12 0.234296462 2.681914391 13 -0.078189176 0.234296462 14 0.674263644 -0.078189176 15 0.001536947 0.674263644 16 2.705962954 0.001536947 17 1.513639541 2.705962954 18 -0.845657373 1.513639541 19 2.651174702 -0.845657373 20 0.709347612 2.651174702 21 1.130797745 0.709347612 22 1.153103900 1.130797745 23 1.902024988 1.153103900 24 1.790018216 1.902024988 25 1.434816226 1.790018216 26 2.545664084 1.434816226 27 0.232876041 2.545664084 28 1.552016053 0.232876041 29 0.534374564 1.552016053 30 1.113923877 0.534374564 31 0.856356938 1.113923877 32 -1.197229521 0.856356938 33 0.915192997 -1.197229521 34 2.054152569 0.915192997 35 0.899023804 2.054152569 36 4.580887484 0.899023804 37 3.588855526 4.580887484 38 -2.285196433 3.588855526 39 2.645590891 -2.285196433 40 -0.766681550 2.645590891 41 -2.734337700 -0.766681550 42 -0.707303683 -2.734337700 43 0.115911496 -0.707303683 44 -0.855097116 0.115911496 45 -0.812477459 -0.855097116 46 1.852367642 -0.812477459 47 3.123054755 1.852367642 48 2.155322988 3.123054755 49 1.364828700 2.155322988 50 4.360022574 1.364828700 51 -0.468481118 4.360022574 52 1.203827108 -0.468481118 53 0.380641501 1.203827108 54 3.555308531 0.380641501 55 0.447802610 3.555308531 56 -0.443766261 0.447802610 57 0.890518375 -0.443766261 58 -6.710082242 0.890518375 59 -8.606017937 -6.710082242 60 -8.390927092 -8.606017937 61 -5.684154658 -8.390927092 62 -1.487375566 -5.684154658 63 -2.625966129 -1.487375566 64 -4.388454461 -2.625966129 65 -5.533985270 -4.388454461 66 -3.347959066 -5.533985270 67 -6.316525506 -3.347959066 68 NA -6.316525506 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -0.626156618 -0.369598058 [2,] -3.807378302 -0.626156618 [3,] 0.214443368 -3.807378302 [4,] -0.306670104 0.214443368 [5,] 5.839667364 -0.306670104 [6,] 0.231687714 5.839667364 [7,] 2.245279760 0.231687714 [8,] 1.786745286 2.245279760 [9,] -2.124031658 1.786745286 [10,] 1.650458131 -2.124031658 [11,] 2.681914391 1.650458131 [12,] 0.234296462 2.681914391 [13,] -0.078189176 0.234296462 [14,] 0.674263644 -0.078189176 [15,] 0.001536947 0.674263644 [16,] 2.705962954 0.001536947 [17,] 1.513639541 2.705962954 [18,] -0.845657373 1.513639541 [19,] 2.651174702 -0.845657373 [20,] 0.709347612 2.651174702 [21,] 1.130797745 0.709347612 [22,] 1.153103900 1.130797745 [23,] 1.902024988 1.153103900 [24,] 1.790018216 1.902024988 [25,] 1.434816226 1.790018216 [26,] 2.545664084 1.434816226 [27,] 0.232876041 2.545664084 [28,] 1.552016053 0.232876041 [29,] 0.534374564 1.552016053 [30,] 1.113923877 0.534374564 [31,] 0.856356938 1.113923877 [32,] -1.197229521 0.856356938 [33,] 0.915192997 -1.197229521 [34,] 2.054152569 0.915192997 [35,] 0.899023804 2.054152569 [36,] 4.580887484 0.899023804 [37,] 3.588855526 4.580887484 [38,] -2.285196433 3.588855526 [39,] 2.645590891 -2.285196433 [40,] -0.766681550 2.645590891 [41,] -2.734337700 -0.766681550 [42,] -0.707303683 -2.734337700 [43,] 0.115911496 -0.707303683 [44,] -0.855097116 0.115911496 [45,] -0.812477459 -0.855097116 [46,] 1.852367642 -0.812477459 [47,] 3.123054755 1.852367642 [48,] 2.155322988 3.123054755 [49,] 1.364828700 2.155322988 [50,] 4.360022574 1.364828700 [51,] -0.468481118 4.360022574 [52,] 1.203827108 -0.468481118 [53,] 0.380641501 1.203827108 [54,] 3.555308531 0.380641501 [55,] 0.447802610 3.555308531 [56,] -0.443766261 0.447802610 [57,] 0.890518375 -0.443766261 [58,] -6.710082242 0.890518375 [59,] -8.606017937 -6.710082242 [60,] -8.390927092 -8.606017937 [61,] -5.684154658 -8.390927092 [62,] -1.487375566 -5.684154658 [63,] -2.625966129 -1.487375566 [64,] -4.388454461 -2.625966129 [65,] -5.533985270 -4.388454461 [66,] -3.347959066 -5.533985270 [67,] -6.316525506 -3.347959066 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -0.626156618 -0.369598058 2 -3.807378302 -0.626156618 3 0.214443368 -3.807378302 4 -0.306670104 0.214443368 5 5.839667364 -0.306670104 6 0.231687714 5.839667364 7 2.245279760 0.231687714 8 1.786745286 2.245279760 9 -2.124031658 1.786745286 10 1.650458131 -2.124031658 11 2.681914391 1.650458131 12 0.234296462 2.681914391 13 -0.078189176 0.234296462 14 0.674263644 -0.078189176 15 0.001536947 0.674263644 16 2.705962954 0.001536947 17 1.513639541 2.705962954 18 -0.845657373 1.513639541 19 2.651174702 -0.845657373 20 0.709347612 2.651174702 21 1.130797745 0.709347612 22 1.153103900 1.130797745 23 1.902024988 1.153103900 24 1.790018216 1.902024988 25 1.434816226 1.790018216 26 2.545664084 1.434816226 27 0.232876041 2.545664084 28 1.552016053 0.232876041 29 0.534374564 1.552016053 30 1.113923877 0.534374564 31 0.856356938 1.113923877 32 -1.197229521 0.856356938 33 0.915192997 -1.197229521 34 2.054152569 0.915192997 35 0.899023804 2.054152569 36 4.580887484 0.899023804 37 3.588855526 4.580887484 38 -2.285196433 3.588855526 39 2.645590891 -2.285196433 40 -0.766681550 2.645590891 41 -2.734337700 -0.766681550 42 -0.707303683 -2.734337700 43 0.115911496 -0.707303683 44 -0.855097116 0.115911496 45 -0.812477459 -0.855097116 46 1.852367642 -0.812477459 47 3.123054755 1.852367642 48 2.155322988 3.123054755 49 1.364828700 2.155322988 50 4.360022574 1.364828700 51 -0.468481118 4.360022574 52 1.203827108 -0.468481118 53 0.380641501 1.203827108 54 3.555308531 0.380641501 55 0.447802610 3.555308531 56 -0.443766261 0.447802610 57 0.890518375 -0.443766261 58 -6.710082242 0.890518375 59 -8.606017937 -6.710082242 60 -8.390927092 -8.606017937 61 -5.684154658 -8.390927092 62 -1.487375566 -5.684154658 63 -2.625966129 -1.487375566 64 -4.388454461 -2.625966129 65 -5.533985270 -4.388454461 66 -3.347959066 -5.533985270 67 -6.316525506 -3.347959066 > 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/79bwf1292686676.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/89bwf1292686676.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/9k3d11292686676.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/10k3d11292686676.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/11n3u61292686676.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/12r4sc1292686676.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/13x4po1292686676.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/148wp91292686676.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/15cwnf1292686676.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/167ol51292686676.tab") + } > > try(system("convert tmp/16bga1292686676.ps tmp/16bga1292686676.png",intern=TRUE)) character(0) > try(system("convert tmp/26bga1292686676.ps tmp/26bga1292686676.png",intern=TRUE)) character(0) > try(system("convert tmp/36bga1292686676.ps tmp/36bga1292686676.png",intern=TRUE)) character(0) > try(system("convert tmp/4h2fv1292686676.ps tmp/4h2fv1292686676.png",intern=TRUE)) character(0) > try(system("convert tmp/5h2fv1292686676.ps tmp/5h2fv1292686676.png",intern=TRUE)) character(0) > try(system("convert tmp/6h2fv1292686676.ps tmp/6h2fv1292686676.png",intern=TRUE)) character(0) > try(system("convert tmp/79bwf1292686676.ps tmp/79bwf1292686676.png",intern=TRUE)) character(0) > try(system("convert tmp/89bwf1292686676.ps tmp/89bwf1292686676.png",intern=TRUE)) character(0) > try(system("convert tmp/9k3d11292686676.ps tmp/9k3d11292686676.png",intern=TRUE)) character(0) > try(system("convert tmp/10k3d11292686676.ps tmp/10k3d11292686676.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.663 1.688 6.107