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(3.58,98.2,3.52,98.71,3.45,98.54,3.36,98.2,3.27,96.92,3.21,99.06,3.19,99.65,3.16,99.82,3.12,99.99,3.06,100.33,3.01,99.31,2.98,101.1,2.97,101.1,3.02,100.93,3.07,100.85,3.18,100.93,3.29,99.6,3.43,101.88,3.61,101.81,3.74,102.38,3.87,102.74,3.88,102.82,4.09,101.72,4.19,103.47,4.2,102.98,4.29,102.68,4.37,102.9,4.47,103.03,4.61,101.29,4.65,103.69,4.69,103.68,4.82,104.2,4.86,104.08,4.87,104.16,5.01,103.05,5.03,104.66,5.13,104.46,5.18,104.95,5.21,105.85,5.26,106.23,5.25,104.86,5.2,107.44,5.16,108.23,5.19,108.45,5.39,109.39,5.58,110.15,5.76,109.13,5.89,110.28,5.98,110.17,6.02,109.99,5.62,109.26,4.87,109.11,4.24,107.06,4.02,109.53,3.74,108.92,3.45,109.24,3.34,109.12,3.21,109,3.12,107.23,3.04,109.49),dim=c(2,60),dimnames=list(c('Y','X'),1:60)) > y <- array(NA,dim=c(2,60),dimnames=list(c('Y','X'),1:60)) > 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 Y X M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 1 3.58 98.20 1 0 0 0 0 0 0 0 0 0 0 2 3.52 98.71 0 1 0 0 0 0 0 0 0 0 0 3 3.45 98.54 0 0 1 0 0 0 0 0 0 0 0 4 3.36 98.20 0 0 0 1 0 0 0 0 0 0 0 5 3.27 96.92 0 0 0 0 1 0 0 0 0 0 0 6 3.21 99.06 0 0 0 0 0 1 0 0 0 0 0 7 3.19 99.65 0 0 0 0 0 0 1 0 0 0 0 8 3.16 99.82 0 0 0 0 0 0 0 1 0 0 0 9 3.12 99.99 0 0 0 0 0 0 0 0 1 0 0 10 3.06 100.33 0 0 0 0 0 0 0 0 0 1 0 11 3.01 99.31 0 0 0 0 0 0 0 0 0 0 1 12 2.98 101.10 0 0 0 0 0 0 0 0 0 0 0 13 2.97 101.10 1 0 0 0 0 0 0 0 0 0 0 14 3.02 100.93 0 1 0 0 0 0 0 0 0 0 0 15 3.07 100.85 0 0 1 0 0 0 0 0 0 0 0 16 3.18 100.93 0 0 0 1 0 0 0 0 0 0 0 17 3.29 99.60 0 0 0 0 1 0 0 0 0 0 0 18 3.43 101.88 0 0 0 0 0 1 0 0 0 0 0 19 3.61 101.81 0 0 0 0 0 0 1 0 0 0 0 20 3.74 102.38 0 0 0 0 0 0 0 1 0 0 0 21 3.87 102.74 0 0 0 0 0 0 0 0 1 0 0 22 3.88 102.82 0 0 0 0 0 0 0 0 0 1 0 23 4.09 101.72 0 0 0 0 0 0 0 0 0 0 1 24 4.19 103.47 0 0 0 0 0 0 0 0 0 0 0 25 4.20 102.98 1 0 0 0 0 0 0 0 0 0 0 26 4.29 102.68 0 1 0 0 0 0 0 0 0 0 0 27 4.37 102.90 0 0 1 0 0 0 0 0 0 0 0 28 4.47 103.03 0 0 0 1 0 0 0 0 0 0 0 29 4.61 101.29 0 0 0 0 1 0 0 0 0 0 0 30 4.65 103.69 0 0 0 0 0 1 0 0 0 0 0 31 4.69 103.68 0 0 0 0 0 0 1 0 0 0 0 32 4.82 104.20 0 0 0 0 0 0 0 1 0 0 0 33 4.86 104.08 0 0 0 0 0 0 0 0 1 0 0 34 4.87 104.16 0 0 0 0 0 0 0 0 0 1 0 35 5.01 103.05 0 0 0 0 0 0 0 0 0 0 1 36 5.03 104.66 0 0 0 0 0 0 0 0 0 0 0 37 5.13 104.46 1 0 0 0 0 0 0 0 0 0 0 38 5.18 104.95 0 1 0 0 0 0 0 0 0 0 0 39 5.21 105.85 0 0 1 0 0 0 0 0 0 0 0 40 5.26 106.23 0 0 0 1 0 0 0 0 0 0 0 41 5.25 104.86 0 0 0 0 1 0 0 0 0 0 0 42 5.20 107.44 0 0 0 0 0 1 0 0 0 0 0 43 5.16 108.23 0 0 0 0 0 0 1 0 0 0 0 44 5.19 108.45 0 0 0 0 0 0 0 1 0 0 0 45 5.39 109.39 0 0 0 0 0 0 0 0 1 0 0 46 5.58 110.15 0 0 0 0 0 0 0 0 0 1 0 47 5.76 109.13 0 0 0 0 0 0 0 0 0 0 1 48 5.89 110.28 0 0 0 0 0 0 0 0 0 0 0 49 5.98 110.17 1 0 0 0 0 0 0 0 0 0 0 50 6.02 109.99 0 1 0 0 0 0 0 0 0 0 0 51 5.62 109.26 0 0 1 0 0 0 0 0 0 0 0 52 4.87 109.11 0 0 0 1 0 0 0 0 0 0 0 53 4.24 107.06 0 0 0 0 1 0 0 0 0 0 0 54 4.02 109.53 0 0 0 0 0 1 0 0 0 0 0 55 3.74 108.92 0 0 0 0 0 0 1 0 0 0 0 56 3.45 109.24 0 0 0 0 0 0 0 1 0 0 0 57 3.34 109.12 0 0 0 0 0 0 0 0 1 0 0 58 3.21 109.00 0 0 0 0 0 0 0 0 0 1 0 59 3.12 107.23 0 0 0 0 0 0 0 0 0 0 1 60 3.04 109.49 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) X M1 M2 M3 M4 -13.106564 0.163824 0.542126 0.564658 0.498071 0.378795 M5 M6 M7 M8 M9 M10 0.537377 0.118459 0.071852 0.006875 0.010574 -0.022777 M11 0.252466 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -1.79051 -0.30910 0.06217 0.56932 0.99076 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) -13.106564 2.947952 -4.446 5.32e-05 *** X 0.163824 0.027660 5.923 3.52e-07 *** M1 0.542126 0.507807 1.068 0.291 M2 0.564658 0.507556 1.113 0.272 M3 0.498071 0.507457 0.982 0.331 M4 0.378795 0.507388 0.747 0.459 M5 0.537377 0.514547 1.044 0.302 M6 0.118459 0.505045 0.235 0.816 M7 0.071852 0.504750 0.142 0.887 M8 0.006875 0.504116 0.014 0.989 M9 0.010574 0.503795 0.021 0.983 M10 -0.022777 0.503580 -0.045 0.964 M11 0.252466 0.505606 0.499 0.620 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 0.7959 on 47 degrees of freedom Multiple R-squared: 0.4357, Adjusted R-squared: 0.2916 F-statistic: 3.024 on 12 and 47 DF, p-value: 0.003259 > 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,] 5.275277e-03 1.055055e-02 0.9947247 [2,] 4.201860e-03 8.403720e-03 0.9957981 [3,] 4.047622e-03 8.095245e-03 0.9959524 [4,] 3.635679e-03 7.271358e-03 0.9963643 [5,] 3.834407e-03 7.668813e-03 0.9961656 [6,] 4.171266e-03 8.342532e-03 0.9958287 [7,] 3.816705e-03 7.633409e-03 0.9961833 [8,] 4.781246e-03 9.562491e-03 0.9952188 [9,] 5.700760e-03 1.140152e-02 0.9942992 [10,] 4.202697e-03 8.405394e-03 0.9957973 [11,] 3.578869e-03 7.157738e-03 0.9964211 [12,] 2.750938e-03 5.501876e-03 0.9972491 [13,] 1.806725e-03 3.613449e-03 0.9981933 [14,] 1.350840e-03 2.701680e-03 0.9986492 [15,] 8.381479e-04 1.676296e-03 0.9991619 [16,] 4.925262e-04 9.850524e-04 0.9995075 [17,] 2.939728e-04 5.879455e-04 0.9997060 [18,] 1.874836e-04 3.749672e-04 0.9998125 [19,] 1.256262e-04 2.512523e-04 0.9998744 [20,] 9.597830e-05 1.919566e-04 0.9999040 [21,] 8.443774e-05 1.688755e-04 0.9999156 [22,] 3.480814e-05 6.961629e-05 0.9999652 [23,] 1.223933e-05 2.447865e-05 0.9999878 [24,] 3.726992e-06 7.453985e-06 0.9999963 [25,] 1.321686e-06 2.643372e-06 0.9999987 [26,] 1.033514e-06 2.067028e-06 0.9999990 [27,] 8.392300e-06 1.678460e-05 0.9999916 [28,] 5.153386e-05 1.030677e-04 0.9999485 [29,] 1.085949e-02 2.171898e-02 0.9891405 > postscript(file="/var/www/html/rcomp/tmp/1tj5n1258559651.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/2m7yx1258559651.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/3z6yv1258559651.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/4xoiy1258559651.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/5lely1258559651.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 = 60 Frequency = 1 1 2 3 4 5 0.0569352437 -0.1091472548 -0.0847101305 0.0002664592 -0.0386212785 6 7 8 9 10 -0.0302864952 -0.1003348800 -0.0932083466 -0.1647577332 -0.2471060055 11 12 13 14 15 -0.4052495958 -0.4760278569 -1.0281539510 -0.9728362245 -0.8431432476 16 17 18 19 20 -0.6269726792 -0.4576692239 -0.2722697810 -0.0341944181 0.0674025712 21 22 23 24 25 0.1347266512 0.1649725825 0.2799349010 0.3457095943 -0.1061428082 26 27 28 29 30 0.0104720201 0.1210178389 0.3189972143 0.5854684523 0.6512090319 31 32 33 34 35 0.7394549633 0.8492431456 0.9052026785 0.9354486098 0.9820491669 36 37 38 39 40 0.9907592007 0.5813978787 0.5285918574 0.4777374513 0.5847608616 41 42 43 44 45 0.6406172713 0.5868695561 0.4640563992 0.5229917396 0.5652979806 46 47 48 49 50 0.6641436870 0.7360000967 0.9300691062 0.4959636367 0.5429196018 51 52 53 54 55 0.3290980879 -0.2770518559 -0.7297952212 -0.9355223118 -1.0689820644 56 57 58 59 60 -1.3464291099 -1.4404695771 -1.5174588737 -1.5927345688 -1.7905100443 > postscript(file="/var/www/html/rcomp/tmp/6tlyw1258559651.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 = 60 Frequency = 1 lag(myerror, k = 1) myerror 0 0.0569352437 NA 1 -0.1091472548 0.0569352437 2 -0.0847101305 -0.1091472548 3 0.0002664592 -0.0847101305 4 -0.0386212785 0.0002664592 5 -0.0302864952 -0.0386212785 6 -0.1003348800 -0.0302864952 7 -0.0932083466 -0.1003348800 8 -0.1647577332 -0.0932083466 9 -0.2471060055 -0.1647577332 10 -0.4052495958 -0.2471060055 11 -0.4760278569 -0.4052495958 12 -1.0281539510 -0.4760278569 13 -0.9728362245 -1.0281539510 14 -0.8431432476 -0.9728362245 15 -0.6269726792 -0.8431432476 16 -0.4576692239 -0.6269726792 17 -0.2722697810 -0.4576692239 18 -0.0341944181 -0.2722697810 19 0.0674025712 -0.0341944181 20 0.1347266512 0.0674025712 21 0.1649725825 0.1347266512 22 0.2799349010 0.1649725825 23 0.3457095943 0.2799349010 24 -0.1061428082 0.3457095943 25 0.0104720201 -0.1061428082 26 0.1210178389 0.0104720201 27 0.3189972143 0.1210178389 28 0.5854684523 0.3189972143 29 0.6512090319 0.5854684523 30 0.7394549633 0.6512090319 31 0.8492431456 0.7394549633 32 0.9052026785 0.8492431456 33 0.9354486098 0.9052026785 34 0.9820491669 0.9354486098 35 0.9907592007 0.9820491669 36 0.5813978787 0.9907592007 37 0.5285918574 0.5813978787 38 0.4777374513 0.5285918574 39 0.5847608616 0.4777374513 40 0.6406172713 0.5847608616 41 0.5868695561 0.6406172713 42 0.4640563992 0.5868695561 43 0.5229917396 0.4640563992 44 0.5652979806 0.5229917396 45 0.6641436870 0.5652979806 46 0.7360000967 0.6641436870 47 0.9300691062 0.7360000967 48 0.4959636367 0.9300691062 49 0.5429196018 0.4959636367 50 0.3290980879 0.5429196018 51 -0.2770518559 0.3290980879 52 -0.7297952212 -0.2770518559 53 -0.9355223118 -0.7297952212 54 -1.0689820644 -0.9355223118 55 -1.3464291099 -1.0689820644 56 -1.4404695771 -1.3464291099 57 -1.5174588737 -1.4404695771 58 -1.5927345688 -1.5174588737 59 -1.7905100443 -1.5927345688 60 NA -1.7905100443 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -0.1091472548 0.0569352437 [2,] -0.0847101305 -0.1091472548 [3,] 0.0002664592 -0.0847101305 [4,] -0.0386212785 0.0002664592 [5,] -0.0302864952 -0.0386212785 [6,] -0.1003348800 -0.0302864952 [7,] -0.0932083466 -0.1003348800 [8,] -0.1647577332 -0.0932083466 [9,] -0.2471060055 -0.1647577332 [10,] -0.4052495958 -0.2471060055 [11,] -0.4760278569 -0.4052495958 [12,] -1.0281539510 -0.4760278569 [13,] -0.9728362245 -1.0281539510 [14,] -0.8431432476 -0.9728362245 [15,] -0.6269726792 -0.8431432476 [16,] -0.4576692239 -0.6269726792 [17,] -0.2722697810 -0.4576692239 [18,] -0.0341944181 -0.2722697810 [19,] 0.0674025712 -0.0341944181 [20,] 0.1347266512 0.0674025712 [21,] 0.1649725825 0.1347266512 [22,] 0.2799349010 0.1649725825 [23,] 0.3457095943 0.2799349010 [24,] -0.1061428082 0.3457095943 [25,] 0.0104720201 -0.1061428082 [26,] 0.1210178389 0.0104720201 [27,] 0.3189972143 0.1210178389 [28,] 0.5854684523 0.3189972143 [29,] 0.6512090319 0.5854684523 [30,] 0.7394549633 0.6512090319 [31,] 0.8492431456 0.7394549633 [32,] 0.9052026785 0.8492431456 [33,] 0.9354486098 0.9052026785 [34,] 0.9820491669 0.9354486098 [35,] 0.9907592007 0.9820491669 [36,] 0.5813978787 0.9907592007 [37,] 0.5285918574 0.5813978787 [38,] 0.4777374513 0.5285918574 [39,] 0.5847608616 0.4777374513 [40,] 0.6406172713 0.5847608616 [41,] 0.5868695561 0.6406172713 [42,] 0.4640563992 0.5868695561 [43,] 0.5229917396 0.4640563992 [44,] 0.5652979806 0.5229917396 [45,] 0.6641436870 0.5652979806 [46,] 0.7360000967 0.6641436870 [47,] 0.9300691062 0.7360000967 [48,] 0.4959636367 0.9300691062 [49,] 0.5429196018 0.4959636367 [50,] 0.3290980879 0.5429196018 [51,] -0.2770518559 0.3290980879 [52,] -0.7297952212 -0.2770518559 [53,] -0.9355223118 -0.7297952212 [54,] -1.0689820644 -0.9355223118 [55,] -1.3464291099 -1.0689820644 [56,] -1.4404695771 -1.3464291099 [57,] -1.5174588737 -1.4404695771 [58,] -1.5927345688 -1.5174588737 [59,] -1.7905100443 -1.5927345688 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -0.1091472548 0.0569352437 2 -0.0847101305 -0.1091472548 3 0.0002664592 -0.0847101305 4 -0.0386212785 0.0002664592 5 -0.0302864952 -0.0386212785 6 -0.1003348800 -0.0302864952 7 -0.0932083466 -0.1003348800 8 -0.1647577332 -0.0932083466 9 -0.2471060055 -0.1647577332 10 -0.4052495958 -0.2471060055 11 -0.4760278569 -0.4052495958 12 -1.0281539510 -0.4760278569 13 -0.9728362245 -1.0281539510 14 -0.8431432476 -0.9728362245 15 -0.6269726792 -0.8431432476 16 -0.4576692239 -0.6269726792 17 -0.2722697810 -0.4576692239 18 -0.0341944181 -0.2722697810 19 0.0674025712 -0.0341944181 20 0.1347266512 0.0674025712 21 0.1649725825 0.1347266512 22 0.2799349010 0.1649725825 23 0.3457095943 0.2799349010 24 -0.1061428082 0.3457095943 25 0.0104720201 -0.1061428082 26 0.1210178389 0.0104720201 27 0.3189972143 0.1210178389 28 0.5854684523 0.3189972143 29 0.6512090319 0.5854684523 30 0.7394549633 0.6512090319 31 0.8492431456 0.7394549633 32 0.9052026785 0.8492431456 33 0.9354486098 0.9052026785 34 0.9820491669 0.9354486098 35 0.9907592007 0.9820491669 36 0.5813978787 0.9907592007 37 0.5285918574 0.5813978787 38 0.4777374513 0.5285918574 39 0.5847608616 0.4777374513 40 0.6406172713 0.5847608616 41 0.5868695561 0.6406172713 42 0.4640563992 0.5868695561 43 0.5229917396 0.4640563992 44 0.5652979806 0.5229917396 45 0.6641436870 0.5652979806 46 0.7360000967 0.6641436870 47 0.9300691062 0.7360000967 48 0.4959636367 0.9300691062 49 0.5429196018 0.4959636367 50 0.3290980879 0.5429196018 51 -0.2770518559 0.3290980879 52 -0.7297952212 -0.2770518559 53 -0.9355223118 -0.7297952212 54 -1.0689820644 -0.9355223118 55 -1.3464291099 -1.0689820644 56 -1.4404695771 -1.3464291099 57 -1.5174588737 -1.4404695771 58 -1.5927345688 -1.5174588737 59 -1.7905100443 -1.5927345688 > 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/7s3941258559651.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/8pxhz1258559651.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/9cjoj1258559651.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/10byrc1258559651.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/112dwb1258559651.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/129vdz1258559651.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/13hxab1258559651.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/14ddwo1258559651.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/156cg21258559651.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/16vgxe1258559651.tab") + } > > system("convert tmp/1tj5n1258559651.ps tmp/1tj5n1258559651.png") > system("convert tmp/2m7yx1258559651.ps tmp/2m7yx1258559651.png") > system("convert tmp/3z6yv1258559651.ps tmp/3z6yv1258559651.png") > system("convert tmp/4xoiy1258559651.ps tmp/4xoiy1258559651.png") > system("convert tmp/5lely1258559651.ps tmp/5lely1258559651.png") > system("convert tmp/6tlyw1258559651.ps tmp/6tlyw1258559651.png") > system("convert tmp/7s3941258559651.ps tmp/7s3941258559651.png") > system("convert tmp/8pxhz1258559651.ps tmp/8pxhz1258559651.png") > system("convert tmp/9cjoj1258559651.ps tmp/9cjoj1258559651.png") > system("convert tmp/10byrc1258559651.ps tmp/10byrc1258559651.png") > > > proc.time() user system elapsed 2.434 1.568 2.954