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(19,80.2,18,74.8,19,77.8,19,73,22,72,23,75.8,20,72.6,14,71.9,14,74.8,14,72.9,15,72.9,11,79.9,17,74,16,76,20,69.6,24,77.3,23,75.2,20,75.8,21,77.6,19,76.7,23,77,23,77.9,23,76.7,23,71.9,27,73.4,26,72.5,17,73.7,24,69.5,26,74.7,24,72.5,27,72.1,27,70.7,26,71.4,24,69.5,23,73.5,23,72.4,24,74.5,17,72.2,21,73,19,73.3,22,71.3,22,73.6,18,71.3,16,71.2,14,81.4,12,76.1,14,71.1,16,75.7,8,70,3,68.5,0,56.7,5,57.9,1,58.8,1,59.3,3,61.3,6,62.9,7,61.4,8,64.5,14,63.8,14,61.6,13,64.7),dim=c(2,61),dimnames=list(c('indcvtr','dzcg '),1:61)) > y <- array(NA,dim=c(2,61),dimnames=list(c('indcvtr','dzcg '),1:61)) > 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 = '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 dzcg\r indcvtr M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t 1 80.2 19 1 0 0 0 0 0 0 0 0 0 0 1 2 74.8 18 0 1 0 0 0 0 0 0 0 0 0 2 3 77.8 19 0 0 1 0 0 0 0 0 0 0 0 3 4 73.0 19 0 0 0 1 0 0 0 0 0 0 0 4 5 72.0 22 0 0 0 0 1 0 0 0 0 0 0 5 6 75.8 23 0 0 0 0 0 1 0 0 0 0 0 6 7 72.6 20 0 0 0 0 0 0 1 0 0 0 0 7 8 71.9 14 0 0 0 0 0 0 0 1 0 0 0 8 9 74.8 14 0 0 0 0 0 0 0 0 1 0 0 9 10 72.9 14 0 0 0 0 0 0 0 0 0 1 0 10 11 72.9 15 0 0 0 0 0 0 0 0 0 0 1 11 12 79.9 11 0 0 0 0 0 0 0 0 0 0 0 12 13 74.0 17 1 0 0 0 0 0 0 0 0 0 0 13 14 76.0 16 0 1 0 0 0 0 0 0 0 0 0 14 15 69.6 20 0 0 1 0 0 0 0 0 0 0 0 15 16 77.3 24 0 0 0 1 0 0 0 0 0 0 0 16 17 75.2 23 0 0 0 0 1 0 0 0 0 0 0 17 18 75.8 20 0 0 0 0 0 1 0 0 0 0 0 18 19 77.6 21 0 0 0 0 0 0 1 0 0 0 0 19 20 76.7 19 0 0 0 0 0 0 0 1 0 0 0 20 21 77.0 23 0 0 0 0 0 0 0 0 1 0 0 21 22 77.9 23 0 0 0 0 0 0 0 0 0 1 0 22 23 76.7 23 0 0 0 0 0 0 0 0 0 0 1 23 24 71.9 23 0 0 0 0 0 0 0 0 0 0 0 24 25 73.4 27 1 0 0 0 0 0 0 0 0 0 0 25 26 72.5 26 0 1 0 0 0 0 0 0 0 0 0 26 27 73.7 17 0 0 1 0 0 0 0 0 0 0 0 27 28 69.5 24 0 0 0 1 0 0 0 0 0 0 0 28 29 74.7 26 0 0 0 0 1 0 0 0 0 0 0 29 30 72.5 24 0 0 0 0 0 1 0 0 0 0 0 30 31 72.1 27 0 0 0 0 0 0 1 0 0 0 0 31 32 70.7 27 0 0 0 0 0 0 0 1 0 0 0 32 33 71.4 26 0 0 0 0 0 0 0 0 1 0 0 33 34 69.5 24 0 0 0 0 0 0 0 0 0 1 0 34 35 73.5 23 0 0 0 0 0 0 0 0 0 0 1 35 36 72.4 23 0 0 0 0 0 0 0 0 0 0 0 36 37 74.5 24 1 0 0 0 0 0 0 0 0 0 0 37 38 72.2 17 0 1 0 0 0 0 0 0 0 0 0 38 39 73.0 21 0 0 1 0 0 0 0 0 0 0 0 39 40 73.3 19 0 0 0 1 0 0 0 0 0 0 0 40 41 71.3 22 0 0 0 0 1 0 0 0 0 0 0 41 42 73.6 22 0 0 0 0 0 1 0 0 0 0 0 42 43 71.3 18 0 0 0 0 0 0 1 0 0 0 0 43 44 71.2 16 0 0 0 0 0 0 0 1 0 0 0 44 45 81.4 14 0 0 0 0 0 0 0 0 1 0 0 45 46 76.1 12 0 0 0 0 0 0 0 0 0 1 0 46 47 71.1 14 0 0 0 0 0 0 0 0 0 0 1 47 48 75.7 16 0 0 0 0 0 0 0 0 0 0 0 48 49 70.0 8 1 0 0 0 0 0 0 0 0 0 0 49 50 68.5 3 0 1 0 0 0 0 0 0 0 0 0 50 51 56.7 0 0 0 1 0 0 0 0 0 0 0 0 51 52 57.9 5 0 0 0 1 0 0 0 0 0 0 0 52 53 58.8 1 0 0 0 0 1 0 0 0 0 0 0 53 54 59.3 1 0 0 0 0 0 1 0 0 0 0 0 54 55 61.3 3 0 0 0 0 0 0 1 0 0 0 0 55 56 62.9 6 0 0 0 0 0 0 0 1 0 0 0 56 57 61.4 7 0 0 0 0 0 0 0 0 1 0 0 57 58 64.5 8 0 0 0 0 0 0 0 0 0 1 0 58 59 63.8 14 0 0 0 0 0 0 0 0 0 0 1 59 60 61.6 14 0 0 0 0 0 0 0 0 0 0 0 60 61 64.7 13 1 0 0 0 0 0 0 0 0 0 0 61 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) indcvtr M1 M2 M3 M4 72.49080 0.31943 -0.49011 -0.64971 -2.93836 -3.63307 M5 M6 M7 M8 M9 M10 -3.46504 -2.04980 -2.24623 -1.93933 0.61258 -0.05607 M11 t -0.98746 -0.15969 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -5.7814 -2.5527 -0.8166 2.5641 11.0107 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 72.49080 2.87474 25.216 < 2e-16 *** indcvtr 0.31943 0.08218 3.887 0.000317 *** M1 -0.49011 2.33374 -0.210 0.834567 M2 -0.64971 2.46642 -0.263 0.793377 M3 -2.93836 2.46727 -1.191 0.239658 M4 -3.63307 2.44440 -1.486 0.143882 M5 -3.46504 2.44078 -1.420 0.162311 M6 -2.04980 2.43927 -0.840 0.404976 M7 -2.24623 2.43743 -0.922 0.361466 M8 -1.93933 2.44009 -0.795 0.430737 M9 0.61258 2.43630 0.251 0.802569 M10 -0.05607 2.43701 -0.023 0.981743 M11 -0.98746 2.43288 -0.406 0.686671 t -0.15969 0.03341 -4.780 1.76e-05 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 3.846 on 47 degrees of freedom Multiple R-squared: 0.6418, Adjusted R-squared: 0.5427 F-statistic: 6.478 on 13 and 47 DF, p-value: 8.058e-07 > 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.56517246 0.86965508 0.4348275 [2,] 0.44061280 0.88122561 0.5593872 [3,] 0.38590334 0.77180669 0.6140967 [4,] 0.26619370 0.53238739 0.7338063 [5,] 0.19495272 0.38990544 0.8050473 [6,] 0.11830823 0.23661647 0.8816918 [7,] 0.06753506 0.13507012 0.9324649 [8,] 0.23019399 0.46038799 0.7698060 [9,] 0.20943069 0.41886138 0.7905693 [10,] 0.17790052 0.35580104 0.8220995 [11,] 0.12012022 0.24024045 0.8798798 [12,] 0.11035882 0.22071764 0.8896412 [13,] 0.07340890 0.14681780 0.9265911 [14,] 0.04832262 0.09664525 0.9516774 [15,] 0.03178659 0.06357317 0.9682134 [16,] 0.02506871 0.05013743 0.9749313 [17,] 0.03923253 0.07846506 0.9607675 [18,] 0.12003664 0.24007328 0.8799634 [19,] 0.10375242 0.20750483 0.8962476 [20,] 0.16974139 0.33948277 0.8302586 [21,] 0.31123240 0.62246480 0.6887676 [22,] 0.51683085 0.96633831 0.4831692 [23,] 0.42179340 0.84358680 0.5782066 [24,] 0.34699941 0.69399881 0.6530006 [25,] 0.25063035 0.50126070 0.7493697 [26,] 0.15849120 0.31698240 0.8415088 [27,] 0.14884733 0.29769465 0.8511527 [28,] 0.64024339 0.71951323 0.3597566 > postscript(file="/var/www/html/rcomp/tmp/163ql1260642475.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/2xx5a1260642475.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/3djow1260642475.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/4c3wm1260642475.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/5t6ex1260642475.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 = 61 Frequency = 1 1 2 3 4 5 6 2.28984164 -2.47144188 2.65747120 -1.28812669 -3.25475707 -1.02972986 7 8 9 10 11 12 -2.91532775 -1.84595284 -1.33818111 -2.40983871 -1.63818111 5.81176447 13 14 15 16 17 18 -1.35500809 1.28370839 -3.94566652 3.33101829 1.54210521 1.84484973 19 20 21 22 23 24 3.68153454 3.27319214 -0.09675344 1.63158896 1.52267588 -4.10509585 25 26 27 28 29 30 -3.23300975 -3.49429327 3.02891308 -2.55269010 2.00010884 -0.81657596 31 32 33 34 35 36 -1.81874981 -3.36595087 -4.73874981 -5.17154875 0.23896750 -1.68880423 37 38 39 40 41 42 0.74156984 0.99686229 2.96748738 4.76074815 1.79411776 2.83857430 43 44 45 46 47 48 2.17240575 2.56406334 11.01069373 7.17789479 2.63012306 5.76349267 49 50 51 52 53 54 3.26873069 3.68516448 -4.70820513 -4.25094965 -2.08157475 -2.83711821 55 56 57 58 59 60 -1.11986273 -0.62535177 -4.83700937 -1.22809629 -2.75358533 -5.78135706 61 -1.71212433 > postscript(file="/var/www/html/rcomp/tmp/6vn571260642475.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 = 61 Frequency = 1 lag(myerror, k = 1) myerror 0 2.28984164 NA 1 -2.47144188 2.28984164 2 2.65747120 -2.47144188 3 -1.28812669 2.65747120 4 -3.25475707 -1.28812669 5 -1.02972986 -3.25475707 6 -2.91532775 -1.02972986 7 -1.84595284 -2.91532775 8 -1.33818111 -1.84595284 9 -2.40983871 -1.33818111 10 -1.63818111 -2.40983871 11 5.81176447 -1.63818111 12 -1.35500809 5.81176447 13 1.28370839 -1.35500809 14 -3.94566652 1.28370839 15 3.33101829 -3.94566652 16 1.54210521 3.33101829 17 1.84484973 1.54210521 18 3.68153454 1.84484973 19 3.27319214 3.68153454 20 -0.09675344 3.27319214 21 1.63158896 -0.09675344 22 1.52267588 1.63158896 23 -4.10509585 1.52267588 24 -3.23300975 -4.10509585 25 -3.49429327 -3.23300975 26 3.02891308 -3.49429327 27 -2.55269010 3.02891308 28 2.00010884 -2.55269010 29 -0.81657596 2.00010884 30 -1.81874981 -0.81657596 31 -3.36595087 -1.81874981 32 -4.73874981 -3.36595087 33 -5.17154875 -4.73874981 34 0.23896750 -5.17154875 35 -1.68880423 0.23896750 36 0.74156984 -1.68880423 37 0.99686229 0.74156984 38 2.96748738 0.99686229 39 4.76074815 2.96748738 40 1.79411776 4.76074815 41 2.83857430 1.79411776 42 2.17240575 2.83857430 43 2.56406334 2.17240575 44 11.01069373 2.56406334 45 7.17789479 11.01069373 46 2.63012306 7.17789479 47 5.76349267 2.63012306 48 3.26873069 5.76349267 49 3.68516448 3.26873069 50 -4.70820513 3.68516448 51 -4.25094965 -4.70820513 52 -2.08157475 -4.25094965 53 -2.83711821 -2.08157475 54 -1.11986273 -2.83711821 55 -0.62535177 -1.11986273 56 -4.83700937 -0.62535177 57 -1.22809629 -4.83700937 58 -2.75358533 -1.22809629 59 -5.78135706 -2.75358533 60 -1.71212433 -5.78135706 61 NA -1.71212433 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -2.47144188 2.28984164 [2,] 2.65747120 -2.47144188 [3,] -1.28812669 2.65747120 [4,] -3.25475707 -1.28812669 [5,] -1.02972986 -3.25475707 [6,] -2.91532775 -1.02972986 [7,] -1.84595284 -2.91532775 [8,] -1.33818111 -1.84595284 [9,] -2.40983871 -1.33818111 [10,] -1.63818111 -2.40983871 [11,] 5.81176447 -1.63818111 [12,] -1.35500809 5.81176447 [13,] 1.28370839 -1.35500809 [14,] -3.94566652 1.28370839 [15,] 3.33101829 -3.94566652 [16,] 1.54210521 3.33101829 [17,] 1.84484973 1.54210521 [18,] 3.68153454 1.84484973 [19,] 3.27319214 3.68153454 [20,] -0.09675344 3.27319214 [21,] 1.63158896 -0.09675344 [22,] 1.52267588 1.63158896 [23,] -4.10509585 1.52267588 [24,] -3.23300975 -4.10509585 [25,] -3.49429327 -3.23300975 [26,] 3.02891308 -3.49429327 [27,] -2.55269010 3.02891308 [28,] 2.00010884 -2.55269010 [29,] -0.81657596 2.00010884 [30,] -1.81874981 -0.81657596 [31,] -3.36595087 -1.81874981 [32,] -4.73874981 -3.36595087 [33,] -5.17154875 -4.73874981 [34,] 0.23896750 -5.17154875 [35,] -1.68880423 0.23896750 [36,] 0.74156984 -1.68880423 [37,] 0.99686229 0.74156984 [38,] 2.96748738 0.99686229 [39,] 4.76074815 2.96748738 [40,] 1.79411776 4.76074815 [41,] 2.83857430 1.79411776 [42,] 2.17240575 2.83857430 [43,] 2.56406334 2.17240575 [44,] 11.01069373 2.56406334 [45,] 7.17789479 11.01069373 [46,] 2.63012306 7.17789479 [47,] 5.76349267 2.63012306 [48,] 3.26873069 5.76349267 [49,] 3.68516448 3.26873069 [50,] -4.70820513 3.68516448 [51,] -4.25094965 -4.70820513 [52,] -2.08157475 -4.25094965 [53,] -2.83711821 -2.08157475 [54,] -1.11986273 -2.83711821 [55,] -0.62535177 -1.11986273 [56,] -4.83700937 -0.62535177 [57,] -1.22809629 -4.83700937 [58,] -2.75358533 -1.22809629 [59,] -5.78135706 -2.75358533 [60,] -1.71212433 -5.78135706 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -2.47144188 2.28984164 2 2.65747120 -2.47144188 3 -1.28812669 2.65747120 4 -3.25475707 -1.28812669 5 -1.02972986 -3.25475707 6 -2.91532775 -1.02972986 7 -1.84595284 -2.91532775 8 -1.33818111 -1.84595284 9 -2.40983871 -1.33818111 10 -1.63818111 -2.40983871 11 5.81176447 -1.63818111 12 -1.35500809 5.81176447 13 1.28370839 -1.35500809 14 -3.94566652 1.28370839 15 3.33101829 -3.94566652 16 1.54210521 3.33101829 17 1.84484973 1.54210521 18 3.68153454 1.84484973 19 3.27319214 3.68153454 20 -0.09675344 3.27319214 21 1.63158896 -0.09675344 22 1.52267588 1.63158896 23 -4.10509585 1.52267588 24 -3.23300975 -4.10509585 25 -3.49429327 -3.23300975 26 3.02891308 -3.49429327 27 -2.55269010 3.02891308 28 2.00010884 -2.55269010 29 -0.81657596 2.00010884 30 -1.81874981 -0.81657596 31 -3.36595087 -1.81874981 32 -4.73874981 -3.36595087 33 -5.17154875 -4.73874981 34 0.23896750 -5.17154875 35 -1.68880423 0.23896750 36 0.74156984 -1.68880423 37 0.99686229 0.74156984 38 2.96748738 0.99686229 39 4.76074815 2.96748738 40 1.79411776 4.76074815 41 2.83857430 1.79411776 42 2.17240575 2.83857430 43 2.56406334 2.17240575 44 11.01069373 2.56406334 45 7.17789479 11.01069373 46 2.63012306 7.17789479 47 5.76349267 2.63012306 48 3.26873069 5.76349267 49 3.68516448 3.26873069 50 -4.70820513 3.68516448 51 -4.25094965 -4.70820513 52 -2.08157475 -4.25094965 53 -2.83711821 -2.08157475 54 -1.11986273 -2.83711821 55 -0.62535177 -1.11986273 56 -4.83700937 -0.62535177 57 -1.22809629 -4.83700937 58 -2.75358533 -1.22809629 59 -5.78135706 -2.75358533 60 -1.71212433 -5.78135706 > 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/707vx1260642475.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/8y7dq1260642475.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/9wtwu1260642475.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/10p3t11260642475.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/11l6te1260642476.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/12pie61260642476.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/13jgvd1260642476.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/14u5w81260642476.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/15uud31260642476.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/161ksf1260642476.tab") + } > > try(system("convert tmp/163ql1260642475.ps tmp/163ql1260642475.png",intern=TRUE)) character(0) > try(system("convert tmp/2xx5a1260642475.ps tmp/2xx5a1260642475.png",intern=TRUE)) character(0) > try(system("convert tmp/3djow1260642475.ps tmp/3djow1260642475.png",intern=TRUE)) character(0) > try(system("convert tmp/4c3wm1260642475.ps tmp/4c3wm1260642475.png",intern=TRUE)) character(0) > try(system("convert tmp/5t6ex1260642475.ps tmp/5t6ex1260642475.png",intern=TRUE)) character(0) > try(system("convert tmp/6vn571260642475.ps tmp/6vn571260642475.png",intern=TRUE)) character(0) > try(system("convert tmp/707vx1260642475.ps tmp/707vx1260642475.png",intern=TRUE)) character(0) > try(system("convert tmp/8y7dq1260642475.ps tmp/8y7dq1260642475.png",intern=TRUE)) character(0) > try(system("convert tmp/9wtwu1260642475.ps tmp/9wtwu1260642475.png",intern=TRUE)) character(0) > try(system("convert tmp/10p3t11260642475.ps tmp/10p3t11260642475.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.384 1.530 3.605