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(2.06 + ,0 + ,2.08 + ,2.05 + ,2.09 + ,2.11 + ,2.06 + ,0 + ,2.06 + ,2.08 + ,2.05 + ,2.09 + ,2.08 + ,0 + ,2.06 + ,2.06 + ,2.08 + ,2.05 + ,2.07 + ,0 + ,2.08 + ,2.06 + ,2.06 + ,2.08 + ,2.06 + ,0 + ,2.07 + ,2.08 + ,2.06 + ,2.06 + ,2.07 + ,0 + ,2.06 + ,2.07 + ,2.08 + ,2.06 + ,2.06 + ,0 + ,2.07 + ,2.06 + ,2.07 + ,2.08 + ,2.09 + ,0 + ,2.06 + ,2.07 + ,2.06 + ,2.07 + ,2.07 + ,0 + ,2.09 + ,2.06 + ,2.07 + ,2.06 + ,2.09 + ,0 + ,2.07 + ,2.09 + ,2.06 + ,2.07 + ,2.28 + ,0 + ,2.09 + ,2.07 + ,2.09 + ,2.06 + ,2.33 + ,0 + ,2.28 + ,2.09 + ,2.07 + ,2.09 + ,2.35 + ,0 + ,2.33 + ,2.28 + ,2.09 + ,2.07 + ,2.52 + ,0 + ,2.35 + ,2.33 + ,2.28 + ,2.09 + ,2.63 + ,0 + ,2.52 + ,2.35 + ,2.33 + ,2.28 + ,2.58 + ,0 + ,2.63 + ,2.52 + ,2.35 + ,2.33 + ,2.70 + ,0 + ,2.58 + ,2.63 + ,2.52 + ,2.35 + ,2.81 + ,0 + ,2.70 + ,2.58 + ,2.63 + ,2.52 + ,2.97 + ,0 + ,2.81 + ,2.70 + ,2.58 + ,2.63 + ,3.04 + ,0 + ,2.97 + ,2.81 + ,2.70 + ,2.58 + ,3.28 + ,0 + ,3.04 + ,2.97 + ,2.81 + ,2.70 + ,3.33 + ,0 + ,3.28 + ,3.04 + ,2.97 + ,2.81 + ,3.50 + ,0 + ,3.33 + ,3.28 + ,3.04 + ,2.97 + ,3.56 + ,0 + ,3.50 + ,3.33 + ,3.28 + ,3.04 + ,3.57 + ,0 + ,3.56 + ,3.50 + ,3.33 + ,3.28 + ,3.69 + ,0 + ,3.57 + ,3.56 + ,3.50 + ,3.33 + ,3.82 + ,0 + ,3.69 + ,3.57 + ,3.56 + ,3.50 + ,3.79 + ,0 + ,3.82 + ,3.69 + ,3.57 + ,3.56 + ,3.96 + ,0 + ,3.79 + ,3.82 + ,3.69 + ,3.57 + ,4.06 + ,0 + ,3.96 + ,3.79 + ,3.82 + ,3.69 + ,4.05 + ,0 + ,4.06 + ,3.96 + ,3.79 + ,3.82 + ,4.03 + ,0 + ,4.05 + ,4.06 + ,3.96 + ,3.79 + ,3.94 + ,0 + ,4.03 + ,4.05 + ,4.06 + ,3.96 + ,4.02 + ,0 + ,3.94 + ,4.03 + ,4.05 + ,4.06 + ,3.88 + ,0 + ,4.02 + ,3.94 + ,4.03 + ,4.05 + ,4.02 + ,0 + ,3.88 + ,4.02 + ,3.94 + ,4.03 + ,4.03 + ,0 + ,4.02 + ,3.88 + ,4.02 + ,3.94 + ,4.09 + ,0 + ,4.03 + ,4.02 + ,3.88 + ,4.02 + ,3.99 + ,0 + ,4.09 + ,4.03 + ,4.02 + ,3.88 + ,4.01 + ,0 + ,3.99 + ,4.09 + ,4.03 + ,4.02 + ,4.01 + ,0 + ,4.01 + ,3.99 + ,4.09 + ,4.03 + ,4.19 + ,0 + ,4.01 + ,4.01 + ,3.99 + ,4.09 + ,4.30 + ,0 + ,4.19 + ,4.01 + ,4.01 + ,3.99 + ,4.27 + ,0 + ,4.30 + ,4.19 + ,4.01 + ,4.01 + ,3.82 + ,0 + ,4.27 + ,4.30 + ,4.19 + ,4.01 + ,3.15 + ,1 + ,3.82 + ,4.27 + ,4.30 + ,4.19 + ,2.49 + ,1 + ,3.15 + ,3.82 + ,4.27 + ,4.30 + ,1.81 + ,1 + ,2.49 + ,3.15 + ,3.82 + ,4.27 + ,1.26 + ,1 + ,1.81 + ,2.49 + ,3.15 + ,3.82 + ,1.06 + ,1 + ,1.26 + ,1.81 + ,2.49 + ,3.15 + ,0.84 + ,1 + ,1.06 + ,1.26 + ,1.81 + ,2.49 + ,0.78 + ,1 + ,0.84 + ,1.06 + ,1.26 + ,1.81 + ,0.70 + ,1 + ,0.78 + ,0.84 + ,1.06 + ,1.26 + ,0.36 + ,1 + ,0.70 + ,0.78 + ,0.84 + ,1.06 + ,0.35 + ,1 + ,0.36 + ,0.70 + ,0.78 + ,0.84 + ,0.36 + ,1 + ,0.35 + ,0.36 + ,0.70 + ,0.78) + ,dim=c(6 + ,56) + ,dimnames=list(c('Y' + ,'X' + ,'Y1' + ,'Y2' + ,'Y3' + ,'Y4') + ,1:56)) > y <- array(NA,dim=c(6,56),dimnames=list(c('Y','X','Y1','Y2','Y3','Y4'),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 = 'Do not include Seasonal 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 Y1 Y2 Y3 Y4 t 1 2.06 0 2.08 2.05 2.09 2.11 1 2 2.06 0 2.06 2.08 2.05 2.09 2 3 2.08 0 2.06 2.06 2.08 2.05 3 4 2.07 0 2.08 2.06 2.06 2.08 4 5 2.06 0 2.07 2.08 2.06 2.06 5 6 2.07 0 2.06 2.07 2.08 2.06 6 7 2.06 0 2.07 2.06 2.07 2.08 7 8 2.09 0 2.06 2.07 2.06 2.07 8 9 2.07 0 2.09 2.06 2.07 2.06 9 10 2.09 0 2.07 2.09 2.06 2.07 10 11 2.28 0 2.09 2.07 2.09 2.06 11 12 2.33 0 2.28 2.09 2.07 2.09 12 13 2.35 0 2.33 2.28 2.09 2.07 13 14 2.52 0 2.35 2.33 2.28 2.09 14 15 2.63 0 2.52 2.35 2.33 2.28 15 16 2.58 0 2.63 2.52 2.35 2.33 16 17 2.70 0 2.58 2.63 2.52 2.35 17 18 2.81 0 2.70 2.58 2.63 2.52 18 19 2.97 0 2.81 2.70 2.58 2.63 19 20 3.04 0 2.97 2.81 2.70 2.58 20 21 3.28 0 3.04 2.97 2.81 2.70 21 22 3.33 0 3.28 3.04 2.97 2.81 22 23 3.50 0 3.33 3.28 3.04 2.97 23 24 3.56 0 3.50 3.33 3.28 3.04 24 25 3.57 0 3.56 3.50 3.33 3.28 25 26 3.69 0 3.57 3.56 3.50 3.33 26 27 3.82 0 3.69 3.57 3.56 3.50 27 28 3.79 0 3.82 3.69 3.57 3.56 28 29 3.96 0 3.79 3.82 3.69 3.57 29 30 4.06 0 3.96 3.79 3.82 3.69 30 31 4.05 0 4.06 3.96 3.79 3.82 31 32 4.03 0 4.05 4.06 3.96 3.79 32 33 3.94 0 4.03 4.05 4.06 3.96 33 34 4.02 0 3.94 4.03 4.05 4.06 34 35 3.88 0 4.02 3.94 4.03 4.05 35 36 4.02 0 3.88 4.02 3.94 4.03 36 37 4.03 0 4.02 3.88 4.02 3.94 37 38 4.09 0 4.03 4.02 3.88 4.02 38 39 3.99 0 4.09 4.03 4.02 3.88 39 40 4.01 0 3.99 4.09 4.03 4.02 40 41 4.01 0 4.01 3.99 4.09 4.03 41 42 4.19 0 4.01 4.01 3.99 4.09 42 43 4.30 0 4.19 4.01 4.01 3.99 43 44 4.27 0 4.30 4.19 4.01 4.01 44 45 3.82 0 4.27 4.30 4.19 4.01 45 46 3.15 1 3.82 4.27 4.30 4.19 46 47 2.49 1 3.15 3.82 4.27 4.30 47 48 1.81 1 2.49 3.15 3.82 4.27 48 49 1.26 1 1.81 2.49 3.15 3.82 49 50 1.06 1 1.26 1.81 2.49 3.15 50 51 0.84 1 1.06 1.26 1.81 2.49 51 52 0.78 1 0.84 1.06 1.26 1.81 52 53 0.70 1 0.78 0.84 1.06 1.26 53 54 0.36 1 0.70 0.78 0.84 1.06 54 55 0.35 1 0.36 0.70 0.78 0.84 55 56 0.36 1 0.35 0.36 0.70 0.78 56 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) X Y1 Y2 Y3 Y4 0.299710 -0.663823 1.080449 -0.087984 -0.188246 0.056074 t 0.007229 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -0.4762915 -0.0547050 -0.0001249 0.0767043 0.1862984 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 0.299710 0.072599 4.128 0.000142 *** X -0.663823 0.155341 -4.273 8.85e-05 *** Y1 1.080449 0.176589 6.118 1.54e-07 *** Y2 -0.087984 0.238677 -0.369 0.713991 Y3 -0.188246 0.242498 -0.776 0.441316 Y4 0.056074 0.135941 0.412 0.681779 t 0.007229 0.002356 3.069 0.003498 ** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 0.1177 on 49 degrees of freedom Multiple R-squared: 0.9909, Adjusted R-squared: 0.9898 F-statistic: 887.9 on 6 and 49 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.0025948165 0.0051896330 0.9974052 [2,] 0.0867610025 0.1735220049 0.9132390 [3,] 0.0399106218 0.0798212436 0.9600894 [4,] 0.0298578834 0.0597157667 0.9701421 [5,] 0.0137399987 0.0274799974 0.9862600 [6,] 0.0055050365 0.0110100730 0.9944950 [7,] 0.0053106181 0.0106212361 0.9946894 [8,] 0.0022141342 0.0044282685 0.9977859 [9,] 0.0008949172 0.0017898344 0.9991051 [10,] 0.0053210202 0.0106420404 0.9946790 [11,] 0.0032365273 0.0064730546 0.9967635 [12,] 0.0048507923 0.0097015846 0.9951492 [13,] 0.0044946913 0.0089893827 0.9955053 [14,] 0.0021599384 0.0043198767 0.9978401 [15,] 0.0021034555 0.0042069110 0.9978965 [16,] 0.0039239862 0.0078479723 0.9960760 [17,] 0.0019616970 0.0039233939 0.9980383 [18,] 0.0009436964 0.0018873929 0.9990563 [19,] 0.0013717695 0.0027435390 0.9986282 [20,] 0.0007650509 0.0015301018 0.9992349 [21,] 0.0003619725 0.0007239450 0.9996380 [22,] 0.0002352116 0.0004704233 0.9997648 [23,] 0.0004729158 0.0009458317 0.9995271 [24,] 0.0011918417 0.0023836835 0.9988082 [25,] 0.0006377315 0.0012754630 0.9993623 [26,] 0.0022276299 0.0044552598 0.9977724 [27,] 0.0016964475 0.0033928949 0.9983036 [28,] 0.0009941623 0.0019883246 0.9990058 [29,] 0.0004646251 0.0009292502 0.9995354 [30,] 0.0033383163 0.0066766327 0.9966617 [31,] 0.0027304792 0.0054609584 0.9972695 [32,] 0.0148574088 0.0297148176 0.9851426 [33,] 0.0124231241 0.0248462482 0.9875769 [34,] 0.0061057459 0.0122114918 0.9938943 [35,] 0.0466559393 0.0933118786 0.9533441 [36,] 0.1893034194 0.3786068388 0.8106966 [37,] 0.2306910548 0.4613821097 0.7693089 > postscript(file="/var/www/html/rcomp/tmp/1ogsa1258656255.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/2hoy91258656255.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/348wz1258656255.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/4hni81258656255.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/5tntd1258656255.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.038790182 -0.028178571 -0.009276430 -0.053561090 -0.057103975 -0.040642936 7 8 9 10 11 12 -0.072559739 -0.039425660 -0.097504303 -0.062927547 0.102683382 -0.063517966 13 14 15 16 17 18 -0.083165690 0.097041178 0.016654131 -0.143505413 0.063846992 0.043739789 19 20 21 22 23 24 0.072639409 -0.002389599 0.182805907 -0.003620429 0.130449939 0.045198006 25 26 27 28 29 30 -0.005945821 0.130498230 0.126257750 -0.042353154 0.186298393 0.110497031 31 32 33 34 35 36 -0.012756252 0.013302065 -0.053905371 0.106856965 -0.137930189 0.137322209 37 38 39 40 41 42 -0.003380552 0.020063765 -0.116907076 0.003220376 -0.023681488 0.128660616 43 44 45 46 47 48 0.046323577 -0.095038819 -0.476291454 0.004478800 0.009743086 -0.106366310 49 50 51 52 53 54 -0.087849756 0.152667536 0.002139818 0.089608745 0.041042495 -0.255228326 55 56 0.088898774 0.060865137 > postscript(file="/var/www/html/rcomp/tmp/6trc61258656255.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.038790182 NA 1 -0.028178571 -0.038790182 2 -0.009276430 -0.028178571 3 -0.053561090 -0.009276430 4 -0.057103975 -0.053561090 5 -0.040642936 -0.057103975 6 -0.072559739 -0.040642936 7 -0.039425660 -0.072559739 8 -0.097504303 -0.039425660 9 -0.062927547 -0.097504303 10 0.102683382 -0.062927547 11 -0.063517966 0.102683382 12 -0.083165690 -0.063517966 13 0.097041178 -0.083165690 14 0.016654131 0.097041178 15 -0.143505413 0.016654131 16 0.063846992 -0.143505413 17 0.043739789 0.063846992 18 0.072639409 0.043739789 19 -0.002389599 0.072639409 20 0.182805907 -0.002389599 21 -0.003620429 0.182805907 22 0.130449939 -0.003620429 23 0.045198006 0.130449939 24 -0.005945821 0.045198006 25 0.130498230 -0.005945821 26 0.126257750 0.130498230 27 -0.042353154 0.126257750 28 0.186298393 -0.042353154 29 0.110497031 0.186298393 30 -0.012756252 0.110497031 31 0.013302065 -0.012756252 32 -0.053905371 0.013302065 33 0.106856965 -0.053905371 34 -0.137930189 0.106856965 35 0.137322209 -0.137930189 36 -0.003380552 0.137322209 37 0.020063765 -0.003380552 38 -0.116907076 0.020063765 39 0.003220376 -0.116907076 40 -0.023681488 0.003220376 41 0.128660616 -0.023681488 42 0.046323577 0.128660616 43 -0.095038819 0.046323577 44 -0.476291454 -0.095038819 45 0.004478800 -0.476291454 46 0.009743086 0.004478800 47 -0.106366310 0.009743086 48 -0.087849756 -0.106366310 49 0.152667536 -0.087849756 50 0.002139818 0.152667536 51 0.089608745 0.002139818 52 0.041042495 0.089608745 53 -0.255228326 0.041042495 54 0.088898774 -0.255228326 55 0.060865137 0.088898774 56 NA 0.060865137 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -0.028178571 -0.038790182 [2,] -0.009276430 -0.028178571 [3,] -0.053561090 -0.009276430 [4,] -0.057103975 -0.053561090 [5,] -0.040642936 -0.057103975 [6,] -0.072559739 -0.040642936 [7,] -0.039425660 -0.072559739 [8,] -0.097504303 -0.039425660 [9,] -0.062927547 -0.097504303 [10,] 0.102683382 -0.062927547 [11,] -0.063517966 0.102683382 [12,] -0.083165690 -0.063517966 [13,] 0.097041178 -0.083165690 [14,] 0.016654131 0.097041178 [15,] -0.143505413 0.016654131 [16,] 0.063846992 -0.143505413 [17,] 0.043739789 0.063846992 [18,] 0.072639409 0.043739789 [19,] -0.002389599 0.072639409 [20,] 0.182805907 -0.002389599 [21,] -0.003620429 0.182805907 [22,] 0.130449939 -0.003620429 [23,] 0.045198006 0.130449939 [24,] -0.005945821 0.045198006 [25,] 0.130498230 -0.005945821 [26,] 0.126257750 0.130498230 [27,] -0.042353154 0.126257750 [28,] 0.186298393 -0.042353154 [29,] 0.110497031 0.186298393 [30,] -0.012756252 0.110497031 [31,] 0.013302065 -0.012756252 [32,] -0.053905371 0.013302065 [33,] 0.106856965 -0.053905371 [34,] -0.137930189 0.106856965 [35,] 0.137322209 -0.137930189 [36,] -0.003380552 0.137322209 [37,] 0.020063765 -0.003380552 [38,] -0.116907076 0.020063765 [39,] 0.003220376 -0.116907076 [40,] -0.023681488 0.003220376 [41,] 0.128660616 -0.023681488 [42,] 0.046323577 0.128660616 [43,] -0.095038819 0.046323577 [44,] -0.476291454 -0.095038819 [45,] 0.004478800 -0.476291454 [46,] 0.009743086 0.004478800 [47,] -0.106366310 0.009743086 [48,] -0.087849756 -0.106366310 [49,] 0.152667536 -0.087849756 [50,] 0.002139818 0.152667536 [51,] 0.089608745 0.002139818 [52,] 0.041042495 0.089608745 [53,] -0.255228326 0.041042495 [54,] 0.088898774 -0.255228326 [55,] 0.060865137 0.088898774 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -0.028178571 -0.038790182 2 -0.009276430 -0.028178571 3 -0.053561090 -0.009276430 4 -0.057103975 -0.053561090 5 -0.040642936 -0.057103975 6 -0.072559739 -0.040642936 7 -0.039425660 -0.072559739 8 -0.097504303 -0.039425660 9 -0.062927547 -0.097504303 10 0.102683382 -0.062927547 11 -0.063517966 0.102683382 12 -0.083165690 -0.063517966 13 0.097041178 -0.083165690 14 0.016654131 0.097041178 15 -0.143505413 0.016654131 16 0.063846992 -0.143505413 17 0.043739789 0.063846992 18 0.072639409 0.043739789 19 -0.002389599 0.072639409 20 0.182805907 -0.002389599 21 -0.003620429 0.182805907 22 0.130449939 -0.003620429 23 0.045198006 0.130449939 24 -0.005945821 0.045198006 25 0.130498230 -0.005945821 26 0.126257750 0.130498230 27 -0.042353154 0.126257750 28 0.186298393 -0.042353154 29 0.110497031 0.186298393 30 -0.012756252 0.110497031 31 0.013302065 -0.012756252 32 -0.053905371 0.013302065 33 0.106856965 -0.053905371 34 -0.137930189 0.106856965 35 0.137322209 -0.137930189 36 -0.003380552 0.137322209 37 0.020063765 -0.003380552 38 -0.116907076 0.020063765 39 0.003220376 -0.116907076 40 -0.023681488 0.003220376 41 0.128660616 -0.023681488 42 0.046323577 0.128660616 43 -0.095038819 0.046323577 44 -0.476291454 -0.095038819 45 0.004478800 -0.476291454 46 0.009743086 0.004478800 47 -0.106366310 0.009743086 48 -0.087849756 -0.106366310 49 0.152667536 -0.087849756 50 0.002139818 0.152667536 51 0.089608745 0.002139818 52 0.041042495 0.089608745 53 -0.255228326 0.041042495 54 0.088898774 -0.255228326 55 0.060865137 0.088898774 > 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/7n9zj1258656255.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/8182p1258656255.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/9t2t11258656255.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/10dw611258656255.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/11pmzp1258656255.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/12swsh1258656255.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/139iei1258656255.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/14vy9o1258656255.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/15xnjx1258656255.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/16ak2s1258656255.tab") + } > > system("convert tmp/1ogsa1258656255.ps tmp/1ogsa1258656255.png") > system("convert tmp/2hoy91258656255.ps tmp/2hoy91258656255.png") > system("convert tmp/348wz1258656255.ps tmp/348wz1258656255.png") > system("convert tmp/4hni81258656255.ps tmp/4hni81258656255.png") > system("convert tmp/5tntd1258656255.ps tmp/5tntd1258656255.png") > system("convert tmp/6trc61258656255.ps tmp/6trc61258656255.png") > system("convert tmp/7n9zj1258656255.ps tmp/7n9zj1258656255.png") > system("convert tmp/8182p1258656255.ps tmp/8182p1258656255.png") > system("convert tmp/9t2t11258656255.ps tmp/9t2t11258656255.png") > system("convert tmp/10dw611258656255.ps tmp/10dw611258656255.png") > > > proc.time() user system elapsed 2.435 1.550 3.311