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(79.8,109.87,83.4,95.74,113.6,123.06,112.9,123.39,104,120.28,109.9,115.33,99,110.4,106.3,114.49,128.9,132.03,111.1,123.16,102.9,118.82,130,128.32,87,112.24,87.5,104.53,117.6,132.57,103.4,122.52,110.8,131.8,112.6,124.55,102.5,120.96,112.4,122.6,135.6,145.52,105.1,118.57,127.7,134.25,137,136.7,91,121.37,90.5,111.63,122.4,134.42,123.3,137.65,124.3,137.86,120,119.77,118.1,130.69,119,128.28,142.7,147.45,123.6,128.42,129.6,136.9,151.6,143.95,110.4,135.64,99.2,122.48,130.5,136.83,136.2,153.04,129.7,142.71,128,123.46,121.6,144.37,135.8,146.15,143.8,147.61,147.5,158.51,136.2,147.4,156.6,165.05,123.3,154.64,104.5,126.2,139.8,157.36,136.5,154.15,112.1,123.21,118.5,113.07,94.4,110.45,102.3,113.57,111.4,122.44,99.2,114.93,87.8,111.85,115.8,126.04),dim=c(2,60),dimnames=list(c('Investgoed','Uitvoer'),1:60)) > y <- array(NA,dim=c(2,60),dimnames=list(c('Investgoed','Uitvoer'),1:60)) > 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 Investgoed Uitvoer M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 1 79.8 109.87 1 0 0 0 0 0 0 0 0 0 0 2 83.4 95.74 0 1 0 0 0 0 0 0 0 0 0 3 113.6 123.06 0 0 1 0 0 0 0 0 0 0 0 4 112.9 123.39 0 0 0 1 0 0 0 0 0 0 0 5 104.0 120.28 0 0 0 0 1 0 0 0 0 0 0 6 109.9 115.33 0 0 0 0 0 1 0 0 0 0 0 7 99.0 110.40 0 0 0 0 0 0 1 0 0 0 0 8 106.3 114.49 0 0 0 0 0 0 0 1 0 0 0 9 128.9 132.03 0 0 0 0 0 0 0 0 1 0 0 10 111.1 123.16 0 0 0 0 0 0 0 0 0 1 0 11 102.9 118.82 0 0 0 0 0 0 0 0 0 0 1 12 130.0 128.32 0 0 0 0 0 0 0 0 0 0 0 13 87.0 112.24 1 0 0 0 0 0 0 0 0 0 0 14 87.5 104.53 0 1 0 0 0 0 0 0 0 0 0 15 117.6 132.57 0 0 1 0 0 0 0 0 0 0 0 16 103.4 122.52 0 0 0 1 0 0 0 0 0 0 0 17 110.8 131.80 0 0 0 0 1 0 0 0 0 0 0 18 112.6 124.55 0 0 0 0 0 1 0 0 0 0 0 19 102.5 120.96 0 0 0 0 0 0 1 0 0 0 0 20 112.4 122.60 0 0 0 0 0 0 0 1 0 0 0 21 135.6 145.52 0 0 0 0 0 0 0 0 1 0 0 22 105.1 118.57 0 0 0 0 0 0 0 0 0 1 0 23 127.7 134.25 0 0 0 0 0 0 0 0 0 0 1 24 137.0 136.70 0 0 0 0 0 0 0 0 0 0 0 25 91.0 121.37 1 0 0 0 0 0 0 0 0 0 0 26 90.5 111.63 0 1 0 0 0 0 0 0 0 0 0 27 122.4 134.42 0 0 1 0 0 0 0 0 0 0 0 28 123.3 137.65 0 0 0 1 0 0 0 0 0 0 0 29 124.3 137.86 0 0 0 0 1 0 0 0 0 0 0 30 120.0 119.77 0 0 0 0 0 1 0 0 0 0 0 31 118.1 130.69 0 0 0 0 0 0 1 0 0 0 0 32 119.0 128.28 0 0 0 0 0 0 0 1 0 0 0 33 142.7 147.45 0 0 0 0 0 0 0 0 1 0 0 34 123.6 128.42 0 0 0 0 0 0 0 0 0 1 0 35 129.6 136.90 0 0 0 0 0 0 0 0 0 0 1 36 151.6 143.95 0 0 0 0 0 0 0 0 0 0 0 37 110.4 135.64 1 0 0 0 0 0 0 0 0 0 0 38 99.2 122.48 0 1 0 0 0 0 0 0 0 0 0 39 130.5 136.83 0 0 1 0 0 0 0 0 0 0 0 40 136.2 153.04 0 0 0 1 0 0 0 0 0 0 0 41 129.7 142.71 0 0 0 0 1 0 0 0 0 0 0 42 128.0 123.46 0 0 0 0 0 1 0 0 0 0 0 43 121.6 144.37 0 0 0 0 0 0 1 0 0 0 0 44 135.8 146.15 0 0 0 0 0 0 0 1 0 0 0 45 143.8 147.61 0 0 0 0 0 0 0 0 1 0 0 46 147.5 158.51 0 0 0 0 0 0 0 0 0 1 0 47 136.2 147.40 0 0 0 0 0 0 0 0 0 0 1 48 156.6 165.05 0 0 0 0 0 0 0 0 0 0 0 49 123.3 154.64 1 0 0 0 0 0 0 0 0 0 0 50 104.5 126.20 0 1 0 0 0 0 0 0 0 0 0 51 139.8 157.36 0 0 1 0 0 0 0 0 0 0 0 52 136.5 154.15 0 0 0 1 0 0 0 0 0 0 0 53 112.1 123.21 0 0 0 0 1 0 0 0 0 0 0 54 118.5 113.07 0 0 0 0 0 1 0 0 0 0 0 55 94.4 110.45 0 0 0 0 0 0 1 0 0 0 0 56 102.3 113.57 0 0 0 0 0 0 0 1 0 0 0 57 111.4 122.44 0 0 0 0 0 0 0 0 1 0 0 58 99.2 114.93 0 0 0 0 0 0 0 0 0 1 0 59 87.8 111.85 0 0 0 0 0 0 0 0 0 0 1 60 115.8 126.04 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) Uitvoer M1 M2 M3 M4 2.2637 0.9709 -27.0260 -18.0960 -10.3481 -13.9322 M5 M6 M7 M8 M9 M10 -13.4373 -0.2288 -14.9263 -8.4825 -4.7472 -9.9348 M11 -11.4880 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -11.56980 -2.51719 0.05023 3.01567 9.57663 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 2.26371 7.55208 0.300 0.765692 Uitvoer 0.97089 0.05159 18.819 < 2e-16 *** M1 -27.02600 3.19016 -8.472 5.08e-11 *** M2 -18.09605 3.43227 -5.272 3.33e-06 *** M3 -10.34810 3.12022 -3.316 0.001764 ** M4 -13.93220 3.11743 -4.469 4.93e-05 *** M5 -13.43733 3.14915 -4.267 9.52e-05 *** M6 -0.22878 3.29516 -0.069 0.944942 M7 -14.92633 3.23202 -4.618 3.02e-05 *** M8 -8.48247 3.21054 -2.642 0.011156 * M9 -4.74717 3.11638 -1.523 0.134385 M10 -9.93477 3.16996 -3.134 0.002968 ** M11 -11.48799 3.15980 -3.636 0.000686 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 4.927 on 47 degrees of freedom Multiple R-squared: 0.9392, Adjusted R-squared: 0.9237 F-statistic: 60.5 on 12 and 47 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.42567928 0.85135855 0.5743207 [2,] 0.27820514 0.55641028 0.7217949 [3,] 0.25070113 0.50140227 0.7492989 [4,] 0.15430755 0.30861510 0.8456925 [5,] 0.09200354 0.18400709 0.9079965 [6,] 0.04977211 0.09954423 0.9502279 [7,] 0.03388401 0.06776802 0.9661160 [8,] 0.28202798 0.56405597 0.7179720 [9,] 0.20729248 0.41458497 0.7927075 [10,] 0.13932146 0.27864292 0.8606785 [11,] 0.10440660 0.20881320 0.8955934 [12,] 0.06723099 0.13446198 0.9327690 [13,] 0.05050266 0.10100532 0.9494973 [14,] 0.05574844 0.11149688 0.9442516 [15,] 0.08156843 0.16313686 0.9184316 [16,] 0.07232234 0.14464468 0.9276777 [17,] 0.04469219 0.08938437 0.9553078 [18,] 0.02828042 0.05656084 0.9717196 [19,] 0.04895141 0.09790281 0.9510486 [20,] 0.06250161 0.12500321 0.9374984 [21,] 0.34787540 0.69575080 0.6521246 [22,] 0.34054649 0.68109299 0.6594535 [23,] 0.29879690 0.59759380 0.7012031 [24,] 0.57415960 0.85168079 0.4258404 [25,] 0.45878931 0.91757862 0.5412107 [26,] 0.38508529 0.77017059 0.6149147 [27,] 0.35321108 0.70642216 0.6467889 [28,] 0.63417086 0.73165829 0.3658291 [29,] 0.54002514 0.91994973 0.4599749 > postscript(file="/var/www/html/rcomp/tmp/1b9dm1258713120.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/2z7ao1258713120.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/32vsl1258713120.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/49axs1258713120.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/53vh11258713120.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 = 60 Frequency = 1 1 2 3 4 5 6 -2.10943075 6.27929878 2.20663481 4.77034013 -1.60506337 -4.10770267 7 8 9 10 11 12 4.47633014 1.36153258 3.19681396 -0.80379197 -3.23690585 3.15164884 13 14 15 16 17 18 2.78955935 1.84517346 -3.02653150 -3.88498535 -5.98971908 -10.35931080 19 20 21 22 23 24 -2.27627093 -0.41238737 -3.20049555 -2.34740571 6.58225755 2.01558852 25 26 27 28 29 30 -2.07466866 -2.04814734 -0.02267847 1.32544513 1.62668599 1.68154460 31 32 33 34 35 36 3.87696691 0.67295600 2.02568627 6.58932530 5.90939838 9.57663418 37 38 39 40 41 42 3.47072743 -3.88230658 5.73747602 -0.71655586 2.31786826 6.09895957 43 44 45 46 47 48 -5.90481175 0.12314718 2.97034383 1.27523759 2.31505072 -5.90915015 49 50 51 52 53 54 -2.07618737 -2.19401832 -4.89490087 -1.49424405 3.65022819 6.68650930 55 56 57 58 59 60 -0.17221437 -1.74524839 -4.99234851 -4.71336519 -11.56980079 -8.83472139 > postscript(file="/var/www/html/rcomp/tmp/6povh1258713120.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 = 60 Frequency = 1 lag(myerror, k = 1) myerror 0 -2.10943075 NA 1 6.27929878 -2.10943075 2 2.20663481 6.27929878 3 4.77034013 2.20663481 4 -1.60506337 4.77034013 5 -4.10770267 -1.60506337 6 4.47633014 -4.10770267 7 1.36153258 4.47633014 8 3.19681396 1.36153258 9 -0.80379197 3.19681396 10 -3.23690585 -0.80379197 11 3.15164884 -3.23690585 12 2.78955935 3.15164884 13 1.84517346 2.78955935 14 -3.02653150 1.84517346 15 -3.88498535 -3.02653150 16 -5.98971908 -3.88498535 17 -10.35931080 -5.98971908 18 -2.27627093 -10.35931080 19 -0.41238737 -2.27627093 20 -3.20049555 -0.41238737 21 -2.34740571 -3.20049555 22 6.58225755 -2.34740571 23 2.01558852 6.58225755 24 -2.07466866 2.01558852 25 -2.04814734 -2.07466866 26 -0.02267847 -2.04814734 27 1.32544513 -0.02267847 28 1.62668599 1.32544513 29 1.68154460 1.62668599 30 3.87696691 1.68154460 31 0.67295600 3.87696691 32 2.02568627 0.67295600 33 6.58932530 2.02568627 34 5.90939838 6.58932530 35 9.57663418 5.90939838 36 3.47072743 9.57663418 37 -3.88230658 3.47072743 38 5.73747602 -3.88230658 39 -0.71655586 5.73747602 40 2.31786826 -0.71655586 41 6.09895957 2.31786826 42 -5.90481175 6.09895957 43 0.12314718 -5.90481175 44 2.97034383 0.12314718 45 1.27523759 2.97034383 46 2.31505072 1.27523759 47 -5.90915015 2.31505072 48 -2.07618737 -5.90915015 49 -2.19401832 -2.07618737 50 -4.89490087 -2.19401832 51 -1.49424405 -4.89490087 52 3.65022819 -1.49424405 53 6.68650930 3.65022819 54 -0.17221437 6.68650930 55 -1.74524839 -0.17221437 56 -4.99234851 -1.74524839 57 -4.71336519 -4.99234851 58 -11.56980079 -4.71336519 59 -8.83472139 -11.56980079 60 NA -8.83472139 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] 6.27929878 -2.10943075 [2,] 2.20663481 6.27929878 [3,] 4.77034013 2.20663481 [4,] -1.60506337 4.77034013 [5,] -4.10770267 -1.60506337 [6,] 4.47633014 -4.10770267 [7,] 1.36153258 4.47633014 [8,] 3.19681396 1.36153258 [9,] -0.80379197 3.19681396 [10,] -3.23690585 -0.80379197 [11,] 3.15164884 -3.23690585 [12,] 2.78955935 3.15164884 [13,] 1.84517346 2.78955935 [14,] -3.02653150 1.84517346 [15,] -3.88498535 -3.02653150 [16,] -5.98971908 -3.88498535 [17,] -10.35931080 -5.98971908 [18,] -2.27627093 -10.35931080 [19,] -0.41238737 -2.27627093 [20,] -3.20049555 -0.41238737 [21,] -2.34740571 -3.20049555 [22,] 6.58225755 -2.34740571 [23,] 2.01558852 6.58225755 [24,] -2.07466866 2.01558852 [25,] -2.04814734 -2.07466866 [26,] -0.02267847 -2.04814734 [27,] 1.32544513 -0.02267847 [28,] 1.62668599 1.32544513 [29,] 1.68154460 1.62668599 [30,] 3.87696691 1.68154460 [31,] 0.67295600 3.87696691 [32,] 2.02568627 0.67295600 [33,] 6.58932530 2.02568627 [34,] 5.90939838 6.58932530 [35,] 9.57663418 5.90939838 [36,] 3.47072743 9.57663418 [37,] -3.88230658 3.47072743 [38,] 5.73747602 -3.88230658 [39,] -0.71655586 5.73747602 [40,] 2.31786826 -0.71655586 [41,] 6.09895957 2.31786826 [42,] -5.90481175 6.09895957 [43,] 0.12314718 -5.90481175 [44,] 2.97034383 0.12314718 [45,] 1.27523759 2.97034383 [46,] 2.31505072 1.27523759 [47,] -5.90915015 2.31505072 [48,] -2.07618737 -5.90915015 [49,] -2.19401832 -2.07618737 [50,] -4.89490087 -2.19401832 [51,] -1.49424405 -4.89490087 [52,] 3.65022819 -1.49424405 [53,] 6.68650930 3.65022819 [54,] -0.17221437 6.68650930 [55,] -1.74524839 -0.17221437 [56,] -4.99234851 -1.74524839 [57,] -4.71336519 -4.99234851 [58,] -11.56980079 -4.71336519 [59,] -8.83472139 -11.56980079 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 6.27929878 -2.10943075 2 2.20663481 6.27929878 3 4.77034013 2.20663481 4 -1.60506337 4.77034013 5 -4.10770267 -1.60506337 6 4.47633014 -4.10770267 7 1.36153258 4.47633014 8 3.19681396 1.36153258 9 -0.80379197 3.19681396 10 -3.23690585 -0.80379197 11 3.15164884 -3.23690585 12 2.78955935 3.15164884 13 1.84517346 2.78955935 14 -3.02653150 1.84517346 15 -3.88498535 -3.02653150 16 -5.98971908 -3.88498535 17 -10.35931080 -5.98971908 18 -2.27627093 -10.35931080 19 -0.41238737 -2.27627093 20 -3.20049555 -0.41238737 21 -2.34740571 -3.20049555 22 6.58225755 -2.34740571 23 2.01558852 6.58225755 24 -2.07466866 2.01558852 25 -2.04814734 -2.07466866 26 -0.02267847 -2.04814734 27 1.32544513 -0.02267847 28 1.62668599 1.32544513 29 1.68154460 1.62668599 30 3.87696691 1.68154460 31 0.67295600 3.87696691 32 2.02568627 0.67295600 33 6.58932530 2.02568627 34 5.90939838 6.58932530 35 9.57663418 5.90939838 36 3.47072743 9.57663418 37 -3.88230658 3.47072743 38 5.73747602 -3.88230658 39 -0.71655586 5.73747602 40 2.31786826 -0.71655586 41 6.09895957 2.31786826 42 -5.90481175 6.09895957 43 0.12314718 -5.90481175 44 2.97034383 0.12314718 45 1.27523759 2.97034383 46 2.31505072 1.27523759 47 -5.90915015 2.31505072 48 -2.07618737 -5.90915015 49 -2.19401832 -2.07618737 50 -4.89490087 -2.19401832 51 -1.49424405 -4.89490087 52 3.65022819 -1.49424405 53 6.68650930 3.65022819 54 -0.17221437 6.68650930 55 -1.74524839 -0.17221437 56 -4.99234851 -1.74524839 57 -4.71336519 -4.99234851 58 -11.56980079 -4.71336519 59 -8.83472139 -11.56980079 > 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/7qqzi1258713120.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/8ccgq1258713120.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/93e1c1258713120.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/10rxqy1258713120.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/119q1h1258713120.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/12dcv11258713120.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/13gce31258713120.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/14lbh31258713120.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/15kqff1258713120.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/16i4nf1258713120.tab") + } > > system("convert tmp/1b9dm1258713120.ps tmp/1b9dm1258713120.png") > system("convert tmp/2z7ao1258713120.ps tmp/2z7ao1258713120.png") > system("convert tmp/32vsl1258713120.ps tmp/32vsl1258713120.png") > system("convert tmp/49axs1258713120.ps tmp/49axs1258713120.png") > system("convert tmp/53vh11258713120.ps tmp/53vh11258713120.png") > system("convert tmp/6povh1258713120.ps tmp/6povh1258713120.png") > system("convert tmp/7qqzi1258713120.ps tmp/7qqzi1258713120.png") > system("convert tmp/8ccgq1258713120.ps tmp/8ccgq1258713120.png") > system("convert tmp/93e1c1258713120.ps tmp/93e1c1258713120.png") > system("convert tmp/10rxqy1258713120.ps tmp/10rxqy1258713120.png") > > > proc.time() user system elapsed 2.382 1.551 2.820