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(31.514,0,27.071,0,29.462,0,26.105,0,22.397,0,23.843,0,21.705,0,18.089,0,20.764,0,25.316,0,17.704,0,15.548,0,28.029,0,29.383,0,36.438,0,32.034,0,22.679,0,24.319,0,18.004,0,17.537,0,20.366,0,22.782,0,19.169,0,13.807,0,29.743,0,25.591,0,29.096,0,26.482,0,22.405,0,27.044,0,17.970,0,18.730,0,19.684,0,19.785,0,18.479,0,10.698,0,31.956,0,29.506,0,34.506,0,27.165,0,26.736,0,23.691,0,18.157,0,17.328,0,18.205,0,20.995,0,17.382,0,9.367,0,31.124,0,26.551,0,30.651,0,25.859,0,25.100,0,25.778,0,20.418,0,18.688,0,20.424,0,24.776,0,19.814,0,12.738,0,31.566,0,30.111,0,30.019,0,31.934,0,25.826,0,26.835,0,20.205,0,17.789,0,20.520,1,22.518,1,15.572,1,11.509,1,25.447,1,24.090,1,27.786,1,26.195,1,20.516,1,22.759,1,19.028,1,16.971,1,20.036,1,22.485,1,18.730,1,14.538,1),dim=c(2,84),dimnames=list(c('Y','X'),1:84)) > y <- array(NA,dim=c(2,84),dimnames=list(c('Y','X'),1:84)) > 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 = 'Do not include Seasonal 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 Y X 1 31.514 0 2 27.071 0 3 29.462 0 4 26.105 0 5 22.397 0 6 23.843 0 7 21.705 0 8 18.089 0 9 20.764 0 10 25.316 0 11 17.704 0 12 15.548 0 13 28.029 0 14 29.383 0 15 36.438 0 16 32.034 0 17 22.679 0 18 24.319 0 19 18.004 0 20 17.537 0 21 20.366 0 22 22.782 0 23 19.169 0 24 13.807 0 25 29.743 0 26 25.591 0 27 29.096 0 28 26.482 0 29 22.405 0 30 27.044 0 31 17.970 0 32 18.730 0 33 19.684 0 34 19.785 0 35 18.479 0 36 10.698 0 37 31.956 0 38 29.506 0 39 34.506 0 40 27.165 0 41 26.736 0 42 23.691 0 43 18.157 0 44 17.328 0 45 18.205 0 46 20.995 0 47 17.382 0 48 9.367 0 49 31.124 0 50 26.551 0 51 30.651 0 52 25.859 0 53 25.100 0 54 25.778 0 55 20.418 0 56 18.688 0 57 20.424 0 58 24.776 0 59 19.814 0 60 12.738 0 61 31.566 0 62 30.111 0 63 30.019 0 64 31.934 0 65 25.826 0 66 26.835 0 67 20.205 0 68 17.789 0 69 20.520 1 70 22.518 1 71 15.572 1 72 11.509 1 73 25.447 1 74 24.090 1 75 27.786 1 76 26.195 1 77 20.516 1 78 22.759 1 79 19.028 1 80 16.971 1 81 20.036 1 82 22.485 1 83 18.730 1 84 14.538 1 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) X 23.54 -3.00 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -14.17671 -4.48446 0.06177 3.56501 12.89429 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 23.5437 0.6811 34.565 <2e-16 *** X -3.0000 1.5607 -1.922 0.058 . --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 5.617 on 82 degrees of freedom Multiple R-squared: 0.04312, Adjusted R-squared: 0.03145 F-statistic: 3.695 on 1 and 82 DF, p-value: 0.05806 > 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.3164660 0.63293190 0.68353405 [2,] 0.2259803 0.45196066 0.77401967 [3,] 0.2140017 0.42800341 0.78599829 [4,] 0.3356308 0.67126159 0.66436920 [5,] 0.2851036 0.57020721 0.71489640 [6,] 0.1945501 0.38910019 0.80544990 [7,] 0.2435224 0.48704477 0.75647762 [8,] 0.3554358 0.71087158 0.64456421 [9,] 0.3263431 0.65268627 0.67365686 [10,] 0.3283823 0.65676461 0.67161770 [11,] 0.6382624 0.72347512 0.36173756 [12,] 0.6835590 0.63288207 0.31644103 [13,] 0.6193482 0.76130369 0.38065185 [14,] 0.5424524 0.91509529 0.45754764 [15,] 0.5677391 0.86452179 0.43226089 [16,] 0.5954080 0.80918408 0.40459204 [17,] 0.5516867 0.89662652 0.44831326 [18,] 0.4806331 0.96126622 0.51936689 [19,] 0.4569238 0.91384768 0.54307616 [20,] 0.5951792 0.80964153 0.40482076 [21,] 0.6041465 0.79170703 0.39585352 [22,] 0.5431607 0.91367864 0.45683932 [23,] 0.5345489 0.93090216 0.46545108 [24,] 0.4815844 0.96316889 0.51841556 [25,] 0.4184710 0.83694201 0.58152900 [26,] 0.3752035 0.75040697 0.62479651 [27,] 0.3779945 0.75598899 0.62200551 [28,] 0.3626589 0.72531771 0.63734115 [29,] 0.3307108 0.66142167 0.66928916 [30,] 0.2981872 0.59637440 0.70181280 [31,] 0.2865001 0.57300022 0.71349989 [32,] 0.5369331 0.92613379 0.46306690 [33,] 0.6105914 0.77881724 0.38940862 [34,] 0.6153333 0.76933333 0.38466666 [35,] 0.7637189 0.47256229 0.23628114 [36,] 0.7339623 0.53207532 0.26603766 [37,] 0.6979836 0.60403272 0.30201636 [38,] 0.6406267 0.71874665 0.35937333 [39,] 0.6318639 0.73627215 0.36813608 [40,] 0.6412154 0.71756929 0.35878465 [41,] 0.6334652 0.73306958 0.36653479 [42,] 0.5846755 0.83064906 0.41532453 [43,] 0.5984406 0.80311878 0.40155939 [44,] 0.8810603 0.23787939 0.11893969 [45,] 0.8998282 0.20034351 0.10017175 [46,] 0.8751069 0.24978620 0.12489310 [47,] 0.8909501 0.21809978 0.10904989 [48,] 0.8616587 0.27668257 0.13834128 [49,] 0.8237183 0.35256346 0.17628173 [50,] 0.7836253 0.43274933 0.21637467 [51,] 0.7492707 0.50145864 0.25072932 [52,] 0.7424810 0.51503792 0.25751896 [53,] 0.7113903 0.57721948 0.28860974 [54,] 0.6497811 0.70043787 0.35021893 [55,] 0.6308059 0.73838820 0.36919410 [56,] 0.8704158 0.25916849 0.12958424 [57,] 0.8791418 0.24171640 0.12085820 [58,] 0.8727046 0.25459080 0.12729540 [59,] 0.8725780 0.25484403 0.12742201 [60,] 0.9250553 0.14988936 0.07494468 [61,] 0.9078381 0.18432385 0.09216193 [62,] 0.9213659 0.15726821 0.07863411 [63,] 0.8906498 0.21870038 0.10935019 [64,] 0.8507503 0.29849936 0.14924968 [65,] 0.7917764 0.41644714 0.20822357 [66,] 0.7295551 0.54088971 0.27044486 [67,] 0.7175470 0.56490607 0.28245304 [68,] 0.8778466 0.24430686 0.12215343 [69,] 0.8639239 0.27215218 0.13607609 [70,] 0.8219467 0.35610669 0.17805335 [71,] 0.9035982 0.19280356 0.09640178 [72,] 0.9544848 0.09103049 0.04551525 [73,] 0.9085051 0.18298974 0.09149487 [74,] 0.8928015 0.21439704 0.10719852 [75,] 0.7751515 0.44969694 0.22484847 > postscript(file="/var/www/html/rcomp/tmp/15w491291109984.ps",horizontal=F,onefile=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/2f6lc1291109984.ps",horizontal=F,onefile=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/3f6lc1291109984.ps",horizontal=F,onefile=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/4f6lc1291109984.ps",horizontal=F,onefile=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/58fke1291109984.ps",horizontal=F,onefile=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 = 84 Frequency = 1 1 2 3 4 5 6 7.9702941 3.5272941 5.9182941 2.5612941 -1.1467059 0.2992941 7 8 9 10 11 12 -1.8387059 -5.4547059 -2.7797059 1.7722941 -5.8397059 -7.9957059 13 14 15 16 17 18 4.4852941 5.8392941 12.8942941 8.4902941 -0.8647059 0.7752941 19 20 21 22 23 24 -5.5397059 -6.0067059 -3.1777059 -0.7617059 -4.3747059 -9.7367059 25 26 27 28 29 30 6.1992941 2.0472941 5.5522941 2.9382941 -1.1387059 3.5002941 31 32 33 34 35 36 -5.5737059 -4.8137059 -3.8597059 -3.7587059 -5.0647059 -12.8457059 37 38 39 40 41 42 8.4122941 5.9622941 10.9622941 3.6212941 3.1922941 0.1472941 43 44 45 46 47 48 -5.3867059 -6.2157059 -5.3387059 -2.5487059 -6.1617059 -14.1767059 49 50 51 52 53 54 7.5802941 3.0072941 7.1072941 2.3152941 1.5562941 2.2342941 55 56 57 58 59 60 -3.1257059 -4.8557059 -3.1197059 1.2322941 -3.7297059 -10.8057059 61 62 63 64 65 66 8.0222941 6.5672941 6.4752941 8.3902941 2.2822941 3.2912941 67 68 69 70 71 72 -3.3387059 -5.7547059 -0.0237500 1.9742500 -4.9717500 -9.0347500 73 74 75 76 77 78 4.9032500 3.5462500 7.2422500 5.6512500 -0.0277500 2.2152500 79 80 81 82 83 84 -1.5157500 -3.5727500 -0.5077500 1.9412500 -1.8137500 -6.0057500 > postscript(file="/var/www/html/rcomp/tmp/68fke1291109984.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > dum <- cbind(lag(myerror,k=1),myerror) > dum Time Series: Start = 0 End = 84 Frequency = 1 lag(myerror, k = 1) myerror 0 7.9702941 NA 1 3.5272941 7.9702941 2 5.9182941 3.5272941 3 2.5612941 5.9182941 4 -1.1467059 2.5612941 5 0.2992941 -1.1467059 6 -1.8387059 0.2992941 7 -5.4547059 -1.8387059 8 -2.7797059 -5.4547059 9 1.7722941 -2.7797059 10 -5.8397059 1.7722941 11 -7.9957059 -5.8397059 12 4.4852941 -7.9957059 13 5.8392941 4.4852941 14 12.8942941 5.8392941 15 8.4902941 12.8942941 16 -0.8647059 8.4902941 17 0.7752941 -0.8647059 18 -5.5397059 0.7752941 19 -6.0067059 -5.5397059 20 -3.1777059 -6.0067059 21 -0.7617059 -3.1777059 22 -4.3747059 -0.7617059 23 -9.7367059 -4.3747059 24 6.1992941 -9.7367059 25 2.0472941 6.1992941 26 5.5522941 2.0472941 27 2.9382941 5.5522941 28 -1.1387059 2.9382941 29 3.5002941 -1.1387059 30 -5.5737059 3.5002941 31 -4.8137059 -5.5737059 32 -3.8597059 -4.8137059 33 -3.7587059 -3.8597059 34 -5.0647059 -3.7587059 35 -12.8457059 -5.0647059 36 8.4122941 -12.8457059 37 5.9622941 8.4122941 38 10.9622941 5.9622941 39 3.6212941 10.9622941 40 3.1922941 3.6212941 41 0.1472941 3.1922941 42 -5.3867059 0.1472941 43 -6.2157059 -5.3867059 44 -5.3387059 -6.2157059 45 -2.5487059 -5.3387059 46 -6.1617059 -2.5487059 47 -14.1767059 -6.1617059 48 7.5802941 -14.1767059 49 3.0072941 7.5802941 50 7.1072941 3.0072941 51 2.3152941 7.1072941 52 1.5562941 2.3152941 53 2.2342941 1.5562941 54 -3.1257059 2.2342941 55 -4.8557059 -3.1257059 56 -3.1197059 -4.8557059 57 1.2322941 -3.1197059 58 -3.7297059 1.2322941 59 -10.8057059 -3.7297059 60 8.0222941 -10.8057059 61 6.5672941 8.0222941 62 6.4752941 6.5672941 63 8.3902941 6.4752941 64 2.2822941 8.3902941 65 3.2912941 2.2822941 66 -3.3387059 3.2912941 67 -5.7547059 -3.3387059 68 -0.0237500 -5.7547059 69 1.9742500 -0.0237500 70 -4.9717500 1.9742500 71 -9.0347500 -4.9717500 72 4.9032500 -9.0347500 73 3.5462500 4.9032500 74 7.2422500 3.5462500 75 5.6512500 7.2422500 76 -0.0277500 5.6512500 77 2.2152500 -0.0277500 78 -1.5157500 2.2152500 79 -3.5727500 -1.5157500 80 -0.5077500 -3.5727500 81 1.9412500 -0.5077500 82 -1.8137500 1.9412500 83 -6.0057500 -1.8137500 84 NA -6.0057500 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] 3.5272941 7.9702941 [2,] 5.9182941 3.5272941 [3,] 2.5612941 5.9182941 [4,] -1.1467059 2.5612941 [5,] 0.2992941 -1.1467059 [6,] -1.8387059 0.2992941 [7,] -5.4547059 -1.8387059 [8,] -2.7797059 -5.4547059 [9,] 1.7722941 -2.7797059 [10,] -5.8397059 1.7722941 [11,] -7.9957059 -5.8397059 [12,] 4.4852941 -7.9957059 [13,] 5.8392941 4.4852941 [14,] 12.8942941 5.8392941 [15,] 8.4902941 12.8942941 [16,] -0.8647059 8.4902941 [17,] 0.7752941 -0.8647059 [18,] -5.5397059 0.7752941 [19,] -6.0067059 -5.5397059 [20,] -3.1777059 -6.0067059 [21,] -0.7617059 -3.1777059 [22,] -4.3747059 -0.7617059 [23,] -9.7367059 -4.3747059 [24,] 6.1992941 -9.7367059 [25,] 2.0472941 6.1992941 [26,] 5.5522941 2.0472941 [27,] 2.9382941 5.5522941 [28,] -1.1387059 2.9382941 [29,] 3.5002941 -1.1387059 [30,] -5.5737059 3.5002941 [31,] -4.8137059 -5.5737059 [32,] -3.8597059 -4.8137059 [33,] -3.7587059 -3.8597059 [34,] -5.0647059 -3.7587059 [35,] -12.8457059 -5.0647059 [36,] 8.4122941 -12.8457059 [37,] 5.9622941 8.4122941 [38,] 10.9622941 5.9622941 [39,] 3.6212941 10.9622941 [40,] 3.1922941 3.6212941 [41,] 0.1472941 3.1922941 [42,] -5.3867059 0.1472941 [43,] -6.2157059 -5.3867059 [44,] -5.3387059 -6.2157059 [45,] -2.5487059 -5.3387059 [46,] -6.1617059 -2.5487059 [47,] -14.1767059 -6.1617059 [48,] 7.5802941 -14.1767059 [49,] 3.0072941 7.5802941 [50,] 7.1072941 3.0072941 [51,] 2.3152941 7.1072941 [52,] 1.5562941 2.3152941 [53,] 2.2342941 1.5562941 [54,] -3.1257059 2.2342941 [55,] -4.8557059 -3.1257059 [56,] -3.1197059 -4.8557059 [57,] 1.2322941 -3.1197059 [58,] -3.7297059 1.2322941 [59,] -10.8057059 -3.7297059 [60,] 8.0222941 -10.8057059 [61,] 6.5672941 8.0222941 [62,] 6.4752941 6.5672941 [63,] 8.3902941 6.4752941 [64,] 2.2822941 8.3902941 [65,] 3.2912941 2.2822941 [66,] -3.3387059 3.2912941 [67,] -5.7547059 -3.3387059 [68,] -0.0237500 -5.7547059 [69,] 1.9742500 -0.0237500 [70,] -4.9717500 1.9742500 [71,] -9.0347500 -4.9717500 [72,] 4.9032500 -9.0347500 [73,] 3.5462500 4.9032500 [74,] 7.2422500 3.5462500 [75,] 5.6512500 7.2422500 [76,] -0.0277500 5.6512500 [77,] 2.2152500 -0.0277500 [78,] -1.5157500 2.2152500 [79,] -3.5727500 -1.5157500 [80,] -0.5077500 -3.5727500 [81,] 1.9412500 -0.5077500 [82,] -1.8137500 1.9412500 [83,] -6.0057500 -1.8137500 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 3.5272941 7.9702941 2 5.9182941 3.5272941 3 2.5612941 5.9182941 4 -1.1467059 2.5612941 5 0.2992941 -1.1467059 6 -1.8387059 0.2992941 7 -5.4547059 -1.8387059 8 -2.7797059 -5.4547059 9 1.7722941 -2.7797059 10 -5.8397059 1.7722941 11 -7.9957059 -5.8397059 12 4.4852941 -7.9957059 13 5.8392941 4.4852941 14 12.8942941 5.8392941 15 8.4902941 12.8942941 16 -0.8647059 8.4902941 17 0.7752941 -0.8647059 18 -5.5397059 0.7752941 19 -6.0067059 -5.5397059 20 -3.1777059 -6.0067059 21 -0.7617059 -3.1777059 22 -4.3747059 -0.7617059 23 -9.7367059 -4.3747059 24 6.1992941 -9.7367059 25 2.0472941 6.1992941 26 5.5522941 2.0472941 27 2.9382941 5.5522941 28 -1.1387059 2.9382941 29 3.5002941 -1.1387059 30 -5.5737059 3.5002941 31 -4.8137059 -5.5737059 32 -3.8597059 -4.8137059 33 -3.7587059 -3.8597059 34 -5.0647059 -3.7587059 35 -12.8457059 -5.0647059 36 8.4122941 -12.8457059 37 5.9622941 8.4122941 38 10.9622941 5.9622941 39 3.6212941 10.9622941 40 3.1922941 3.6212941 41 0.1472941 3.1922941 42 -5.3867059 0.1472941 43 -6.2157059 -5.3867059 44 -5.3387059 -6.2157059 45 -2.5487059 -5.3387059 46 -6.1617059 -2.5487059 47 -14.1767059 -6.1617059 48 7.5802941 -14.1767059 49 3.0072941 7.5802941 50 7.1072941 3.0072941 51 2.3152941 7.1072941 52 1.5562941 2.3152941 53 2.2342941 1.5562941 54 -3.1257059 2.2342941 55 -4.8557059 -3.1257059 56 -3.1197059 -4.8557059 57 1.2322941 -3.1197059 58 -3.7297059 1.2322941 59 -10.8057059 -3.7297059 60 8.0222941 -10.8057059 61 6.5672941 8.0222941 62 6.4752941 6.5672941 63 8.3902941 6.4752941 64 2.2822941 8.3902941 65 3.2912941 2.2822941 66 -3.3387059 3.2912941 67 -5.7547059 -3.3387059 68 -0.0237500 -5.7547059 69 1.9742500 -0.0237500 70 -4.9717500 1.9742500 71 -9.0347500 -4.9717500 72 4.9032500 -9.0347500 73 3.5462500 4.9032500 74 7.2422500 3.5462500 75 5.6512500 7.2422500 76 -0.0277500 5.6512500 77 2.2152500 -0.0277500 78 -1.5157500 2.2152500 79 -3.5727500 -1.5157500 80 -0.5077500 -3.5727500 81 1.9412500 -0.5077500 82 -1.8137500 1.9412500 83 -6.0057500 -1.8137500 > 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/7j6kh1291109984.ps",horizontal=F,onefile=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/8j6kh1291109984.ps",horizontal=F,onefile=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/9cg131291109984.ps",horizontal=F,onefile=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/10cg131291109984.ps",horizontal=F,onefile=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/11fghq1291109984.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/120gye1291109984.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/137hdq1291109984.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/1409ub1291109984.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/153rbz1291109984.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/16hj981291109984.tab") + } > > try(system("convert tmp/15w491291109984.ps tmp/15w491291109984.png",intern=TRUE)) character(0) > try(system("convert tmp/2f6lc1291109984.ps tmp/2f6lc1291109984.png",intern=TRUE)) character(0) > try(system("convert tmp/3f6lc1291109984.ps tmp/3f6lc1291109984.png",intern=TRUE)) character(0) > try(system("convert tmp/4f6lc1291109984.ps tmp/4f6lc1291109984.png",intern=TRUE)) character(0) > try(system("convert tmp/58fke1291109984.ps tmp/58fke1291109984.png",intern=TRUE)) character(0) > try(system("convert tmp/68fke1291109984.ps tmp/68fke1291109984.png",intern=TRUE)) character(0) > try(system("convert tmp/7j6kh1291109984.ps tmp/7j6kh1291109984.png",intern=TRUE)) character(0) > try(system("convert tmp/8j6kh1291109984.ps tmp/8j6kh1291109984.png",intern=TRUE)) character(0) > try(system("convert tmp/9cg131291109984.ps tmp/9cg131291109984.png",intern=TRUE)) character(0) > try(system("convert tmp/10cg131291109984.ps tmp/10cg131291109984.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.755 1.658 7.451