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(132.92 + ,138.04 + ,136.51 + ,131.02 + ,126.51 + ,129.61 + ,132.92 + ,138.04 + ,136.51 + ,131.02 + ,122.96 + ,129.61 + ,132.92 + ,138.04 + ,136.51 + ,124.04 + ,122.96 + ,129.61 + ,132.92 + ,138.04 + ,121.29 + ,124.04 + ,122.96 + ,129.61 + ,132.92 + ,124.56 + ,121.29 + ,124.04 + ,122.96 + ,129.61 + ,118.53 + ,124.56 + ,121.29 + ,124.04 + ,122.96 + ,113.14 + ,118.53 + ,124.56 + ,121.29 + ,124.04 + ,114.15 + ,113.14 + ,118.53 + ,124.56 + ,121.29 + ,122.17 + ,114.15 + ,113.14 + ,118.53 + ,124.56 + ,129.23 + ,122.17 + ,114.15 + ,113.14 + ,118.53 + ,131.19 + ,129.23 + ,122.17 + ,114.15 + ,113.14 + ,129.12 + ,131.19 + ,129.23 + ,122.17 + ,114.15 + ,128.28 + ,129.12 + ,131.19 + ,129.23 + ,122.17 + ,126.83 + ,128.28 + ,129.12 + ,131.19 + ,129.23 + ,138.13 + ,126.83 + ,128.28 + ,129.12 + ,131.19 + ,140.52 + ,138.13 + ,126.83 + ,128.28 + ,129.12 + ,146.83 + ,140.52 + ,138.13 + ,126.83 + ,128.28 + ,135.14 + ,146.83 + ,140.52 + ,138.13 + ,126.83 + ,131.84 + ,135.14 + ,146.83 + ,140.52 + ,138.13 + ,125.7 + ,131.84 + ,135.14 + ,146.83 + ,140.52 + ,128.98 + ,125.7 + ,131.84 + ,135.14 + ,146.83 + ,133.25 + ,128.98 + ,125.7 + ,131.84 + ,135.14 + ,136.76 + ,133.25 + ,128.98 + ,125.7 + ,131.84 + ,133.24 + ,136.76 + ,133.25 + ,128.98 + ,125.7 + ,128.54 + ,133.24 + ,136.76 + ,133.25 + ,128.98 + ,121.08 + ,128.54 + ,133.24 + ,136.76 + ,133.25 + ,120.23 + ,121.08 + ,128.54 + ,133.24 + ,136.76 + ,119.08 + ,120.23 + ,121.08 + ,128.54 + ,133.24 + ,125.75 + ,119.08 + ,120.23 + ,121.08 + ,128.54 + ,126.89 + ,125.75 + ,119.08 + ,120.23 + ,121.08 + ,126.6 + ,126.89 + ,125.75 + ,119.08 + ,120.23 + ,121.89 + ,126.6 + ,126.89 + ,125.75 + ,119.08 + ,123.44 + ,121.89 + ,126.6 + ,126.89 + ,125.75 + ,126.46 + ,123.44 + ,121.89 + ,126.6 + ,126.89 + ,129.49 + ,126.46 + ,123.44 + ,121.89 + ,126.6 + ,127.78 + ,129.49 + ,126.46 + ,123.44 + ,121.89 + ,125.29 + ,127.78 + ,129.49 + ,126.46 + ,123.44 + ,119.02 + ,125.29 + ,127.78 + ,129.49 + ,126.46 + ,119.96 + ,119.02 + ,125.29 + ,127.78 + ,129.49 + ,122.86 + ,119.96 + ,119.02 + ,125.29 + ,127.78 + ,131.89 + ,122.86 + ,119.96 + ,119.02 + ,125.29 + ,132.73 + ,131.89 + ,122.86 + ,119.96 + ,119.02 + ,135.01 + ,132.73 + ,131.89 + ,122.86 + ,119.96 + ,136.71 + ,135.01 + ,132.73 + ,131.89 + ,122.86 + ,142.73 + ,136.71 + ,135.01 + ,132.73 + ,131.89 + ,144.43 + ,142.73 + ,136.71 + ,135.01 + ,132.73 + ,144.93 + ,144.43 + ,142.73 + ,136.71 + ,135.01 + ,138.75 + ,144.93 + ,144.43 + ,142.73 + ,136.71 + ,130.22 + ,138.75 + ,144.93 + ,144.43 + ,142.73 + ,122.19 + ,130.22 + ,138.75 + ,144.93 + ,144.43 + ,128.4 + ,122.19 + ,130.22 + ,138.75 + ,144.93 + ,140.43 + ,128.4 + ,122.19 + ,130.22 + ,138.75 + ,153.5 + ,140.43 + ,128.4 + ,122.19 + ,130.22 + ,149.33 + ,153.5 + ,140.43 + ,128.4 + ,122.19 + ,142.97 + ,149.33 + ,153.5 + ,140.43 + ,128.4) + ,dim=c(5 + ,56) + ,dimnames=list(c('Y' + ,'Y[t-1]' + ,'Y[t-2]' + ,'Y[t-3]' + ,'Y[t-4]') + ,1:56)) > y <- array(NA,dim=c(5,56),dimnames=list(c('Y','Y[t-1]','Y[t-2]','Y[t-3]','Y[t-4]'),1:56)) > 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 Y[t-1] Y[t-2] Y[t-3] Y[t-4] M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t 1 132.92 138.04 136.51 131.02 126.51 1 0 0 0 0 0 0 0 0 0 0 1 2 129.61 132.92 138.04 136.51 131.02 0 1 0 0 0 0 0 0 0 0 0 2 3 122.96 129.61 132.92 138.04 136.51 0 0 1 0 0 0 0 0 0 0 0 3 4 124.04 122.96 129.61 132.92 138.04 0 0 0 1 0 0 0 0 0 0 0 4 5 121.29 124.04 122.96 129.61 132.92 0 0 0 0 1 0 0 0 0 0 0 5 6 124.56 121.29 124.04 122.96 129.61 0 0 0 0 0 1 0 0 0 0 0 6 7 118.53 124.56 121.29 124.04 122.96 0 0 0 0 0 0 1 0 0 0 0 7 8 113.14 118.53 124.56 121.29 124.04 0 0 0 0 0 0 0 1 0 0 0 8 9 114.15 113.14 118.53 124.56 121.29 0 0 0 0 0 0 0 0 1 0 0 9 10 122.17 114.15 113.14 118.53 124.56 0 0 0 0 0 0 0 0 0 1 0 10 11 129.23 122.17 114.15 113.14 118.53 0 0 0 0 0 0 0 0 0 0 1 11 12 131.19 129.23 122.17 114.15 113.14 0 0 0 0 0 0 0 0 0 0 0 12 13 129.12 131.19 129.23 122.17 114.15 1 0 0 0 0 0 0 0 0 0 0 13 14 128.28 129.12 131.19 129.23 122.17 0 1 0 0 0 0 0 0 0 0 0 14 15 126.83 128.28 129.12 131.19 129.23 0 0 1 0 0 0 0 0 0 0 0 15 16 138.13 126.83 128.28 129.12 131.19 0 0 0 1 0 0 0 0 0 0 0 16 17 140.52 138.13 126.83 128.28 129.12 0 0 0 0 1 0 0 0 0 0 0 17 18 146.83 140.52 138.13 126.83 128.28 0 0 0 0 0 1 0 0 0 0 0 18 19 135.14 146.83 140.52 138.13 126.83 0 0 0 0 0 0 1 0 0 0 0 19 20 131.84 135.14 146.83 140.52 138.13 0 0 0 0 0 0 0 1 0 0 0 20 21 125.70 131.84 135.14 146.83 140.52 0 0 0 0 0 0 0 0 1 0 0 21 22 128.98 125.70 131.84 135.14 146.83 0 0 0 0 0 0 0 0 0 1 0 22 23 133.25 128.98 125.70 131.84 135.14 0 0 0 0 0 0 0 0 0 0 1 23 24 136.76 133.25 128.98 125.70 131.84 0 0 0 0 0 0 0 0 0 0 0 24 25 133.24 136.76 133.25 128.98 125.70 1 0 0 0 0 0 0 0 0 0 0 25 26 128.54 133.24 136.76 133.25 128.98 0 1 0 0 0 0 0 0 0 0 0 26 27 121.08 128.54 133.24 136.76 133.25 0 0 1 0 0 0 0 0 0 0 0 27 28 120.23 121.08 128.54 133.24 136.76 0 0 0 1 0 0 0 0 0 0 0 28 29 119.08 120.23 121.08 128.54 133.24 0 0 0 0 1 0 0 0 0 0 0 29 30 125.75 119.08 120.23 121.08 128.54 0 0 0 0 0 1 0 0 0 0 0 30 31 126.89 125.75 119.08 120.23 121.08 0 0 0 0 0 0 1 0 0 0 0 31 32 126.60 126.89 125.75 119.08 120.23 0 0 0 0 0 0 0 1 0 0 0 32 33 121.89 126.60 126.89 125.75 119.08 0 0 0 0 0 0 0 0 1 0 0 33 34 123.44 121.89 126.60 126.89 125.75 0 0 0 0 0 0 0 0 0 1 0 34 35 126.46 123.44 121.89 126.60 126.89 0 0 0 0 0 0 0 0 0 0 1 35 36 129.49 126.46 123.44 121.89 126.60 0 0 0 0 0 0 0 0 0 0 0 36 37 127.78 129.49 126.46 123.44 121.89 1 0 0 0 0 0 0 0 0 0 0 37 38 125.29 127.78 129.49 126.46 123.44 0 1 0 0 0 0 0 0 0 0 0 38 39 119.02 125.29 127.78 129.49 126.46 0 0 1 0 0 0 0 0 0 0 0 39 40 119.96 119.02 125.29 127.78 129.49 0 0 0 1 0 0 0 0 0 0 0 40 41 122.86 119.96 119.02 125.29 127.78 0 0 0 0 1 0 0 0 0 0 0 41 42 131.89 122.86 119.96 119.02 125.29 0 0 0 0 0 1 0 0 0 0 0 42 43 132.73 131.89 122.86 119.96 119.02 0 0 0 0 0 0 1 0 0 0 0 43 44 135.01 132.73 131.89 122.86 119.96 0 0 0 0 0 0 0 1 0 0 0 44 45 136.71 135.01 132.73 131.89 122.86 0 0 0 0 0 0 0 0 1 0 0 45 46 142.73 136.71 135.01 132.73 131.89 0 0 0 0 0 0 0 0 0 1 0 46 47 144.43 142.73 136.71 135.01 132.73 0 0 0 0 0 0 0 0 0 0 1 47 48 144.93 144.43 142.73 136.71 135.01 0 0 0 0 0 0 0 0 0 0 0 48 49 138.75 144.93 144.43 142.73 136.71 1 0 0 0 0 0 0 0 0 0 0 49 50 130.22 138.75 144.93 144.43 142.73 0 1 0 0 0 0 0 0 0 0 0 50 51 122.19 130.22 138.75 144.93 144.43 0 0 1 0 0 0 0 0 0 0 0 51 52 128.40 122.19 130.22 138.75 144.93 0 0 0 1 0 0 0 0 0 0 0 52 53 140.43 128.40 122.19 130.22 138.75 0 0 0 0 1 0 0 0 0 0 0 53 54 153.50 140.43 128.40 122.19 130.22 0 0 0 0 0 1 0 0 0 0 0 54 55 149.33 153.50 140.43 128.40 122.19 0 0 0 0 0 0 1 0 0 0 0 55 56 142.97 149.33 153.50 140.43 128.40 0 0 0 0 0 0 0 1 0 0 0 56 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) `Y[t-1]` `Y[t-2]` `Y[t-3]` `Y[t-4]` M1 15.10517 1.51204 -0.61509 -0.32310 0.29646 -2.20172 M2 M3 M4 M5 M6 M7 0.71229 -2.17352 6.28391 -0.57336 4.54706 -6.44162 M8 M9 M10 M11 t 1.40686 1.31742 4.89880 1.11412 0.03782 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -3.8648 -1.3816 -0.4567 1.4397 6.0940 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 15.10517 9.33752 1.618 0.11379 `Y[t-1]` 1.51204 0.15391 9.824 4.22e-12 *** `Y[t-2]` -0.61509 0.28084 -2.190 0.03456 * `Y[t-3]` -0.32310 0.28643 -1.128 0.26620 `Y[t-4]` 0.29646 0.16098 1.842 0.07315 . M1 -2.20172 2.11577 -1.041 0.30446 M2 0.71229 2.26492 0.314 0.75483 M3 -2.17352 2.44103 -0.890 0.37871 M4 6.28391 2.24615 2.798 0.00796 ** M5 -0.57336 2.48498 -0.231 0.81873 M6 4.54706 1.94321 2.340 0.02450 * M7 -6.44162 2.32824 -2.767 0.00861 ** M8 1.40686 2.33578 0.602 0.55045 M9 1.31742 2.95037 0.447 0.65769 M10 4.89880 2.12908 2.301 0.02683 * M11 1.11412 2.32417 0.479 0.63436 t 0.03782 0.02579 1.466 0.15056 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 2.774 on 39 degrees of freedom Multiple R-squared: 0.9301, Adjusted R-squared: 0.9014 F-statistic: 32.44 on 16 and 39 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.8763930 0.247213946 0.123606973 [2,] 0.9358675 0.128264997 0.064132498 [3,] 0.9795523 0.040895454 0.020447727 [4,] 0.9628882 0.074223681 0.037111841 [5,] 0.9478813 0.104237310 0.052118655 [6,] 0.9484366 0.103126783 0.051563391 [7,] 0.9863858 0.027228478 0.013614239 [8,] 0.9864052 0.027189645 0.013594822 [9,] 0.9859062 0.028187510 0.014093755 [10,] 0.9715691 0.056861761 0.028430880 [11,] 0.9846891 0.030621812 0.015310906 [12,] 0.9971197 0.005760592 0.002880296 [13,] 0.9952189 0.009562215 0.004781107 [14,] 0.9933685 0.013262975 0.006631488 [15,] 0.9815055 0.036989069 0.018494535 [16,] 0.9463185 0.107363097 0.053681548 [17,] 0.9949541 0.010091804 0.005045902 > postscript(file="/var/www/html/rcomp/tmp/1doha1259094519.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/2jf0d1259094519.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/3stww1259094519.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/436jo1259094519.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/5fke91259094519.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 = 56 Frequency = 1 1 2 3 4 5 6 0.05045822 2.90813561 -0.17150309 -1.67550205 -2.88097987 -1.11415768 7 8 9 10 11 12 -0.50874400 -3.86481511 3.50950086 0.15009659 -0.50219398 -1.28360796 13 14 15 16 17 18 2.48107260 2.92821933 2.86336295 6.09401889 -2.33215902 1.93687132 19 20 21 22 23 24 -2.79225407 5.00059709 -1.95822791 -0.69101244 0.98910438 0.13098410 25 26 27 28 29 30 -1.02590241 -0.78914476 -0.59148969 -3.72574213 -1.83465476 -0.12384730 31 32 33 34 35 36 3.11133142 -2.80561608 -3.82829376 -0.56322255 0.53125348 -0.41123452 37 38 39 40 41 42 -0.78410521 -1.26037837 -1.88552767 -2.94264504 1.20131178 -0.02130793 43 44 45 46 47 48 2.06213747 1.39830548 2.27702081 1.10413839 -1.01816388 1.56385838 49 50 51 52 53 54 -0.72152320 -3.78683182 -0.21484251 2.24987033 5.84648188 -0.67755842 55 56 -1.87247083 0.27152862 > postscript(file="/var/www/html/rcomp/tmp/6761i1259094519.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 = 56 Frequency = 1 lag(myerror, k = 1) myerror 0 0.05045822 NA 1 2.90813561 0.05045822 2 -0.17150309 2.90813561 3 -1.67550205 -0.17150309 4 -2.88097987 -1.67550205 5 -1.11415768 -2.88097987 6 -0.50874400 -1.11415768 7 -3.86481511 -0.50874400 8 3.50950086 -3.86481511 9 0.15009659 3.50950086 10 -0.50219398 0.15009659 11 -1.28360796 -0.50219398 12 2.48107260 -1.28360796 13 2.92821933 2.48107260 14 2.86336295 2.92821933 15 6.09401889 2.86336295 16 -2.33215902 6.09401889 17 1.93687132 -2.33215902 18 -2.79225407 1.93687132 19 5.00059709 -2.79225407 20 -1.95822791 5.00059709 21 -0.69101244 -1.95822791 22 0.98910438 -0.69101244 23 0.13098410 0.98910438 24 -1.02590241 0.13098410 25 -0.78914476 -1.02590241 26 -0.59148969 -0.78914476 27 -3.72574213 -0.59148969 28 -1.83465476 -3.72574213 29 -0.12384730 -1.83465476 30 3.11133142 -0.12384730 31 -2.80561608 3.11133142 32 -3.82829376 -2.80561608 33 -0.56322255 -3.82829376 34 0.53125348 -0.56322255 35 -0.41123452 0.53125348 36 -0.78410521 -0.41123452 37 -1.26037837 -0.78410521 38 -1.88552767 -1.26037837 39 -2.94264504 -1.88552767 40 1.20131178 -2.94264504 41 -0.02130793 1.20131178 42 2.06213747 -0.02130793 43 1.39830548 2.06213747 44 2.27702081 1.39830548 45 1.10413839 2.27702081 46 -1.01816388 1.10413839 47 1.56385838 -1.01816388 48 -0.72152320 1.56385838 49 -3.78683182 -0.72152320 50 -0.21484251 -3.78683182 51 2.24987033 -0.21484251 52 5.84648188 2.24987033 53 -0.67755842 5.84648188 54 -1.87247083 -0.67755842 55 0.27152862 -1.87247083 56 NA 0.27152862 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] 2.90813561 0.05045822 [2,] -0.17150309 2.90813561 [3,] -1.67550205 -0.17150309 [4,] -2.88097987 -1.67550205 [5,] -1.11415768 -2.88097987 [6,] -0.50874400 -1.11415768 [7,] -3.86481511 -0.50874400 [8,] 3.50950086 -3.86481511 [9,] 0.15009659 3.50950086 [10,] -0.50219398 0.15009659 [11,] -1.28360796 -0.50219398 [12,] 2.48107260 -1.28360796 [13,] 2.92821933 2.48107260 [14,] 2.86336295 2.92821933 [15,] 6.09401889 2.86336295 [16,] -2.33215902 6.09401889 [17,] 1.93687132 -2.33215902 [18,] -2.79225407 1.93687132 [19,] 5.00059709 -2.79225407 [20,] -1.95822791 5.00059709 [21,] -0.69101244 -1.95822791 [22,] 0.98910438 -0.69101244 [23,] 0.13098410 0.98910438 [24,] -1.02590241 0.13098410 [25,] -0.78914476 -1.02590241 [26,] -0.59148969 -0.78914476 [27,] -3.72574213 -0.59148969 [28,] -1.83465476 -3.72574213 [29,] -0.12384730 -1.83465476 [30,] 3.11133142 -0.12384730 [31,] -2.80561608 3.11133142 [32,] -3.82829376 -2.80561608 [33,] -0.56322255 -3.82829376 [34,] 0.53125348 -0.56322255 [35,] -0.41123452 0.53125348 [36,] -0.78410521 -0.41123452 [37,] -1.26037837 -0.78410521 [38,] -1.88552767 -1.26037837 [39,] -2.94264504 -1.88552767 [40,] 1.20131178 -2.94264504 [41,] -0.02130793 1.20131178 [42,] 2.06213747 -0.02130793 [43,] 1.39830548 2.06213747 [44,] 2.27702081 1.39830548 [45,] 1.10413839 2.27702081 [46,] -1.01816388 1.10413839 [47,] 1.56385838 -1.01816388 [48,] -0.72152320 1.56385838 [49,] -3.78683182 -0.72152320 [50,] -0.21484251 -3.78683182 [51,] 2.24987033 -0.21484251 [52,] 5.84648188 2.24987033 [53,] -0.67755842 5.84648188 [54,] -1.87247083 -0.67755842 [55,] 0.27152862 -1.87247083 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 2.90813561 0.05045822 2 -0.17150309 2.90813561 3 -1.67550205 -0.17150309 4 -2.88097987 -1.67550205 5 -1.11415768 -2.88097987 6 -0.50874400 -1.11415768 7 -3.86481511 -0.50874400 8 3.50950086 -3.86481511 9 0.15009659 3.50950086 10 -0.50219398 0.15009659 11 -1.28360796 -0.50219398 12 2.48107260 -1.28360796 13 2.92821933 2.48107260 14 2.86336295 2.92821933 15 6.09401889 2.86336295 16 -2.33215902 6.09401889 17 1.93687132 -2.33215902 18 -2.79225407 1.93687132 19 5.00059709 -2.79225407 20 -1.95822791 5.00059709 21 -0.69101244 -1.95822791 22 0.98910438 -0.69101244 23 0.13098410 0.98910438 24 -1.02590241 0.13098410 25 -0.78914476 -1.02590241 26 -0.59148969 -0.78914476 27 -3.72574213 -0.59148969 28 -1.83465476 -3.72574213 29 -0.12384730 -1.83465476 30 3.11133142 -0.12384730 31 -2.80561608 3.11133142 32 -3.82829376 -2.80561608 33 -0.56322255 -3.82829376 34 0.53125348 -0.56322255 35 -0.41123452 0.53125348 36 -0.78410521 -0.41123452 37 -1.26037837 -0.78410521 38 -1.88552767 -1.26037837 39 -2.94264504 -1.88552767 40 1.20131178 -2.94264504 41 -0.02130793 1.20131178 42 2.06213747 -0.02130793 43 1.39830548 2.06213747 44 2.27702081 1.39830548 45 1.10413839 2.27702081 46 -1.01816388 1.10413839 47 1.56385838 -1.01816388 48 -0.72152320 1.56385838 49 -3.78683182 -0.72152320 50 -0.21484251 -3.78683182 51 2.24987033 -0.21484251 52 5.84648188 2.24987033 53 -0.67755842 5.84648188 54 -1.87247083 -0.67755842 55 0.27152862 -1.87247083 > 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/72le31259094519.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/838mf1259094519.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/9x9gd1259094519.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/10di7z1259094519.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/11zk4m1259094519.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/12rou81259094519.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/13l8nu1259094519.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/14i0id1259094519.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/154xmi1259094519.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/1657wq1259094519.tab") + } > > system("convert tmp/1doha1259094519.ps tmp/1doha1259094519.png") > system("convert tmp/2jf0d1259094519.ps tmp/2jf0d1259094519.png") > system("convert tmp/3stww1259094519.ps tmp/3stww1259094519.png") > system("convert tmp/436jo1259094519.ps tmp/436jo1259094519.png") > system("convert tmp/5fke91259094519.ps tmp/5fke91259094519.png") > system("convert tmp/6761i1259094519.ps tmp/6761i1259094519.png") > system("convert tmp/72le31259094519.ps tmp/72le31259094519.png") > system("convert tmp/838mf1259094519.ps tmp/838mf1259094519.png") > system("convert tmp/9x9gd1259094519.ps tmp/9x9gd1259094519.png") > system("convert tmp/10di7z1259094519.ps tmp/10di7z1259094519.png") > > > proc.time() user system elapsed 2.355 1.562 2.807