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(96.8,92.9,114.1,107.7,110.3,103.5,103.9,91.1,101.6,79.8,94.6,71.9,95.9,82.9,104.7,90.1,102.8,100.7,98.1,90.7,113.9,108.8,80.9,44.1,95.7,93.6,113.2,107.4,105.9,96.5,108.8,93.6,102.3,76.5,99,76.7,100.7,84,115.5,103.3,100.7,88.5,109.9,99,114.6,105.9,85.4,44.7,100.5,94,114.8,107.1,116.5,104.8,112.9,102.5,102,77.7,106,85.2,105.3,91.3,118.8,106.5,106.1,92.4,109.3,97.5,117.2,107,92.5,51.1,104.2,98.6,112.5,102.2,122.4,114.3,113.3,99.4,100,72.5,110.7,92.3,112.8,99.4,109.8,85.9,117.3,109.4,109.1,97.6,115.9,104.7,96,56.9,99.8,86.7,116.8,108.5,115.7,103.4,99.4,86.2,94.3,71,91,75.9,93.2,87.1,103.1,102,94.1,88.5,91.8,87.8,102.7,100.8,82.6,50.6),dim=c(2,60),dimnames=list(c('Totind','Bouw'),1:60)) > y <- array(NA,dim=c(2,60),dimnames=list(c('Totind','Bouw'),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 Totind Bouw M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 1 96.8 92.9 1 0 0 0 0 0 0 0 0 0 0 2 114.1 107.7 0 1 0 0 0 0 0 0 0 0 0 3 110.3 103.5 0 0 1 0 0 0 0 0 0 0 0 4 103.9 91.1 0 0 0 1 0 0 0 0 0 0 0 5 101.6 79.8 0 0 0 0 1 0 0 0 0 0 0 6 94.6 71.9 0 0 0 0 0 1 0 0 0 0 0 7 95.9 82.9 0 0 0 0 0 0 1 0 0 0 0 8 104.7 90.1 0 0 0 0 0 0 0 1 0 0 0 9 102.8 100.7 0 0 0 0 0 0 0 0 1 0 0 10 98.1 90.7 0 0 0 0 0 0 0 0 0 1 0 11 113.9 108.8 0 0 0 0 0 0 0 0 0 0 1 12 80.9 44.1 0 0 0 0 0 0 0 0 0 0 0 13 95.7 93.6 1 0 0 0 0 0 0 0 0 0 0 14 113.2 107.4 0 1 0 0 0 0 0 0 0 0 0 15 105.9 96.5 0 0 1 0 0 0 0 0 0 0 0 16 108.8 93.6 0 0 0 1 0 0 0 0 0 0 0 17 102.3 76.5 0 0 0 0 1 0 0 0 0 0 0 18 99.0 76.7 0 0 0 0 0 1 0 0 0 0 0 19 100.7 84.0 0 0 0 0 0 0 1 0 0 0 0 20 115.5 103.3 0 0 0 0 0 0 0 1 0 0 0 21 100.7 88.5 0 0 0 0 0 0 0 0 1 0 0 22 109.9 99.0 0 0 0 0 0 0 0 0 0 1 0 23 114.6 105.9 0 0 0 0 0 0 0 0 0 0 1 24 85.4 44.7 0 0 0 0 0 0 0 0 0 0 0 25 100.5 94.0 1 0 0 0 0 0 0 0 0 0 0 26 114.8 107.1 0 1 0 0 0 0 0 0 0 0 0 27 116.5 104.8 0 0 1 0 0 0 0 0 0 0 0 28 112.9 102.5 0 0 0 1 0 0 0 0 0 0 0 29 102.0 77.7 0 0 0 0 1 0 0 0 0 0 0 30 106.0 85.2 0 0 0 0 0 1 0 0 0 0 0 31 105.3 91.3 0 0 0 0 0 0 1 0 0 0 0 32 118.8 106.5 0 0 0 0 0 0 0 1 0 0 0 33 106.1 92.4 0 0 0 0 0 0 0 0 1 0 0 34 109.3 97.5 0 0 0 0 0 0 0 0 0 1 0 35 117.2 107.0 0 0 0 0 0 0 0 0 0 0 1 36 92.5 51.1 0 0 0 0 0 0 0 0 0 0 0 37 104.2 98.6 1 0 0 0 0 0 0 0 0 0 0 38 112.5 102.2 0 1 0 0 0 0 0 0 0 0 0 39 122.4 114.3 0 0 1 0 0 0 0 0 0 0 0 40 113.3 99.4 0 0 0 1 0 0 0 0 0 0 0 41 100.0 72.5 0 0 0 0 1 0 0 0 0 0 0 42 110.7 92.3 0 0 0 0 0 1 0 0 0 0 0 43 112.8 99.4 0 0 0 0 0 0 1 0 0 0 0 44 109.8 85.9 0 0 0 0 0 0 0 1 0 0 0 45 117.3 109.4 0 0 0 0 0 0 0 0 1 0 0 46 109.1 97.6 0 0 0 0 0 0 0 0 0 1 0 47 115.9 104.7 0 0 0 0 0 0 0 0 0 0 1 48 96.0 56.9 0 0 0 0 0 0 0 0 0 0 0 49 99.8 86.7 1 0 0 0 0 0 0 0 0 0 0 50 116.8 108.5 0 1 0 0 0 0 0 0 0 0 0 51 115.7 103.4 0 0 1 0 0 0 0 0 0 0 0 52 99.4 86.2 0 0 0 1 0 0 0 0 0 0 0 53 94.3 71.0 0 0 0 0 1 0 0 0 0 0 0 54 91.0 75.9 0 0 0 0 0 1 0 0 0 0 0 55 93.2 87.1 0 0 0 0 0 0 1 0 0 0 0 56 103.1 102.0 0 0 0 0 0 0 0 1 0 0 0 57 94.1 88.5 0 0 0 0 0 0 0 0 1 0 0 58 91.8 87.8 0 0 0 0 0 0 0 0 0 1 0 59 102.7 100.8 0 0 0 0 0 0 0 0 0 0 1 60 82.6 50.6 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) Bouw M1 M2 M3 M4 46.4686 0.8288 -24.2841 -20.5273 -18.9233 -17.1845 M5 M6 M7 M8 M9 M10 -9.0066 -12.8480 -18.6064 -16.9511 -21.7552 -21.1713 M11 -21.0024 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -10.960 -1.821 0.540 2.161 9.084 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 46.46856 4.78929 9.703 8.41e-13 *** Bouw 0.82885 0.09028 9.181 4.69e-12 *** M1 -24.28412 4.63836 -5.235 3.78e-06 *** M2 -20.52727 5.70425 -3.599 0.000767 *** M3 -18.92326 5.53512 -3.419 0.001309 ** M4 -17.18450 4.74629 -3.621 0.000718 *** M5 -9.00665 3.38840 -2.658 0.010707 * M6 -12.84800 3.70883 -3.464 0.001145 ** M7 -18.60637 4.31910 -4.308 8.34e-05 *** M8 -16.95105 4.98049 -3.403 0.001369 ** M9 -21.75516 4.85043 -4.485 4.68e-05 *** M10 -21.17135 4.74319 -4.464 5.02e-05 *** M11 -21.00238 5.61140 -3.743 0.000495 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 3.861 on 47 degrees of freedom Multiple R-squared: 0.8675, Adjusted R-squared: 0.8337 F-statistic: 25.64 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,] 5.054000e-02 1.010800e-01 0.9494600 [2,] 3.479770e-02 6.959540e-02 0.9652023 [3,] 1.303499e-02 2.606999e-02 0.9869650 [4,] 1.655242e-02 3.310483e-02 0.9834476 [5,] 5.984594e-03 1.196919e-02 0.9940154 [6,] 1.734448e-02 3.468896e-02 0.9826555 [7,] 3.401371e-02 6.802742e-02 0.9659863 [8,] 2.029151e-02 4.058303e-02 0.9797085 [9,] 1.583291e-02 3.166582e-02 0.9841671 [10,] 1.285099e-02 2.570198e-02 0.9871490 [11,] 6.572852e-03 1.314570e-02 0.9934271 [12,] 7.173855e-03 1.434771e-02 0.9928261 [13,] 3.494481e-03 6.988961e-03 0.9965055 [14,] 1.536392e-03 3.072784e-03 0.9984636 [15,] 7.666563e-04 1.533313e-03 0.9992333 [16,] 3.671860e-04 7.343720e-04 0.9996328 [17,] 1.493940e-04 2.987881e-04 0.9998506 [18,] 3.656393e-04 7.312785e-04 0.9996344 [19,] 2.547887e-04 5.095775e-04 0.9997452 [20,] 1.666751e-04 3.333503e-04 0.9998333 [21,] 1.565433e-04 3.130867e-04 0.9998435 [22,] 1.075581e-04 2.151162e-04 0.9998924 [23,] 5.113612e-05 1.022722e-04 0.9999489 [24,] 2.104395e-05 4.208790e-05 0.9999790 [25,] 7.318151e-06 1.463630e-05 0.9999927 [26,] 3.279883e-06 6.559766e-06 0.9999967 [27,] 1.043012e-06 2.086024e-06 0.9999990 [28,] 7.507274e-07 1.501455e-06 0.9999992 [29,] 4.206855e-02 8.413710e-02 0.9579314 > postscript(file="/var/www/html/rcomp/tmp/1oje71258727878.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/2bp9f1258727878.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/3q0yt1258727878.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/4l01h1258727878.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/5n8i81258727878.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.38449931 -1.10831066 -3.03115120 -0.89218315 -2.00404984 1.38521480 7 8 9 10 11 12 -0.67375325 0.50321204 -5.37847424 -2.37379759 -1.74493197 -2.12079346 13 14 15 16 17 18 -4.06469347 -1.75965602 -1.62920960 1.93569485 1.43115120 1.80674056 19 20 21 22 23 24 3.21451307 0.36240789 2.63348112 2.54675738 1.35872955 1.88189726 25 26 27 28 29 30 0.40376701 0.08899862 2.09134536 -1.34105947 0.13653264 1.76152576 31 32 33 34 35 36 1.76391683 1.01009173 4.80097080 3.19003058 3.04699587 3.67726494 37 38 39 40 41 42 0.29106253 1.85035774 0.11728176 1.62837181 2.44654640 0.57669929 43 44 45 46 47 48 2.55024156 9.08437700 1.91054121 2.90714570 3.65334811 2.36994191 49 50 51 52 53 54 5.75436325 0.92861030 2.45173368 -1.33082404 -2.01018040 -5.53018040 55 56 57 58 59 60 -6.85491821 -10.96008867 -3.96651888 -6.27013607 -6.31414157 -5.80831066 > postscript(file="/var/www/html/rcomp/tmp/6mzxj1258727878.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.38449931 NA 1 -1.10831066 -2.38449931 2 -3.03115120 -1.10831066 3 -0.89218315 -3.03115120 4 -2.00404984 -0.89218315 5 1.38521480 -2.00404984 6 -0.67375325 1.38521480 7 0.50321204 -0.67375325 8 -5.37847424 0.50321204 9 -2.37379759 -5.37847424 10 -1.74493197 -2.37379759 11 -2.12079346 -1.74493197 12 -4.06469347 -2.12079346 13 -1.75965602 -4.06469347 14 -1.62920960 -1.75965602 15 1.93569485 -1.62920960 16 1.43115120 1.93569485 17 1.80674056 1.43115120 18 3.21451307 1.80674056 19 0.36240789 3.21451307 20 2.63348112 0.36240789 21 2.54675738 2.63348112 22 1.35872955 2.54675738 23 1.88189726 1.35872955 24 0.40376701 1.88189726 25 0.08899862 0.40376701 26 2.09134536 0.08899862 27 -1.34105947 2.09134536 28 0.13653264 -1.34105947 29 1.76152576 0.13653264 30 1.76391683 1.76152576 31 1.01009173 1.76391683 32 4.80097080 1.01009173 33 3.19003058 4.80097080 34 3.04699587 3.19003058 35 3.67726494 3.04699587 36 0.29106253 3.67726494 37 1.85035774 0.29106253 38 0.11728176 1.85035774 39 1.62837181 0.11728176 40 2.44654640 1.62837181 41 0.57669929 2.44654640 42 2.55024156 0.57669929 43 9.08437700 2.55024156 44 1.91054121 9.08437700 45 2.90714570 1.91054121 46 3.65334811 2.90714570 47 2.36994191 3.65334811 48 5.75436325 2.36994191 49 0.92861030 5.75436325 50 2.45173368 0.92861030 51 -1.33082404 2.45173368 52 -2.01018040 -1.33082404 53 -5.53018040 -2.01018040 54 -6.85491821 -5.53018040 55 -10.96008867 -6.85491821 56 -3.96651888 -10.96008867 57 -6.27013607 -3.96651888 58 -6.31414157 -6.27013607 59 -5.80831066 -6.31414157 60 NA -5.80831066 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -1.10831066 -2.38449931 [2,] -3.03115120 -1.10831066 [3,] -0.89218315 -3.03115120 [4,] -2.00404984 -0.89218315 [5,] 1.38521480 -2.00404984 [6,] -0.67375325 1.38521480 [7,] 0.50321204 -0.67375325 [8,] -5.37847424 0.50321204 [9,] -2.37379759 -5.37847424 [10,] -1.74493197 -2.37379759 [11,] -2.12079346 -1.74493197 [12,] -4.06469347 -2.12079346 [13,] -1.75965602 -4.06469347 [14,] -1.62920960 -1.75965602 [15,] 1.93569485 -1.62920960 [16,] 1.43115120 1.93569485 [17,] 1.80674056 1.43115120 [18,] 3.21451307 1.80674056 [19,] 0.36240789 3.21451307 [20,] 2.63348112 0.36240789 [21,] 2.54675738 2.63348112 [22,] 1.35872955 2.54675738 [23,] 1.88189726 1.35872955 [24,] 0.40376701 1.88189726 [25,] 0.08899862 0.40376701 [26,] 2.09134536 0.08899862 [27,] -1.34105947 2.09134536 [28,] 0.13653264 -1.34105947 [29,] 1.76152576 0.13653264 [30,] 1.76391683 1.76152576 [31,] 1.01009173 1.76391683 [32,] 4.80097080 1.01009173 [33,] 3.19003058 4.80097080 [34,] 3.04699587 3.19003058 [35,] 3.67726494 3.04699587 [36,] 0.29106253 3.67726494 [37,] 1.85035774 0.29106253 [38,] 0.11728176 1.85035774 [39,] 1.62837181 0.11728176 [40,] 2.44654640 1.62837181 [41,] 0.57669929 2.44654640 [42,] 2.55024156 0.57669929 [43,] 9.08437700 2.55024156 [44,] 1.91054121 9.08437700 [45,] 2.90714570 1.91054121 [46,] 3.65334811 2.90714570 [47,] 2.36994191 3.65334811 [48,] 5.75436325 2.36994191 [49,] 0.92861030 5.75436325 [50,] 2.45173368 0.92861030 [51,] -1.33082404 2.45173368 [52,] -2.01018040 -1.33082404 [53,] -5.53018040 -2.01018040 [54,] -6.85491821 -5.53018040 [55,] -10.96008867 -6.85491821 [56,] -3.96651888 -10.96008867 [57,] -6.27013607 -3.96651888 [58,] -6.31414157 -6.27013607 [59,] -5.80831066 -6.31414157 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -1.10831066 -2.38449931 2 -3.03115120 -1.10831066 3 -0.89218315 -3.03115120 4 -2.00404984 -0.89218315 5 1.38521480 -2.00404984 6 -0.67375325 1.38521480 7 0.50321204 -0.67375325 8 -5.37847424 0.50321204 9 -2.37379759 -5.37847424 10 -1.74493197 -2.37379759 11 -2.12079346 -1.74493197 12 -4.06469347 -2.12079346 13 -1.75965602 -4.06469347 14 -1.62920960 -1.75965602 15 1.93569485 -1.62920960 16 1.43115120 1.93569485 17 1.80674056 1.43115120 18 3.21451307 1.80674056 19 0.36240789 3.21451307 20 2.63348112 0.36240789 21 2.54675738 2.63348112 22 1.35872955 2.54675738 23 1.88189726 1.35872955 24 0.40376701 1.88189726 25 0.08899862 0.40376701 26 2.09134536 0.08899862 27 -1.34105947 2.09134536 28 0.13653264 -1.34105947 29 1.76152576 0.13653264 30 1.76391683 1.76152576 31 1.01009173 1.76391683 32 4.80097080 1.01009173 33 3.19003058 4.80097080 34 3.04699587 3.19003058 35 3.67726494 3.04699587 36 0.29106253 3.67726494 37 1.85035774 0.29106253 38 0.11728176 1.85035774 39 1.62837181 0.11728176 40 2.44654640 1.62837181 41 0.57669929 2.44654640 42 2.55024156 0.57669929 43 9.08437700 2.55024156 44 1.91054121 9.08437700 45 2.90714570 1.91054121 46 3.65334811 2.90714570 47 2.36994191 3.65334811 48 5.75436325 2.36994191 49 0.92861030 5.75436325 50 2.45173368 0.92861030 51 -1.33082404 2.45173368 52 -2.01018040 -1.33082404 53 -5.53018040 -2.01018040 54 -6.85491821 -5.53018040 55 -10.96008867 -6.85491821 56 -3.96651888 -10.96008867 57 -6.27013607 -3.96651888 58 -6.31414157 -6.27013607 59 -5.80831066 -6.31414157 > 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/7dmna1258727878.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/86nwy1258727878.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/9tt8h1258727878.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/10wnq01258727878.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/11i6gh1258727878.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/12tyq41258727878.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/13zlw51258727878.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/1429wa1258727878.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/15kqla1258727878.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/163drf1258727878.tab") + } > > system("convert tmp/1oje71258727878.ps tmp/1oje71258727878.png") > system("convert tmp/2bp9f1258727878.ps tmp/2bp9f1258727878.png") > system("convert tmp/3q0yt1258727878.ps tmp/3q0yt1258727878.png") > system("convert tmp/4l01h1258727878.ps tmp/4l01h1258727878.png") > system("convert tmp/5n8i81258727878.ps tmp/5n8i81258727878.png") > system("convert tmp/6mzxj1258727878.ps tmp/6mzxj1258727878.png") > system("convert tmp/7dmna1258727878.ps tmp/7dmna1258727878.png") > system("convert tmp/86nwy1258727878.ps tmp/86nwy1258727878.png") > system("convert tmp/9tt8h1258727878.ps tmp/9tt8h1258727878.png") > system("convert tmp/10wnq01258727878.ps tmp/10wnq01258727878.png") > > > proc.time() user system elapsed 2.522 1.661 4.683