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(2.155,22.782,2.172,19.169,2.15,13.807,2.533,29.743,2.058,25.591,2.16,29.096,2.26,26.482,2.498,22.405,2.695,27.044,2.799,17.97,2.947,18.73,2.93,19.684,2.318,19.785,2.54,18.479,2.57,10.698,2.669,31.956,2.45,29.506,2.842,34.506,3.44,27.165,2.678,26.736,2.981,23.691,2.26,18.157,2.844,17.328,2.546,18.205,2.456,20.995,2.295,17.382,2.379,9.367,2.479,31.124,2.057,26.551,2.28,30.651,2.351,25.859,2.276,25.1,2.548,25.778,2.311,20.418,2.201,18.688,2.725,20.424,2.408,24.776,2.139,19.814,1.898,12.738,2.537,31.566,2.069,30.111,2.063,30.019,2.524,31.934,2.437,25.826,2.189,26.835,2.793,20.205,2.074,17.789,2.622,20.52,2.278,22.518,2.144,15.572,2.427,11.509,2.139,25.447,1.828,24.09,2.072,27.786,1.8,26.195,1.758,20.516,2.246,22.759,1.987,19.028,1.868,16.971,2.514,20.036,2.121,22.485),dim=c(2,61),dimnames=list(c('geb','aut'),1:61)) > y <- array(NA,dim=c(2,61),dimnames=list(c('geb','aut'),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 = '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 geb aut M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t 1 2.155 22.782 1 0 0 0 0 0 0 0 0 0 0 1 2 2.172 19.169 0 1 0 0 0 0 0 0 0 0 0 2 3 2.150 13.807 0 0 1 0 0 0 0 0 0 0 0 3 4 2.533 29.743 0 0 0 1 0 0 0 0 0 0 0 4 5 2.058 25.591 0 0 0 0 1 0 0 0 0 0 0 5 6 2.160 29.096 0 0 0 0 0 1 0 0 0 0 0 6 7 2.260 26.482 0 0 0 0 0 0 1 0 0 0 0 7 8 2.498 22.405 0 0 0 0 0 0 0 1 0 0 0 8 9 2.695 27.044 0 0 0 0 0 0 0 0 1 0 0 9 10 2.799 17.970 0 0 0 0 0 0 0 0 0 1 0 10 11 2.947 18.730 0 0 0 0 0 0 0 0 0 0 1 11 12 2.930 19.684 0 0 0 0 0 0 0 0 0 0 0 12 13 2.318 19.785 1 0 0 0 0 0 0 0 0 0 0 13 14 2.540 18.479 0 1 0 0 0 0 0 0 0 0 0 14 15 2.570 10.698 0 0 1 0 0 0 0 0 0 0 0 15 16 2.669 31.956 0 0 0 1 0 0 0 0 0 0 0 16 17 2.450 29.506 0 0 0 0 1 0 0 0 0 0 0 17 18 2.842 34.506 0 0 0 0 0 1 0 0 0 0 0 18 19 3.440 27.165 0 0 0 0 0 0 1 0 0 0 0 19 20 2.678 26.736 0 0 0 0 0 0 0 1 0 0 0 20 21 2.981 23.691 0 0 0 0 0 0 0 0 1 0 0 21 22 2.260 18.157 0 0 0 0 0 0 0 0 0 1 0 22 23 2.844 17.328 0 0 0 0 0 0 0 0 0 0 1 23 24 2.546 18.205 0 0 0 0 0 0 0 0 0 0 0 24 25 2.456 20.995 1 0 0 0 0 0 0 0 0 0 0 25 26 2.295 17.382 0 1 0 0 0 0 0 0 0 0 0 26 27 2.379 9.367 0 0 1 0 0 0 0 0 0 0 0 27 28 2.479 31.124 0 0 0 1 0 0 0 0 0 0 0 28 29 2.057 26.551 0 0 0 0 1 0 0 0 0 0 0 29 30 2.280 30.651 0 0 0 0 0 1 0 0 0 0 0 30 31 2.351 25.859 0 0 0 0 0 0 1 0 0 0 0 31 32 2.276 25.100 0 0 0 0 0 0 0 1 0 0 0 32 33 2.548 25.778 0 0 0 0 0 0 0 0 1 0 0 33 34 2.311 20.418 0 0 0 0 0 0 0 0 0 1 0 34 35 2.201 18.688 0 0 0 0 0 0 0 0 0 0 1 35 36 2.725 20.424 0 0 0 0 0 0 0 0 0 0 0 36 37 2.408 24.776 1 0 0 0 0 0 0 0 0 0 0 37 38 2.139 19.814 0 1 0 0 0 0 0 0 0 0 0 38 39 1.898 12.738 0 0 1 0 0 0 0 0 0 0 0 39 40 2.537 31.566 0 0 0 1 0 0 0 0 0 0 0 40 41 2.069 30.111 0 0 0 0 1 0 0 0 0 0 0 41 42 2.063 30.019 0 0 0 0 0 1 0 0 0 0 0 42 43 2.524 31.934 0 0 0 0 0 0 1 0 0 0 0 43 44 2.437 25.826 0 0 0 0 0 0 0 1 0 0 0 44 45 2.189 26.835 0 0 0 0 0 0 0 0 1 0 0 45 46 2.793 20.205 0 0 0 0 0 0 0 0 0 1 0 46 47 2.074 17.789 0 0 0 0 0 0 0 0 0 0 1 47 48 2.622 20.520 0 0 0 0 0 0 0 0 0 0 0 48 49 2.278 22.518 1 0 0 0 0 0 0 0 0 0 0 49 50 2.144 15.572 0 1 0 0 0 0 0 0 0 0 0 50 51 2.427 11.509 0 0 1 0 0 0 0 0 0 0 0 51 52 2.139 25.447 0 0 0 1 0 0 0 0 0 0 0 52 53 1.828 24.090 0 0 0 0 1 0 0 0 0 0 0 53 54 2.072 27.786 0 0 0 0 0 1 0 0 0 0 0 54 55 1.800 26.195 0 0 0 0 0 0 1 0 0 0 0 55 56 1.758 20.516 0 0 0 0 0 0 0 1 0 0 0 56 57 2.246 22.759 0 0 0 0 0 0 0 0 1 0 0 57 58 1.987 19.028 0 0 0 0 0 0 0 0 0 1 0 58 59 1.868 16.971 0 0 0 0 0 0 0 0 0 0 1 59 60 2.514 20.036 0 0 0 0 0 0 0 0 0 0 0 60 61 2.121 22.485 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) aut M1 M2 M3 M4 2.184673 0.039357 -0.515523 -0.424949 -0.135718 -0.662851 M5 M6 M7 M8 M9 M10 -0.923545 -0.851924 -0.538586 -0.541754 -0.374627 -0.229487 M11 t -0.215109 -0.008209 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -0.42557 -0.16868 0.00812 0.13883 0.88074 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 2.184673 0.422630 5.169 4.74e-06 *** aut 0.039357 0.019602 2.008 0.050427 . M1 -0.515523 0.170905 -3.016 0.004119 ** M2 -0.424949 0.176354 -2.410 0.019937 * M3 -0.135718 0.236876 -0.573 0.569411 M4 -0.662851 0.261951 -2.530 0.014801 * M5 -0.923545 0.223612 -4.130 0.000148 *** M6 -0.851924 0.268830 -3.169 0.002690 ** M7 -0.538586 0.228334 -2.359 0.022545 * M8 -0.541754 0.191054 -2.836 0.006725 ** M9 -0.374627 0.201596 -1.858 0.069395 . M10 -0.229487 0.171965 -1.334 0.188471 M11 -0.215109 0.175407 -1.226 0.226180 t -0.008209 0.002023 -4.058 0.000186 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 0.2711 on 47 degrees of freedom Multiple R-squared: 0.4639, Adjusted R-squared: 0.3157 F-statistic: 3.129 on 13 and 47 DF, p-value: 0.002041 > 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.09156801 0.18313602 0.90843199 [2,] 0.10675358 0.21350716 0.89324642 [3,] 0.78483770 0.43032460 0.21516230 [4,] 0.76101703 0.47796594 0.23898297 [5,] 0.73233656 0.53532688 0.26766344 [6,] 0.95115056 0.09769888 0.04884944 [7,] 0.97948197 0.04103605 0.02051803 [8,] 0.98594197 0.02811607 0.01405803 [9,] 0.97427624 0.05144752 0.02572376 [10,] 0.96297887 0.07404227 0.03702113 [11,] 0.94373676 0.11252647 0.05626324 [12,] 0.93218859 0.13562282 0.06781141 [13,] 0.91173883 0.17652234 0.08826117 [14,] 0.88328106 0.23343787 0.11671894 [15,] 0.89980738 0.20038524 0.10019262 [16,] 0.87491955 0.25016090 0.12508045 [17,] 0.84976873 0.30046255 0.15023127 [18,] 0.82155777 0.35688446 0.17844223 [19,] 0.82825439 0.34349122 0.17174561 [20,] 0.75152810 0.49694380 0.24847190 [21,] 0.65656687 0.68686626 0.34343313 [22,] 0.60143958 0.79712083 0.39856042 [23,] 0.80641772 0.38716456 0.19358228 [24,] 0.70920674 0.58158652 0.29079326 [25,] 0.63193089 0.73613822 0.36806911 [26,] 0.59336639 0.81326723 0.40663361 [27,] 0.48175271 0.96350543 0.51824729 [28,] 0.47889557 0.95779114 0.52110443 > postscript(file="/var/www/html/rcomp/tmp/1cs1q1258722186.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/23wdk1258722186.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/38xsb1258722186.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/472e71258722186.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/5jwpg1258722186.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 -0.402573359 -0.325741154 -0.417731545 -0.126583462 -0.169270447 -0.268629214 7 8 9 10 11 12 -0.370879222 0.038956165 -0.105539404 0.218654374 0.330573599 0.069126955 13 14 15 16 17 18 -0.023116726 0.167918840 0.223133074 0.020823112 0.167150484 0.298952977 19 20 21 22 23 24 0.880743588 0.147004577 0.410928326 -0.229201735 0.381255790 -0.158160364 25 26 27 28 29 30 0.165764936 0.064597140 0.183020916 -0.037928197 -0.011045878 -0.012822070 31 32 33 34 35 36 -0.058352496 -0.092103691 -0.005706116 -0.168684298 -0.216766101 0.032010068 37 38 39 40 41 42 0.067459707 -0.088615473 -0.332147936 0.101179654 -0.040653206 -0.106444783 43 44 45 46 47 48 -0.025942721 0.138826768 -0.307802830 0.420202399 -0.209880490 0.023735446 49 50 51 52 53 54 0.124831504 0.181840646 0.343725491 0.042508893 0.053819046 0.088943089 55 56 57 58 59 60 -0.425569148 -0.232683819 0.008120024 -0.240970740 -0.285182798 0.033287895 61 0.067633938 > postscript(file="/var/www/html/rcomp/tmp/6s7yl1258722186.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 -0.402573359 NA 1 -0.325741154 -0.402573359 2 -0.417731545 -0.325741154 3 -0.126583462 -0.417731545 4 -0.169270447 -0.126583462 5 -0.268629214 -0.169270447 6 -0.370879222 -0.268629214 7 0.038956165 -0.370879222 8 -0.105539404 0.038956165 9 0.218654374 -0.105539404 10 0.330573599 0.218654374 11 0.069126955 0.330573599 12 -0.023116726 0.069126955 13 0.167918840 -0.023116726 14 0.223133074 0.167918840 15 0.020823112 0.223133074 16 0.167150484 0.020823112 17 0.298952977 0.167150484 18 0.880743588 0.298952977 19 0.147004577 0.880743588 20 0.410928326 0.147004577 21 -0.229201735 0.410928326 22 0.381255790 -0.229201735 23 -0.158160364 0.381255790 24 0.165764936 -0.158160364 25 0.064597140 0.165764936 26 0.183020916 0.064597140 27 -0.037928197 0.183020916 28 -0.011045878 -0.037928197 29 -0.012822070 -0.011045878 30 -0.058352496 -0.012822070 31 -0.092103691 -0.058352496 32 -0.005706116 -0.092103691 33 -0.168684298 -0.005706116 34 -0.216766101 -0.168684298 35 0.032010068 -0.216766101 36 0.067459707 0.032010068 37 -0.088615473 0.067459707 38 -0.332147936 -0.088615473 39 0.101179654 -0.332147936 40 -0.040653206 0.101179654 41 -0.106444783 -0.040653206 42 -0.025942721 -0.106444783 43 0.138826768 -0.025942721 44 -0.307802830 0.138826768 45 0.420202399 -0.307802830 46 -0.209880490 0.420202399 47 0.023735446 -0.209880490 48 0.124831504 0.023735446 49 0.181840646 0.124831504 50 0.343725491 0.181840646 51 0.042508893 0.343725491 52 0.053819046 0.042508893 53 0.088943089 0.053819046 54 -0.425569148 0.088943089 55 -0.232683819 -0.425569148 56 0.008120024 -0.232683819 57 -0.240970740 0.008120024 58 -0.285182798 -0.240970740 59 0.033287895 -0.285182798 60 0.067633938 0.033287895 61 NA 0.067633938 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -0.325741154 -0.402573359 [2,] -0.417731545 -0.325741154 [3,] -0.126583462 -0.417731545 [4,] -0.169270447 -0.126583462 [5,] -0.268629214 -0.169270447 [6,] -0.370879222 -0.268629214 [7,] 0.038956165 -0.370879222 [8,] -0.105539404 0.038956165 [9,] 0.218654374 -0.105539404 [10,] 0.330573599 0.218654374 [11,] 0.069126955 0.330573599 [12,] -0.023116726 0.069126955 [13,] 0.167918840 -0.023116726 [14,] 0.223133074 0.167918840 [15,] 0.020823112 0.223133074 [16,] 0.167150484 0.020823112 [17,] 0.298952977 0.167150484 [18,] 0.880743588 0.298952977 [19,] 0.147004577 0.880743588 [20,] 0.410928326 0.147004577 [21,] -0.229201735 0.410928326 [22,] 0.381255790 -0.229201735 [23,] -0.158160364 0.381255790 [24,] 0.165764936 -0.158160364 [25,] 0.064597140 0.165764936 [26,] 0.183020916 0.064597140 [27,] -0.037928197 0.183020916 [28,] -0.011045878 -0.037928197 [29,] -0.012822070 -0.011045878 [30,] -0.058352496 -0.012822070 [31,] -0.092103691 -0.058352496 [32,] -0.005706116 -0.092103691 [33,] -0.168684298 -0.005706116 [34,] -0.216766101 -0.168684298 [35,] 0.032010068 -0.216766101 [36,] 0.067459707 0.032010068 [37,] -0.088615473 0.067459707 [38,] -0.332147936 -0.088615473 [39,] 0.101179654 -0.332147936 [40,] -0.040653206 0.101179654 [41,] -0.106444783 -0.040653206 [42,] -0.025942721 -0.106444783 [43,] 0.138826768 -0.025942721 [44,] -0.307802830 0.138826768 [45,] 0.420202399 -0.307802830 [46,] -0.209880490 0.420202399 [47,] 0.023735446 -0.209880490 [48,] 0.124831504 0.023735446 [49,] 0.181840646 0.124831504 [50,] 0.343725491 0.181840646 [51,] 0.042508893 0.343725491 [52,] 0.053819046 0.042508893 [53,] 0.088943089 0.053819046 [54,] -0.425569148 0.088943089 [55,] -0.232683819 -0.425569148 [56,] 0.008120024 -0.232683819 [57,] -0.240970740 0.008120024 [58,] -0.285182798 -0.240970740 [59,] 0.033287895 -0.285182798 [60,] 0.067633938 0.033287895 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -0.325741154 -0.402573359 2 -0.417731545 -0.325741154 3 -0.126583462 -0.417731545 4 -0.169270447 -0.126583462 5 -0.268629214 -0.169270447 6 -0.370879222 -0.268629214 7 0.038956165 -0.370879222 8 -0.105539404 0.038956165 9 0.218654374 -0.105539404 10 0.330573599 0.218654374 11 0.069126955 0.330573599 12 -0.023116726 0.069126955 13 0.167918840 -0.023116726 14 0.223133074 0.167918840 15 0.020823112 0.223133074 16 0.167150484 0.020823112 17 0.298952977 0.167150484 18 0.880743588 0.298952977 19 0.147004577 0.880743588 20 0.410928326 0.147004577 21 -0.229201735 0.410928326 22 0.381255790 -0.229201735 23 -0.158160364 0.381255790 24 0.165764936 -0.158160364 25 0.064597140 0.165764936 26 0.183020916 0.064597140 27 -0.037928197 0.183020916 28 -0.011045878 -0.037928197 29 -0.012822070 -0.011045878 30 -0.058352496 -0.012822070 31 -0.092103691 -0.058352496 32 -0.005706116 -0.092103691 33 -0.168684298 -0.005706116 34 -0.216766101 -0.168684298 35 0.032010068 -0.216766101 36 0.067459707 0.032010068 37 -0.088615473 0.067459707 38 -0.332147936 -0.088615473 39 0.101179654 -0.332147936 40 -0.040653206 0.101179654 41 -0.106444783 -0.040653206 42 -0.025942721 -0.106444783 43 0.138826768 -0.025942721 44 -0.307802830 0.138826768 45 0.420202399 -0.307802830 46 -0.209880490 0.420202399 47 0.023735446 -0.209880490 48 0.124831504 0.023735446 49 0.181840646 0.124831504 50 0.343725491 0.181840646 51 0.042508893 0.343725491 52 0.053819046 0.042508893 53 0.088943089 0.053819046 54 -0.425569148 0.088943089 55 -0.232683819 -0.425569148 56 0.008120024 -0.232683819 57 -0.240970740 0.008120024 58 -0.285182798 -0.240970740 59 0.033287895 -0.285182798 60 0.067633938 0.033287895 > 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/7gjqm1258722186.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/8ljvg1258722186.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/9sv3g1258722186.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/10try11258722186.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/11s43i1258722186.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/129irk1258722186.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/13uwkq1258722186.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/149b2i1258722186.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/151laa1258722186.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/16ngur1258722186.tab") + } > > system("convert tmp/1cs1q1258722186.ps tmp/1cs1q1258722186.png") > system("convert tmp/23wdk1258722186.ps tmp/23wdk1258722186.png") > system("convert tmp/38xsb1258722186.ps tmp/38xsb1258722186.png") > system("convert tmp/472e71258722186.ps tmp/472e71258722186.png") > system("convert tmp/5jwpg1258722186.ps tmp/5jwpg1258722186.png") > system("convert tmp/6s7yl1258722186.ps tmp/6s7yl1258722186.png") > system("convert tmp/7gjqm1258722186.ps tmp/7gjqm1258722186.png") > system("convert tmp/8ljvg1258722186.ps tmp/8ljvg1258722186.png") > system("convert tmp/9sv3g1258722186.ps tmp/9sv3g1258722186.png") > system("convert tmp/10try11258722186.ps tmp/10try11258722186.png") > > > proc.time() user system elapsed 2.412 1.575 2.813