R version 2.8.0 (2008-10-20) Copyright (C) 2008 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(124.9,1487.6,132,1320.9,151.4,1514,108.9,1290.9,121.3,1392.5,123.4,1288.2,90.3,1304.4,79.3,1297.8,117.2,1211,116.9,1454,120.8,1405.7,96.1,1160.8,100.8,1492.1,105.3,1263,116.1,1376.3,112.8,1368.6,114.5,1427.6,117.2,1339.8,77.1,1248.3,80.1,1309.8,120.3,1424,133.4,1590.5,109.4,1423.1,93.2,1355.3,91.2,1515,99.2,1385.6,108.2,1430,101.5,1494.2,106.9,1580.9,104.4,1369.8,77.9,1407.5,60,1388.3,99.5,1478.5,95,1630.4,105.6,1413.5,102.5,1493.8,93.3,1641.3,97.3,1465,127,1725.1,111.7,1628.4,96.4,1679.8,133,1876,72.2,1669.4,95.8,1712.4,124.1,1768.8,127.6,1820.5,110.7,1776.2,104.6,1693.7,112.7,1799.1,115.3,1917.5,139.4,1887.2,119,1787.8,97.4,1803.8,154,2196.4,81.5,1759.5,88.8,2002.6,127.7,2056.8,105.1,1851.1,114.9,1984.3,106.4,1725.3,104.5,2096.6,121.6,1792.2,141.4,2029.9,99,1785.3,126.7,2026.5,134.1,1930.8,81.3,1845.5,88.6,1943.1,132.7,2066.8,132.9,2354.4,134.4,2190.7,103.7,1929.6),dim=c(2,72),dimnames=list(c('transport','Import'),1:72)) > y <- array(NA,dim=c(2,72),dimnames=list(c('transport','Import'),1:72)) > for (i in 1:dim(x)[1]) + { + for (j in 1:dim(x)[2]) + { + y[i,j] <- as.numeric(x[i,j]) + } + } > par3 = 'No Linear Trend' > par2 = 'Include Monthly Dummies' > par1 = '1' > #'GNU S' R Code compiled by R2WASP v. 1.0.44 () > #Author: Prof. Dr. P. Wessa > #To cite this work: AUTHOR(S), (YEAR), YOUR SOFTWARE TITLE (vNUMBER) in Free Statistics Software (v$_version), Office for Research Development and Education, URL http://www.wessa.net/rwasp_YOURPAGE.wasp/ > #Source of accompanying publication: Office for Research, Development, and Education > #Technical description: Write here your technical program description (don't use hard returns!) > library(lattice) > library(lmtest) Loading required package: zoo Attaching package: 'zoo' The following object(s) are masked from package:base : as.Date.numeric > n25 <- 25 #minimum number of obs. for Goldfeld-Quandt test > par1 <- as.numeric(par1) > x <- t(y) > k <- length(x[1,]) > n <- length(x[,1]) > x1 <- cbind(x[,par1], x[,1:k!=par1]) > mycolnames <- c(colnames(x)[par1], colnames(x)[1:k!=par1]) > colnames(x1) <- mycolnames #colnames(x)[par1] > x <- x1 > if (par3 == 'First Differences'){ + x2 <- array(0, dim=c(n-1,k), dimnames=list(1:(n-1), paste('(1-B)',colnames(x),sep=''))) + for (i in 1:n-1) { + for (j in 1:k) { + x2[i,j] <- x[i+1,j] - x[i,j] + } + } + x <- x2 + } > if (par2 == 'Include Monthly Dummies'){ + x2 <- array(0, dim=c(n,11), dimnames=list(1:n, paste('M', seq(1:11), sep =''))) + for (i in 1:11){ + x2[seq(i,n,12),i] <- 1 + } + x <- cbind(x, x2) + } > if (par2 == 'Include Quarterly Dummies'){ + x2 <- array(0, dim=c(n,3), dimnames=list(1:n, paste('Q', seq(1:3), sep =''))) + for (i in 1:3){ + x2[seq(i,n,4),i] <- 1 + } + x <- cbind(x, x2) + } > k <- length(x[1,]) > if (par3 == 'Linear Trend'){ + x <- cbind(x, c(1:n)) + colnames(x)[k+1] <- 't' + } > x transport Import M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 1 124.9 1487.6 1 0 0 0 0 0 0 0 0 0 0 2 132.0 1320.9 0 1 0 0 0 0 0 0 0 0 0 3 151.4 1514.0 0 0 1 0 0 0 0 0 0 0 0 4 108.9 1290.9 0 0 0 1 0 0 0 0 0 0 0 5 121.3 1392.5 0 0 0 0 1 0 0 0 0 0 0 6 123.4 1288.2 0 0 0 0 0 1 0 0 0 0 0 7 90.3 1304.4 0 0 0 0 0 0 1 0 0 0 0 8 79.3 1297.8 0 0 0 0 0 0 0 1 0 0 0 9 117.2 1211.0 0 0 0 0 0 0 0 0 1 0 0 10 116.9 1454.0 0 0 0 0 0 0 0 0 0 1 0 11 120.8 1405.7 0 0 0 0 0 0 0 0 0 0 1 12 96.1 1160.8 0 0 0 0 0 0 0 0 0 0 0 13 100.8 1492.1 1 0 0 0 0 0 0 0 0 0 0 14 105.3 1263.0 0 1 0 0 0 0 0 0 0 0 0 15 116.1 1376.3 0 0 1 0 0 0 0 0 0 0 0 16 112.8 1368.6 0 0 0 1 0 0 0 0 0 0 0 17 114.5 1427.6 0 0 0 0 1 0 0 0 0 0 0 18 117.2 1339.8 0 0 0 0 0 1 0 0 0 0 0 19 77.1 1248.3 0 0 0 0 0 0 1 0 0 0 0 20 80.1 1309.8 0 0 0 0 0 0 0 1 0 0 0 21 120.3 1424.0 0 0 0 0 0 0 0 0 1 0 0 22 133.4 1590.5 0 0 0 0 0 0 0 0 0 1 0 23 109.4 1423.1 0 0 0 0 0 0 0 0 0 0 1 24 93.2 1355.3 0 0 0 0 0 0 0 0 0 0 0 25 91.2 1515.0 1 0 0 0 0 0 0 0 0 0 0 26 99.2 1385.6 0 1 0 0 0 0 0 0 0 0 0 27 108.2 1430.0 0 0 1 0 0 0 0 0 0 0 0 28 101.5 1494.2 0 0 0 1 0 0 0 0 0 0 0 29 106.9 1580.9 0 0 0 0 1 0 0 0 0 0 0 30 104.4 1369.8 0 0 0 0 0 1 0 0 0 0 0 31 77.9 1407.5 0 0 0 0 0 0 1 0 0 0 0 32 60.0 1388.3 0 0 0 0 0 0 0 1 0 0 0 33 99.5 1478.5 0 0 0 0 0 0 0 0 1 0 0 34 95.0 1630.4 0 0 0 0 0 0 0 0 0 1 0 35 105.6 1413.5 0 0 0 0 0 0 0 0 0 0 1 36 102.5 1493.8 0 0 0 0 0 0 0 0 0 0 0 37 93.3 1641.3 1 0 0 0 0 0 0 0 0 0 0 38 97.3 1465.0 0 1 0 0 0 0 0 0 0 0 0 39 127.0 1725.1 0 0 1 0 0 0 0 0 0 0 0 40 111.7 1628.4 0 0 0 1 0 0 0 0 0 0 0 41 96.4 1679.8 0 0 0 0 1 0 0 0 0 0 0 42 133.0 1876.0 0 0 0 0 0 1 0 0 0 0 0 43 72.2 1669.4 0 0 0 0 0 0 1 0 0 0 0 44 95.8 1712.4 0 0 0 0 0 0 0 1 0 0 0 45 124.1 1768.8 0 0 0 0 0 0 0 0 1 0 0 46 127.6 1820.5 0 0 0 0 0 0 0 0 0 1 0 47 110.7 1776.2 0 0 0 0 0 0 0 0 0 0 1 48 104.6 1693.7 0 0 0 0 0 0 0 0 0 0 0 49 112.7 1799.1 1 0 0 0 0 0 0 0 0 0 0 50 115.3 1917.5 0 1 0 0 0 0 0 0 0 0 0 51 139.4 1887.2 0 0 1 0 0 0 0 0 0 0 0 52 119.0 1787.8 0 0 0 1 0 0 0 0 0 0 0 53 97.4 1803.8 0 0 0 0 1 0 0 0 0 0 0 54 154.0 2196.4 0 0 0 0 0 1 0 0 0 0 0 55 81.5 1759.5 0 0 0 0 0 0 1 0 0 0 0 56 88.8 2002.6 0 0 0 0 0 0 0 1 0 0 0 57 127.7 2056.8 0 0 0 0 0 0 0 0 1 0 0 58 105.1 1851.1 0 0 0 0 0 0 0 0 0 1 0 59 114.9 1984.3 0 0 0 0 0 0 0 0 0 0 1 60 106.4 1725.3 0 0 0 0 0 0 0 0 0 0 0 61 104.5 2096.6 1 0 0 0 0 0 0 0 0 0 0 62 121.6 1792.2 0 1 0 0 0 0 0 0 0 0 0 63 141.4 2029.9 0 0 1 0 0 0 0 0 0 0 0 64 99.0 1785.3 0 0 0 1 0 0 0 0 0 0 0 65 126.7 2026.5 0 0 0 0 1 0 0 0 0 0 0 66 134.1 1930.8 0 0 0 0 0 1 0 0 0 0 0 67 81.3 1845.5 0 0 0 0 0 0 1 0 0 0 0 68 88.6 1943.1 0 0 0 0 0 0 0 1 0 0 0 69 132.7 2066.8 0 0 0 0 0 0 0 0 1 0 0 70 132.9 2354.4 0 0 0 0 0 0 0 0 0 1 0 71 134.4 2190.7 0 0 0 0 0 0 0 0 0 0 1 72 103.7 1929.6 0 0 0 0 0 0 0 0 0 0 0 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) Import M1 M2 M3 M4 71.85189 0.01874 1.38058 11.36937 27.61340 7.74364 M5 M6 M7 M8 M9 M10 7.72394 24.59314 -20.64633 -19.90633 17.14450 13.20699 M11 12.27520 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -20.614 -6.178 1.201 5.005 24.024 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 71.851891 8.897680 8.075 4.08e-11 *** Import 0.018741 0.004905 3.821 0.000322 *** M1 1.380581 6.449238 0.214 0.831231 M2 11.369370 6.428105 1.769 0.082114 . M3 27.613395 6.444658 4.285 6.85e-05 *** M4 7.743641 6.425718 1.205 0.232976 M5 7.723944 6.441575 1.199 0.235292 M6 24.593140 6.447146 3.815 0.000329 *** M7 -20.646329 6.426515 -3.213 0.002132 ** M8 -19.906333 6.430256 -3.096 0.003002 ** M9 17.144501 6.447473 2.659 0.010070 * M10 13.206990 6.518742 2.026 0.047294 * M11 12.275196 6.461868 1.900 0.062372 . --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 11.13 on 59 degrees of freedom Multiple R-squared: 0.7136, Adjusted R-squared: 0.6553 F-statistic: 12.25 on 12 and 59 DF, p-value: 5.716e-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.8574558 0.28508834 0.142544168 [2,] 0.8575258 0.28494831 0.142474153 [3,] 0.8531770 0.29364598 0.146822990 [4,] 0.7891544 0.42169122 0.210845608 [5,] 0.7155268 0.56894641 0.284473204 [6,] 0.8492061 0.30158781 0.150793905 [7,] 0.9106000 0.17879999 0.089399995 [8,] 0.9080239 0.18395229 0.091976145 [9,] 0.9174483 0.16510344 0.082551718 [10,] 0.9547249 0.09055029 0.045275144 [11,] 0.9737843 0.05243145 0.026215724 [12,] 0.9863201 0.02735981 0.013679905 [13,] 0.9829199 0.03416013 0.017080063 [14,] 0.9821202 0.03575954 0.017879769 [15,] 0.9829972 0.03400561 0.017002805 [16,] 0.9817076 0.03658480 0.018292400 [17,] 0.9854495 0.02910098 0.014550489 [18,] 0.9864374 0.02712526 0.013562628 [19,] 0.9939507 0.01209866 0.006049328 [20,] 0.9906506 0.01869888 0.009349442 [21,] 0.9887516 0.02249674 0.011248371 [22,] 0.9828058 0.03438842 0.017194209 [23,] 0.9776240 0.04475194 0.022375970 [24,] 0.9686466 0.06270684 0.031353419 [25,] 0.9582141 0.08357178 0.041785888 [26,] 0.9498014 0.10039718 0.050198592 [27,] 0.9509690 0.09806199 0.049030995 [28,] 0.9297494 0.14050119 0.070250595 [29,] 0.9489042 0.10219154 0.051095772 [30,] 0.9241130 0.15177396 0.075886980 [31,] 0.9531829 0.09363426 0.046817132 [32,] 0.9226989 0.15460227 0.077301133 [33,] 0.8855084 0.22898326 0.114491628 [34,] 0.9400992 0.11980153 0.059900763 [35,] 0.9358187 0.12836269 0.064181346 [36,] 0.9031477 0.19370465 0.096852327 [37,] 0.9515481 0.09690375 0.048451873 [38,] 0.9770812 0.04583769 0.022918847 [39,] 0.9617469 0.07650617 0.038253083 [40,] 0.9170962 0.16580769 0.082903846 [41,] 0.8169789 0.36604229 0.183021145 > postscript(file="/var/www/html/rcomp/tmp/1x12w1229557011.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/2gdda1229557011.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/38d821229557011.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/4pwja1229557011.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/5uv6f1229557011.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 = 72 Frequency = 1 1 2 3 4 5 6 23.7882564 24.0236102 23.5606771 5.1115724 15.6271728 2.8126745 7 8 9 10 11 12 14.6485379 3.0322326 5.5081266 4.5915491 10.3285383 2.4934314 13 14 15 16 17 18 -0.3960785 -1.5912797 -9.1586724 7.5553884 8.1693599 -4.3543666 19 20 21 22 23 24 2.4999140 3.6073393 4.6162708 18.5333880 -1.3975570 -4.0517140 25 26 27 28 29 30 -10.4252499 -9.9889394 -18.0650699 -6.0984947 -2.3036518 -17.7165998 31 32 33 34 35 36 0.3163297 -17.9638376 -17.2051196 -20.6143822 -5.0176423 2.6526427 37 38 39 40 41 42 -10.6922517 -13.3769833 -4.7955706 1.5864487 -14.6571473 1.3966518 43 44 45 46 47 48 -10.2919663 11.7621695 1.9543370 8.4229333 -6.7150419 1.0062954 49 50 51 52 53 54 5.7504016 -3.8573343 4.5664959 5.8991162 -15.9810446 16.3920010 55 56 57 58 59 60 -2.6805400 -0.6764998 0.1568981 -14.6505445 -6.4150663 2.2140764 61 62 63 64 65 66 -8.0250778 4.7909264 3.8921399 -14.0540310 9.1453109 1.4696391 67 68 69 70 71 72 -4.4922752 0.2385961 4.9694871 3.7170562 9.2167692 -4.3147318 > postscript(file="/var/www/html/rcomp/tmp/69req1229557011.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 = 72 Frequency = 1 lag(myerror, k = 1) myerror 0 23.7882564 NA 1 24.0236102 23.7882564 2 23.5606771 24.0236102 3 5.1115724 23.5606771 4 15.6271728 5.1115724 5 2.8126745 15.6271728 6 14.6485379 2.8126745 7 3.0322326 14.6485379 8 5.5081266 3.0322326 9 4.5915491 5.5081266 10 10.3285383 4.5915491 11 2.4934314 10.3285383 12 -0.3960785 2.4934314 13 -1.5912797 -0.3960785 14 -9.1586724 -1.5912797 15 7.5553884 -9.1586724 16 8.1693599 7.5553884 17 -4.3543666 8.1693599 18 2.4999140 -4.3543666 19 3.6073393 2.4999140 20 4.6162708 3.6073393 21 18.5333880 4.6162708 22 -1.3975570 18.5333880 23 -4.0517140 -1.3975570 24 -10.4252499 -4.0517140 25 -9.9889394 -10.4252499 26 -18.0650699 -9.9889394 27 -6.0984947 -18.0650699 28 -2.3036518 -6.0984947 29 -17.7165998 -2.3036518 30 0.3163297 -17.7165998 31 -17.9638376 0.3163297 32 -17.2051196 -17.9638376 33 -20.6143822 -17.2051196 34 -5.0176423 -20.6143822 35 2.6526427 -5.0176423 36 -10.6922517 2.6526427 37 -13.3769833 -10.6922517 38 -4.7955706 -13.3769833 39 1.5864487 -4.7955706 40 -14.6571473 1.5864487 41 1.3966518 -14.6571473 42 -10.2919663 1.3966518 43 11.7621695 -10.2919663 44 1.9543370 11.7621695 45 8.4229333 1.9543370 46 -6.7150419 8.4229333 47 1.0062954 -6.7150419 48 5.7504016 1.0062954 49 -3.8573343 5.7504016 50 4.5664959 -3.8573343 51 5.8991162 4.5664959 52 -15.9810446 5.8991162 53 16.3920010 -15.9810446 54 -2.6805400 16.3920010 55 -0.6764998 -2.6805400 56 0.1568981 -0.6764998 57 -14.6505445 0.1568981 58 -6.4150663 -14.6505445 59 2.2140764 -6.4150663 60 -8.0250778 2.2140764 61 4.7909264 -8.0250778 62 3.8921399 4.7909264 63 -14.0540310 3.8921399 64 9.1453109 -14.0540310 65 1.4696391 9.1453109 66 -4.4922752 1.4696391 67 0.2385961 -4.4922752 68 4.9694871 0.2385961 69 3.7170562 4.9694871 70 9.2167692 3.7170562 71 -4.3147318 9.2167692 72 NA -4.3147318 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] 24.0236102 23.7882564 [2,] 23.5606771 24.0236102 [3,] 5.1115724 23.5606771 [4,] 15.6271728 5.1115724 [5,] 2.8126745 15.6271728 [6,] 14.6485379 2.8126745 [7,] 3.0322326 14.6485379 [8,] 5.5081266 3.0322326 [9,] 4.5915491 5.5081266 [10,] 10.3285383 4.5915491 [11,] 2.4934314 10.3285383 [12,] -0.3960785 2.4934314 [13,] -1.5912797 -0.3960785 [14,] -9.1586724 -1.5912797 [15,] 7.5553884 -9.1586724 [16,] 8.1693599 7.5553884 [17,] -4.3543666 8.1693599 [18,] 2.4999140 -4.3543666 [19,] 3.6073393 2.4999140 [20,] 4.6162708 3.6073393 [21,] 18.5333880 4.6162708 [22,] -1.3975570 18.5333880 [23,] -4.0517140 -1.3975570 [24,] -10.4252499 -4.0517140 [25,] -9.9889394 -10.4252499 [26,] -18.0650699 -9.9889394 [27,] -6.0984947 -18.0650699 [28,] -2.3036518 -6.0984947 [29,] -17.7165998 -2.3036518 [30,] 0.3163297 -17.7165998 [31,] -17.9638376 0.3163297 [32,] -17.2051196 -17.9638376 [33,] -20.6143822 -17.2051196 [34,] -5.0176423 -20.6143822 [35,] 2.6526427 -5.0176423 [36,] -10.6922517 2.6526427 [37,] -13.3769833 -10.6922517 [38,] -4.7955706 -13.3769833 [39,] 1.5864487 -4.7955706 [40,] -14.6571473 1.5864487 [41,] 1.3966518 -14.6571473 [42,] -10.2919663 1.3966518 [43,] 11.7621695 -10.2919663 [44,] 1.9543370 11.7621695 [45,] 8.4229333 1.9543370 [46,] -6.7150419 8.4229333 [47,] 1.0062954 -6.7150419 [48,] 5.7504016 1.0062954 [49,] -3.8573343 5.7504016 [50,] 4.5664959 -3.8573343 [51,] 5.8991162 4.5664959 [52,] -15.9810446 5.8991162 [53,] 16.3920010 -15.9810446 [54,] -2.6805400 16.3920010 [55,] -0.6764998 -2.6805400 [56,] 0.1568981 -0.6764998 [57,] -14.6505445 0.1568981 [58,] -6.4150663 -14.6505445 [59,] 2.2140764 -6.4150663 [60,] -8.0250778 2.2140764 [61,] 4.7909264 -8.0250778 [62,] 3.8921399 4.7909264 [63,] -14.0540310 3.8921399 [64,] 9.1453109 -14.0540310 [65,] 1.4696391 9.1453109 [66,] -4.4922752 1.4696391 [67,] 0.2385961 -4.4922752 [68,] 4.9694871 0.2385961 [69,] 3.7170562 4.9694871 [70,] 9.2167692 3.7170562 [71,] -4.3147318 9.2167692 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 24.0236102 23.7882564 2 23.5606771 24.0236102 3 5.1115724 23.5606771 4 15.6271728 5.1115724 5 2.8126745 15.6271728 6 14.6485379 2.8126745 7 3.0322326 14.6485379 8 5.5081266 3.0322326 9 4.5915491 5.5081266 10 10.3285383 4.5915491 11 2.4934314 10.3285383 12 -0.3960785 2.4934314 13 -1.5912797 -0.3960785 14 -9.1586724 -1.5912797 15 7.5553884 -9.1586724 16 8.1693599 7.5553884 17 -4.3543666 8.1693599 18 2.4999140 -4.3543666 19 3.6073393 2.4999140 20 4.6162708 3.6073393 21 18.5333880 4.6162708 22 -1.3975570 18.5333880 23 -4.0517140 -1.3975570 24 -10.4252499 -4.0517140 25 -9.9889394 -10.4252499 26 -18.0650699 -9.9889394 27 -6.0984947 -18.0650699 28 -2.3036518 -6.0984947 29 -17.7165998 -2.3036518 30 0.3163297 -17.7165998 31 -17.9638376 0.3163297 32 -17.2051196 -17.9638376 33 -20.6143822 -17.2051196 34 -5.0176423 -20.6143822 35 2.6526427 -5.0176423 36 -10.6922517 2.6526427 37 -13.3769833 -10.6922517 38 -4.7955706 -13.3769833 39 1.5864487 -4.7955706 40 -14.6571473 1.5864487 41 1.3966518 -14.6571473 42 -10.2919663 1.3966518 43 11.7621695 -10.2919663 44 1.9543370 11.7621695 45 8.4229333 1.9543370 46 -6.7150419 8.4229333 47 1.0062954 -6.7150419 48 5.7504016 1.0062954 49 -3.8573343 5.7504016 50 4.5664959 -3.8573343 51 5.8991162 4.5664959 52 -15.9810446 5.8991162 53 16.3920010 -15.9810446 54 -2.6805400 16.3920010 55 -0.6764998 -2.6805400 56 0.1568981 -0.6764998 57 -14.6505445 0.1568981 58 -6.4150663 -14.6505445 59 2.2140764 -6.4150663 60 -8.0250778 2.2140764 61 4.7909264 -8.0250778 62 3.8921399 4.7909264 63 -14.0540310 3.8921399 64 9.1453109 -14.0540310 65 1.4696391 9.1453109 66 -4.4922752 1.4696391 67 0.2385961 -4.4922752 68 4.9694871 0.2385961 69 3.7170562 4.9694871 70 9.2167692 3.7170562 71 -4.3147318 9.2167692 > 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/7vmjz1229557011.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/8ko221229557011.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/9af201229557011.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/10iawf1229557011.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/11ix581229557011.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/12owny1229557011.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/13eda61229557011.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/145mw51229557011.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/15ss5d1229557011.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/16un5e1229557012.tab") + } > > system("convert tmp/1x12w1229557011.ps tmp/1x12w1229557011.png") > system("convert tmp/2gdda1229557011.ps tmp/2gdda1229557011.png") > system("convert tmp/38d821229557011.ps tmp/38d821229557011.png") > system("convert tmp/4pwja1229557011.ps tmp/4pwja1229557011.png") > system("convert tmp/5uv6f1229557011.ps tmp/5uv6f1229557011.png") > system("convert tmp/69req1229557011.ps tmp/69req1229557011.png") > system("convert tmp/7vmjz1229557011.ps tmp/7vmjz1229557011.png") > system("convert tmp/8ko221229557011.ps tmp/8ko221229557011.png") > system("convert tmp/9af201229557011.ps tmp/9af201229557011.png") > system("convert tmp/10iawf1229557011.ps tmp/10iawf1229557011.png") > > > proc.time() user system elapsed 2.587 1.583 3.287