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(17972385.83 + ,0 + ,17637387.4 + ,15213975.95 + ,16471559.62 + ,14731798.37 + ,16896235.55 + ,0 + ,17972385.83 + ,17637387.4 + ,15213975.95 + ,16471559.62 + ,16697955.94 + ,0 + ,16896235.55 + ,17972385.83 + ,17637387.4 + ,15213975.95 + ,19691579.52 + ,0 + ,16697955.94 + ,16896235.55 + ,17972385.83 + ,17637387.4 + ,15930700.75 + ,0 + ,19691579.52 + ,16697955.94 + ,16896235.55 + ,17972385.83 + ,17444615.98 + ,0 + ,15930700.75 + ,19691579.52 + ,16697955.94 + ,16896235.55 + ,17699369.88 + ,0 + ,17444615.98 + ,15930700.75 + ,19691579.52 + ,16697955.94 + ,15189796.81 + ,0 + ,17699369.88 + ,17444615.98 + ,15930700.75 + ,19691579.52 + ,15672722.75 + ,0 + ,15189796.81 + ,17699369.88 + ,17444615.98 + ,15930700.75 + ,17180794.3 + ,0 + ,15672722.75 + ,15189796.81 + ,17699369.88 + ,17444615.98 + ,17664893.45 + ,0 + ,17180794.3 + ,15672722.75 + ,15189796.81 + ,17699369.88 + ,17862884.98 + ,0 + ,17664893.45 + ,17180794.3 + ,15672722.75 + ,15189796.81 + ,16162288.88 + ,0 + ,17862884.98 + ,17664893.45 + ,17180794.3 + ,15672722.75 + ,17463628.82 + ,0 + ,16162288.88 + ,17862884.98 + ,17664893.45 + ,17180794.3 + ,16772112.17 + ,0 + ,17463628.82 + ,16162288.88 + ,17862884.98 + ,17664893.45 + ,19106861.48 + ,0 + ,16772112.17 + ,17463628.82 + ,16162288.88 + ,17862884.98 + ,16721314.25 + ,0 + ,19106861.48 + ,16772112.17 + ,17463628.82 + ,16162288.88 + ,18161267.85 + ,0 + ,16721314.25 + ,19106861.48 + ,16772112.17 + ,17463628.82 + ,18509941.2 + ,0 + ,18161267.85 + ,16721314.25 + ,19106861.48 + ,16772112.17 + ,17802737.97 + ,0 + ,18509941.2 + ,18161267.85 + ,16721314.25 + ,19106861.48 + ,16409869.75 + ,0 + ,17802737.97 + ,18509941.2 + ,18161267.85 + ,16721314.25 + ,17967742.04 + ,0 + ,16409869.75 + ,17802737.97 + ,18509941.2 + ,18161267.85 + ,20286602.27 + ,0 + ,17967742.04 + ,16409869.75 + ,17802737.97 + ,18509941.2 + ,19537280.81 + ,0 + ,20286602.27 + ,17967742.04 + ,16409869.75 + ,17802737.97 + ,18021889.62 + ,0 + ,19537280.81 + ,20286602.27 + ,17967742.04 + ,16409869.75 + ,20194317.23 + ,0 + ,18021889.62 + ,19537280.81 + ,20286602.27 + ,17967742.04 + ,19049596.62 + ,0 + ,20194317.23 + ,18021889.62 + ,19537280.81 + ,20286602.27 + ,20244720.94 + ,0 + ,19049596.62 + ,20194317.23 + ,18021889.62 + ,19537280.81 + ,21473302.24 + ,0 + ,20244720.94 + ,19049596.62 + ,20194317.23 + ,18021889.62 + ,19673603.19 + ,0 + ,21473302.24 + ,20244720.94 + ,19049596.62 + ,20194317.23 + ,21053177.29 + ,0 + ,19673603.19 + ,21473302.24 + ,20244720.94 + ,19049596.62 + ,20159479.84 + ,0 + ,21053177.29 + ,19673603.19 + ,21473302.24 + ,20244720.94 + ,18203628.31 + ,0 + ,20159479.84 + ,21053177.29 + ,19673603.19 + ,21473302.24 + ,21289464.94 + ,0 + ,18203628.31 + ,20159479.84 + ,21053177.29 + ,19673603.19 + ,20432335.71 + ,1 + ,21289464.94 + ,18203628.31 + ,20159479.84 + ,21053177.29 + ,17180395.07 + ,1 + ,20432335.71 + ,21289464.94 + ,18203628.31 + ,20159479.84 + ,15816786.32 + ,1 + ,17180395.07 + ,20432335.71 + ,21289464.94 + ,18203628.31 + ,15071819.75 + ,1 + ,15816786.32 + ,17180395.07 + ,20432335.71 + ,21289464.94 + ,14521120.61 + ,1 + ,15071819.75 + ,15816786.32 + ,17180395.07 + ,20432335.71 + ,15668789.39 + ,1 + ,14521120.61 + ,15071819.75 + ,15816786.32 + ,17180395.07 + ,14346884.11 + ,1 + ,15668789.39 + ,14521120.61 + ,15071819.75 + ,15816786.32 + ,13881008.13 + ,1 + ,14346884.11 + ,15668789.39 + ,14521120.61 + ,15071819.75 + ,15465943.69 + ,1 + ,13881008.13 + ,14346884.11 + ,15668789.39 + ,14521120.61 + ,14238232.92 + ,1 + ,15465943.69 + ,13881008.13 + ,14346884.11 + ,15668789.39 + ,13557713.21 + ,1 + ,14238232.92 + ,15465943.69 + ,13881008.13 + ,14346884.11 + ,16127590.29 + ,1 + ,13557713.21 + ,14238232.92 + ,15465943.69 + ,13881008.13 + ,16793894.2 + ,1 + ,16127590.29 + ,13557713.21 + ,14238232.92 + ,15465943.69 + ,16014007.43 + ,1 + ,16793894.2 + ,16127590.29 + ,13557713.21 + ,14238232.92 + ,16867867.15 + ,1 + ,16014007.43 + ,16793894.2 + ,16127590.29 + ,13557713.21 + ,16014583.21 + ,1 + ,16867867.15 + ,16014007.43 + ,16793894.2 + ,16127590.29 + ,15878594.85 + ,1 + ,16014583.21 + ,16867867.15 + ,16014007.43 + ,16793894.2 + ,18664899.14 + ,1 + ,15878594.85 + ,16014583.21 + ,16867867.15 + ,16014007.43 + ,17962530.06 + ,1 + ,18664899.14 + ,15878594.85 + ,16014583.21 + ,16867867.15 + ,17332692.2 + ,1 + ,17962530.06 + ,18664899.14 + ,15878594.85 + ,16014583.21 + ,19542066.35 + ,1 + ,17332692.2 + ,17962530.06 + ,18664899.14 + ,15878594.85 + ,17203555.19 + ,1 + ,19542066.35 + ,17332692.2 + ,17962530.06 + ,18664899.14) + ,dim=c(6 + ,56) + ,dimnames=list(c('Y' + ,'X' + ,'Y1' + ,'Y2' + ,'Y3' + ,'Y4') + ,1:56)) > y <- array(NA,dim=c(6,56),dimnames=list(c('Y','X','Y1','Y2','Y3','Y4'),1:56)) > for (i in 1:dim(x)[1]) + { + for (j in 1:dim(x)[2]) + { + y[i,j] <- as.numeric(x[i,j]) + } + } > par20 = '' > par19 = '' > par18 = '' > par17 = '' > par16 = '' > par15 = '' > par14 = '' > par13 = '' > par12 = '' > par11 = '' > par10 = '' > par9 = '' > par8 = '' > par7 = '' > par6 = '' > par5 = '' > par4 = '' > par3 = 'Linear Trend' > par2 = 'Include Monthly Dummies' > par1 = '1' > ylab = '' > xlab = '' > main = '' > #'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 Y1 Y2 Y3 Y4 M1 M2 M3 M4 M5 M6 M7 M8 M9 1 17972386 0 17637387 15213976 16471560 14731798 1 0 0 0 0 0 0 0 0 2 16896236 0 17972386 17637387 15213976 16471560 0 1 0 0 0 0 0 0 0 3 16697956 0 16896236 17972386 17637387 15213976 0 0 1 0 0 0 0 0 0 4 19691580 0 16697956 16896236 17972386 17637387 0 0 0 1 0 0 0 0 0 5 15930701 0 19691580 16697956 16896236 17972386 0 0 0 0 1 0 0 0 0 6 17444616 0 15930701 19691580 16697956 16896236 0 0 0 0 0 1 0 0 0 7 17699370 0 17444616 15930701 19691580 16697956 0 0 0 0 0 0 1 0 0 8 15189797 0 17699370 17444616 15930701 19691580 0 0 0 0 0 0 0 1 0 9 15672723 0 15189797 17699370 17444616 15930701 0 0 0 0 0 0 0 0 1 10 17180794 0 15672723 15189797 17699370 17444616 0 0 0 0 0 0 0 0 0 11 17664893 0 17180794 15672723 15189797 17699370 0 0 0 0 0 0 0 0 0 12 17862885 0 17664893 17180794 15672723 15189797 0 0 0 0 0 0 0 0 0 13 16162289 0 17862885 17664893 17180794 15672723 1 0 0 0 0 0 0 0 0 14 17463629 0 16162289 17862885 17664893 17180794 0 1 0 0 0 0 0 0 0 15 16772112 0 17463629 16162289 17862885 17664893 0 0 1 0 0 0 0 0 0 16 19106861 0 16772112 17463629 16162289 17862885 0 0 0 1 0 0 0 0 0 17 16721314 0 19106861 16772112 17463629 16162289 0 0 0 0 1 0 0 0 0 18 18161268 0 16721314 19106861 16772112 17463629 0 0 0 0 0 1 0 0 0 19 18509941 0 18161268 16721314 19106861 16772112 0 0 0 0 0 0 1 0 0 20 17802738 0 18509941 18161268 16721314 19106861 0 0 0 0 0 0 0 1 0 21 16409870 0 17802738 18509941 18161268 16721314 0 0 0 0 0 0 0 0 1 22 17967742 0 16409870 17802738 18509941 18161268 0 0 0 0 0 0 0 0 0 23 20286602 0 17967742 16409870 17802738 18509941 0 0 0 0 0 0 0 0 0 24 19537281 0 20286602 17967742 16409870 17802738 0 0 0 0 0 0 0 0 0 25 18021890 0 19537281 20286602 17967742 16409870 1 0 0 0 0 0 0 0 0 26 20194317 0 18021890 19537281 20286602 17967742 0 1 0 0 0 0 0 0 0 27 19049597 0 20194317 18021890 19537281 20286602 0 0 1 0 0 0 0 0 0 28 20244721 0 19049597 20194317 18021890 19537281 0 0 0 1 0 0 0 0 0 29 21473302 0 20244721 19049597 20194317 18021890 0 0 0 0 1 0 0 0 0 30 19673603 0 21473302 20244721 19049597 20194317 0 0 0 0 0 1 0 0 0 31 21053177 0 19673603 21473302 20244721 19049597 0 0 0 0 0 0 1 0 0 32 20159480 0 21053177 19673603 21473302 20244721 0 0 0 0 0 0 0 1 0 33 18203628 0 20159480 21053177 19673603 21473302 0 0 0 0 0 0 0 0 1 34 21289465 0 18203628 20159480 21053177 19673603 0 0 0 0 0 0 0 0 0 35 20432336 1 21289465 18203628 20159480 21053177 0 0 0 0 0 0 0 0 0 36 17180395 1 20432336 21289465 18203628 20159480 0 0 0 0 0 0 0 0 0 37 15816786 1 17180395 20432336 21289465 18203628 1 0 0 0 0 0 0 0 0 38 15071820 1 15816786 17180395 20432336 21289465 0 1 0 0 0 0 0 0 0 39 14521121 1 15071820 15816786 17180395 20432336 0 0 1 0 0 0 0 0 0 40 15668789 1 14521121 15071820 15816786 17180395 0 0 0 1 0 0 0 0 0 41 14346884 1 15668789 14521121 15071820 15816786 0 0 0 0 1 0 0 0 0 42 13881008 1 14346884 15668789 14521121 15071820 0 0 0 0 0 1 0 0 0 43 15465944 1 13881008 14346884 15668789 14521121 0 0 0 0 0 0 1 0 0 44 14238233 1 15465944 13881008 14346884 15668789 0 0 0 0 0 0 0 1 0 45 13557713 1 14238233 15465944 13881008 14346884 0 0 0 0 0 0 0 0 1 46 16127590 1 13557713 14238233 15465944 13881008 0 0 0 0 0 0 0 0 0 47 16793894 1 16127590 13557713 14238233 15465944 0 0 0 0 0 0 0 0 0 48 16014007 1 16793894 16127590 13557713 14238233 0 0 0 0 0 0 0 0 0 49 16867867 1 16014007 16793894 16127590 13557713 1 0 0 0 0 0 0 0 0 50 16014583 1 16867867 16014007 16793894 16127590 0 1 0 0 0 0 0 0 0 51 15878595 1 16014583 16867867 16014007 16793894 0 0 1 0 0 0 0 0 0 52 18664899 1 15878595 16014583 16867867 16014007 0 0 0 1 0 0 0 0 0 53 17962530 1 18664899 15878595 16014583 16867867 0 0 0 0 1 0 0 0 0 54 17332692 1 17962530 18664899 15878595 16014583 0 0 0 0 0 1 0 0 0 55 19542066 1 17332692 17962530 18664899 15878595 0 0 0 0 0 0 1 0 0 56 17203555 1 19542066 17332692 17962530 18664899 0 0 0 0 0 0 0 1 0 M10 M11 t 1 0 0 1 2 0 0 2 3 0 0 3 4 0 0 4 5 0 0 5 6 0 0 6 7 0 0 7 8 0 0 8 9 0 0 9 10 1 0 10 11 0 1 11 12 0 0 12 13 0 0 13 14 0 0 14 15 0 0 15 16 0 0 16 17 0 0 17 18 0 0 18 19 0 0 19 20 0 0 20 21 0 0 21 22 1 0 22 23 0 1 23 24 0 0 24 25 0 0 25 26 0 0 26 27 0 0 27 28 0 0 28 29 0 0 29 30 0 0 30 31 0 0 31 32 0 0 32 33 0 0 33 34 1 0 34 35 0 1 35 36 0 0 36 37 0 0 37 38 0 0 38 39 0 0 39 40 0 0 40 41 0 0 41 42 0 0 42 43 0 0 43 44 0 0 44 45 0 0 45 46 1 0 46 47 0 1 47 48 0 0 48 49 0 0 49 50 0 0 50 51 0 0 51 52 0 0 52 53 0 0 53 54 0 0 54 55 0 0 55 56 0 0 56 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) X Y1 Y2 Y3 Y4 7.058e+06 -2.794e+06 3.603e-01 1.520e-01 3.746e-01 -3.206e-01 M1 M2 M3 M4 M5 M6 -1.278e+06 -3.012e+05 -6.140e+05 1.702e+06 -6.971e+05 -3.108e+05 M7 M8 M9 M10 M11 t 3.103e+04 -7.945e+05 -1.914e+06 4.473e+05 1.871e+06 6.269e+04 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -1498952 -536456 48795 442203 2015070 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 7.058e+06 1.705e+06 4.138 0.000187 *** X -2.794e+06 6.268e+05 -4.457 7.12e-05 *** Y1 3.603e-01 1.264e-01 2.851 0.007004 ** Y2 1.520e-01 1.226e-01 1.241 0.222379 Y3 3.746e-01 1.201e-01 3.120 0.003448 ** Y4 -3.206e-01 1.109e-01 -2.892 0.006300 ** M1 -1.278e+06 6.475e+05 -1.973 0.055753 . M2 -3.012e+05 6.755e+05 -0.446 0.658213 M3 -6.140e+05 6.748e+05 -0.910 0.368640 M4 1.702e+06 6.684e+05 2.546 0.015057 * M5 -6.971e+05 6.217e+05 -1.121 0.269190 M6 -3.108e+05 6.120e+05 -0.508 0.614573 M7 3.103e+04 7.215e+05 0.043 0.965917 M8 -7.945e+05 6.378e+05 -1.246 0.220521 M9 -1.914e+06 6.937e+05 -2.759 0.008872 ** M10 4.473e+05 8.204e+05 0.545 0.588791 M11 1.871e+06 6.836e+05 2.737 0.009371 ** t 6.269e+04 1.639e+04 3.825 0.000473 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 822600 on 38 degrees of freedom Multiple R-squared: 0.877, Adjusted R-squared: 0.822 F-statistic: 15.94 on 17 and 38 DF, p-value: 2.464e-12 > 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.8299735 0.3400530 0.1700265 [2,] 0.8331479 0.3337041 0.1668521 [3,] 0.7876216 0.4247569 0.2123784 [4,] 0.7574487 0.4851026 0.2425513 [5,] 0.6634802 0.6730395 0.3365198 [6,] 0.6663547 0.6672905 0.3336453 [7,] 0.6328071 0.7343858 0.3671929 [8,] 0.5119441 0.9761119 0.4880559 [9,] 0.8798021 0.2403958 0.1201979 [10,] 0.8980771 0.2038457 0.1019229 [11,] 0.8915004 0.2169992 0.1084996 [12,] 0.8189367 0.3621267 0.1810633 [13,] 0.8121994 0.3756012 0.1878006 [14,] 0.6858475 0.6283050 0.3141525 [15,] 0.6108650 0.7782699 0.3891350 > postscript(file="/var/www/html/rcomp/tmp/1cc6c1292938115.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/2cc6c1292938115.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/3436x1292938115.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/4436x1292938115.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/5436x1292938115.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 = 56 Frequency = 1 1 2 3 4 5 6 2015069.79 439344.12 -482964.99 1018445.14 -943853.59 750123.62 7 8 9 10 11 12 -558086.76 -258344.61 373862.99 55647.31 -541839.28 75343.30 13 14 15 16 17 18 -965144.60 181767.71 -388913.85 318783.74 -1498952.23 672723.68 19 20 21 22 23 24 -635388.71 717741.02 -720860.24 -646366.80 213194.35 494894.83 25 26 27 28 29 30 -918109.29 505939.87 83122.47 -691058.16 1317955.55 -429873.64 31 32 33 34 35 36 192188.87 -239111.97 41942.68 450777.68 863306.42 -294552.98 37 38 39 40 41 42 -923994.28 -412021.50 706340.05 -744971.42 -218266.40 -863981.51 43 44 45 46 47 48 78892.25 -23126.80 305054.57 139941.82 -534661.50 -275685.15 49 50 51 52 53 54 792178.37 -715030.19 82416.32 98800.69 1343116.67 -128992.16 55 56 922394.35 -197157.65 > postscript(file="/var/www/html/rcomp/tmp/6fcn01292938115.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 = 56 Frequency = 1 lag(myerror, k = 1) myerror 0 2015069.79 NA 1 439344.12 2015069.79 2 -482964.99 439344.12 3 1018445.14 -482964.99 4 -943853.59 1018445.14 5 750123.62 -943853.59 6 -558086.76 750123.62 7 -258344.61 -558086.76 8 373862.99 -258344.61 9 55647.31 373862.99 10 -541839.28 55647.31 11 75343.30 -541839.28 12 -965144.60 75343.30 13 181767.71 -965144.60 14 -388913.85 181767.71 15 318783.74 -388913.85 16 -1498952.23 318783.74 17 672723.68 -1498952.23 18 -635388.71 672723.68 19 717741.02 -635388.71 20 -720860.24 717741.02 21 -646366.80 -720860.24 22 213194.35 -646366.80 23 494894.83 213194.35 24 -918109.29 494894.83 25 505939.87 -918109.29 26 83122.47 505939.87 27 -691058.16 83122.47 28 1317955.55 -691058.16 29 -429873.64 1317955.55 30 192188.87 -429873.64 31 -239111.97 192188.87 32 41942.68 -239111.97 33 450777.68 41942.68 34 863306.42 450777.68 35 -294552.98 863306.42 36 -923994.28 -294552.98 37 -412021.50 -923994.28 38 706340.05 -412021.50 39 -744971.42 706340.05 40 -218266.40 -744971.42 41 -863981.51 -218266.40 42 78892.25 -863981.51 43 -23126.80 78892.25 44 305054.57 -23126.80 45 139941.82 305054.57 46 -534661.50 139941.82 47 -275685.15 -534661.50 48 792178.37 -275685.15 49 -715030.19 792178.37 50 82416.32 -715030.19 51 98800.69 82416.32 52 1343116.67 98800.69 53 -128992.16 1343116.67 54 922394.35 -128992.16 55 -197157.65 922394.35 56 NA -197157.65 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] 439344.12 2015069.79 [2,] -482964.99 439344.12 [3,] 1018445.14 -482964.99 [4,] -943853.59 1018445.14 [5,] 750123.62 -943853.59 [6,] -558086.76 750123.62 [7,] -258344.61 -558086.76 [8,] 373862.99 -258344.61 [9,] 55647.31 373862.99 [10,] -541839.28 55647.31 [11,] 75343.30 -541839.28 [12,] -965144.60 75343.30 [13,] 181767.71 -965144.60 [14,] -388913.85 181767.71 [15,] 318783.74 -388913.85 [16,] -1498952.23 318783.74 [17,] 672723.68 -1498952.23 [18,] -635388.71 672723.68 [19,] 717741.02 -635388.71 [20,] -720860.24 717741.02 [21,] -646366.80 -720860.24 [22,] 213194.35 -646366.80 [23,] 494894.83 213194.35 [24,] -918109.29 494894.83 [25,] 505939.87 -918109.29 [26,] 83122.47 505939.87 [27,] -691058.16 83122.47 [28,] 1317955.55 -691058.16 [29,] -429873.64 1317955.55 [30,] 192188.87 -429873.64 [31,] -239111.97 192188.87 [32,] 41942.68 -239111.97 [33,] 450777.68 41942.68 [34,] 863306.42 450777.68 [35,] -294552.98 863306.42 [36,] -923994.28 -294552.98 [37,] -412021.50 -923994.28 [38,] 706340.05 -412021.50 [39,] -744971.42 706340.05 [40,] -218266.40 -744971.42 [41,] -863981.51 -218266.40 [42,] 78892.25 -863981.51 [43,] -23126.80 78892.25 [44,] 305054.57 -23126.80 [45,] 139941.82 305054.57 [46,] -534661.50 139941.82 [47,] -275685.15 -534661.50 [48,] 792178.37 -275685.15 [49,] -715030.19 792178.37 [50,] 82416.32 -715030.19 [51,] 98800.69 82416.32 [52,] 1343116.67 98800.69 [53,] -128992.16 1343116.67 [54,] 922394.35 -128992.16 [55,] -197157.65 922394.35 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 439344.12 2015069.79 2 -482964.99 439344.12 3 1018445.14 -482964.99 4 -943853.59 1018445.14 5 750123.62 -943853.59 6 -558086.76 750123.62 7 -258344.61 -558086.76 8 373862.99 -258344.61 9 55647.31 373862.99 10 -541839.28 55647.31 11 75343.30 -541839.28 12 -965144.60 75343.30 13 181767.71 -965144.60 14 -388913.85 181767.71 15 318783.74 -388913.85 16 -1498952.23 318783.74 17 672723.68 -1498952.23 18 -635388.71 672723.68 19 717741.02 -635388.71 20 -720860.24 717741.02 21 -646366.80 -720860.24 22 213194.35 -646366.80 23 494894.83 213194.35 24 -918109.29 494894.83 25 505939.87 -918109.29 26 83122.47 505939.87 27 -691058.16 83122.47 28 1317955.55 -691058.16 29 -429873.64 1317955.55 30 192188.87 -429873.64 31 -239111.97 192188.87 32 41942.68 -239111.97 33 450777.68 41942.68 34 863306.42 450777.68 35 -294552.98 863306.42 36 -923994.28 -294552.98 37 -412021.50 -923994.28 38 706340.05 -412021.50 39 -744971.42 706340.05 40 -218266.40 -744971.42 41 -863981.51 -218266.40 42 78892.25 -863981.51 43 -23126.80 78892.25 44 305054.57 -23126.80 45 139941.82 305054.57 46 -534661.50 139941.82 47 -275685.15 -534661.50 48 792178.37 -275685.15 49 -715030.19 792178.37 50 82416.32 -715030.19 51 98800.69 82416.32 52 1343116.67 98800.69 53 -128992.16 1343116.67 54 922394.35 -128992.16 55 -197157.65 922394.35 > 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/784431292938115.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/884431292938115.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/984431292938115.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/10jvlo1292938115.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/11mv2c1292938115.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/12pei01292938115.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/13wfxb1292938115.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/147ofw1292938115.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/15apdk1292938115.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/16d7uq1292938115.tab") + } > > try(system("convert tmp/1cc6c1292938115.ps tmp/1cc6c1292938115.png",intern=TRUE)) character(0) > try(system("convert tmp/2cc6c1292938115.ps tmp/2cc6c1292938115.png",intern=TRUE)) character(0) > try(system("convert tmp/3436x1292938115.ps tmp/3436x1292938115.png",intern=TRUE)) character(0) > try(system("convert tmp/4436x1292938115.ps tmp/4436x1292938115.png",intern=TRUE)) character(0) > try(system("convert tmp/5436x1292938115.ps tmp/5436x1292938115.png",intern=TRUE)) character(0) > try(system("convert tmp/6fcn01292938115.ps tmp/6fcn01292938115.png",intern=TRUE)) character(0) > try(system("convert tmp/784431292938115.ps tmp/784431292938115.png",intern=TRUE)) character(0) > try(system("convert tmp/884431292938115.ps tmp/884431292938115.png",intern=TRUE)) character(0) > try(system("convert tmp/984431292938115.ps tmp/984431292938115.png",intern=TRUE)) character(0) > try(system("convert tmp/10jvlo1292938115.ps tmp/10jvlo1292938115.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.416 1.651 9.755