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.5,0,99.2,0,107.8,0,92.3,0,99.2,0,101.6,0,87,0,71.4,0,104.7,0,115.1,0,102.5,0,75.3,0,96.7,1,94.6,1,98.6,1,99.5,1,92,1,93.6,1,89.3,1,66.9,1,108.8,1,113.2,1,105.5,1,77.8,1,102.1,1,97,1,95.5,1,99.3,1,86.4,1,92.4,1,85.7,1,61.9,1,104.9,1,107.9,1,95.6,1,79.8,1,94.8,1,93.7,1,108.1,1,96.9,1,88.8,1,106.7,1,86.8,1,69.8,1,110.9,1,105.4,1,99.2,1,84.4,1,87.2,1,91.9,1,97.9,1,94.5,1,85,1,100.3,1,78.7,1,65.8,1,104.8,1,96,1,103.3,1,82.9,1,91.4,1,94.5,1,109.3,1,92.1,1,99.3,1,109.6,1,87.5,1,73.1,1,110.7,1,111.6,1,110.7,1,84,1,101.6,1,102.1,1,113.9,1,99,1,100.4,1,109.5,1,93,1,76.8,1,105.3,1),dim=c(2,81),dimnames=list(c('y','x'),1:81)) > y <- array(NA,dim=c(2,81),dimnames=list(c('y','x'),1:81)) > 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 x M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t 1 101.5 0 1 0 0 0 0 0 0 0 0 0 0 1 2 99.2 0 0 1 0 0 0 0 0 0 0 0 0 2 3 107.8 0 0 0 1 0 0 0 0 0 0 0 0 3 4 92.3 0 0 0 0 1 0 0 0 0 0 0 0 4 5 99.2 0 0 0 0 0 1 0 0 0 0 0 0 5 6 101.6 0 0 0 0 0 0 1 0 0 0 0 0 6 7 87.0 0 0 0 0 0 0 0 1 0 0 0 0 7 8 71.4 0 0 0 0 0 0 0 0 1 0 0 0 8 9 104.7 0 0 0 0 0 0 0 0 0 1 0 0 9 10 115.1 0 0 0 0 0 0 0 0 0 0 1 0 10 11 102.5 0 0 0 0 0 0 0 0 0 0 0 1 11 12 75.3 0 0 0 0 0 0 0 0 0 0 0 0 12 13 96.7 1 1 0 0 0 0 0 0 0 0 0 0 13 14 94.6 1 0 1 0 0 0 0 0 0 0 0 0 14 15 98.6 1 0 0 1 0 0 0 0 0 0 0 0 15 16 99.5 1 0 0 0 1 0 0 0 0 0 0 0 16 17 92.0 1 0 0 0 0 1 0 0 0 0 0 0 17 18 93.6 1 0 0 0 0 0 1 0 0 0 0 0 18 19 89.3 1 0 0 0 0 0 0 1 0 0 0 0 19 20 66.9 1 0 0 0 0 0 0 0 1 0 0 0 20 21 108.8 1 0 0 0 0 0 0 0 0 1 0 0 21 22 113.2 1 0 0 0 0 0 0 0 0 0 1 0 22 23 105.5 1 0 0 0 0 0 0 0 0 0 0 1 23 24 77.8 1 0 0 0 0 0 0 0 0 0 0 0 24 25 102.1 1 1 0 0 0 0 0 0 0 0 0 0 25 26 97.0 1 0 1 0 0 0 0 0 0 0 0 0 26 27 95.5 1 0 0 1 0 0 0 0 0 0 0 0 27 28 99.3 1 0 0 0 1 0 0 0 0 0 0 0 28 29 86.4 1 0 0 0 0 1 0 0 0 0 0 0 29 30 92.4 1 0 0 0 0 0 1 0 0 0 0 0 30 31 85.7 1 0 0 0 0 0 0 1 0 0 0 0 31 32 61.9 1 0 0 0 0 0 0 0 1 0 0 0 32 33 104.9 1 0 0 0 0 0 0 0 0 1 0 0 33 34 107.9 1 0 0 0 0 0 0 0 0 0 1 0 34 35 95.6 1 0 0 0 0 0 0 0 0 0 0 1 35 36 79.8 1 0 0 0 0 0 0 0 0 0 0 0 36 37 94.8 1 1 0 0 0 0 0 0 0 0 0 0 37 38 93.7 1 0 1 0 0 0 0 0 0 0 0 0 38 39 108.1 1 0 0 1 0 0 0 0 0 0 0 0 39 40 96.9 1 0 0 0 1 0 0 0 0 0 0 0 40 41 88.8 1 0 0 0 0 1 0 0 0 0 0 0 41 42 106.7 1 0 0 0 0 0 1 0 0 0 0 0 42 43 86.8 1 0 0 0 0 0 0 1 0 0 0 0 43 44 69.8 1 0 0 0 0 0 0 0 1 0 0 0 44 45 110.9 1 0 0 0 0 0 0 0 0 1 0 0 45 46 105.4 1 0 0 0 0 0 0 0 0 0 1 0 46 47 99.2 1 0 0 0 0 0 0 0 0 0 0 1 47 48 84.4 1 0 0 0 0 0 0 0 0 0 0 0 48 49 87.2 1 1 0 0 0 0 0 0 0 0 0 0 49 50 91.9 1 0 1 0 0 0 0 0 0 0 0 0 50 51 97.9 1 0 0 1 0 0 0 0 0 0 0 0 51 52 94.5 1 0 0 0 1 0 0 0 0 0 0 0 52 53 85.0 1 0 0 0 0 1 0 0 0 0 0 0 53 54 100.3 1 0 0 0 0 0 1 0 0 0 0 0 54 55 78.7 1 0 0 0 0 0 0 1 0 0 0 0 55 56 65.8 1 0 0 0 0 0 0 0 1 0 0 0 56 57 104.8 1 0 0 0 0 0 0 0 0 1 0 0 57 58 96.0 1 0 0 0 0 0 0 0 0 0 1 0 58 59 103.3 1 0 0 0 0 0 0 0 0 0 0 1 59 60 82.9 1 0 0 0 0 0 0 0 0 0 0 0 60 61 91.4 1 1 0 0 0 0 0 0 0 0 0 0 61 62 94.5 1 0 1 0 0 0 0 0 0 0 0 0 62 63 109.3 1 0 0 1 0 0 0 0 0 0 0 0 63 64 92.1 1 0 0 0 1 0 0 0 0 0 0 0 64 65 99.3 1 0 0 0 0 1 0 0 0 0 0 0 65 66 109.6 1 0 0 0 0 0 1 0 0 0 0 0 66 67 87.5 1 0 0 0 0 0 0 1 0 0 0 0 67 68 73.1 1 0 0 0 0 0 0 0 1 0 0 0 68 69 110.7 1 0 0 0 0 0 0 0 0 1 0 0 69 70 111.6 1 0 0 0 0 0 0 0 0 0 1 0 70 71 110.7 1 0 0 0 0 0 0 0 0 0 0 1 71 72 84.0 1 0 0 0 0 0 0 0 0 0 0 0 72 73 101.6 1 1 0 0 0 0 0 0 0 0 0 0 73 74 102.1 1 0 1 0 0 0 0 0 0 0 0 0 74 75 113.9 1 0 0 1 0 0 0 0 0 0 0 0 75 76 99.0 1 0 0 0 1 0 0 0 0 0 0 0 76 77 100.4 1 0 0 0 0 1 0 0 0 0 0 0 77 78 109.5 1 0 0 0 0 0 1 0 0 0 0 0 78 79 93.0 1 0 0 0 0 0 0 1 0 0 0 0 79 80 76.8 1 0 0 0 0 0 0 0 1 0 0 0 80 81 105.3 1 0 0 0 0 0 0 0 0 1 0 0 81 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) x M1 M2 M3 M4 81.09781 -5.16078 16.35893 15.93743 24.14451 15.83730 M5 M6 M7 M8 M9 M10 12.53009 21.38002 6.18709 -11.37726 26.30124 27.68585 M11 t 22.19292 0.09292 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -13.0125 -3.2974 0.6952 3.9503 7.5328 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 81.09781 2.44663 33.147 < 2e-16 *** x -5.16078 2.00077 -2.579 0.012098 * M1 16.35893 2.80131 5.840 1.68e-07 *** M2 15.93743 2.79949 5.693 3.01e-07 *** M3 24.14451 2.79800 8.629 1.77e-12 *** M4 15.83730 2.79685 5.663 3.39e-07 *** M5 12.53009 2.79602 4.481 2.97e-05 *** M6 21.38002 2.79553 7.648 1.04e-10 *** M7 6.18709 2.79538 2.213 0.030285 * M8 -11.37726 2.79556 -4.070 0.000127 *** M9 26.30124 2.79607 9.407 7.20e-14 *** M10 27.68585 2.90129 9.543 4.12e-14 *** M11 22.19292 2.90080 7.651 1.03e-10 *** t 0.09292 0.03054 3.043 0.003344 ** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 5.024 on 67 degrees of freedom Multiple R-squared: 0.8554, Adjusted R-squared: 0.8273 F-statistic: 30.49 on 13 and 67 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.58493357 0.8301329 0.4150664 [2,] 0.46668898 0.9333780 0.5333110 [3,] 0.43262659 0.8652532 0.5673734 [4,] 0.30404484 0.6080897 0.6959552 [5,] 0.31471420 0.6294284 0.6852858 [6,] 0.26294090 0.5258818 0.7370591 [7,] 0.24793955 0.4958791 0.7520605 [8,] 0.19933775 0.3986755 0.8006623 [9,] 0.19342087 0.3868417 0.8065791 [10,] 0.15549774 0.3109955 0.8445023 [11,] 0.21852239 0.4370448 0.7814776 [12,] 0.23185949 0.4637190 0.7681405 [13,] 0.28456775 0.5691355 0.7154323 [14,] 0.27931325 0.5586265 0.7206867 [15,] 0.22490313 0.4498063 0.7750969 [16,] 0.20552966 0.4110593 0.7944703 [17,] 0.15548312 0.3109662 0.8445169 [18,] 0.15517495 0.3103499 0.8448251 [19,] 0.14695986 0.2939197 0.8530401 [20,] 0.15430099 0.3086020 0.8456990 [21,] 0.13171503 0.2634301 0.8682850 [22,] 0.09799653 0.1959931 0.9020035 [23,] 0.21772659 0.4354532 0.7822734 [24,] 0.21657619 0.4331524 0.7834238 [25,] 0.16536434 0.3307287 0.8346357 [26,] 0.34291193 0.6858239 0.6570881 [27,] 0.34081554 0.6816311 0.6591845 [28,] 0.32876435 0.6575287 0.6712357 [29,] 0.55293361 0.8941328 0.4470664 [30,] 0.66567623 0.6686475 0.3343238 [31,] 0.59066446 0.8186711 0.4093355 [32,] 0.72526730 0.5494654 0.2747327 [33,] 0.76572560 0.4685488 0.2342744 [34,] 0.70878797 0.5824241 0.2912120 [35,] 0.70368085 0.5926383 0.2963192 [36,] 0.73731930 0.5253614 0.2626807 [37,] 0.77798764 0.4440247 0.2220124 [38,] 0.71950059 0.5609988 0.2804994 [39,] 0.71232328 0.5753534 0.2876767 [40,] 0.64042004 0.7191599 0.3595800 [41,] 0.58251171 0.8349766 0.4174883 [42,] 0.85175954 0.2964809 0.1482405 [43,] 0.81817615 0.3636477 0.1818239 [44,] 0.75920549 0.4815890 0.2407945 [45,] 0.79186663 0.4162667 0.2081334 [46,] 0.76485883 0.4702823 0.2351412 [47,] 0.68755783 0.6248843 0.3124422 [48,] 0.65656995 0.6868601 0.3434301 > postscript(file="/var/www/html/rcomp/tmp/1mvgk1260961416.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/23sar1260961416.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/3yrvy1260961416.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/4wbln1260961416.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/58njk1260961416.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 = 81 Frequency = 1 1 2 3 4 5 6 3.9503348 1.9789063 2.2789063 -5.0068080 5.1074777 -1.4353795 7 8 9 10 11 12 -0.9353795 0.9360491 -3.5353795 5.3870908 -1.8129092 -6.9129092 13 14 15 16 17 18 3.1960193 1.4245908 -2.8754092 6.2388765 1.9531622 -5.3896949 19 20 21 22 23 24 5.4103051 0.4817336 4.6103051 7.5327753 5.2327753 -0.3672247 25 26 27 28 29 30 7.4809226 2.7094940 -7.0905060 4.9237798 -4.7619345 -7.7047917 31 32 33 34 35 36 0.6952083 -5.6333631 -0.4047917 1.1176786 -5.7823214 0.5176786 37 38 39 40 41 42 -0.9341741 -1.7056027 4.3943973 1.4086830 -3.4770313 5.4801116 43 44 45 46 47 48 0.6801116 1.1515402 4.4801116 -2.4974182 -3.2974182 4.0025818 49 50 51 52 53 54 -9.6492708 -4.6206994 -6.9206994 -2.1064137 -8.3921280 -2.0349851 55 56 57 58 59 60 -8.5349851 -3.9635565 -2.7349851 -13.0125149 -0.3125149 1.3874851 61 62 63 64 65 66 -6.5643676 -3.1357961 3.3642039 -5.6215104 4.7927753 6.1499182 67 68 69 70 71 72 -0.8500818 2.2213467 2.0499182 1.4723884 5.9723884 1.3723884 73 74 75 76 77 78 2.5205357 3.3491071 6.8491071 0.1633929 4.7776786 4.9348214 79 80 81 3.5348214 4.8062500 -4.4651786 > postscript(file="/var/www/html/rcomp/tmp/67y941260961416.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 = 81 Frequency = 1 lag(myerror, k = 1) myerror 0 3.9503348 NA 1 1.9789063 3.9503348 2 2.2789063 1.9789063 3 -5.0068080 2.2789063 4 5.1074777 -5.0068080 5 -1.4353795 5.1074777 6 -0.9353795 -1.4353795 7 0.9360491 -0.9353795 8 -3.5353795 0.9360491 9 5.3870908 -3.5353795 10 -1.8129092 5.3870908 11 -6.9129092 -1.8129092 12 3.1960193 -6.9129092 13 1.4245908 3.1960193 14 -2.8754092 1.4245908 15 6.2388765 -2.8754092 16 1.9531622 6.2388765 17 -5.3896949 1.9531622 18 5.4103051 -5.3896949 19 0.4817336 5.4103051 20 4.6103051 0.4817336 21 7.5327753 4.6103051 22 5.2327753 7.5327753 23 -0.3672247 5.2327753 24 7.4809226 -0.3672247 25 2.7094940 7.4809226 26 -7.0905060 2.7094940 27 4.9237798 -7.0905060 28 -4.7619345 4.9237798 29 -7.7047917 -4.7619345 30 0.6952083 -7.7047917 31 -5.6333631 0.6952083 32 -0.4047917 -5.6333631 33 1.1176786 -0.4047917 34 -5.7823214 1.1176786 35 0.5176786 -5.7823214 36 -0.9341741 0.5176786 37 -1.7056027 -0.9341741 38 4.3943973 -1.7056027 39 1.4086830 4.3943973 40 -3.4770313 1.4086830 41 5.4801116 -3.4770313 42 0.6801116 5.4801116 43 1.1515402 0.6801116 44 4.4801116 1.1515402 45 -2.4974182 4.4801116 46 -3.2974182 -2.4974182 47 4.0025818 -3.2974182 48 -9.6492708 4.0025818 49 -4.6206994 -9.6492708 50 -6.9206994 -4.6206994 51 -2.1064137 -6.9206994 52 -8.3921280 -2.1064137 53 -2.0349851 -8.3921280 54 -8.5349851 -2.0349851 55 -3.9635565 -8.5349851 56 -2.7349851 -3.9635565 57 -13.0125149 -2.7349851 58 -0.3125149 -13.0125149 59 1.3874851 -0.3125149 60 -6.5643676 1.3874851 61 -3.1357961 -6.5643676 62 3.3642039 -3.1357961 63 -5.6215104 3.3642039 64 4.7927753 -5.6215104 65 6.1499182 4.7927753 66 -0.8500818 6.1499182 67 2.2213467 -0.8500818 68 2.0499182 2.2213467 69 1.4723884 2.0499182 70 5.9723884 1.4723884 71 1.3723884 5.9723884 72 2.5205357 1.3723884 73 3.3491071 2.5205357 74 6.8491071 3.3491071 75 0.1633929 6.8491071 76 4.7776786 0.1633929 77 4.9348214 4.7776786 78 3.5348214 4.9348214 79 4.8062500 3.5348214 80 -4.4651786 4.8062500 81 NA -4.4651786 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] 1.9789063 3.9503348 [2,] 2.2789063 1.9789063 [3,] -5.0068080 2.2789063 [4,] 5.1074777 -5.0068080 [5,] -1.4353795 5.1074777 [6,] -0.9353795 -1.4353795 [7,] 0.9360491 -0.9353795 [8,] -3.5353795 0.9360491 [9,] 5.3870908 -3.5353795 [10,] -1.8129092 5.3870908 [11,] -6.9129092 -1.8129092 [12,] 3.1960193 -6.9129092 [13,] 1.4245908 3.1960193 [14,] -2.8754092 1.4245908 [15,] 6.2388765 -2.8754092 [16,] 1.9531622 6.2388765 [17,] -5.3896949 1.9531622 [18,] 5.4103051 -5.3896949 [19,] 0.4817336 5.4103051 [20,] 4.6103051 0.4817336 [21,] 7.5327753 4.6103051 [22,] 5.2327753 7.5327753 [23,] -0.3672247 5.2327753 [24,] 7.4809226 -0.3672247 [25,] 2.7094940 7.4809226 [26,] -7.0905060 2.7094940 [27,] 4.9237798 -7.0905060 [28,] -4.7619345 4.9237798 [29,] -7.7047917 -4.7619345 [30,] 0.6952083 -7.7047917 [31,] -5.6333631 0.6952083 [32,] -0.4047917 -5.6333631 [33,] 1.1176786 -0.4047917 [34,] -5.7823214 1.1176786 [35,] 0.5176786 -5.7823214 [36,] -0.9341741 0.5176786 [37,] -1.7056027 -0.9341741 [38,] 4.3943973 -1.7056027 [39,] 1.4086830 4.3943973 [40,] -3.4770313 1.4086830 [41,] 5.4801116 -3.4770313 [42,] 0.6801116 5.4801116 [43,] 1.1515402 0.6801116 [44,] 4.4801116 1.1515402 [45,] -2.4974182 4.4801116 [46,] -3.2974182 -2.4974182 [47,] 4.0025818 -3.2974182 [48,] -9.6492708 4.0025818 [49,] -4.6206994 -9.6492708 [50,] -6.9206994 -4.6206994 [51,] -2.1064137 -6.9206994 [52,] -8.3921280 -2.1064137 [53,] -2.0349851 -8.3921280 [54,] -8.5349851 -2.0349851 [55,] -3.9635565 -8.5349851 [56,] -2.7349851 -3.9635565 [57,] -13.0125149 -2.7349851 [58,] -0.3125149 -13.0125149 [59,] 1.3874851 -0.3125149 [60,] -6.5643676 1.3874851 [61,] -3.1357961 -6.5643676 [62,] 3.3642039 -3.1357961 [63,] -5.6215104 3.3642039 [64,] 4.7927753 -5.6215104 [65,] 6.1499182 4.7927753 [66,] -0.8500818 6.1499182 [67,] 2.2213467 -0.8500818 [68,] 2.0499182 2.2213467 [69,] 1.4723884 2.0499182 [70,] 5.9723884 1.4723884 [71,] 1.3723884 5.9723884 [72,] 2.5205357 1.3723884 [73,] 3.3491071 2.5205357 [74,] 6.8491071 3.3491071 [75,] 0.1633929 6.8491071 [76,] 4.7776786 0.1633929 [77,] 4.9348214 4.7776786 [78,] 3.5348214 4.9348214 [79,] 4.8062500 3.5348214 [80,] -4.4651786 4.8062500 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 1.9789063 3.9503348 2 2.2789063 1.9789063 3 -5.0068080 2.2789063 4 5.1074777 -5.0068080 5 -1.4353795 5.1074777 6 -0.9353795 -1.4353795 7 0.9360491 -0.9353795 8 -3.5353795 0.9360491 9 5.3870908 -3.5353795 10 -1.8129092 5.3870908 11 -6.9129092 -1.8129092 12 3.1960193 -6.9129092 13 1.4245908 3.1960193 14 -2.8754092 1.4245908 15 6.2388765 -2.8754092 16 1.9531622 6.2388765 17 -5.3896949 1.9531622 18 5.4103051 -5.3896949 19 0.4817336 5.4103051 20 4.6103051 0.4817336 21 7.5327753 4.6103051 22 5.2327753 7.5327753 23 -0.3672247 5.2327753 24 7.4809226 -0.3672247 25 2.7094940 7.4809226 26 -7.0905060 2.7094940 27 4.9237798 -7.0905060 28 -4.7619345 4.9237798 29 -7.7047917 -4.7619345 30 0.6952083 -7.7047917 31 -5.6333631 0.6952083 32 -0.4047917 -5.6333631 33 1.1176786 -0.4047917 34 -5.7823214 1.1176786 35 0.5176786 -5.7823214 36 -0.9341741 0.5176786 37 -1.7056027 -0.9341741 38 4.3943973 -1.7056027 39 1.4086830 4.3943973 40 -3.4770313 1.4086830 41 5.4801116 -3.4770313 42 0.6801116 5.4801116 43 1.1515402 0.6801116 44 4.4801116 1.1515402 45 -2.4974182 4.4801116 46 -3.2974182 -2.4974182 47 4.0025818 -3.2974182 48 -9.6492708 4.0025818 49 -4.6206994 -9.6492708 50 -6.9206994 -4.6206994 51 -2.1064137 -6.9206994 52 -8.3921280 -2.1064137 53 -2.0349851 -8.3921280 54 -8.5349851 -2.0349851 55 -3.9635565 -8.5349851 56 -2.7349851 -3.9635565 57 -13.0125149 -2.7349851 58 -0.3125149 -13.0125149 59 1.3874851 -0.3125149 60 -6.5643676 1.3874851 61 -3.1357961 -6.5643676 62 3.3642039 -3.1357961 63 -5.6215104 3.3642039 64 4.7927753 -5.6215104 65 6.1499182 4.7927753 66 -0.8500818 6.1499182 67 2.2213467 -0.8500818 68 2.0499182 2.2213467 69 1.4723884 2.0499182 70 5.9723884 1.4723884 71 1.3723884 5.9723884 72 2.5205357 1.3723884 73 3.3491071 2.5205357 74 6.8491071 3.3491071 75 0.1633929 6.8491071 76 4.7776786 0.1633929 77 4.9348214 4.7776786 78 3.5348214 4.9348214 79 4.8062500 3.5348214 80 -4.4651786 4.8062500 > 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/7stuy1260961416.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/8vy521260961416.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/9jxgm1260961416.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/10soiu1260961416.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/11fefw1260961416.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/12vx8d1260961416.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/13q0ub1260961416.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/14042c1260961417.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/15v8hb1260961417.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/16qj9v1260961417.tab") + } > > try(system("convert tmp/1mvgk1260961416.ps tmp/1mvgk1260961416.png",intern=TRUE)) character(0) > try(system("convert tmp/23sar1260961416.ps tmp/23sar1260961416.png",intern=TRUE)) character(0) > try(system("convert tmp/3yrvy1260961416.ps tmp/3yrvy1260961416.png",intern=TRUE)) character(0) > try(system("convert tmp/4wbln1260961416.ps tmp/4wbln1260961416.png",intern=TRUE)) character(0) > try(system("convert tmp/58njk1260961416.ps tmp/58njk1260961416.png",intern=TRUE)) character(0) > try(system("convert tmp/67y941260961416.ps tmp/67y941260961416.png",intern=TRUE)) character(0) > try(system("convert tmp/7stuy1260961416.ps tmp/7stuy1260961416.png",intern=TRUE)) character(0) > try(system("convert tmp/8vy521260961416.ps tmp/8vy521260961416.png",intern=TRUE)) character(0) > try(system("convert tmp/9jxgm1260961416.ps tmp/9jxgm1260961416.png",intern=TRUE)) character(0) > try(system("convert tmp/10soiu1260961416.ps tmp/10soiu1260961416.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.639 1.534 8.822