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(100.0 + ,114.1 + ,141.7 + ,93.5 + ,110.3 + ,153.4 + ,88.2 + ,103.9 + ,145 + ,89.2 + ,101.6 + ,137.7 + ,91.4 + ,94.6 + ,148.3 + ,92.5 + ,95.9 + ,152.2 + ,91.4 + ,104.7 + ,169.4 + ,88.2 + ,102.8 + ,168.6 + ,87.1 + ,98.1 + ,161.1 + ,84.9 + ,113.9 + ,174.1 + ,92.5 + ,80.9 + ,179 + ,93.5 + ,95.7 + ,190.6 + ,93.5 + ,113.2 + ,190 + ,91.4 + ,105.9 + ,181.6 + ,90.3 + ,108.8 + ,174.8 + ,91.4 + ,102.3 + ,180.5 + ,93.5 + ,99 + ,196.8 + ,93.5 + ,100.7 + ,193.8 + ,92.5 + ,115.5 + ,197 + ,91.4 + ,100.7 + ,216.3 + ,89.2 + ,109.9 + ,221.4 + ,86.0 + ,114.6 + ,217.9 + ,88.2 + ,85.4 + ,229.7 + ,87.1 + ,100.5 + ,227.4 + ,87.1 + ,114.8 + ,204.2 + ,86.0 + ,116.5 + ,196.6 + ,84.9 + ,112.9 + ,198.8 + ,84.9 + ,102 + ,207.5 + ,86.0 + ,106 + ,190.7 + ,86.0 + ,105.3 + ,201.6 + ,84.9 + ,118.8 + ,210.5 + ,86.0 + ,106.1 + ,223.5 + ,82.8 + ,109.3 + ,223.8 + ,77.4 + ,117.2 + ,231.2 + ,80.6 + ,92.5 + ,244 + ,78.5 + ,104.2 + ,234.7 + ,75.3 + ,112.5 + ,250.2 + ,75.3 + ,122.4 + ,265.7 + ,75.3 + ,113.3 + ,287.6 + ,77.4 + ,100 + ,283.3 + ,78.5 + ,110.7 + ,295.4 + ,76.3 + ,112.8 + ,312.3 + ,73.1 + ,109.8 + ,333.8 + ,68.8 + ,117.3 + ,347.7 + ,65.6 + ,109.1 + ,383.2 + ,69.9 + ,115.9 + ,407.1 + ,82.8 + ,96 + ,413.6 + ,84.9 + ,99.8 + ,362.7 + ,80.6 + ,116.8 + ,321.9 + ,74.2 + ,115.7 + ,239.4 + ,71.0 + ,99.4 + ,191 + ,74.2 + ,94.3 + ,159.7 + ,82.8 + ,91 + ,163.4 + ,86.0 + ,93.2 + ,157.6 + ,86.0 + ,103.1 + ,166.2 + ,82.8 + ,94.1 + ,176.7 + ,78.5 + ,91.8 + ,198.3 + ,79.6 + ,102.7 + ,226.2 + ,87.1 + ,82.6 + ,216.2 + ,89.2 + ,89.1 + ,235.9) + ,dim=c(3 + ,60) + ,dimnames=list(c('WRKL(index)' + ,'IND' + ,'GRON') + ,1:60)) > y <- array(NA,dim=c(3,60),dimnames=list(c('WRKL(index)','IND','GRON'),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 WRKL(index) IND GRON M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 1 100.0 114.1 141.7 1 0 0 0 0 0 0 0 0 0 0 2 93.5 110.3 153.4 0 1 0 0 0 0 0 0 0 0 0 3 88.2 103.9 145.0 0 0 1 0 0 0 0 0 0 0 0 4 89.2 101.6 137.7 0 0 0 1 0 0 0 0 0 0 0 5 91.4 94.6 148.3 0 0 0 0 1 0 0 0 0 0 0 6 92.5 95.9 152.2 0 0 0 0 0 1 0 0 0 0 0 7 91.4 104.7 169.4 0 0 0 0 0 0 1 0 0 0 0 8 88.2 102.8 168.6 0 0 0 0 0 0 0 1 0 0 0 9 87.1 98.1 161.1 0 0 0 0 0 0 0 0 1 0 0 10 84.9 113.9 174.1 0 0 0 0 0 0 0 0 0 1 0 11 92.5 80.9 179.0 0 0 0 0 0 0 0 0 0 0 1 12 93.5 95.7 190.6 0 0 0 0 0 0 0 0 0 0 0 13 93.5 113.2 190.0 1 0 0 0 0 0 0 0 0 0 0 14 91.4 105.9 181.6 0 1 0 0 0 0 0 0 0 0 0 15 90.3 108.8 174.8 0 0 1 0 0 0 0 0 0 0 0 16 91.4 102.3 180.5 0 0 0 1 0 0 0 0 0 0 0 17 93.5 99.0 196.8 0 0 0 0 1 0 0 0 0 0 0 18 93.5 100.7 193.8 0 0 0 0 0 1 0 0 0 0 0 19 92.5 115.5 197.0 0 0 0 0 0 0 1 0 0 0 0 20 91.4 100.7 216.3 0 0 0 0 0 0 0 1 0 0 0 21 89.2 109.9 221.4 0 0 0 0 0 0 0 0 1 0 0 22 86.0 114.6 217.9 0 0 0 0 0 0 0 0 0 1 0 23 88.2 85.4 229.7 0 0 0 0 0 0 0 0 0 0 1 24 87.1 100.5 227.4 0 0 0 0 0 0 0 0 0 0 0 25 87.1 114.8 204.2 1 0 0 0 0 0 0 0 0 0 0 26 86.0 116.5 196.6 0 1 0 0 0 0 0 0 0 0 0 27 84.9 112.9 198.8 0 0 1 0 0 0 0 0 0 0 0 28 84.9 102.0 207.5 0 0 0 1 0 0 0 0 0 0 0 29 86.0 106.0 190.7 0 0 0 0 1 0 0 0 0 0 0 30 86.0 105.3 201.6 0 0 0 0 0 1 0 0 0 0 0 31 84.9 118.8 210.5 0 0 0 0 0 0 1 0 0 0 0 32 86.0 106.1 223.5 0 0 0 0 0 0 0 1 0 0 0 33 82.8 109.3 223.8 0 0 0 0 0 0 0 0 1 0 0 34 77.4 117.2 231.2 0 0 0 0 0 0 0 0 0 1 0 35 80.6 92.5 244.0 0 0 0 0 0 0 0 0 0 0 1 36 78.5 104.2 234.7 0 0 0 0 0 0 0 0 0 0 0 37 75.3 112.5 250.2 1 0 0 0 0 0 0 0 0 0 0 38 75.3 122.4 265.7 0 1 0 0 0 0 0 0 0 0 0 39 75.3 113.3 287.6 0 0 1 0 0 0 0 0 0 0 0 40 77.4 100.0 283.3 0 0 0 1 0 0 0 0 0 0 0 41 78.5 110.7 295.4 0 0 0 0 1 0 0 0 0 0 0 42 76.3 112.8 312.3 0 0 0 0 0 1 0 0 0 0 0 43 73.1 109.8 333.8 0 0 0 0 0 0 1 0 0 0 0 44 68.8 117.3 347.7 0 0 0 0 0 0 0 1 0 0 0 45 65.6 109.1 383.2 0 0 0 0 0 0 0 0 1 0 0 46 69.9 115.9 407.1 0 0 0 0 0 0 0 0 0 1 0 47 82.8 96.0 413.6 0 0 0 0 0 0 0 0 0 0 1 48 84.9 99.8 362.7 0 0 0 0 0 0 0 0 0 0 0 49 80.6 116.8 321.9 1 0 0 0 0 0 0 0 0 0 0 50 74.2 115.7 239.4 0 1 0 0 0 0 0 0 0 0 0 51 71.0 99.4 191.0 0 0 1 0 0 0 0 0 0 0 0 52 74.2 94.3 159.7 0 0 0 1 0 0 0 0 0 0 0 53 82.8 91.0 163.4 0 0 0 0 1 0 0 0 0 0 0 54 86.0 93.2 157.6 0 0 0 0 0 1 0 0 0 0 0 55 86.0 103.1 166.2 0 0 0 0 0 0 1 0 0 0 0 56 82.8 94.1 176.7 0 0 0 0 0 0 0 1 0 0 0 57 78.5 91.8 198.3 0 0 0 0 0 0 0 0 1 0 0 58 79.6 102.7 226.2 0 0 0 0 0 0 0 0 0 1 0 59 87.1 82.6 216.2 0 0 0 0 0 0 0 0 0 0 1 60 89.2 89.1 235.9 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) IND GRON M1 M2 M3 92.19966 0.16707 -0.08754 -4.59227 -9.04060 -10.78627 M4 M5 M6 M7 M8 M9 -8.53222 -5.09549 -4.49507 -6.20523 -6.33401 -8.07746 M10 M11 -9.49496 1.88044 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -11.2410 -2.7293 0.3551 2.8811 8.8898 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 92.19966 12.90404 7.145 5.52e-09 *** IND 0.16707 0.14637 1.141 0.25960 GRON -0.08754 0.01374 -6.372 8.01e-08 *** M1 -4.59227 4.33564 -1.059 0.29504 M2 -9.04060 4.40833 -2.051 0.04601 * M3 -10.78627 3.93381 -2.742 0.00867 ** M4 -8.53222 3.57380 -2.387 0.02113 * M5 -5.09549 3.56204 -1.430 0.15933 M6 -4.49507 3.59070 -1.252 0.21695 M7 -6.20523 4.04678 -1.533 0.13203 M8 -6.33401 3.61892 -1.750 0.08674 . M9 -8.07746 3.56352 -2.267 0.02815 * M10 -9.49496 4.07040 -2.333 0.02409 * M11 1.88044 3.77468 0.498 0.62074 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 5.428 on 46 degrees of freedom Multiple R-squared: 0.576, Adjusted R-squared: 0.4561 F-statistic: 4.806 on 13 and 46 DF, p-value: 3.398e-05 > 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.088317660 0.17663532 0.9116823 [2,] 0.034066385 0.06813277 0.9659336 [3,] 0.020934119 0.04186824 0.9790659 [4,] 0.025408412 0.05081682 0.9745916 [5,] 0.013161761 0.02632352 0.9868382 [6,] 0.005935217 0.01187043 0.9940648 [7,] 0.006997614 0.01399523 0.9930024 [8,] 0.013152969 0.02630594 0.9868470 [9,] 0.052974725 0.10594945 0.9470253 [10,] 0.080055631 0.16011126 0.9199444 [11,] 0.081711055 0.16342211 0.9182889 [12,] 0.083368996 0.16673799 0.9166310 [13,] 0.083378220 0.16675644 0.9166218 [14,] 0.075350748 0.15070150 0.9246493 [15,] 0.067693266 0.13538653 0.9323067 [16,] 0.076436418 0.15287284 0.9235636 [17,] 0.159769175 0.31953835 0.8402308 [18,] 0.185046913 0.37009383 0.8149531 [19,] 0.168296610 0.33659322 0.8317034 [20,] 0.278650353 0.55730071 0.7213496 [21,] 0.557866885 0.88426623 0.4421331 [22,] 0.472899221 0.94579844 0.5271008 [23,] 0.631124463 0.73775107 0.3688755 [24,] 0.787581787 0.42483643 0.2124182 [25,] 0.758088043 0.48382391 0.2419120 [26,] 0.618530338 0.76293932 0.3814697 [27,] 0.834106460 0.33178708 0.1658935 > postscript(file="/var/www/html/rcomp/tmp/1wloh1261145515.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/2ftr01261145515.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/3kz211261145515.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/47hov1261145515.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/5ub9l1261145515.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 5.735272303 5.342733392 2.122254446 0.613385226 1.474102067 6 7 8 9 10 2.097913202 2.743649560 -0.080180813 0.691905964 -1.592179869 11 12 13 14 15 0.574609770 1.997964821 3.614028772 6.446582469 6.012448546 16 17 18 19 20 6.443339630 7.084910634 5.937838287 4.455548738 7.646529782 21 22 23 24 25 6.099440626 3.225318963 -0.038690654 -1.982323350 -1.810148057 26 27 28 29 30 0.588835316 2.028538817 2.357159388 -2.118581608 -1.647824839 31 32 33 34 35 -2.513923632 1.974686144 0.009787645 -4.644715170 -7.572983292 36 37 38 39 40 -10.561398103 -9.198849526 -5.047541874 0.135657115 1.827161684 41 42 43 44 45 -1.237896372 -2.909661525 -2.016089766 -6.223449839 -3.202217034 46 47 48 49 50 3.471537267 8.889816118 7.779384910 1.659696507 -7.330609302 51 52 53 54 55 -10.298898923 -11.241045928 -5.202534720 -3.478265125 -2.669184900 56 57 58 59 60 -3.317585273 -3.598917200 -0.459961192 -1.852751942 2.766371721 > postscript(file="/var/www/html/rcomp/tmp/6pc0g1261145515.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 5.735272303 NA 1 5.342733392 5.735272303 2 2.122254446 5.342733392 3 0.613385226 2.122254446 4 1.474102067 0.613385226 5 2.097913202 1.474102067 6 2.743649560 2.097913202 7 -0.080180813 2.743649560 8 0.691905964 -0.080180813 9 -1.592179869 0.691905964 10 0.574609770 -1.592179869 11 1.997964821 0.574609770 12 3.614028772 1.997964821 13 6.446582469 3.614028772 14 6.012448546 6.446582469 15 6.443339630 6.012448546 16 7.084910634 6.443339630 17 5.937838287 7.084910634 18 4.455548738 5.937838287 19 7.646529782 4.455548738 20 6.099440626 7.646529782 21 3.225318963 6.099440626 22 -0.038690654 3.225318963 23 -1.982323350 -0.038690654 24 -1.810148057 -1.982323350 25 0.588835316 -1.810148057 26 2.028538817 0.588835316 27 2.357159388 2.028538817 28 -2.118581608 2.357159388 29 -1.647824839 -2.118581608 30 -2.513923632 -1.647824839 31 1.974686144 -2.513923632 32 0.009787645 1.974686144 33 -4.644715170 0.009787645 34 -7.572983292 -4.644715170 35 -10.561398103 -7.572983292 36 -9.198849526 -10.561398103 37 -5.047541874 -9.198849526 38 0.135657115 -5.047541874 39 1.827161684 0.135657115 40 -1.237896372 1.827161684 41 -2.909661525 -1.237896372 42 -2.016089766 -2.909661525 43 -6.223449839 -2.016089766 44 -3.202217034 -6.223449839 45 3.471537267 -3.202217034 46 8.889816118 3.471537267 47 7.779384910 8.889816118 48 1.659696507 7.779384910 49 -7.330609302 1.659696507 50 -10.298898923 -7.330609302 51 -11.241045928 -10.298898923 52 -5.202534720 -11.241045928 53 -3.478265125 -5.202534720 54 -2.669184900 -3.478265125 55 -3.317585273 -2.669184900 56 -3.598917200 -3.317585273 57 -0.459961192 -3.598917200 58 -1.852751942 -0.459961192 59 2.766371721 -1.852751942 60 NA 2.766371721 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] 5.342733392 5.735272303 [2,] 2.122254446 5.342733392 [3,] 0.613385226 2.122254446 [4,] 1.474102067 0.613385226 [5,] 2.097913202 1.474102067 [6,] 2.743649560 2.097913202 [7,] -0.080180813 2.743649560 [8,] 0.691905964 -0.080180813 [9,] -1.592179869 0.691905964 [10,] 0.574609770 -1.592179869 [11,] 1.997964821 0.574609770 [12,] 3.614028772 1.997964821 [13,] 6.446582469 3.614028772 [14,] 6.012448546 6.446582469 [15,] 6.443339630 6.012448546 [16,] 7.084910634 6.443339630 [17,] 5.937838287 7.084910634 [18,] 4.455548738 5.937838287 [19,] 7.646529782 4.455548738 [20,] 6.099440626 7.646529782 [21,] 3.225318963 6.099440626 [22,] -0.038690654 3.225318963 [23,] -1.982323350 -0.038690654 [24,] -1.810148057 -1.982323350 [25,] 0.588835316 -1.810148057 [26,] 2.028538817 0.588835316 [27,] 2.357159388 2.028538817 [28,] -2.118581608 2.357159388 [29,] -1.647824839 -2.118581608 [30,] -2.513923632 -1.647824839 [31,] 1.974686144 -2.513923632 [32,] 0.009787645 1.974686144 [33,] -4.644715170 0.009787645 [34,] -7.572983292 -4.644715170 [35,] -10.561398103 -7.572983292 [36,] -9.198849526 -10.561398103 [37,] -5.047541874 -9.198849526 [38,] 0.135657115 -5.047541874 [39,] 1.827161684 0.135657115 [40,] -1.237896372 1.827161684 [41,] -2.909661525 -1.237896372 [42,] -2.016089766 -2.909661525 [43,] -6.223449839 -2.016089766 [44,] -3.202217034 -6.223449839 [45,] 3.471537267 -3.202217034 [46,] 8.889816118 3.471537267 [47,] 7.779384910 8.889816118 [48,] 1.659696507 7.779384910 [49,] -7.330609302 1.659696507 [50,] -10.298898923 -7.330609302 [51,] -11.241045928 -10.298898923 [52,] -5.202534720 -11.241045928 [53,] -3.478265125 -5.202534720 [54,] -2.669184900 -3.478265125 [55,] -3.317585273 -2.669184900 [56,] -3.598917200 -3.317585273 [57,] -0.459961192 -3.598917200 [58,] -1.852751942 -0.459961192 [59,] 2.766371721 -1.852751942 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 5.342733392 5.735272303 2 2.122254446 5.342733392 3 0.613385226 2.122254446 4 1.474102067 0.613385226 5 2.097913202 1.474102067 6 2.743649560 2.097913202 7 -0.080180813 2.743649560 8 0.691905964 -0.080180813 9 -1.592179869 0.691905964 10 0.574609770 -1.592179869 11 1.997964821 0.574609770 12 3.614028772 1.997964821 13 6.446582469 3.614028772 14 6.012448546 6.446582469 15 6.443339630 6.012448546 16 7.084910634 6.443339630 17 5.937838287 7.084910634 18 4.455548738 5.937838287 19 7.646529782 4.455548738 20 6.099440626 7.646529782 21 3.225318963 6.099440626 22 -0.038690654 3.225318963 23 -1.982323350 -0.038690654 24 -1.810148057 -1.982323350 25 0.588835316 -1.810148057 26 2.028538817 0.588835316 27 2.357159388 2.028538817 28 -2.118581608 2.357159388 29 -1.647824839 -2.118581608 30 -2.513923632 -1.647824839 31 1.974686144 -2.513923632 32 0.009787645 1.974686144 33 -4.644715170 0.009787645 34 -7.572983292 -4.644715170 35 -10.561398103 -7.572983292 36 -9.198849526 -10.561398103 37 -5.047541874 -9.198849526 38 0.135657115 -5.047541874 39 1.827161684 0.135657115 40 -1.237896372 1.827161684 41 -2.909661525 -1.237896372 42 -2.016089766 -2.909661525 43 -6.223449839 -2.016089766 44 -3.202217034 -6.223449839 45 3.471537267 -3.202217034 46 8.889816118 3.471537267 47 7.779384910 8.889816118 48 1.659696507 7.779384910 49 -7.330609302 1.659696507 50 -10.298898923 -7.330609302 51 -11.241045928 -10.298898923 52 -5.202534720 -11.241045928 53 -3.478265125 -5.202534720 54 -2.669184900 -3.478265125 55 -3.317585273 -2.669184900 56 -3.598917200 -3.317585273 57 -0.459961192 -3.598917200 58 -1.852751942 -0.459961192 59 2.766371721 -1.852751942 > 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/74o3m1261145515.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/8omix1261145515.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/99ngr1261145515.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/10c2aq1261145515.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/11k36i1261145515.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/124rge1261145515.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/13hdgz1261145515.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/14h2op1261145515.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/15mzdm1261145515.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/16npdj1261145515.tab") + } > > try(system("convert tmp/1wloh1261145515.ps tmp/1wloh1261145515.png",intern=TRUE)) character(0) > try(system("convert tmp/2ftr01261145515.ps tmp/2ftr01261145515.png",intern=TRUE)) character(0) > try(system("convert tmp/3kz211261145515.ps tmp/3kz211261145515.png",intern=TRUE)) character(0) > try(system("convert tmp/47hov1261145515.ps tmp/47hov1261145515.png",intern=TRUE)) character(0) > try(system("convert tmp/5ub9l1261145515.ps tmp/5ub9l1261145515.png",intern=TRUE)) character(0) > try(system("convert tmp/6pc0g1261145515.ps tmp/6pc0g1261145515.png",intern=TRUE)) character(0) > try(system("convert tmp/74o3m1261145515.ps tmp/74o3m1261145515.png",intern=TRUE)) character(0) > try(system("convert tmp/8omix1261145515.ps tmp/8omix1261145515.png",intern=TRUE)) character(0) > try(system("convert tmp/99ngr1261145515.ps tmp/99ngr1261145515.png",intern=TRUE)) character(0) > try(system("convert tmp/10c2aq1261145515.ps tmp/10c2aq1261145515.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.448 1.579 8.050