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(104.2,97.4,103.2,97,112.7,105.4,106.4,102.7,102.6,98.1,110.6,104.5,95.2,87.4,89,89.9,112.5,109.8,116.8,111.7,107.2,98.6,113.6,96.9,101.8,95.1,102.6,97,122.7,112.7,110.3,102.9,110.5,97.4,121.6,111.4,100.3,87.4,100.7,96.8,123.4,114.1,127.1,110.3,124.1,103.9,131.2,101.6,111.6,94.6,114.2,95.9,130.1,104.7,125.9,102.8,119,98.1,133.8,113.9,107.5,80.9,113.5,95.7,134.4,113.2,126.8,105.9,135.6,108.8,139.9,102.3,129.8,99,131,100.7,153.1,115.5,134.1,100.7,144.1,109.9,155.9,114.6,123.3,85.4,128.1,100.5,144.3,114.8,153,116.5,149.9,112.9,150.9,102,141,106,138.9,105.3,157.4,118.8,142.9,106.1,151.7,109.3,161,117.2,138.5,92.5,135.9,104.2,151.5,112.5,164,122.4,159.1,113.3,157,100,142.1,110.7,144.8,112.8,152.1,109.8,154.9,117.3,148.4,109.1,157.3,115.9,145.7,96,133.8,99.8,156.8,116.8),dim=c(2,69),dimnames=list(c('Omzet','Productie'),1:69)) > y <- array(NA,dim=c(2,69),dimnames=list(c('Omzet','Productie'),1:69)) > for (i in 1:dim(x)[1]) + { + for (j in 1:dim(x)[2]) + { + y[i,j] <- as.numeric(x[i,j]) + } + } > par3 = '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 Omzet Productie M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t 1 104.2 97.4 1 0 0 0 0 0 0 0 0 0 0 1 2 103.2 97.0 0 1 0 0 0 0 0 0 0 0 0 2 3 112.7 105.4 0 0 1 0 0 0 0 0 0 0 0 3 4 106.4 102.7 0 0 0 1 0 0 0 0 0 0 0 4 5 102.6 98.1 0 0 0 0 1 0 0 0 0 0 0 5 6 110.6 104.5 0 0 0 0 0 1 0 0 0 0 0 6 7 95.2 87.4 0 0 0 0 0 0 1 0 0 0 0 7 8 89.0 89.9 0 0 0 0 0 0 0 1 0 0 0 8 9 112.5 109.8 0 0 0 0 0 0 0 0 1 0 0 9 10 116.8 111.7 0 0 0 0 0 0 0 0 0 1 0 10 11 107.2 98.6 0 0 0 0 0 0 0 0 0 0 1 11 12 113.6 96.9 0 0 0 0 0 0 0 0 0 0 0 12 13 101.8 95.1 1 0 0 0 0 0 0 0 0 0 0 13 14 102.6 97.0 0 1 0 0 0 0 0 0 0 0 0 14 15 122.7 112.7 0 0 1 0 0 0 0 0 0 0 0 15 16 110.3 102.9 0 0 0 1 0 0 0 0 0 0 0 16 17 110.5 97.4 0 0 0 0 1 0 0 0 0 0 0 17 18 121.6 111.4 0 0 0 0 0 1 0 0 0 0 0 18 19 100.3 87.4 0 0 0 0 0 0 1 0 0 0 0 19 20 100.7 96.8 0 0 0 0 0 0 0 1 0 0 0 20 21 123.4 114.1 0 0 0 0 0 0 0 0 1 0 0 21 22 127.1 110.3 0 0 0 0 0 0 0 0 0 1 0 22 23 124.1 103.9 0 0 0 0 0 0 0 0 0 0 1 23 24 131.2 101.6 0 0 0 0 0 0 0 0 0 0 0 24 25 111.6 94.6 1 0 0 0 0 0 0 0 0 0 0 25 26 114.2 95.9 0 1 0 0 0 0 0 0 0 0 0 26 27 130.1 104.7 0 0 1 0 0 0 0 0 0 0 0 27 28 125.9 102.8 0 0 0 1 0 0 0 0 0 0 0 28 29 119.0 98.1 0 0 0 0 1 0 0 0 0 0 0 29 30 133.8 113.9 0 0 0 0 0 1 0 0 0 0 0 30 31 107.5 80.9 0 0 0 0 0 0 1 0 0 0 0 31 32 113.5 95.7 0 0 0 0 0 0 0 1 0 0 0 32 33 134.4 113.2 0 0 0 0 0 0 0 0 1 0 0 33 34 126.8 105.9 0 0 0 0 0 0 0 0 0 1 0 34 35 135.6 108.8 0 0 0 0 0 0 0 0 0 0 1 35 36 139.9 102.3 0 0 0 0 0 0 0 0 0 0 0 36 37 129.8 99.0 1 0 0 0 0 0 0 0 0 0 0 37 38 131.0 100.7 0 1 0 0 0 0 0 0 0 0 0 38 39 153.1 115.5 0 0 1 0 0 0 0 0 0 0 0 39 40 134.1 100.7 0 0 0 1 0 0 0 0 0 0 0 40 41 144.1 109.9 0 0 0 0 1 0 0 0 0 0 0 41 42 155.9 114.6 0 0 0 0 0 1 0 0 0 0 0 42 43 123.3 85.4 0 0 0 0 0 0 1 0 0 0 0 43 44 128.1 100.5 0 0 0 0 0 0 0 1 0 0 0 44 45 144.3 114.8 0 0 0 0 0 0 0 0 1 0 0 45 46 153.0 116.5 0 0 0 0 0 0 0 0 0 1 0 46 47 149.9 112.9 0 0 0 0 0 0 0 0 0 0 1 47 48 150.9 102.0 0 0 0 0 0 0 0 0 0 0 0 48 49 141.0 106.0 1 0 0 0 0 0 0 0 0 0 0 49 50 138.9 105.3 0 1 0 0 0 0 0 0 0 0 0 50 51 157.4 118.8 0 0 1 0 0 0 0 0 0 0 0 51 52 142.9 106.1 0 0 0 1 0 0 0 0 0 0 0 52 53 151.7 109.3 0 0 0 0 1 0 0 0 0 0 0 53 54 161.0 117.2 0 0 0 0 0 1 0 0 0 0 0 54 55 138.5 92.5 0 0 0 0 0 0 1 0 0 0 0 55 56 135.9 104.2 0 0 0 0 0 0 0 1 0 0 0 56 57 151.5 112.5 0 0 0 0 0 0 0 0 1 0 0 57 58 164.0 122.4 0 0 0 0 0 0 0 0 0 1 0 58 59 159.1 113.3 0 0 0 0 0 0 0 0 0 0 1 59 60 157.0 100.0 0 0 0 0 0 0 0 0 0 0 0 60 61 142.1 110.7 1 0 0 0 0 0 0 0 0 0 0 61 62 144.8 112.8 0 1 0 0 0 0 0 0 0 0 0 62 63 152.1 109.8 0 0 1 0 0 0 0 0 0 0 0 63 64 154.9 117.3 0 0 0 1 0 0 0 0 0 0 0 64 65 148.4 109.1 0 0 0 0 1 0 0 0 0 0 0 65 66 157.3 115.9 0 0 0 0 0 1 0 0 0 0 0 66 67 145.7 96.0 0 0 0 0 0 0 1 0 0 0 0 67 68 133.8 99.8 0 0 0 0 0 0 0 1 0 0 0 68 69 156.8 116.8 0 0 0 0 0 0 0 0 1 0 0 69 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) Productie M1 M2 M3 M4 29.6444 0.8328 -13.2023 -14.0192 -7.2289 -12.0854 M5 M6 M7 M8 M9 M10 -11.0121 -8.7775 -10.5633 -20.7980 -14.2684 -10.2440 M11 t -8.4217 0.6980 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -9.1123 -2.8643 0.2940 2.6174 10.2768 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 29.64445 14.96341 1.981 0.052585 . Productie 0.83281 0.15775 5.279 2.27e-06 *** M1 -13.20231 2.64101 -4.999 6.22e-06 *** M2 -14.01923 2.64909 -5.292 2.17e-06 *** M3 -7.22886 3.16846 -2.282 0.026412 * M4 -12.08538 2.76101 -4.377 5.42e-05 *** M5 -11.01207 2.68473 -4.102 0.000137 *** M6 -8.77748 3.27711 -2.678 0.009735 ** M7 -10.56326 3.28878 -3.212 0.002205 ** M8 -20.79797 2.68036 -7.759 2.15e-10 *** M9 -14.26836 3.28353 -4.345 6.04e-05 *** M10 -10.24404 3.44838 -2.971 0.004399 ** M11 -8.42174 2.97241 -2.833 0.006428 ** t 0.69799 0.03954 17.652 < 2e-16 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 4.351 on 55 degrees of freedom Multiple R-squared: 0.9598, Adjusted R-squared: 0.9503 F-statistic: 101 on 13 and 55 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.25994505 0.51989010 0.74005495 [2,] 0.14310634 0.28621268 0.85689366 [3,] 0.08970239 0.17940478 0.91029761 [4,] 0.04745900 0.09491800 0.95254100 [5,] 0.03217308 0.06434615 0.96782692 [6,] 0.08788950 0.17577901 0.91211050 [7,] 0.11945426 0.23890851 0.88054574 [8,] 0.16668589 0.33337178 0.83331411 [9,] 0.11722475 0.23444950 0.88277525 [10,] 0.08851620 0.17703240 0.91148380 [11,] 0.10260570 0.20521141 0.89739430 [12,] 0.11493795 0.22987590 0.88506205 [13,] 0.08737740 0.17475480 0.91262260 [14,] 0.11342316 0.22684632 0.88657684 [15,] 0.11681986 0.23363972 0.88318014 [16,] 0.11293302 0.22586605 0.88706698 [17,] 0.10736219 0.21472438 0.89263781 [18,] 0.26679290 0.53358580 0.73320710 [19,] 0.37743555 0.75487109 0.62256445 [20,] 0.60442153 0.79115695 0.39557847 [21,] 0.56962266 0.86075467 0.43037734 [22,] 0.51873296 0.96253408 0.48126704 [23,] 0.54385146 0.91229707 0.45614854 [24,] 0.48599915 0.97199830 0.51400085 [25,] 0.42246729 0.84493458 0.57753271 [26,] 0.59381550 0.81236901 0.40618450 [27,] 0.66737986 0.66524028 0.33262014 [28,] 0.57407918 0.85184165 0.42592082 [29,] 0.63996650 0.72006701 0.36003350 [30,] 0.61770265 0.76459470 0.38229735 [31,] 0.75723992 0.48552016 0.24276008 [32,] 0.89676908 0.20646184 0.10323092 [33,] 0.90032023 0.19935953 0.09967977 [34,] 0.85338227 0.29323546 0.14661773 [35,] 0.82921706 0.34156588 0.17078294 [36,] 0.69698618 0.60602765 0.30301382 > postscript(file="/var/www/html/rcomp/tmp/1m96z1261063239.ps",horizontal=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/24kby1261063239.ps",horizontal=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/367kt1261063239.ps",horizontal=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/4hg9p1261063239.ps",horizontal=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/5k2z81261063239.ps",horizontal=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 = 69 Frequency = 1 1 2 3 4 5 6 5.94375166 5.39581147 0.41180342 0.51893332 -1.22142611 -1.48402505 7 8 9 10 11 12 -1.55510651 -0.30043221 -0.60103879 -2.60569803 -3.81612235 -5.12006939 13 14 15 16 17 18 -2.91669050 -3.58010362 -4.04365622 -4.12354464 -1.11437118 -4.60635897 19 20 21 22 23 24 -4.83102161 -2.72276613 -1.65805547 0.48432692 0.29404665 0.18978820 25 26 27 28 29 30 -1.07619843 0.56007703 1.64294325 3.18382169 -1.57325630 -2.86430987 31 32 33 34 35 36 -0.59364362 2.61741453 1.71556232 -4.52720517 -0.66265862 -0.06909692 37 38 39 40 41 42 5.08350345 4.98665319 7.27263349 4.75681666 5.32361961 10.27680501 43 44 45 46 47 48 3.08277684 4.84399069 1.90714431 4.46904793 1.84688757 2.80483228 49 50 51 52 53 54 2.07788811 0.67979222 0.44843113 0.68370423 5.04739311 4.83557268 55 56 57 58 59 60 3.99388006 1.18666260 2.64670215 2.17952834 2.33784674 2.19454582 61 62 63 64 65 66 -9.11225430 -8.04223029 -5.73215508 -5.01973126 -6.46195913 -6.15768380 67 68 69 -0.09688516 -5.62486948 -4.01031453 > postscript(file="/var/www/html/rcomp/tmp/6nmpj1261063239.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > dum <- cbind(lag(myerror,k=1),myerror) > dum Time Series: Start = 0 End = 69 Frequency = 1 lag(myerror, k = 1) myerror 0 5.94375166 NA 1 5.39581147 5.94375166 2 0.41180342 5.39581147 3 0.51893332 0.41180342 4 -1.22142611 0.51893332 5 -1.48402505 -1.22142611 6 -1.55510651 -1.48402505 7 -0.30043221 -1.55510651 8 -0.60103879 -0.30043221 9 -2.60569803 -0.60103879 10 -3.81612235 -2.60569803 11 -5.12006939 -3.81612235 12 -2.91669050 -5.12006939 13 -3.58010362 -2.91669050 14 -4.04365622 -3.58010362 15 -4.12354464 -4.04365622 16 -1.11437118 -4.12354464 17 -4.60635897 -1.11437118 18 -4.83102161 -4.60635897 19 -2.72276613 -4.83102161 20 -1.65805547 -2.72276613 21 0.48432692 -1.65805547 22 0.29404665 0.48432692 23 0.18978820 0.29404665 24 -1.07619843 0.18978820 25 0.56007703 -1.07619843 26 1.64294325 0.56007703 27 3.18382169 1.64294325 28 -1.57325630 3.18382169 29 -2.86430987 -1.57325630 30 -0.59364362 -2.86430987 31 2.61741453 -0.59364362 32 1.71556232 2.61741453 33 -4.52720517 1.71556232 34 -0.66265862 -4.52720517 35 -0.06909692 -0.66265862 36 5.08350345 -0.06909692 37 4.98665319 5.08350345 38 7.27263349 4.98665319 39 4.75681666 7.27263349 40 5.32361961 4.75681666 41 10.27680501 5.32361961 42 3.08277684 10.27680501 43 4.84399069 3.08277684 44 1.90714431 4.84399069 45 4.46904793 1.90714431 46 1.84688757 4.46904793 47 2.80483228 1.84688757 48 2.07788811 2.80483228 49 0.67979222 2.07788811 50 0.44843113 0.67979222 51 0.68370423 0.44843113 52 5.04739311 0.68370423 53 4.83557268 5.04739311 54 3.99388006 4.83557268 55 1.18666260 3.99388006 56 2.64670215 1.18666260 57 2.17952834 2.64670215 58 2.33784674 2.17952834 59 2.19454582 2.33784674 60 -9.11225430 2.19454582 61 -8.04223029 -9.11225430 62 -5.73215508 -8.04223029 63 -5.01973126 -5.73215508 64 -6.46195913 -5.01973126 65 -6.15768380 -6.46195913 66 -0.09688516 -6.15768380 67 -5.62486948 -0.09688516 68 -4.01031453 -5.62486948 69 NA -4.01031453 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] 5.39581147 5.94375166 [2,] 0.41180342 5.39581147 [3,] 0.51893332 0.41180342 [4,] -1.22142611 0.51893332 [5,] -1.48402505 -1.22142611 [6,] -1.55510651 -1.48402505 [7,] -0.30043221 -1.55510651 [8,] -0.60103879 -0.30043221 [9,] -2.60569803 -0.60103879 [10,] -3.81612235 -2.60569803 [11,] -5.12006939 -3.81612235 [12,] -2.91669050 -5.12006939 [13,] -3.58010362 -2.91669050 [14,] -4.04365622 -3.58010362 [15,] -4.12354464 -4.04365622 [16,] -1.11437118 -4.12354464 [17,] -4.60635897 -1.11437118 [18,] -4.83102161 -4.60635897 [19,] -2.72276613 -4.83102161 [20,] -1.65805547 -2.72276613 [21,] 0.48432692 -1.65805547 [22,] 0.29404665 0.48432692 [23,] 0.18978820 0.29404665 [24,] -1.07619843 0.18978820 [25,] 0.56007703 -1.07619843 [26,] 1.64294325 0.56007703 [27,] 3.18382169 1.64294325 [28,] -1.57325630 3.18382169 [29,] -2.86430987 -1.57325630 [30,] -0.59364362 -2.86430987 [31,] 2.61741453 -0.59364362 [32,] 1.71556232 2.61741453 [33,] -4.52720517 1.71556232 [34,] -0.66265862 -4.52720517 [35,] -0.06909692 -0.66265862 [36,] 5.08350345 -0.06909692 [37,] 4.98665319 5.08350345 [38,] 7.27263349 4.98665319 [39,] 4.75681666 7.27263349 [40,] 5.32361961 4.75681666 [41,] 10.27680501 5.32361961 [42,] 3.08277684 10.27680501 [43,] 4.84399069 3.08277684 [44,] 1.90714431 4.84399069 [45,] 4.46904793 1.90714431 [46,] 1.84688757 4.46904793 [47,] 2.80483228 1.84688757 [48,] 2.07788811 2.80483228 [49,] 0.67979222 2.07788811 [50,] 0.44843113 0.67979222 [51,] 0.68370423 0.44843113 [52,] 5.04739311 0.68370423 [53,] 4.83557268 5.04739311 [54,] 3.99388006 4.83557268 [55,] 1.18666260 3.99388006 [56,] 2.64670215 1.18666260 [57,] 2.17952834 2.64670215 [58,] 2.33784674 2.17952834 [59,] 2.19454582 2.33784674 [60,] -9.11225430 2.19454582 [61,] -8.04223029 -9.11225430 [62,] -5.73215508 -8.04223029 [63,] -5.01973126 -5.73215508 [64,] -6.46195913 -5.01973126 [65,] -6.15768380 -6.46195913 [66,] -0.09688516 -6.15768380 [67,] -5.62486948 -0.09688516 [68,] -4.01031453 -5.62486948 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 5.39581147 5.94375166 2 0.41180342 5.39581147 3 0.51893332 0.41180342 4 -1.22142611 0.51893332 5 -1.48402505 -1.22142611 6 -1.55510651 -1.48402505 7 -0.30043221 -1.55510651 8 -0.60103879 -0.30043221 9 -2.60569803 -0.60103879 10 -3.81612235 -2.60569803 11 -5.12006939 -3.81612235 12 -2.91669050 -5.12006939 13 -3.58010362 -2.91669050 14 -4.04365622 -3.58010362 15 -4.12354464 -4.04365622 16 -1.11437118 -4.12354464 17 -4.60635897 -1.11437118 18 -4.83102161 -4.60635897 19 -2.72276613 -4.83102161 20 -1.65805547 -2.72276613 21 0.48432692 -1.65805547 22 0.29404665 0.48432692 23 0.18978820 0.29404665 24 -1.07619843 0.18978820 25 0.56007703 -1.07619843 26 1.64294325 0.56007703 27 3.18382169 1.64294325 28 -1.57325630 3.18382169 29 -2.86430987 -1.57325630 30 -0.59364362 -2.86430987 31 2.61741453 -0.59364362 32 1.71556232 2.61741453 33 -4.52720517 1.71556232 34 -0.66265862 -4.52720517 35 -0.06909692 -0.66265862 36 5.08350345 -0.06909692 37 4.98665319 5.08350345 38 7.27263349 4.98665319 39 4.75681666 7.27263349 40 5.32361961 4.75681666 41 10.27680501 5.32361961 42 3.08277684 10.27680501 43 4.84399069 3.08277684 44 1.90714431 4.84399069 45 4.46904793 1.90714431 46 1.84688757 4.46904793 47 2.80483228 1.84688757 48 2.07788811 2.80483228 49 0.67979222 2.07788811 50 0.44843113 0.67979222 51 0.68370423 0.44843113 52 5.04739311 0.68370423 53 4.83557268 5.04739311 54 3.99388006 4.83557268 55 1.18666260 3.99388006 56 2.64670215 1.18666260 57 2.17952834 2.64670215 58 2.33784674 2.17952834 59 2.19454582 2.33784674 60 -9.11225430 2.19454582 61 -8.04223029 -9.11225430 62 -5.73215508 -8.04223029 63 -5.01973126 -5.73215508 64 -6.46195913 -5.01973126 65 -6.15768380 -6.46195913 66 -0.09688516 -6.15768380 67 -5.62486948 -0.09688516 68 -4.01031453 -5.62486948 > 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/7992y1261063239.ps",horizontal=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/86qa71261063239.ps",horizontal=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/9mwyg1261063239.ps",horizontal=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/10tsr11261063239.ps",horizontal=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/11g6pe1261063239.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/12hvqj1261063239.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/13pco21261063239.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/14n9r61261063239.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/15qqxh1261063239.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/16rbii1261063239.tab") + } > > try(system("convert tmp/1m96z1261063239.ps tmp/1m96z1261063239.png",intern=TRUE)) character(0) > try(system("convert tmp/24kby1261063239.ps tmp/24kby1261063239.png",intern=TRUE)) character(0) > try(system("convert tmp/367kt1261063239.ps tmp/367kt1261063239.png",intern=TRUE)) character(0) > try(system("convert tmp/4hg9p1261063239.ps tmp/4hg9p1261063239.png",intern=TRUE)) character(0) > try(system("convert tmp/5k2z81261063239.ps tmp/5k2z81261063239.png",intern=TRUE)) character(0) > try(system("convert tmp/6nmpj1261063239.ps tmp/6nmpj1261063239.png",intern=TRUE)) character(0) > try(system("convert tmp/7992y1261063239.ps tmp/7992y1261063239.png",intern=TRUE)) character(0) > try(system("convert tmp/86qa71261063239.ps tmp/86qa71261063239.png",intern=TRUE)) character(0) > try(system("convert tmp/9mwyg1261063239.ps tmp/9mwyg1261063239.png",intern=TRUE)) character(0) > try(system("convert tmp/10tsr11261063239.ps tmp/10tsr11261063239.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.504 1.579 4.300