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(101.0,0,98.7,0,105.1,0,98.4,0,101.7,0,102.9,0,92.2,0,94.9,0,92.8,0,98.5,0,94.3,0,87.4,0,103.4,0,101.2,0,109.6,0,111.9,0,108.9,0,105.6,0,107.8,0,97.5,0,102.4,0,105.6,0,99.8,0,96.2,0,113.1,0,107.4,0,116.8,0,112.9,0,105.3,0,109.3,0,107.9,0,101.1,0,114.7,0,116.2,0,108.4,0,113.4,0,108.7,0,112.6,0,124.2,1,114.9,1,110.5,1,121.5,1,118.1,1,111.7,1,132.7,1,119.0,1,116.7,1,120.1,1,113.4,1,106.6,1,116.3,1,112.6,1,111.6,1,125.1,1,110.7,1,109.6,1,114.2,1,113.4,1,116.0,1,109.6,1,117.8,1,115.8,1,125.3,1,113.0,1,120.5,1,116.6,1,111.8,1,115.2,1,118.6,1,122.4,1,116.4,1,114.5,1,119.8,1,115.8,1,127.8,1,118.8,1,119.7,1,118.6,1,120.8,1,115.9,1,109.7,1,114.8,1,116.2,1,112.2,1),dim=c(2,84),dimnames=list(c('Y','DUM'),1:84)) > y <- array(NA,dim=c(2,84),dimnames=list(c('Y','DUM'),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 = '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 Y DUM M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t 1 101.0 0 1 0 0 0 0 0 0 0 0 0 0 1 2 98.7 0 0 1 0 0 0 0 0 0 0 0 0 2 3 105.1 0 0 0 1 0 0 0 0 0 0 0 0 3 4 98.4 0 0 0 0 1 0 0 0 0 0 0 0 4 5 101.7 0 0 0 0 0 1 0 0 0 0 0 0 5 6 102.9 0 0 0 0 0 0 1 0 0 0 0 0 6 7 92.2 0 0 0 0 0 0 0 1 0 0 0 0 7 8 94.9 0 0 0 0 0 0 0 0 1 0 0 0 8 9 92.8 0 0 0 0 0 0 0 0 0 1 0 0 9 10 98.5 0 0 0 0 0 0 0 0 0 0 1 0 10 11 94.3 0 0 0 0 0 0 0 0 0 0 0 1 11 12 87.4 0 0 0 0 0 0 0 0 0 0 0 0 12 13 103.4 0 1 0 0 0 0 0 0 0 0 0 0 13 14 101.2 0 0 1 0 0 0 0 0 0 0 0 0 14 15 109.6 0 0 0 1 0 0 0 0 0 0 0 0 15 16 111.9 0 0 0 0 1 0 0 0 0 0 0 0 16 17 108.9 0 0 0 0 0 1 0 0 0 0 0 0 17 18 105.6 0 0 0 0 0 0 1 0 0 0 0 0 18 19 107.8 0 0 0 0 0 0 0 1 0 0 0 0 19 20 97.5 0 0 0 0 0 0 0 0 1 0 0 0 20 21 102.4 0 0 0 0 0 0 0 0 0 1 0 0 21 22 105.6 0 0 0 0 0 0 0 0 0 0 1 0 22 23 99.8 0 0 0 0 0 0 0 0 0 0 0 1 23 24 96.2 0 0 0 0 0 0 0 0 0 0 0 0 24 25 113.1 0 1 0 0 0 0 0 0 0 0 0 0 25 26 107.4 0 0 1 0 0 0 0 0 0 0 0 0 26 27 116.8 0 0 0 1 0 0 0 0 0 0 0 0 27 28 112.9 0 0 0 0 1 0 0 0 0 0 0 0 28 29 105.3 0 0 0 0 0 1 0 0 0 0 0 0 29 30 109.3 0 0 0 0 0 0 1 0 0 0 0 0 30 31 107.9 0 0 0 0 0 0 0 1 0 0 0 0 31 32 101.1 0 0 0 0 0 0 0 0 1 0 0 0 32 33 114.7 0 0 0 0 0 0 0 0 0 1 0 0 33 34 116.2 0 0 0 0 0 0 0 0 0 0 1 0 34 35 108.4 0 0 0 0 0 0 0 0 0 0 0 1 35 36 113.4 0 0 0 0 0 0 0 0 0 0 0 0 36 37 108.7 0 1 0 0 0 0 0 0 0 0 0 0 37 38 112.6 0 0 1 0 0 0 0 0 0 0 0 0 38 39 124.2 1 0 0 1 0 0 0 0 0 0 0 0 39 40 114.9 1 0 0 0 1 0 0 0 0 0 0 0 40 41 110.5 1 0 0 0 0 1 0 0 0 0 0 0 41 42 121.5 1 0 0 0 0 0 1 0 0 0 0 0 42 43 118.1 1 0 0 0 0 0 0 1 0 0 0 0 43 44 111.7 1 0 0 0 0 0 0 0 1 0 0 0 44 45 132.7 1 0 0 0 0 0 0 0 0 1 0 0 45 46 119.0 1 0 0 0 0 0 0 0 0 0 1 0 46 47 116.7 1 0 0 0 0 0 0 0 0 0 0 1 47 48 120.1 1 0 0 0 0 0 0 0 0 0 0 0 48 49 113.4 1 1 0 0 0 0 0 0 0 0 0 0 49 50 106.6 1 0 1 0 0 0 0 0 0 0 0 0 50 51 116.3 1 0 0 1 0 0 0 0 0 0 0 0 51 52 112.6 1 0 0 0 1 0 0 0 0 0 0 0 52 53 111.6 1 0 0 0 0 1 0 0 0 0 0 0 53 54 125.1 1 0 0 0 0 0 1 0 0 0 0 0 54 55 110.7 1 0 0 0 0 0 0 1 0 0 0 0 55 56 109.6 1 0 0 0 0 0 0 0 1 0 0 0 56 57 114.2 1 0 0 0 0 0 0 0 0 1 0 0 57 58 113.4 1 0 0 0 0 0 0 0 0 0 1 0 58 59 116.0 1 0 0 0 0 0 0 0 0 0 0 1 59 60 109.6 1 0 0 0 0 0 0 0 0 0 0 0 60 61 117.8 1 1 0 0 0 0 0 0 0 0 0 0 61 62 115.8 1 0 1 0 0 0 0 0 0 0 0 0 62 63 125.3 1 0 0 1 0 0 0 0 0 0 0 0 63 64 113.0 1 0 0 0 1 0 0 0 0 0 0 0 64 65 120.5 1 0 0 0 0 1 0 0 0 0 0 0 65 66 116.6 1 0 0 0 0 0 1 0 0 0 0 0 66 67 111.8 1 0 0 0 0 0 0 1 0 0 0 0 67 68 115.2 1 0 0 0 0 0 0 0 1 0 0 0 68 69 118.6 1 0 0 0 0 0 0 0 0 1 0 0 69 70 122.4 1 0 0 0 0 0 0 0 0 0 1 0 70 71 116.4 1 0 0 0 0 0 0 0 0 0 0 1 71 72 114.5 1 0 0 0 0 0 0 0 0 0 0 0 72 73 119.8 1 1 0 0 0 0 0 0 0 0 0 0 73 74 115.8 1 0 1 0 0 0 0 0 0 0 0 0 74 75 127.8 1 0 0 1 0 0 0 0 0 0 0 0 75 76 118.8 1 0 0 0 1 0 0 0 0 0 0 0 76 77 119.7 1 0 0 0 0 1 0 0 0 0 0 0 77 78 118.6 1 0 0 0 0 0 1 0 0 0 0 0 78 79 120.8 1 0 0 0 0 0 0 1 0 0 0 0 79 80 115.9 1 0 0 0 0 0 0 0 1 0 0 0 80 81 109.7 1 0 0 0 0 0 0 0 0 1 0 0 81 82 114.8 1 0 0 0 0 0 0 0 0 0 1 0 82 83 116.2 1 0 0 0 0 0 0 0 0 0 0 1 83 84 112.2 1 0 0 0 0 0 0 0 0 0 0 0 84 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) DUM M1 M2 M3 M4 96.0952 4.4333 6.0958 3.1798 11.9304 5.6571 M5 M6 M7 M8 M9 M10 4.8554 7.7250 3.2089 -0.3214 5.0911 5.5893 M11 t 2.2446 0.1875 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -11.1071 -2.9732 -0.5929 3.1786 18.6429 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 96.09524 2.45175 39.195 < 2e-16 *** DUM 4.43333 2.37997 1.863 0.066692 . M1 6.09583 2.90037 2.102 0.039176 * M2 3.17976 2.89663 1.098 0.276077 M3 11.93036 2.91858 4.088 0.000115 *** M4 5.65714 2.91155 1.943 0.056039 . M5 4.85536 2.90534 1.671 0.099151 . M6 7.72500 2.89995 2.664 0.009581 ** M7 3.20893 2.89538 1.108 0.271529 M8 -0.32143 2.89163 -0.111 0.911809 M9 5.09107 2.88872 1.762 0.082367 . M10 5.58929 2.88663 1.936 0.056874 . M11 2.24464 2.88538 0.778 0.439228 t 0.18750 0.04907 3.821 0.000285 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 5.397 on 70 degrees of freedom Multiple R-squared: 0.6769, Adjusted R-squared: 0.6169 F-statistic: 11.28 on 13 and 70 DF, p-value: 1.485e-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.36773931 0.73547862 0.63226069 [2,] 0.24922359 0.49844717 0.75077641 [3,] 0.39406560 0.78813119 0.60593440 [4,] 0.32050291 0.64100582 0.67949709 [5,] 0.25898650 0.51797301 0.74101350 [6,] 0.17749032 0.35498065 0.82250968 [7,] 0.13278290 0.26556580 0.86721710 [8,] 0.12500577 0.25001154 0.87499423 [9,] 0.08003963 0.16007927 0.91996037 [10,] 0.05614838 0.11229677 0.94385162 [11,] 0.03291029 0.06582057 0.96708971 [12,] 0.02176549 0.04353098 0.97823451 [13,] 0.07087699 0.14175397 0.92912301 [14,] 0.05981132 0.11962264 0.94018868 [15,] 0.03836761 0.07673521 0.96163239 [16,] 0.03592437 0.07184875 0.96407563 [17,] 0.07329764 0.14659528 0.92670236 [18,] 0.07169535 0.14339069 0.92830465 [19,] 0.05493136 0.10986271 0.94506864 [20,] 0.15598250 0.31196501 0.84401750 [21,] 0.24983050 0.49966100 0.75016950 [22,] 0.19571785 0.39143571 0.80428215 [23,] 0.14753267 0.29506534 0.85246733 [24,] 0.12564137 0.25128275 0.87435863 [25,] 0.12277351 0.24554701 0.87722649 [26,] 0.11462688 0.22925376 0.88537312 [27,] 0.10160256 0.20320512 0.89839744 [28,] 0.07489541 0.14979081 0.92510459 [29,] 0.69817854 0.60364293 0.30182146 [30,] 0.66289613 0.67420774 0.33710387 [31,] 0.60941401 0.78117198 0.39058599 [32,] 0.80045474 0.39909052 0.19954526 [33,] 0.82770062 0.34459877 0.17229938 [34,] 0.91644159 0.16711681 0.08355841 [35,] 0.96137628 0.07724745 0.03862372 [36,] 0.95890051 0.08219899 0.04109949 [37,] 0.97021402 0.05957196 0.02978598 [38,] 0.98710432 0.02579136 0.01289568 [39,] 0.98540185 0.02919630 0.01459815 [40,] 0.98250898 0.03498204 0.01749102 [41,] 0.97473455 0.05053089 0.02526545 [42,] 0.97088779 0.05822442 0.02911221 [43,] 0.94863527 0.10272946 0.05136473 [44,] 0.92915893 0.14168214 0.07084107 [45,] 0.88843561 0.22312877 0.11156439 [46,] 0.82364802 0.35270396 0.17635198 [47,] 0.74667717 0.50664566 0.25332283 [48,] 0.74534522 0.50930957 0.25465478 [49,] 0.61996350 0.76007301 0.38003650 [50,] 0.51360902 0.97278196 0.48639098 [51,] 0.75585155 0.48829690 0.24414845 > postscript(file="/var/www/html/rcomp/tmp/12w5l1261321869.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/2mkx91261321869.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/3c9v71261321869.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/4atcz1261321869.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/5q3ee1261321869.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 = 84 Frequency = 1 1 2 3 4 5 6 -1.37857143 -0.95000000 -3.48809524 -4.10238095 -0.18809524 -2.04523810 7 8 9 10 11 12 -8.41666667 -2.37380952 -10.07380952 -5.05952381 -6.10238095 -10.94523810 13 14 15 16 17 18 -1.22857143 -0.70000000 -1.23809524 7.14761905 4.76190476 -1.59523810 19 20 21 22 23 24 4.93333333 -2.02380952 -2.72380952 -0.20952381 -2.85238095 -4.39523810 25 26 27 28 29 30 6.22142857 3.25000000 3.71190476 5.89761905 -1.08809524 -0.14523810 31 32 33 34 35 36 2.78333333 -0.67380952 7.32619048 8.14047619 3.49761905 10.55476190 37 38 39 40 41 42 -0.42857143 6.20000000 4.42857143 1.21428571 -2.57142857 5.37142857 43 44 45 46 47 48 6.30000000 3.24285714 18.64285714 4.25714286 5.11428571 10.57142857 49 50 51 52 53 54 -2.41190476 -6.48333333 -5.72142857 -3.33571429 -3.72142857 6.72142857 55 56 57 58 59 60 -3.35000000 -1.10714286 -2.10714286 -3.59285714 2.16428571 -2.17857143 61 62 63 64 65 66 -0.26190476 0.46666667 1.02857143 -5.18571429 2.92857143 -4.02857143 67 68 69 70 71 72 -4.50000000 2.24285714 0.04285714 3.15714286 0.31428571 0.47142857 73 74 75 76 77 78 -0.51190476 -1.78333333 1.27857143 -1.63571429 -0.12142857 -4.27857143 79 80 81 82 83 84 2.25000000 0.69285714 -11.10714286 -6.69285714 -2.13571429 -4.07857143 > postscript(file="/var/www/html/rcomp/tmp/6okzs1261321869.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 = 84 Frequency = 1 lag(myerror, k = 1) myerror 0 -1.37857143 NA 1 -0.95000000 -1.37857143 2 -3.48809524 -0.95000000 3 -4.10238095 -3.48809524 4 -0.18809524 -4.10238095 5 -2.04523810 -0.18809524 6 -8.41666667 -2.04523810 7 -2.37380952 -8.41666667 8 -10.07380952 -2.37380952 9 -5.05952381 -10.07380952 10 -6.10238095 -5.05952381 11 -10.94523810 -6.10238095 12 -1.22857143 -10.94523810 13 -0.70000000 -1.22857143 14 -1.23809524 -0.70000000 15 7.14761905 -1.23809524 16 4.76190476 7.14761905 17 -1.59523810 4.76190476 18 4.93333333 -1.59523810 19 -2.02380952 4.93333333 20 -2.72380952 -2.02380952 21 -0.20952381 -2.72380952 22 -2.85238095 -0.20952381 23 -4.39523810 -2.85238095 24 6.22142857 -4.39523810 25 3.25000000 6.22142857 26 3.71190476 3.25000000 27 5.89761905 3.71190476 28 -1.08809524 5.89761905 29 -0.14523810 -1.08809524 30 2.78333333 -0.14523810 31 -0.67380952 2.78333333 32 7.32619048 -0.67380952 33 8.14047619 7.32619048 34 3.49761905 8.14047619 35 10.55476190 3.49761905 36 -0.42857143 10.55476190 37 6.20000000 -0.42857143 38 4.42857143 6.20000000 39 1.21428571 4.42857143 40 -2.57142857 1.21428571 41 5.37142857 -2.57142857 42 6.30000000 5.37142857 43 3.24285714 6.30000000 44 18.64285714 3.24285714 45 4.25714286 18.64285714 46 5.11428571 4.25714286 47 10.57142857 5.11428571 48 -2.41190476 10.57142857 49 -6.48333333 -2.41190476 50 -5.72142857 -6.48333333 51 -3.33571429 -5.72142857 52 -3.72142857 -3.33571429 53 6.72142857 -3.72142857 54 -3.35000000 6.72142857 55 -1.10714286 -3.35000000 56 -2.10714286 -1.10714286 57 -3.59285714 -2.10714286 58 2.16428571 -3.59285714 59 -2.17857143 2.16428571 60 -0.26190476 -2.17857143 61 0.46666667 -0.26190476 62 1.02857143 0.46666667 63 -5.18571429 1.02857143 64 2.92857143 -5.18571429 65 -4.02857143 2.92857143 66 -4.50000000 -4.02857143 67 2.24285714 -4.50000000 68 0.04285714 2.24285714 69 3.15714286 0.04285714 70 0.31428571 3.15714286 71 0.47142857 0.31428571 72 -0.51190476 0.47142857 73 -1.78333333 -0.51190476 74 1.27857143 -1.78333333 75 -1.63571429 1.27857143 76 -0.12142857 -1.63571429 77 -4.27857143 -0.12142857 78 2.25000000 -4.27857143 79 0.69285714 2.25000000 80 -11.10714286 0.69285714 81 -6.69285714 -11.10714286 82 -2.13571429 -6.69285714 83 -4.07857143 -2.13571429 84 NA -4.07857143 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -0.95000000 -1.37857143 [2,] -3.48809524 -0.95000000 [3,] -4.10238095 -3.48809524 [4,] -0.18809524 -4.10238095 [5,] -2.04523810 -0.18809524 [6,] -8.41666667 -2.04523810 [7,] -2.37380952 -8.41666667 [8,] -10.07380952 -2.37380952 [9,] -5.05952381 -10.07380952 [10,] -6.10238095 -5.05952381 [11,] -10.94523810 -6.10238095 [12,] -1.22857143 -10.94523810 [13,] -0.70000000 -1.22857143 [14,] -1.23809524 -0.70000000 [15,] 7.14761905 -1.23809524 [16,] 4.76190476 7.14761905 [17,] -1.59523810 4.76190476 [18,] 4.93333333 -1.59523810 [19,] -2.02380952 4.93333333 [20,] -2.72380952 -2.02380952 [21,] -0.20952381 -2.72380952 [22,] -2.85238095 -0.20952381 [23,] -4.39523810 -2.85238095 [24,] 6.22142857 -4.39523810 [25,] 3.25000000 6.22142857 [26,] 3.71190476 3.25000000 [27,] 5.89761905 3.71190476 [28,] -1.08809524 5.89761905 [29,] -0.14523810 -1.08809524 [30,] 2.78333333 -0.14523810 [31,] -0.67380952 2.78333333 [32,] 7.32619048 -0.67380952 [33,] 8.14047619 7.32619048 [34,] 3.49761905 8.14047619 [35,] 10.55476190 3.49761905 [36,] -0.42857143 10.55476190 [37,] 6.20000000 -0.42857143 [38,] 4.42857143 6.20000000 [39,] 1.21428571 4.42857143 [40,] -2.57142857 1.21428571 [41,] 5.37142857 -2.57142857 [42,] 6.30000000 5.37142857 [43,] 3.24285714 6.30000000 [44,] 18.64285714 3.24285714 [45,] 4.25714286 18.64285714 [46,] 5.11428571 4.25714286 [47,] 10.57142857 5.11428571 [48,] -2.41190476 10.57142857 [49,] -6.48333333 -2.41190476 [50,] -5.72142857 -6.48333333 [51,] -3.33571429 -5.72142857 [52,] -3.72142857 -3.33571429 [53,] 6.72142857 -3.72142857 [54,] -3.35000000 6.72142857 [55,] -1.10714286 -3.35000000 [56,] -2.10714286 -1.10714286 [57,] -3.59285714 -2.10714286 [58,] 2.16428571 -3.59285714 [59,] -2.17857143 2.16428571 [60,] -0.26190476 -2.17857143 [61,] 0.46666667 -0.26190476 [62,] 1.02857143 0.46666667 [63,] -5.18571429 1.02857143 [64,] 2.92857143 -5.18571429 [65,] -4.02857143 2.92857143 [66,] -4.50000000 -4.02857143 [67,] 2.24285714 -4.50000000 [68,] 0.04285714 2.24285714 [69,] 3.15714286 0.04285714 [70,] 0.31428571 3.15714286 [71,] 0.47142857 0.31428571 [72,] -0.51190476 0.47142857 [73,] -1.78333333 -0.51190476 [74,] 1.27857143 -1.78333333 [75,] -1.63571429 1.27857143 [76,] -0.12142857 -1.63571429 [77,] -4.27857143 -0.12142857 [78,] 2.25000000 -4.27857143 [79,] 0.69285714 2.25000000 [80,] -11.10714286 0.69285714 [81,] -6.69285714 -11.10714286 [82,] -2.13571429 -6.69285714 [83,] -4.07857143 -2.13571429 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -0.95000000 -1.37857143 2 -3.48809524 -0.95000000 3 -4.10238095 -3.48809524 4 -0.18809524 -4.10238095 5 -2.04523810 -0.18809524 6 -8.41666667 -2.04523810 7 -2.37380952 -8.41666667 8 -10.07380952 -2.37380952 9 -5.05952381 -10.07380952 10 -6.10238095 -5.05952381 11 -10.94523810 -6.10238095 12 -1.22857143 -10.94523810 13 -0.70000000 -1.22857143 14 -1.23809524 -0.70000000 15 7.14761905 -1.23809524 16 4.76190476 7.14761905 17 -1.59523810 4.76190476 18 4.93333333 -1.59523810 19 -2.02380952 4.93333333 20 -2.72380952 -2.02380952 21 -0.20952381 -2.72380952 22 -2.85238095 -0.20952381 23 -4.39523810 -2.85238095 24 6.22142857 -4.39523810 25 3.25000000 6.22142857 26 3.71190476 3.25000000 27 5.89761905 3.71190476 28 -1.08809524 5.89761905 29 -0.14523810 -1.08809524 30 2.78333333 -0.14523810 31 -0.67380952 2.78333333 32 7.32619048 -0.67380952 33 8.14047619 7.32619048 34 3.49761905 8.14047619 35 10.55476190 3.49761905 36 -0.42857143 10.55476190 37 6.20000000 -0.42857143 38 4.42857143 6.20000000 39 1.21428571 4.42857143 40 -2.57142857 1.21428571 41 5.37142857 -2.57142857 42 6.30000000 5.37142857 43 3.24285714 6.30000000 44 18.64285714 3.24285714 45 4.25714286 18.64285714 46 5.11428571 4.25714286 47 10.57142857 5.11428571 48 -2.41190476 10.57142857 49 -6.48333333 -2.41190476 50 -5.72142857 -6.48333333 51 -3.33571429 -5.72142857 52 -3.72142857 -3.33571429 53 6.72142857 -3.72142857 54 -3.35000000 6.72142857 55 -1.10714286 -3.35000000 56 -2.10714286 -1.10714286 57 -3.59285714 -2.10714286 58 2.16428571 -3.59285714 59 -2.17857143 2.16428571 60 -0.26190476 -2.17857143 61 0.46666667 -0.26190476 62 1.02857143 0.46666667 63 -5.18571429 1.02857143 64 2.92857143 -5.18571429 65 -4.02857143 2.92857143 66 -4.50000000 -4.02857143 67 2.24285714 -4.50000000 68 0.04285714 2.24285714 69 3.15714286 0.04285714 70 0.31428571 3.15714286 71 0.47142857 0.31428571 72 -0.51190476 0.47142857 73 -1.78333333 -0.51190476 74 1.27857143 -1.78333333 75 -1.63571429 1.27857143 76 -0.12142857 -1.63571429 77 -4.27857143 -0.12142857 78 2.25000000 -4.27857143 79 0.69285714 2.25000000 80 -11.10714286 0.69285714 81 -6.69285714 -11.10714286 82 -2.13571429 -6.69285714 83 -4.07857143 -2.13571429 > 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/7z7wp1261321869.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/8frlw1261321869.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/94zm71261321869.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/10astq1261321869.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/11xjpj1261321869.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/12kg9g1261321869.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/13bxp51261321869.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/14iw1y1261321869.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/1512pm1261321869.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/1628051261321869.tab") + } > try(system("convert tmp/12w5l1261321869.ps tmp/12w5l1261321869.png",intern=TRUE)) character(0) > try(system("convert tmp/2mkx91261321869.ps tmp/2mkx91261321869.png",intern=TRUE)) character(0) > try(system("convert tmp/3c9v71261321869.ps tmp/3c9v71261321869.png",intern=TRUE)) character(0) > try(system("convert tmp/4atcz1261321869.ps tmp/4atcz1261321869.png",intern=TRUE)) character(0) > try(system("convert tmp/5q3ee1261321869.ps tmp/5q3ee1261321869.png",intern=TRUE)) character(0) > try(system("convert tmp/6okzs1261321869.ps tmp/6okzs1261321869.png",intern=TRUE)) character(0) > try(system("convert tmp/7z7wp1261321869.ps tmp/7z7wp1261321869.png",intern=TRUE)) character(0) > try(system("convert tmp/8frlw1261321869.ps tmp/8frlw1261321869.png",intern=TRUE)) character(0) > try(system("convert tmp/94zm71261321869.ps tmp/94zm71261321869.png",intern=TRUE)) character(0) > try(system("convert tmp/10astq1261321869.ps tmp/10astq1261321869.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.729 1.583 3.910