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(79.8,109.87,83.4,95.74,113.6,123.06,112.9,123.39,104,120.28,109.9,115.33,99,110.4,106.3,114.49,128.9,132.03,111.1,123.16,102.9,118.82,130,128.32,87,112.24,87.5,104.53,117.6,132.57,103.4,122.52,110.8,131.8,112.6,124.55,102.5,120.96,112.4,122.6,135.6,145.52,105.1,118.57,127.7,134.25,137,136.7,91,121.37,90.5,111.63,122.4,134.42,123.3,137.65,124.3,137.86,120,119.77,118.1,130.69,119,128.28,142.7,147.45,123.6,128.42,129.6,136.9,151.6,143.95,110.4,135.64,99.2,122.48,130.5,136.83,136.2,153.04,129.7,142.71,128,123.46,121.6,144.37,135.8,146.15,143.8,147.61,147.5,158.51,136.2,147.4,156.6,165.05,123.3,154.64,104.5,126.2,139.8,157.36,136.5,154.15,112.1,123.21,118.5,113.07,94.4,110.45,102.3,113.57,111.4,122.44,99.2,114.93,87.8,111.85,115.8,126.04),dim=c(2,60),dimnames=list(c('Investgoed','Uitvoer'),1:60)) > y <- array(NA,dim=c(2,60),dimnames=list(c('Investgoed','Uitvoer'),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 = '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 Investgoed Uitvoer M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t 1 79.8 109.87 1 0 0 0 0 0 0 0 0 0 0 1 2 83.4 95.74 0 1 0 0 0 0 0 0 0 0 0 2 3 113.6 123.06 0 0 1 0 0 0 0 0 0 0 0 3 4 112.9 123.39 0 0 0 1 0 0 0 0 0 0 0 4 5 104.0 120.28 0 0 0 0 1 0 0 0 0 0 0 5 6 109.9 115.33 0 0 0 0 0 1 0 0 0 0 0 6 7 99.0 110.40 0 0 0 0 0 0 1 0 0 0 0 7 8 106.3 114.49 0 0 0 0 0 0 0 1 0 0 0 8 9 128.9 132.03 0 0 0 0 0 0 0 0 1 0 0 9 10 111.1 123.16 0 0 0 0 0 0 0 0 0 1 0 10 11 102.9 118.82 0 0 0 0 0 0 0 0 0 0 1 11 12 130.0 128.32 0 0 0 0 0 0 0 0 0 0 0 12 13 87.0 112.24 1 0 0 0 0 0 0 0 0 0 0 13 14 87.5 104.53 0 1 0 0 0 0 0 0 0 0 0 14 15 117.6 132.57 0 0 1 0 0 0 0 0 0 0 0 15 16 103.4 122.52 0 0 0 1 0 0 0 0 0 0 0 16 17 110.8 131.80 0 0 0 0 1 0 0 0 0 0 0 17 18 112.6 124.55 0 0 0 0 0 1 0 0 0 0 0 18 19 102.5 120.96 0 0 0 0 0 0 1 0 0 0 0 19 20 112.4 122.60 0 0 0 0 0 0 0 1 0 0 0 20 21 135.6 145.52 0 0 0 0 0 0 0 0 1 0 0 21 22 105.1 118.57 0 0 0 0 0 0 0 0 0 1 0 22 23 127.7 134.25 0 0 0 0 0 0 0 0 0 0 1 23 24 137.0 136.70 0 0 0 0 0 0 0 0 0 0 0 24 25 91.0 121.37 1 0 0 0 0 0 0 0 0 0 0 25 26 90.5 111.63 0 1 0 0 0 0 0 0 0 0 0 26 27 122.4 134.42 0 0 1 0 0 0 0 0 0 0 0 27 28 123.3 137.65 0 0 0 1 0 0 0 0 0 0 0 28 29 124.3 137.86 0 0 0 0 1 0 0 0 0 0 0 29 30 120.0 119.77 0 0 0 0 0 1 0 0 0 0 0 30 31 118.1 130.69 0 0 0 0 0 0 1 0 0 0 0 31 32 119.0 128.28 0 0 0 0 0 0 0 1 0 0 0 32 33 142.7 147.45 0 0 0 0 0 0 0 0 1 0 0 33 34 123.6 128.42 0 0 0 0 0 0 0 0 0 1 0 34 35 129.6 136.90 0 0 0 0 0 0 0 0 0 0 1 35 36 151.6 143.95 0 0 0 0 0 0 0 0 0 0 0 36 37 110.4 135.64 1 0 0 0 0 0 0 0 0 0 0 37 38 99.2 122.48 0 1 0 0 0 0 0 0 0 0 0 38 39 130.5 136.83 0 0 1 0 0 0 0 0 0 0 0 39 40 136.2 153.04 0 0 0 1 0 0 0 0 0 0 0 40 41 129.7 142.71 0 0 0 0 1 0 0 0 0 0 0 41 42 128.0 123.46 0 0 0 0 0 1 0 0 0 0 0 42 43 121.6 144.37 0 0 0 0 0 0 1 0 0 0 0 43 44 135.8 146.15 0 0 0 0 0 0 0 1 0 0 0 44 45 143.8 147.61 0 0 0 0 0 0 0 0 1 0 0 45 46 147.5 158.51 0 0 0 0 0 0 0 0 0 1 0 46 47 136.2 147.40 0 0 0 0 0 0 0 0 0 0 1 47 48 156.6 165.05 0 0 0 0 0 0 0 0 0 0 0 48 49 123.3 154.64 1 0 0 0 0 0 0 0 0 0 0 49 50 104.5 126.20 0 1 0 0 0 0 0 0 0 0 0 50 51 139.8 157.36 0 0 1 0 0 0 0 0 0 0 0 51 52 136.5 154.15 0 0 0 1 0 0 0 0 0 0 0 52 53 112.1 123.21 0 0 0 0 1 0 0 0 0 0 0 53 54 118.5 113.07 0 0 0 0 0 1 0 0 0 0 0 54 55 94.4 110.45 0 0 0 0 0 0 1 0 0 0 0 55 56 102.3 113.57 0 0 0 0 0 0 0 1 0 0 0 56 57 111.4 122.44 0 0 0 0 0 0 0 0 1 0 0 57 58 99.2 114.93 0 0 0 0 0 0 0 0 0 1 0 58 59 87.8 111.85 0 0 0 0 0 0 0 0 0 0 1 59 60 115.8 126.04 0 0 0 0 0 0 0 0 0 0 0 60 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) Uitvoer M1 M2 M3 M4 -0.26592 1.00324 -27.20821 -17.74915 -10.74583 -14.31649 M5 M6 M7 M8 M9 M10 -13.54028 0.11001 -14.66585 -8.21961 -4.88145 -9.68049 M11 t -11.21457 -0.05557 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -11.1980 -2.9060 0.2374 2.5971 9.4492 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) -0.26592 7.71488 -0.034 0.972653 Uitvoer 1.00324 0.05644 17.777 < 2e-16 *** M1 -27.20821 3.16499 -8.597 3.97e-11 *** M2 -17.74915 3.41172 -5.202 4.44e-06 *** M3 -10.74583 3.10669 -3.459 0.001180 ** M4 -14.31649 3.10302 -4.614 3.17e-05 *** M5 -13.54028 3.12240 -4.336 7.82e-05 *** M6 0.11001 3.27575 0.034 0.973354 M7 -14.66585 3.20938 -4.570 3.67e-05 *** M8 -8.21961 3.18823 -2.578 0.013202 * M9 -4.88145 3.09058 -1.579 0.121084 M10 -9.68049 3.14770 -3.075 0.003532 ** M11 -11.21457 3.13852 -3.573 0.000841 *** t -0.05557 0.04100 -1.355 0.181925 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 4.883 on 46 degrees of freedom Multiple R-squared: 0.9415, Adjusted R-squared: 0.925 F-statistic: 56.98 on 13 and 46 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.38104908 0.7620982 0.6189509 [2,] 0.36912383 0.7382477 0.6308762 [3,] 0.25190626 0.5038125 0.7480937 [4,] 0.17042797 0.3408559 0.8295720 [5,] 0.11820965 0.2364193 0.8817904 [6,] 0.08072137 0.1614427 0.9192786 [7,] 0.41763525 0.8352705 0.5823647 [8,] 0.31537803 0.6307561 0.6846220 [9,] 0.25976436 0.5195287 0.7402356 [10,] 0.19757046 0.3951409 0.8024295 [11,] 0.18604908 0.3720982 0.8139509 [12,] 0.15187232 0.3037446 0.8481277 [13,] 0.22752404 0.4550481 0.7724760 [14,] 0.50080896 0.9983821 0.4991910 [15,] 0.43114264 0.8622853 0.5688574 [16,] 0.40633697 0.8126739 0.5936630 [17,] 0.35927434 0.7185487 0.6407257 [18,] 0.35418731 0.7083746 0.6458127 [19,] 0.28754702 0.5750940 0.7124530 [20,] 0.45617851 0.9123570 0.5438215 [21,] 0.37264109 0.7452822 0.6273589 [22,] 0.37521967 0.7504393 0.6247803 [23,] 0.45916668 0.9183334 0.5408333 [24,] 0.34819751 0.6963950 0.6518025 [25,] 0.25647042 0.5129408 0.7435296 [26,] 0.18763830 0.3752766 0.8123617 [27,] 0.45772349 0.9154470 0.5422765 > postscript(file="/var/www/html/rcomp/tmp/1kgye1258713863.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/25j3v1258713863.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/3x5c81258713863.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/4uhyb1258713863.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/5j7qz1258713863.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 6 -2.89681739 5.47554075 1.31914324 3.91429717 -2.58625367 -5.31492175 7 8 9 10 11 12 3.56250198 0.36856523 2.08905272 -1.95756136 -4.21382535 2.19634216 13 14 15 16 17 18 2.59229041 1.42381701 -3.55491675 -4.04608191 -6.67683567 -11.19804075 19 20 21 22 23 24 -2.86496503 -1.00095205 -4.07792152 -2.68586984 5.77290552 1.45594879 25 26 27 28 29 30 -1.90053655 -2.03242303 0.05587834 1.34162239 1.41029886 1.66426728 31 32 33 34 35 36 3.64026113 0.56741550 1.75261399 6.59896695 5.68110478 9.44922203 37 38 39 40 41 42 3.84995827 -3.55083103 6.40485635 -0.53151694 2.61135959 6.62909196 43 44 45 46 47 48 -5.91732962 0.10622909 3.35889277 0.97812923 2.41383245 -6.05244505 49 50 51 52 53 54 -1.64489475 -1.31610370 -4.22496119 -0.67832071 5.24143089 8.21960326 55 56 57 58 59 60 1.57953153 -0.04125778 -3.12263797 -2.93366497 -9.65401739 -7.04906793 > postscript(file="/var/www/html/rcomp/tmp/6onh21258713863.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 -2.89681739 NA 1 5.47554075 -2.89681739 2 1.31914324 5.47554075 3 3.91429717 1.31914324 4 -2.58625367 3.91429717 5 -5.31492175 -2.58625367 6 3.56250198 -5.31492175 7 0.36856523 3.56250198 8 2.08905272 0.36856523 9 -1.95756136 2.08905272 10 -4.21382535 -1.95756136 11 2.19634216 -4.21382535 12 2.59229041 2.19634216 13 1.42381701 2.59229041 14 -3.55491675 1.42381701 15 -4.04608191 -3.55491675 16 -6.67683567 -4.04608191 17 -11.19804075 -6.67683567 18 -2.86496503 -11.19804075 19 -1.00095205 -2.86496503 20 -4.07792152 -1.00095205 21 -2.68586984 -4.07792152 22 5.77290552 -2.68586984 23 1.45594879 5.77290552 24 -1.90053655 1.45594879 25 -2.03242303 -1.90053655 26 0.05587834 -2.03242303 27 1.34162239 0.05587834 28 1.41029886 1.34162239 29 1.66426728 1.41029886 30 3.64026113 1.66426728 31 0.56741550 3.64026113 32 1.75261399 0.56741550 33 6.59896695 1.75261399 34 5.68110478 6.59896695 35 9.44922203 5.68110478 36 3.84995827 9.44922203 37 -3.55083103 3.84995827 38 6.40485635 -3.55083103 39 -0.53151694 6.40485635 40 2.61135959 -0.53151694 41 6.62909196 2.61135959 42 -5.91732962 6.62909196 43 0.10622909 -5.91732962 44 3.35889277 0.10622909 45 0.97812923 3.35889277 46 2.41383245 0.97812923 47 -6.05244505 2.41383245 48 -1.64489475 -6.05244505 49 -1.31610370 -1.64489475 50 -4.22496119 -1.31610370 51 -0.67832071 -4.22496119 52 5.24143089 -0.67832071 53 8.21960326 5.24143089 54 1.57953153 8.21960326 55 -0.04125778 1.57953153 56 -3.12263797 -0.04125778 57 -2.93366497 -3.12263797 58 -9.65401739 -2.93366497 59 -7.04906793 -9.65401739 60 NA -7.04906793 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] 5.47554075 -2.89681739 [2,] 1.31914324 5.47554075 [3,] 3.91429717 1.31914324 [4,] -2.58625367 3.91429717 [5,] -5.31492175 -2.58625367 [6,] 3.56250198 -5.31492175 [7,] 0.36856523 3.56250198 [8,] 2.08905272 0.36856523 [9,] -1.95756136 2.08905272 [10,] -4.21382535 -1.95756136 [11,] 2.19634216 -4.21382535 [12,] 2.59229041 2.19634216 [13,] 1.42381701 2.59229041 [14,] -3.55491675 1.42381701 [15,] -4.04608191 -3.55491675 [16,] -6.67683567 -4.04608191 [17,] -11.19804075 -6.67683567 [18,] -2.86496503 -11.19804075 [19,] -1.00095205 -2.86496503 [20,] -4.07792152 -1.00095205 [21,] -2.68586984 -4.07792152 [22,] 5.77290552 -2.68586984 [23,] 1.45594879 5.77290552 [24,] -1.90053655 1.45594879 [25,] -2.03242303 -1.90053655 [26,] 0.05587834 -2.03242303 [27,] 1.34162239 0.05587834 [28,] 1.41029886 1.34162239 [29,] 1.66426728 1.41029886 [30,] 3.64026113 1.66426728 [31,] 0.56741550 3.64026113 [32,] 1.75261399 0.56741550 [33,] 6.59896695 1.75261399 [34,] 5.68110478 6.59896695 [35,] 9.44922203 5.68110478 [36,] 3.84995827 9.44922203 [37,] -3.55083103 3.84995827 [38,] 6.40485635 -3.55083103 [39,] -0.53151694 6.40485635 [40,] 2.61135959 -0.53151694 [41,] 6.62909196 2.61135959 [42,] -5.91732962 6.62909196 [43,] 0.10622909 -5.91732962 [44,] 3.35889277 0.10622909 [45,] 0.97812923 3.35889277 [46,] 2.41383245 0.97812923 [47,] -6.05244505 2.41383245 [48,] -1.64489475 -6.05244505 [49,] -1.31610370 -1.64489475 [50,] -4.22496119 -1.31610370 [51,] -0.67832071 -4.22496119 [52,] 5.24143089 -0.67832071 [53,] 8.21960326 5.24143089 [54,] 1.57953153 8.21960326 [55,] -0.04125778 1.57953153 [56,] -3.12263797 -0.04125778 [57,] -2.93366497 -3.12263797 [58,] -9.65401739 -2.93366497 [59,] -7.04906793 -9.65401739 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 5.47554075 -2.89681739 2 1.31914324 5.47554075 3 3.91429717 1.31914324 4 -2.58625367 3.91429717 5 -5.31492175 -2.58625367 6 3.56250198 -5.31492175 7 0.36856523 3.56250198 8 2.08905272 0.36856523 9 -1.95756136 2.08905272 10 -4.21382535 -1.95756136 11 2.19634216 -4.21382535 12 2.59229041 2.19634216 13 1.42381701 2.59229041 14 -3.55491675 1.42381701 15 -4.04608191 -3.55491675 16 -6.67683567 -4.04608191 17 -11.19804075 -6.67683567 18 -2.86496503 -11.19804075 19 -1.00095205 -2.86496503 20 -4.07792152 -1.00095205 21 -2.68586984 -4.07792152 22 5.77290552 -2.68586984 23 1.45594879 5.77290552 24 -1.90053655 1.45594879 25 -2.03242303 -1.90053655 26 0.05587834 -2.03242303 27 1.34162239 0.05587834 28 1.41029886 1.34162239 29 1.66426728 1.41029886 30 3.64026113 1.66426728 31 0.56741550 3.64026113 32 1.75261399 0.56741550 33 6.59896695 1.75261399 34 5.68110478 6.59896695 35 9.44922203 5.68110478 36 3.84995827 9.44922203 37 -3.55083103 3.84995827 38 6.40485635 -3.55083103 39 -0.53151694 6.40485635 40 2.61135959 -0.53151694 41 6.62909196 2.61135959 42 -5.91732962 6.62909196 43 0.10622909 -5.91732962 44 3.35889277 0.10622909 45 0.97812923 3.35889277 46 2.41383245 0.97812923 47 -6.05244505 2.41383245 48 -1.64489475 -6.05244505 49 -1.31610370 -1.64489475 50 -4.22496119 -1.31610370 51 -0.67832071 -4.22496119 52 5.24143089 -0.67832071 53 8.21960326 5.24143089 54 1.57953153 8.21960326 55 -0.04125778 1.57953153 56 -3.12263797 -0.04125778 57 -2.93366497 -3.12263797 58 -9.65401739 -2.93366497 59 -7.04906793 -9.65401739 > 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/7o4vk1258713863.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/8mcuq1258713863.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/93gg41258713863.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/10jxk61258713863.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/111ddw1258713863.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/12czar1258713863.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/13v2if1258713863.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/14bnpg1258713863.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/15b3cr1258713863.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/16x2h31258713863.tab") + } > > system("convert tmp/1kgye1258713863.ps tmp/1kgye1258713863.png") > system("convert tmp/25j3v1258713863.ps tmp/25j3v1258713863.png") > system("convert tmp/3x5c81258713863.ps tmp/3x5c81258713863.png") > system("convert tmp/4uhyb1258713863.ps tmp/4uhyb1258713863.png") > system("convert tmp/5j7qz1258713863.ps tmp/5j7qz1258713863.png") > system("convert tmp/6onh21258713863.ps tmp/6onh21258713863.png") > system("convert tmp/7o4vk1258713863.ps tmp/7o4vk1258713863.png") > system("convert tmp/8mcuq1258713863.ps tmp/8mcuq1258713863.png") > system("convert tmp/93gg41258713863.ps tmp/93gg41258713863.png") > system("convert tmp/10jxk61258713863.ps tmp/10jxk61258713863.png") > > > proc.time() user system elapsed 2.347 1.507 2.792