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(7.2,102.9,7.4,97.4,8.8,111.4,9.3,87.4,9.3,96.8,8.7,114.1,8.2,110.3,8.3,103.9,8.5,101.6,8.6,94.6,8.5,95.9,8.2,104.7,8.1,102.8,7.9,98.1,8.6,113.9,8.7,80.9,8.7,95.7,8.5,113.2,8.4,105.9,8.5,108.8,8.7,102.3,8.7,99,8.6,100.7,8.5,115.5,8.3,100.7,8,109.9,8.2,114.6,8.1,85.4,8.1,100.5,8,114.8,7.9,116.5,7.9,112.9,8,102,8,106,7.9,105.3,8,118.8,7.7,106.1,7.2,109.3,7.5,117.2,7.3,92.5,7,104.2,7,112.5,7,122.4,7.2,113.3,7.3,100,7.1,110.7,6.8,112.8,6.4,109.8,6.1,117.3,6.5,109.1,7.7,115.9,7.9,96,7.5,99.8,6.9,116.8,6.6,115.7,6.9,99.4,7.7,94.3,8,91,8,93.2,7.7,103.1,7.3,94.1,7.4,91.8,8.1,102.7,8.3,82.6,8.2,89.1),dim=c(2,65),dimnames=list(c('Werkl.graad','Industr.prod.'),1:65)) > y <- array(NA,dim=c(2,65),dimnames=list(c('Werkl.graad','Industr.prod.'),1:65)) > 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 Werkl.graad Industr.prod. M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 1 7.2 102.9 1 0 0 0 0 0 0 0 0 0 0 2 7.4 97.4 0 1 0 0 0 0 0 0 0 0 0 3 8.8 111.4 0 0 1 0 0 0 0 0 0 0 0 4 9.3 87.4 0 0 0 1 0 0 0 0 0 0 0 5 9.3 96.8 0 0 0 0 1 0 0 0 0 0 0 6 8.7 114.1 0 0 0 0 0 1 0 0 0 0 0 7 8.2 110.3 0 0 0 0 0 0 1 0 0 0 0 8 8.3 103.9 0 0 0 0 0 0 0 1 0 0 0 9 8.5 101.6 0 0 0 0 0 0 0 0 1 0 0 10 8.6 94.6 0 0 0 0 0 0 0 0 0 1 0 11 8.5 95.9 0 0 0 0 0 0 0 0 0 0 1 12 8.2 104.7 0 0 0 0 0 0 0 0 0 0 0 13 8.1 102.8 1 0 0 0 0 0 0 0 0 0 0 14 7.9 98.1 0 1 0 0 0 0 0 0 0 0 0 15 8.6 113.9 0 0 1 0 0 0 0 0 0 0 0 16 8.7 80.9 0 0 0 1 0 0 0 0 0 0 0 17 8.7 95.7 0 0 0 0 1 0 0 0 0 0 0 18 8.5 113.2 0 0 0 0 0 1 0 0 0 0 0 19 8.4 105.9 0 0 0 0 0 0 1 0 0 0 0 20 8.5 108.8 0 0 0 0 0 0 0 1 0 0 0 21 8.7 102.3 0 0 0 0 0 0 0 0 1 0 0 22 8.7 99.0 0 0 0 0 0 0 0 0 0 1 0 23 8.6 100.7 0 0 0 0 0 0 0 0 0 0 1 24 8.5 115.5 0 0 0 0 0 0 0 0 0 0 0 25 8.3 100.7 1 0 0 0 0 0 0 0 0 0 0 26 8.0 109.9 0 1 0 0 0 0 0 0 0 0 0 27 8.2 114.6 0 0 1 0 0 0 0 0 0 0 0 28 8.1 85.4 0 0 0 1 0 0 0 0 0 0 0 29 8.1 100.5 0 0 0 0 1 0 0 0 0 0 0 30 8.0 114.8 0 0 0 0 0 1 0 0 0 0 0 31 7.9 116.5 0 0 0 0 0 0 1 0 0 0 0 32 7.9 112.9 0 0 0 0 0 0 0 1 0 0 0 33 8.0 102.0 0 0 0 0 0 0 0 0 1 0 0 34 8.0 106.0 0 0 0 0 0 0 0 0 0 1 0 35 7.9 105.3 0 0 0 0 0 0 0 0 0 0 1 36 8.0 118.8 0 0 0 0 0 0 0 0 0 0 0 37 7.7 106.1 1 0 0 0 0 0 0 0 0 0 0 38 7.2 109.3 0 1 0 0 0 0 0 0 0 0 0 39 7.5 117.2 0 0 1 0 0 0 0 0 0 0 0 40 7.3 92.5 0 0 0 1 0 0 0 0 0 0 0 41 7.0 104.2 0 0 0 0 1 0 0 0 0 0 0 42 7.0 112.5 0 0 0 0 0 1 0 0 0 0 0 43 7.0 122.4 0 0 0 0 0 0 1 0 0 0 0 44 7.2 113.3 0 0 0 0 0 0 0 1 0 0 0 45 7.3 100.0 0 0 0 0 0 0 0 0 1 0 0 46 7.1 110.7 0 0 0 0 0 0 0 0 0 1 0 47 6.8 112.8 0 0 0 0 0 0 0 0 0 0 1 48 6.4 109.8 0 0 0 0 0 0 0 0 0 0 0 49 6.1 117.3 1 0 0 0 0 0 0 0 0 0 0 50 6.5 109.1 0 1 0 0 0 0 0 0 0 0 0 51 7.7 115.9 0 0 1 0 0 0 0 0 0 0 0 52 7.9 96.0 0 0 0 1 0 0 0 0 0 0 0 53 7.5 99.8 0 0 0 0 1 0 0 0 0 0 0 54 6.9 116.8 0 0 0 0 0 1 0 0 0 0 0 55 6.6 115.7 0 0 0 0 0 0 1 0 0 0 0 56 6.9 99.4 0 0 0 0 0 0 0 1 0 0 0 57 7.7 94.3 0 0 0 0 0 0 0 0 1 0 0 58 8.0 91.0 0 0 0 0 0 0 0 0 0 1 0 59 8.0 93.2 0 0 0 0 0 0 0 0 0 0 1 60 7.7 103.1 0 0 0 0 0 0 0 0 0 0 0 61 7.3 94.1 1 0 0 0 0 0 0 0 0 0 0 62 7.4 91.8 0 1 0 0 0 0 0 0 0 0 0 63 8.1 102.7 0 0 1 0 0 0 0 0 0 0 0 64 8.3 82.6 0 0 0 1 0 0 0 0 0 0 0 65 8.2 89.1 0 0 0 0 1 0 0 0 0 0 0 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) Industr.prod. M1 M2 M3 12.30908 -0.04121 -0.57363 -0.68064 0.48218 M4 M5 M6 M7 M8 -0.43766 -0.14993 0.22073 0.01578 -0.11210 M9 M10 M11 -0.14614 -0.09707 -0.16267 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -1.38390 -0.46111 0.08275 0.48493 1.13026 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 12.30908 1.62984 7.552 6.53e-10 *** Industr.prod. -0.04121 0.01452 -2.838 0.00645 ** M1 -0.57363 0.41170 -1.393 0.16945 M2 -0.68064 0.41669 -1.633 0.10842 M3 0.48218 0.40240 1.198 0.23624 M4 -0.43766 0.52111 -0.840 0.40483 M5 -0.14993 0.44142 -0.340 0.73548 M6 0.22073 0.42273 0.522 0.60378 M7 0.01578 0.42250 0.037 0.97034 M8 -0.11210 0.42078 -0.266 0.79098 M9 -0.14614 0.44501 -0.328 0.74393 M10 -0.09707 0.44394 -0.219 0.82777 M11 -0.16267 0.43797 -0.371 0.71183 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 0.6624 on 52 degrees of freedom Multiple R-squared: 0.2738, Adjusted R-squared: 0.1062 F-statistic: 1.634 on 12 and 52 DF, p-value: 0.1110 > 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.273608852 0.547217705 0.726391148 [2,] 0.198048991 0.396097982 0.801951009 [3,] 0.116128622 0.232257243 0.883871378 [4,] 0.087749770 0.175499539 0.912250230 [5,] 0.052653797 0.105307594 0.947346203 [6,] 0.032925656 0.065851311 0.967074344 [7,] 0.018592877 0.037185754 0.981407123 [8,] 0.010766196 0.021532392 0.989233804 [9,] 0.007938603 0.015877206 0.992061397 [10,] 0.022113178 0.044226355 0.977886822 [11,] 0.019051201 0.038102402 0.980948799 [12,] 0.021669377 0.043338754 0.978330623 [13,] 0.050263472 0.100526944 0.949736528 [14,] 0.100998324 0.201996648 0.899001676 [15,] 0.135147206 0.270294412 0.864852794 [16,] 0.157294167 0.314588333 0.842705833 [17,] 0.202203795 0.404407591 0.797796205 [18,] 0.219613435 0.439226870 0.780386565 [19,] 0.224359636 0.448719272 0.775640364 [20,] 0.220676367 0.441352734 0.779323633 [21,] 0.464846086 0.929692172 0.535153914 [22,] 0.619873703 0.760252595 0.380126297 [23,] 0.669866209 0.660267582 0.330133791 [24,] 0.688386838 0.623226325 0.311613162 [25,] 0.821965168 0.356069664 0.178034832 [26,] 0.887724500 0.224550999 0.112275500 [27,] 0.905211842 0.189576316 0.094788158 [28,] 0.917057611 0.165884777 0.082942389 [29,] 0.977403855 0.045192289 0.022596145 [30,] 0.965398861 0.069202279 0.034601139 [31,] 0.934068182 0.131863635 0.065931818 [32,] 0.879906376 0.240187248 0.120093624 [33,] 0.995047231 0.009905539 0.004952769 [34,] 0.980895494 0.038209012 0.019104506 > postscript(file="/var/www/html/rcomp/tmp/1exff1258657008.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/2f9w81258657008.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/3xxet1258657008.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/4wbnf1258657008.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/5x4fk1258657008.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 = 65 Frequency = 1 1 2 3 4 5 6 -0.29464733 -0.21430718 0.59985762 1.03058581 1.13026192 0.87258167 7 8 9 10 11 12 0.42091813 0.38503943 0.52429215 0.28673488 0.30591062 0.20591062 13 14 15 16 17 18 0.60123138 0.31454187 0.50288991 0.16270184 0.48492771 0.63549005 19 20 21 22 23 24 0.43958129 0.78698273 0.75314120 0.56807172 0.60373263 0.95101014 25 26 27 28 29 30 0.71468425 0.90085430 0.13173895 -0.25184003 0.08274972 0.20143072 31 32 33 34 35 36 0.37643823 0.35595569 0.04077732 0.15656215 0.09331206 0.58701277 37 38 39 40 41 42 0.33723401 0.07612655 -0.46110746 -0.75922831 -0.86476248 -0.89335899 43 44 45 46 47 48 -0.28040555 -0.32755914 -0.74164852 -0.54973713 -0.69759106 -1.38390349 49 50 51 52 53 54 -0.80118130 -0.63211603 -0.31468425 -0.01498310 -0.54609932 -0.81614345 55 56 57 58 59 60 -0.95653211 -1.20041871 -0.57656215 -0.46163162 -0.30536426 -0.36003005 61 62 63 64 65 -0.55732101 -0.44509952 -0.45869477 -0.16723620 -0.28707755 > postscript(file="/var/www/html/rcomp/tmp/6a5l51258657008.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 = 65 Frequency = 1 lag(myerror, k = 1) myerror 0 -0.29464733 NA 1 -0.21430718 -0.29464733 2 0.59985762 -0.21430718 3 1.03058581 0.59985762 4 1.13026192 1.03058581 5 0.87258167 1.13026192 6 0.42091813 0.87258167 7 0.38503943 0.42091813 8 0.52429215 0.38503943 9 0.28673488 0.52429215 10 0.30591062 0.28673488 11 0.20591062 0.30591062 12 0.60123138 0.20591062 13 0.31454187 0.60123138 14 0.50288991 0.31454187 15 0.16270184 0.50288991 16 0.48492771 0.16270184 17 0.63549005 0.48492771 18 0.43958129 0.63549005 19 0.78698273 0.43958129 20 0.75314120 0.78698273 21 0.56807172 0.75314120 22 0.60373263 0.56807172 23 0.95101014 0.60373263 24 0.71468425 0.95101014 25 0.90085430 0.71468425 26 0.13173895 0.90085430 27 -0.25184003 0.13173895 28 0.08274972 -0.25184003 29 0.20143072 0.08274972 30 0.37643823 0.20143072 31 0.35595569 0.37643823 32 0.04077732 0.35595569 33 0.15656215 0.04077732 34 0.09331206 0.15656215 35 0.58701277 0.09331206 36 0.33723401 0.58701277 37 0.07612655 0.33723401 38 -0.46110746 0.07612655 39 -0.75922831 -0.46110746 40 -0.86476248 -0.75922831 41 -0.89335899 -0.86476248 42 -0.28040555 -0.89335899 43 -0.32755914 -0.28040555 44 -0.74164852 -0.32755914 45 -0.54973713 -0.74164852 46 -0.69759106 -0.54973713 47 -1.38390349 -0.69759106 48 -0.80118130 -1.38390349 49 -0.63211603 -0.80118130 50 -0.31468425 -0.63211603 51 -0.01498310 -0.31468425 52 -0.54609932 -0.01498310 53 -0.81614345 -0.54609932 54 -0.95653211 -0.81614345 55 -1.20041871 -0.95653211 56 -0.57656215 -1.20041871 57 -0.46163162 -0.57656215 58 -0.30536426 -0.46163162 59 -0.36003005 -0.30536426 60 -0.55732101 -0.36003005 61 -0.44509952 -0.55732101 62 -0.45869477 -0.44509952 63 -0.16723620 -0.45869477 64 -0.28707755 -0.16723620 65 NA -0.28707755 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -0.21430718 -0.29464733 [2,] 0.59985762 -0.21430718 [3,] 1.03058581 0.59985762 [4,] 1.13026192 1.03058581 [5,] 0.87258167 1.13026192 [6,] 0.42091813 0.87258167 [7,] 0.38503943 0.42091813 [8,] 0.52429215 0.38503943 [9,] 0.28673488 0.52429215 [10,] 0.30591062 0.28673488 [11,] 0.20591062 0.30591062 [12,] 0.60123138 0.20591062 [13,] 0.31454187 0.60123138 [14,] 0.50288991 0.31454187 [15,] 0.16270184 0.50288991 [16,] 0.48492771 0.16270184 [17,] 0.63549005 0.48492771 [18,] 0.43958129 0.63549005 [19,] 0.78698273 0.43958129 [20,] 0.75314120 0.78698273 [21,] 0.56807172 0.75314120 [22,] 0.60373263 0.56807172 [23,] 0.95101014 0.60373263 [24,] 0.71468425 0.95101014 [25,] 0.90085430 0.71468425 [26,] 0.13173895 0.90085430 [27,] -0.25184003 0.13173895 [28,] 0.08274972 -0.25184003 [29,] 0.20143072 0.08274972 [30,] 0.37643823 0.20143072 [31,] 0.35595569 0.37643823 [32,] 0.04077732 0.35595569 [33,] 0.15656215 0.04077732 [34,] 0.09331206 0.15656215 [35,] 0.58701277 0.09331206 [36,] 0.33723401 0.58701277 [37,] 0.07612655 0.33723401 [38,] -0.46110746 0.07612655 [39,] -0.75922831 -0.46110746 [40,] -0.86476248 -0.75922831 [41,] -0.89335899 -0.86476248 [42,] -0.28040555 -0.89335899 [43,] -0.32755914 -0.28040555 [44,] -0.74164852 -0.32755914 [45,] -0.54973713 -0.74164852 [46,] -0.69759106 -0.54973713 [47,] -1.38390349 -0.69759106 [48,] -0.80118130 -1.38390349 [49,] -0.63211603 -0.80118130 [50,] -0.31468425 -0.63211603 [51,] -0.01498310 -0.31468425 [52,] -0.54609932 -0.01498310 [53,] -0.81614345 -0.54609932 [54,] -0.95653211 -0.81614345 [55,] -1.20041871 -0.95653211 [56,] -0.57656215 -1.20041871 [57,] -0.46163162 -0.57656215 [58,] -0.30536426 -0.46163162 [59,] -0.36003005 -0.30536426 [60,] -0.55732101 -0.36003005 [61,] -0.44509952 -0.55732101 [62,] -0.45869477 -0.44509952 [63,] -0.16723620 -0.45869477 [64,] -0.28707755 -0.16723620 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -0.21430718 -0.29464733 2 0.59985762 -0.21430718 3 1.03058581 0.59985762 4 1.13026192 1.03058581 5 0.87258167 1.13026192 6 0.42091813 0.87258167 7 0.38503943 0.42091813 8 0.52429215 0.38503943 9 0.28673488 0.52429215 10 0.30591062 0.28673488 11 0.20591062 0.30591062 12 0.60123138 0.20591062 13 0.31454187 0.60123138 14 0.50288991 0.31454187 15 0.16270184 0.50288991 16 0.48492771 0.16270184 17 0.63549005 0.48492771 18 0.43958129 0.63549005 19 0.78698273 0.43958129 20 0.75314120 0.78698273 21 0.56807172 0.75314120 22 0.60373263 0.56807172 23 0.95101014 0.60373263 24 0.71468425 0.95101014 25 0.90085430 0.71468425 26 0.13173895 0.90085430 27 -0.25184003 0.13173895 28 0.08274972 -0.25184003 29 0.20143072 0.08274972 30 0.37643823 0.20143072 31 0.35595569 0.37643823 32 0.04077732 0.35595569 33 0.15656215 0.04077732 34 0.09331206 0.15656215 35 0.58701277 0.09331206 36 0.33723401 0.58701277 37 0.07612655 0.33723401 38 -0.46110746 0.07612655 39 -0.75922831 -0.46110746 40 -0.86476248 -0.75922831 41 -0.89335899 -0.86476248 42 -0.28040555 -0.89335899 43 -0.32755914 -0.28040555 44 -0.74164852 -0.32755914 45 -0.54973713 -0.74164852 46 -0.69759106 -0.54973713 47 -1.38390349 -0.69759106 48 -0.80118130 -1.38390349 49 -0.63211603 -0.80118130 50 -0.31468425 -0.63211603 51 -0.01498310 -0.31468425 52 -0.54609932 -0.01498310 53 -0.81614345 -0.54609932 54 -0.95653211 -0.81614345 55 -1.20041871 -0.95653211 56 -0.57656215 -1.20041871 57 -0.46163162 -0.57656215 58 -0.30536426 -0.46163162 59 -0.36003005 -0.30536426 60 -0.55732101 -0.36003005 61 -0.44509952 -0.55732101 62 -0.45869477 -0.44509952 63 -0.16723620 -0.45869477 64 -0.28707755 -0.16723620 > 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/7eypx1258657008.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/8x7oz1258657008.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/966y61258657008.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/10mtq81258657008.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/118yz01258657008.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/12zvx91258657008.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/13cfvh1258657008.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/14d3ty1258657008.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/15kejh1258657008.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/16xqmo1258657009.tab") + } > > system("convert tmp/1exff1258657008.ps tmp/1exff1258657008.png") > system("convert tmp/2f9w81258657008.ps tmp/2f9w81258657008.png") > system("convert tmp/3xxet1258657008.ps tmp/3xxet1258657008.png") > system("convert tmp/4wbnf1258657008.ps tmp/4wbnf1258657008.png") > system("convert tmp/5x4fk1258657008.ps tmp/5x4fk1258657008.png") > system("convert tmp/6a5l51258657008.ps tmp/6a5l51258657008.png") > system("convert tmp/7eypx1258657008.ps tmp/7eypx1258657008.png") > system("convert tmp/8x7oz1258657008.ps tmp/8x7oz1258657008.png") > system("convert tmp/966y61258657008.ps tmp/966y61258657008.png") > system("convert tmp/10mtq81258657008.ps tmp/10mtq81258657008.png") > > > proc.time() user system elapsed 2.480 1.548 2.877