R version 2.15.2 (2012-10-26) -- "Trick or Treat" Copyright (C) 2012 The R Foundation for Statistical Computing ISBN 3-900051-07-0 Platform: i686-pc-linux-gnu (32-bit) 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(9676,8642,9402,9610,9294,9448,10319,9548,9801,9596,8923,9746,9829,9125,9782,9441,9162,9915,10444,10209,9985,9842,9429,10132,9849,9172,10313,9819,9955,10048,10082,10541,10208,10233,9439,9963,10158,9225,10474,9757,10490,10281,10444,10640,10695,10786,9832,9747,10411,9511,10402,9701,10540,10112,10915,11183,10384,10834,9886,10216,10943,9867,10203,10837,10573,10647,11502,10656,10866,10835,9945,10331,10718,9462,10579,10633,10346,10757,11207,11013,11015,10765,10042,10661),dim=c(1,84),dimnames=list(c('Y'),1:84)) > y <- array(NA,dim=c(1,84),dimnames=list(c('Y'),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' > 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, 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 M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t 1 9676 1 0 0 0 0 0 0 0 0 0 0 1 2 8642 0 1 0 0 0 0 0 0 0 0 0 2 3 9402 0 0 1 0 0 0 0 0 0 0 0 3 4 9610 0 0 0 1 0 0 0 0 0 0 0 4 5 9294 0 0 0 0 1 0 0 0 0 0 0 5 6 9448 0 0 0 0 0 1 0 0 0 0 0 6 7 10319 0 0 0 0 0 0 1 0 0 0 0 7 8 9548 0 0 0 0 0 0 0 1 0 0 0 8 9 9801 0 0 0 0 0 0 0 0 1 0 0 9 10 9596 0 0 0 0 0 0 0 0 0 1 0 10 11 8923 0 0 0 0 0 0 0 0 0 0 1 11 12 9746 0 0 0 0 0 0 0 0 0 0 0 12 13 9829 1 0 0 0 0 0 0 0 0 0 0 13 14 9125 0 1 0 0 0 0 0 0 0 0 0 14 15 9782 0 0 1 0 0 0 0 0 0 0 0 15 16 9441 0 0 0 1 0 0 0 0 0 0 0 16 17 9162 0 0 0 0 1 0 0 0 0 0 0 17 18 9915 0 0 0 0 0 1 0 0 0 0 0 18 19 10444 0 0 0 0 0 0 1 0 0 0 0 19 20 10209 0 0 0 0 0 0 0 1 0 0 0 20 21 9985 0 0 0 0 0 0 0 0 1 0 0 21 22 9842 0 0 0 0 0 0 0 0 0 1 0 22 23 9429 0 0 0 0 0 0 0 0 0 0 1 23 24 10132 0 0 0 0 0 0 0 0 0 0 0 24 25 9849 1 0 0 0 0 0 0 0 0 0 0 25 26 9172 0 1 0 0 0 0 0 0 0 0 0 26 27 10313 0 0 1 0 0 0 0 0 0 0 0 27 28 9819 0 0 0 1 0 0 0 0 0 0 0 28 29 9955 0 0 0 0 1 0 0 0 0 0 0 29 30 10048 0 0 0 0 0 1 0 0 0 0 0 30 31 10082 0 0 0 0 0 0 1 0 0 0 0 31 32 10541 0 0 0 0 0 0 0 1 0 0 0 32 33 10208 0 0 0 0 0 0 0 0 1 0 0 33 34 10233 0 0 0 0 0 0 0 0 0 1 0 34 35 9439 0 0 0 0 0 0 0 0 0 0 1 35 36 9963 0 0 0 0 0 0 0 0 0 0 0 36 37 10158 1 0 0 0 0 0 0 0 0 0 0 37 38 9225 0 1 0 0 0 0 0 0 0 0 0 38 39 10474 0 0 1 0 0 0 0 0 0 0 0 39 40 9757 0 0 0 1 0 0 0 0 0 0 0 40 41 10490 0 0 0 0 1 0 0 0 0 0 0 41 42 10281 0 0 0 0 0 1 0 0 0 0 0 42 43 10444 0 0 0 0 0 0 1 0 0 0 0 43 44 10640 0 0 0 0 0 0 0 1 0 0 0 44 45 10695 0 0 0 0 0 0 0 0 1 0 0 45 46 10786 0 0 0 0 0 0 0 0 0 1 0 46 47 9832 0 0 0 0 0 0 0 0 0 0 1 47 48 9747 0 0 0 0 0 0 0 0 0 0 0 48 49 10411 1 0 0 0 0 0 0 0 0 0 0 49 50 9511 0 1 0 0 0 0 0 0 0 0 0 50 51 10402 0 0 1 0 0 0 0 0 0 0 0 51 52 9701 0 0 0 1 0 0 0 0 0 0 0 52 53 10540 0 0 0 0 1 0 0 0 0 0 0 53 54 10112 0 0 0 0 0 1 0 0 0 0 0 54 55 10915 0 0 0 0 0 0 1 0 0 0 0 55 56 11183 0 0 0 0 0 0 0 1 0 0 0 56 57 10384 0 0 0 0 0 0 0 0 1 0 0 57 58 10834 0 0 0 0 0 0 0 0 0 1 0 58 59 9886 0 0 0 0 0 0 0 0 0 0 1 59 60 10216 0 0 0 0 0 0 0 0 0 0 0 60 61 10943 1 0 0 0 0 0 0 0 0 0 0 61 62 9867 0 1 0 0 0 0 0 0 0 0 0 62 63 10203 0 0 1 0 0 0 0 0 0 0 0 63 64 10837 0 0 0 1 0 0 0 0 0 0 0 64 65 10573 0 0 0 0 1 0 0 0 0 0 0 65 66 10647 0 0 0 0 0 1 0 0 0 0 0 66 67 11502 0 0 0 0 0 0 1 0 0 0 0 67 68 10656 0 0 0 0 0 0 0 1 0 0 0 68 69 10866 0 0 0 0 0 0 0 0 1 0 0 69 70 10835 0 0 0 0 0 0 0 0 0 1 0 70 71 9945 0 0 0 0 0 0 0 0 0 0 1 71 72 10331 0 0 0 0 0 0 0 0 0 0 0 72 73 10718 1 0 0 0 0 0 0 0 0 0 0 73 74 9462 0 1 0 0 0 0 0 0 0 0 0 74 75 10579 0 0 1 0 0 0 0 0 0 0 0 75 76 10633 0 0 0 1 0 0 0 0 0 0 0 76 77 10346 0 0 0 0 1 0 0 0 0 0 0 77 78 10757 0 0 0 0 0 1 0 0 0 0 0 78 79 11207 0 0 0 0 0 0 1 0 0 0 0 79 80 11013 0 0 0 0 0 0 0 1 0 0 0 80 81 11015 0 0 0 0 0 0 0 0 1 0 0 81 82 10765 0 0 0 0 0 0 0 0 0 1 0 82 83 10042 0 0 0 0 0 0 0 0 0 0 1 83 84 10661 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) M1 M2 M3 M4 M5 9353.33 286.83 -669.02 193.86 -15.84 48.60 M6 M7 M8 M9 M10 M11 153.90 667.35 491.08 355.81 330.97 -455.59 t 15.84 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -509.24 -157.94 12.12 127.31 485.67 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 9353.333 105.548 88.617 < 2e-16 *** M1 286.825 129.834 2.209 0.030390 * M2 -669.016 129.736 -5.157 2.18e-06 *** M3 193.857 129.648 1.495 0.139278 M4 -15.841 129.568 -0.122 0.903037 M5 48.603 129.498 0.375 0.708542 M6 153.905 129.438 1.189 0.238391 M7 667.349 129.386 5.158 2.17e-06 *** M8 491.079 129.344 3.797 0.000306 *** M9 355.810 129.312 2.752 0.007522 ** M10 330.968 129.288 2.560 0.012599 * M11 -455.587 129.274 -3.524 0.000748 *** t 15.841 1.099 14.408 < 2e-16 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 241.8 on 71 degrees of freedom Multiple R-squared: 0.851, Adjusted R-squared: 0.8258 F-statistic: 33.79 on 12 and 71 DF, p-value: < 2.2e-16 > 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.42053259 0.8410652 0.57946741 [2,] 0.44637750 0.8927550 0.55362250 [3,] 0.41159004 0.8231801 0.58840996 [4,] 0.28913826 0.5782765 0.71086174 [5,] 0.37864558 0.7572912 0.62135442 [6,] 0.27794403 0.5558881 0.72205597 [7,] 0.20901654 0.4180331 0.79098346 [8,] 0.18029266 0.3605853 0.81970734 [9,] 0.14837808 0.2967562 0.85162192 [10,] 0.16220932 0.3244186 0.83779068 [11,] 0.11143763 0.2228753 0.88856237 [12,] 0.15288438 0.3057688 0.84711562 [13,] 0.10938179 0.2187636 0.89061821 [14,] 0.12275125 0.2455025 0.87724875 [15,] 0.08464547 0.1692909 0.91535453 [16,] 0.35293684 0.7058737 0.64706316 [17,] 0.33707898 0.6741580 0.66292102 [18,] 0.27509513 0.5501903 0.72490487 [19,] 0.23308436 0.4661687 0.76691564 [20,] 0.18680975 0.3736195 0.81319025 [21,] 0.18660122 0.3732024 0.81339878 [22,] 0.15478790 0.3095758 0.84521210 [23,] 0.13043663 0.2608733 0.86956337 [24,] 0.12796106 0.2559221 0.87203894 [25,] 0.14813300 0.2962660 0.85186700 [26,] 0.25273606 0.5054721 0.74726394 [27,] 0.19734906 0.3946981 0.80265094 [28,] 0.25710319 0.5142064 0.74289681 [29,] 0.20422016 0.4084403 0.79577984 [30,] 0.18344864 0.3668973 0.81655136 [31,] 0.20945513 0.4189103 0.79054487 [32,] 0.16890118 0.3378024 0.83109882 [33,] 0.31834664 0.6366933 0.68165336 [34,] 0.27395731 0.5479146 0.72604269 [35,] 0.21700590 0.4340118 0.78299410 [36,] 0.18223085 0.3644617 0.81776915 [37,] 0.57150349 0.8569930 0.42849651 [38,] 0.54832827 0.9033435 0.45167173 [39,] 0.65671153 0.6865769 0.34328847 [40,] 0.67379981 0.6524004 0.32620019 [41,] 0.78138466 0.4372307 0.21861534 [42,] 0.88774911 0.2245018 0.11225089 [43,] 0.84673124 0.3065375 0.15326876 [44,] 0.78492770 0.4301446 0.21507230 [45,] 0.77500342 0.4499932 0.22499658 [46,] 0.75215818 0.4956836 0.24784182 [47,] 0.82556127 0.3488775 0.17443873 [48,] 0.86628341 0.2674332 0.13371659 [49,] 0.86635861 0.2672828 0.13364139 [50,] 0.86858911 0.2628218 0.13141089 [51,] 0.77340633 0.4531873 0.22659367 [52,] 0.90910212 0.1817958 0.09089788 [53,] 0.88764669 0.2247066 0.11235331 > postscript(file="/var/wessaorg/rcomp/tmp/1qyhx1356009951.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/wessaorg/rcomp/tmp/2yw6a1356009951.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/wessaorg/rcomp/tmp/3ioph1356009951.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/wessaorg/rcomp/tmp/4tftk1356009951.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/wessaorg/rcomp/tmp/5nkcn1356009951.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 20.000000 -74.000000 -192.714286 209.142857 -187.142857 -154.285714 7 8 9 10 11 12 187.428571 -423.142857 -50.714286 -246.714286 -149.000000 202.571429 13 14 15 16 17 18 -17.095238 218.904762 -2.809524 -149.952381 -509.238095 122.619048 19 20 21 22 23 24 122.333333 47.761905 -56.809524 -190.809524 166.904762 398.476190 25 26 27 28 29 30 -187.190476 75.809524 338.095238 37.952381 93.666667 65.523810 31 32 33 34 35 36 -429.761905 189.666667 -23.904762 10.095238 -13.190476 39.380952 37 38 39 40 41 42 -68.285714 -61.285714 309.000000 -214.142857 438.571429 108.428571 43 44 45 46 47 48 -257.857143 98.571429 273.000000 373.000000 189.714286 -366.714286 49 50 51 52 53 54 -5.380952 34.619048 46.904762 -460.238095 298.476190 -250.666667 55 56 57 58 59 60 23.047619 451.476190 -228.095238 230.904762 53.619048 -87.809524 61 62 63 64 65 66 336.523810 200.523810 -342.190476 485.666667 141.380952 94.238095 67 68 69 70 71 72 419.952381 -265.619048 63.809524 41.809524 -77.476190 -162.904762 73 74 75 76 77 78 -78.571429 -394.571429 -156.285714 91.571429 -275.714286 14.142857 79 80 81 82 83 84 -65.142857 -98.714286 22.714286 -218.285714 -170.571429 -23.000000 > postscript(file="/var/wessaorg/rcomp/tmp/6oqfl1356009951.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 20.000000 NA 1 -74.000000 20.000000 2 -192.714286 -74.000000 3 209.142857 -192.714286 4 -187.142857 209.142857 5 -154.285714 -187.142857 6 187.428571 -154.285714 7 -423.142857 187.428571 8 -50.714286 -423.142857 9 -246.714286 -50.714286 10 -149.000000 -246.714286 11 202.571429 -149.000000 12 -17.095238 202.571429 13 218.904762 -17.095238 14 -2.809524 218.904762 15 -149.952381 -2.809524 16 -509.238095 -149.952381 17 122.619048 -509.238095 18 122.333333 122.619048 19 47.761905 122.333333 20 -56.809524 47.761905 21 -190.809524 -56.809524 22 166.904762 -190.809524 23 398.476190 166.904762 24 -187.190476 398.476190 25 75.809524 -187.190476 26 338.095238 75.809524 27 37.952381 338.095238 28 93.666667 37.952381 29 65.523810 93.666667 30 -429.761905 65.523810 31 189.666667 -429.761905 32 -23.904762 189.666667 33 10.095238 -23.904762 34 -13.190476 10.095238 35 39.380952 -13.190476 36 -68.285714 39.380952 37 -61.285714 -68.285714 38 309.000000 -61.285714 39 -214.142857 309.000000 40 438.571429 -214.142857 41 108.428571 438.571429 42 -257.857143 108.428571 43 98.571429 -257.857143 44 273.000000 98.571429 45 373.000000 273.000000 46 189.714286 373.000000 47 -366.714286 189.714286 48 -5.380952 -366.714286 49 34.619048 -5.380952 50 46.904762 34.619048 51 -460.238095 46.904762 52 298.476190 -460.238095 53 -250.666667 298.476190 54 23.047619 -250.666667 55 451.476190 23.047619 56 -228.095238 451.476190 57 230.904762 -228.095238 58 53.619048 230.904762 59 -87.809524 53.619048 60 336.523810 -87.809524 61 200.523810 336.523810 62 -342.190476 200.523810 63 485.666667 -342.190476 64 141.380952 485.666667 65 94.238095 141.380952 66 419.952381 94.238095 67 -265.619048 419.952381 68 63.809524 -265.619048 69 41.809524 63.809524 70 -77.476190 41.809524 71 -162.904762 -77.476190 72 -78.571429 -162.904762 73 -394.571429 -78.571429 74 -156.285714 -394.571429 75 91.571429 -156.285714 76 -275.714286 91.571429 77 14.142857 -275.714286 78 -65.142857 14.142857 79 -98.714286 -65.142857 80 22.714286 -98.714286 81 -218.285714 22.714286 82 -170.571429 -218.285714 83 -23.000000 -170.571429 84 NA -23.000000 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -74.000000 20.000000 [2,] -192.714286 -74.000000 [3,] 209.142857 -192.714286 [4,] -187.142857 209.142857 [5,] -154.285714 -187.142857 [6,] 187.428571 -154.285714 [7,] -423.142857 187.428571 [8,] -50.714286 -423.142857 [9,] -246.714286 -50.714286 [10,] -149.000000 -246.714286 [11,] 202.571429 -149.000000 [12,] -17.095238 202.571429 [13,] 218.904762 -17.095238 [14,] -2.809524 218.904762 [15,] -149.952381 -2.809524 [16,] -509.238095 -149.952381 [17,] 122.619048 -509.238095 [18,] 122.333333 122.619048 [19,] 47.761905 122.333333 [20,] -56.809524 47.761905 [21,] -190.809524 -56.809524 [22,] 166.904762 -190.809524 [23,] 398.476190 166.904762 [24,] -187.190476 398.476190 [25,] 75.809524 -187.190476 [26,] 338.095238 75.809524 [27,] 37.952381 338.095238 [28,] 93.666667 37.952381 [29,] 65.523810 93.666667 [30,] -429.761905 65.523810 [31,] 189.666667 -429.761905 [32,] -23.904762 189.666667 [33,] 10.095238 -23.904762 [34,] -13.190476 10.095238 [35,] 39.380952 -13.190476 [36,] -68.285714 39.380952 [37,] -61.285714 -68.285714 [38,] 309.000000 -61.285714 [39,] -214.142857 309.000000 [40,] 438.571429 -214.142857 [41,] 108.428571 438.571429 [42,] -257.857143 108.428571 [43,] 98.571429 -257.857143 [44,] 273.000000 98.571429 [45,] 373.000000 273.000000 [46,] 189.714286 373.000000 [47,] -366.714286 189.714286 [48,] -5.380952 -366.714286 [49,] 34.619048 -5.380952 [50,] 46.904762 34.619048 [51,] -460.238095 46.904762 [52,] 298.476190 -460.238095 [53,] -250.666667 298.476190 [54,] 23.047619 -250.666667 [55,] 451.476190 23.047619 [56,] -228.095238 451.476190 [57,] 230.904762 -228.095238 [58,] 53.619048 230.904762 [59,] -87.809524 53.619048 [60,] 336.523810 -87.809524 [61,] 200.523810 336.523810 [62,] -342.190476 200.523810 [63,] 485.666667 -342.190476 [64,] 141.380952 485.666667 [65,] 94.238095 141.380952 [66,] 419.952381 94.238095 [67,] -265.619048 419.952381 [68,] 63.809524 -265.619048 [69,] 41.809524 63.809524 [70,] -77.476190 41.809524 [71,] -162.904762 -77.476190 [72,] -78.571429 -162.904762 [73,] -394.571429 -78.571429 [74,] -156.285714 -394.571429 [75,] 91.571429 -156.285714 [76,] -275.714286 91.571429 [77,] 14.142857 -275.714286 [78,] -65.142857 14.142857 [79,] -98.714286 -65.142857 [80,] 22.714286 -98.714286 [81,] -218.285714 22.714286 [82,] -170.571429 -218.285714 [83,] -23.000000 -170.571429 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -74.000000 20.000000 2 -192.714286 -74.000000 3 209.142857 -192.714286 4 -187.142857 209.142857 5 -154.285714 -187.142857 6 187.428571 -154.285714 7 -423.142857 187.428571 8 -50.714286 -423.142857 9 -246.714286 -50.714286 10 -149.000000 -246.714286 11 202.571429 -149.000000 12 -17.095238 202.571429 13 218.904762 -17.095238 14 -2.809524 218.904762 15 -149.952381 -2.809524 16 -509.238095 -149.952381 17 122.619048 -509.238095 18 122.333333 122.619048 19 47.761905 122.333333 20 -56.809524 47.761905 21 -190.809524 -56.809524 22 166.904762 -190.809524 23 398.476190 166.904762 24 -187.190476 398.476190 25 75.809524 -187.190476 26 338.095238 75.809524 27 37.952381 338.095238 28 93.666667 37.952381 29 65.523810 93.666667 30 -429.761905 65.523810 31 189.666667 -429.761905 32 -23.904762 189.666667 33 10.095238 -23.904762 34 -13.190476 10.095238 35 39.380952 -13.190476 36 -68.285714 39.380952 37 -61.285714 -68.285714 38 309.000000 -61.285714 39 -214.142857 309.000000 40 438.571429 -214.142857 41 108.428571 438.571429 42 -257.857143 108.428571 43 98.571429 -257.857143 44 273.000000 98.571429 45 373.000000 273.000000 46 189.714286 373.000000 47 -366.714286 189.714286 48 -5.380952 -366.714286 49 34.619048 -5.380952 50 46.904762 34.619048 51 -460.238095 46.904762 52 298.476190 -460.238095 53 -250.666667 298.476190 54 23.047619 -250.666667 55 451.476190 23.047619 56 -228.095238 451.476190 57 230.904762 -228.095238 58 53.619048 230.904762 59 -87.809524 53.619048 60 336.523810 -87.809524 61 200.523810 336.523810 62 -342.190476 200.523810 63 485.666667 -342.190476 64 141.380952 485.666667 65 94.238095 141.380952 66 419.952381 94.238095 67 -265.619048 419.952381 68 63.809524 -265.619048 69 41.809524 63.809524 70 -77.476190 41.809524 71 -162.904762 -77.476190 72 -78.571429 -162.904762 73 -394.571429 -78.571429 74 -156.285714 -394.571429 75 91.571429 -156.285714 76 -275.714286 91.571429 77 14.142857 -275.714286 78 -65.142857 14.142857 79 -98.714286 -65.142857 80 22.714286 -98.714286 81 -218.285714 22.714286 82 -170.571429 -218.285714 83 -23.000000 -170.571429 > 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/wessaorg/rcomp/tmp/7zzd51356009951.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/wessaorg/rcomp/tmp/8ha0v1356009951.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/wessaorg/rcomp/tmp/9ia2n1356009951.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/wessaorg/rcomp/tmp/10fyc21356009951.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/wessaorg/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/wessaorg/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/wessaorg/rcomp/tmp/11kg8u1356009951.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/wessaorg/rcomp/tmp/12hwdh1356009951.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/wessaorg/rcomp/tmp/136izb1356009951.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/wessaorg/rcomp/tmp/14izom1356009951.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/wessaorg/rcomp/tmp/155hf51356009951.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/wessaorg/rcomp/tmp/16shwc1356009951.tab") + } > > try(system("convert tmp/1qyhx1356009951.ps tmp/1qyhx1356009951.png",intern=TRUE)) character(0) > try(system("convert tmp/2yw6a1356009951.ps tmp/2yw6a1356009951.png",intern=TRUE)) character(0) > try(system("convert tmp/3ioph1356009951.ps tmp/3ioph1356009951.png",intern=TRUE)) character(0) > try(system("convert tmp/4tftk1356009951.ps tmp/4tftk1356009951.png",intern=TRUE)) character(0) > try(system("convert tmp/5nkcn1356009951.ps tmp/5nkcn1356009951.png",intern=TRUE)) character(0) > try(system("convert tmp/6oqfl1356009951.ps tmp/6oqfl1356009951.png",intern=TRUE)) character(0) > try(system("convert tmp/7zzd51356009951.ps tmp/7zzd51356009951.png",intern=TRUE)) character(0) > try(system("convert tmp/8ha0v1356009951.ps tmp/8ha0v1356009951.png",intern=TRUE)) character(0) > try(system("convert tmp/9ia2n1356009951.ps tmp/9ia2n1356009951.png",intern=TRUE)) character(0) > try(system("convert tmp/10fyc21356009951.ps tmp/10fyc21356009951.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 6.832 1.283 8.194