R version 2.8.0 (2008-10-20) Copyright (C) 2008 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(82.7,0,88.9,0,105.9,0,100.8,0,94,0,105,0,58.5,0,87.6,0,113.1,0,112.5,0,89.6,0,74.5,0,82.7,0,90.1,0,109.4,0,96,0,89.2,0,109.1,0,49.1,0,92.9,0,107.7,0,103.5,0,91.1,0,79.8,0,71.9,0,82.9,0,90.1,0,100.7,0,90.7,0,108.8,0,44.1,0,93.6,0,107.4,0,96.5,0,93.6,0,76.5,0,76.7,1,84,1,103.3,1,88.5,1,99,1,105.9,1,44.7,1,94,1,107.1,1,104.8,1,102.5,1,77.7,1,85.2,1,91.3,1,106.5,1,92.4,1,97.5,1,107,1,51.1,1,98.6,1,102.2,1,114.3,1,99.4,1,72.5,1,92.3,1,99.4,1,85.9,1,109.4,1,97.6,1),dim=c(2,65),dimnames=list(c('Bouwproductie','d'),1:65)) > y <- array(NA,dim=c(2,65),dimnames=list(c('Bouwproductie','d'),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 = '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 Bouwproductie d M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t 1 82.7 0 1 0 0 0 0 0 0 0 0 0 0 1 2 88.9 0 0 1 0 0 0 0 0 0 0 0 0 2 3 105.9 0 0 0 1 0 0 0 0 0 0 0 0 3 4 100.8 0 0 0 0 1 0 0 0 0 0 0 0 4 5 94.0 0 0 0 0 0 1 0 0 0 0 0 0 5 6 105.0 0 0 0 0 0 0 1 0 0 0 0 0 6 7 58.5 0 0 0 0 0 0 0 1 0 0 0 0 7 8 87.6 0 0 0 0 0 0 0 0 1 0 0 0 8 9 113.1 0 0 0 0 0 0 0 0 0 1 0 0 9 10 112.5 0 0 0 0 0 0 0 0 0 0 1 0 10 11 89.6 0 0 0 0 0 0 0 0 0 0 0 1 11 12 74.5 0 0 0 0 0 0 0 0 0 0 0 0 12 13 82.7 0 1 0 0 0 0 0 0 0 0 0 0 13 14 90.1 0 0 1 0 0 0 0 0 0 0 0 0 14 15 109.4 0 0 0 1 0 0 0 0 0 0 0 0 15 16 96.0 0 0 0 0 1 0 0 0 0 0 0 0 16 17 89.2 0 0 0 0 0 1 0 0 0 0 0 0 17 18 109.1 0 0 0 0 0 0 1 0 0 0 0 0 18 19 49.1 0 0 0 0 0 0 0 1 0 0 0 0 19 20 92.9 0 0 0 0 0 0 0 0 1 0 0 0 20 21 107.7 0 0 0 0 0 0 0 0 0 1 0 0 21 22 103.5 0 0 0 0 0 0 0 0 0 0 1 0 22 23 91.1 0 0 0 0 0 0 0 0 0 0 0 1 23 24 79.8 0 0 0 0 0 0 0 0 0 0 0 0 24 25 71.9 0 1 0 0 0 0 0 0 0 0 0 0 25 26 82.9 0 0 1 0 0 0 0 0 0 0 0 0 26 27 90.1 0 0 0 1 0 0 0 0 0 0 0 0 27 28 100.7 0 0 0 0 1 0 0 0 0 0 0 0 28 29 90.7 0 0 0 0 0 1 0 0 0 0 0 0 29 30 108.8 0 0 0 0 0 0 1 0 0 0 0 0 30 31 44.1 0 0 0 0 0 0 0 1 0 0 0 0 31 32 93.6 0 0 0 0 0 0 0 0 1 0 0 0 32 33 107.4 0 0 0 0 0 0 0 0 0 1 0 0 33 34 96.5 0 0 0 0 0 0 0 0 0 0 1 0 34 35 93.6 0 0 0 0 0 0 0 0 0 0 0 1 35 36 76.5 0 0 0 0 0 0 0 0 0 0 0 0 36 37 76.7 1 1 0 0 0 0 0 0 0 0 0 0 37 38 84.0 1 0 1 0 0 0 0 0 0 0 0 0 38 39 103.3 1 0 0 1 0 0 0 0 0 0 0 0 39 40 88.5 1 0 0 0 1 0 0 0 0 0 0 0 40 41 99.0 1 0 0 0 0 1 0 0 0 0 0 0 41 42 105.9 1 0 0 0 0 0 1 0 0 0 0 0 42 43 44.7 1 0 0 0 0 0 0 1 0 0 0 0 43 44 94.0 1 0 0 0 0 0 0 0 1 0 0 0 44 45 107.1 1 0 0 0 0 0 0 0 0 1 0 0 45 46 104.8 1 0 0 0 0 0 0 0 0 0 1 0 46 47 102.5 1 0 0 0 0 0 0 0 0 0 0 1 47 48 77.7 1 0 0 0 0 0 0 0 0 0 0 0 48 49 85.2 1 1 0 0 0 0 0 0 0 0 0 0 49 50 91.3 1 0 1 0 0 0 0 0 0 0 0 0 50 51 106.5 1 0 0 1 0 0 0 0 0 0 0 0 51 52 92.4 1 0 0 0 1 0 0 0 0 0 0 0 52 53 97.5 1 0 0 0 0 1 0 0 0 0 0 0 53 54 107.0 1 0 0 0 0 0 1 0 0 0 0 0 54 55 51.1 1 0 0 0 0 0 0 1 0 0 0 0 55 56 98.6 1 0 0 0 0 0 0 0 1 0 0 0 56 57 102.2 1 0 0 0 0 0 0 0 0 1 0 0 57 58 114.3 1 0 0 0 0 0 0 0 0 0 1 0 58 59 99.4 1 0 0 0 0 0 0 0 0 0 0 1 59 60 72.5 1 0 0 0 0 0 0 0 0 0 0 0 60 61 92.3 1 1 0 0 0 0 0 0 0 0 0 0 61 62 99.4 1 0 1 0 0 0 0 0 0 0 0 0 62 63 85.9 1 0 0 1 0 0 0 0 0 0 0 0 63 64 109.4 1 0 0 0 1 0 0 0 0 0 0 0 64 65 97.6 1 0 0 0 0 1 0 0 0 0 0 0 65 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) d M1 M2 M3 M4 76.35775 2.97696 5.23167 12.78580 23.57326 21.39405 M5 M6 M7 M8 M9 M10 18.13151 30.73525 -26.88730 16.99016 31.18762 30.04508 M11 t 19.00254 -0.03746 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -14.6480 -3.3987 0.3413 3.0696 11.0686 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 76.35775 3.29924 23.144 < 2e-16 *** d 2.97696 3.03352 0.981 0.33105 M1 5.23167 3.68458 1.420 0.16173 M2 12.78580 3.67093 3.483 0.00103 ** M3 23.57326 3.65899 6.443 4.13e-08 *** M4 21.39405 3.64878 5.863 3.36e-07 *** M5 18.13151 3.64031 4.981 7.65e-06 *** M6 30.73525 3.81251 8.062 1.16e-10 *** M7 -26.88730 3.80319 -7.070 4.22e-09 *** M8 16.99016 3.79555 4.476 4.29e-05 *** M9 31.18762 3.78959 8.230 6.36e-11 *** M10 30.04508 3.78534 7.937 1.82e-10 *** M11 19.00254 3.78278 5.023 6.59e-06 *** t -0.03746 0.08032 -0.466 0.64293 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 5.98 on 51 degrees of freedom Multiple R-squared: 0.8921, Adjusted R-squared: 0.8646 F-statistic: 32.43 on 13 and 51 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.149906700 0.299813399 0.8500933 [2,] 0.107365625 0.214731249 0.8926344 [3,] 0.175185576 0.350371152 0.8248144 [4,] 0.153515106 0.307030211 0.8464849 [5,] 0.115706816 0.231413632 0.8842932 [6,] 0.118609310 0.237218620 0.8813907 [7,] 0.076702381 0.153404761 0.9232976 [8,] 0.081855190 0.163710380 0.9181448 [9,] 0.119463753 0.238927507 0.8805362 [10,] 0.084210502 0.168421004 0.9157895 [11,] 0.194828948 0.389657897 0.8051711 [12,] 0.217174449 0.434348899 0.7828256 [13,] 0.166985225 0.333970450 0.8330148 [14,] 0.149217469 0.298434937 0.8507825 [15,] 0.119899712 0.239799424 0.8801003 [16,] 0.107420547 0.214841094 0.8925795 [17,] 0.084468120 0.168936240 0.9155319 [18,] 0.092945963 0.185891927 0.9070540 [19,] 0.089397063 0.178794125 0.9106029 [20,] 0.059403312 0.118806623 0.9405967 [21,] 0.048311585 0.096623169 0.9516884 [22,] 0.040941177 0.081882354 0.9590588 [23,] 0.042328096 0.084656192 0.9576719 [24,] 0.060748648 0.121497297 0.9392514 [25,] 0.065654632 0.131309265 0.9343454 [26,] 0.038531350 0.077062701 0.9614686 [27,] 0.025689902 0.051379804 0.9743101 [28,] 0.015606674 0.031213348 0.9843933 [29,] 0.009128600 0.018257201 0.9908714 [30,] 0.006253975 0.012507949 0.9937460 [31,] 0.005874367 0.011748734 0.9941256 [32,] 0.002859137 0.005718273 0.9971409 > postscript(file="/var/www/html/rcomp/tmp/16s0a1229035030.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/2mq5e1229035030.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/3e8xl1229035030.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/4qc1d1229035030.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/5n90j1229035030.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 1.1480392 -0.1686275 6.0813725 3.1980392 -0.3019608 -1.8682353 7 8 9 10 11 12 9.2917647 -5.4482353 5.8917647 6.4717647 -5.3482353 -1.4082353 13 14 15 16 17 18 1.5975490 1.4808824 10.0308824 -1.1524510 -4.6524510 2.6812745 19 20 21 22 23 24 0.3412745 0.3012745 0.9412745 -2.0787255 -3.3987255 4.3412745 25 26 27 28 29 30 -8.7529412 -5.2696078 -8.8196078 3.9970588 -2.7029412 2.8307843 31 32 33 34 35 36 -4.2092157 1.4507843 1.0907843 -8.6292157 -0.4492157 1.4907843 37 38 39 40 41 42 -6.4803922 -6.6970588 1.8529412 -10.7303922 3.0696078 -2.5966667 43 44 45 46 47 48 -6.1366667 -0.6766667 -1.7366667 -2.8566667 5.9233333 0.1633333 49 50 51 52 53 54 2.4691176 1.0524510 5.5024510 -6.3808824 2.0191176 -1.0471569 55 56 57 58 59 60 0.7128431 4.3728431 -6.1871569 7.0928431 3.2728431 -4.5871569 61 62 63 64 65 10.0186275 9.6019608 -14.6480392 11.0686275 2.5686275 > postscript(file="/var/www/html/rcomp/tmp/6byp61229035030.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 1.1480392 NA 1 -0.1686275 1.1480392 2 6.0813725 -0.1686275 3 3.1980392 6.0813725 4 -0.3019608 3.1980392 5 -1.8682353 -0.3019608 6 9.2917647 -1.8682353 7 -5.4482353 9.2917647 8 5.8917647 -5.4482353 9 6.4717647 5.8917647 10 -5.3482353 6.4717647 11 -1.4082353 -5.3482353 12 1.5975490 -1.4082353 13 1.4808824 1.5975490 14 10.0308824 1.4808824 15 -1.1524510 10.0308824 16 -4.6524510 -1.1524510 17 2.6812745 -4.6524510 18 0.3412745 2.6812745 19 0.3012745 0.3412745 20 0.9412745 0.3012745 21 -2.0787255 0.9412745 22 -3.3987255 -2.0787255 23 4.3412745 -3.3987255 24 -8.7529412 4.3412745 25 -5.2696078 -8.7529412 26 -8.8196078 -5.2696078 27 3.9970588 -8.8196078 28 -2.7029412 3.9970588 29 2.8307843 -2.7029412 30 -4.2092157 2.8307843 31 1.4507843 -4.2092157 32 1.0907843 1.4507843 33 -8.6292157 1.0907843 34 -0.4492157 -8.6292157 35 1.4907843 -0.4492157 36 -6.4803922 1.4907843 37 -6.6970588 -6.4803922 38 1.8529412 -6.6970588 39 -10.7303922 1.8529412 40 3.0696078 -10.7303922 41 -2.5966667 3.0696078 42 -6.1366667 -2.5966667 43 -0.6766667 -6.1366667 44 -1.7366667 -0.6766667 45 -2.8566667 -1.7366667 46 5.9233333 -2.8566667 47 0.1633333 5.9233333 48 2.4691176 0.1633333 49 1.0524510 2.4691176 50 5.5024510 1.0524510 51 -6.3808824 5.5024510 52 2.0191176 -6.3808824 53 -1.0471569 2.0191176 54 0.7128431 -1.0471569 55 4.3728431 0.7128431 56 -6.1871569 4.3728431 57 7.0928431 -6.1871569 58 3.2728431 7.0928431 59 -4.5871569 3.2728431 60 10.0186275 -4.5871569 61 9.6019608 10.0186275 62 -14.6480392 9.6019608 63 11.0686275 -14.6480392 64 2.5686275 11.0686275 65 NA 2.5686275 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -0.1686275 1.1480392 [2,] 6.0813725 -0.1686275 [3,] 3.1980392 6.0813725 [4,] -0.3019608 3.1980392 [5,] -1.8682353 -0.3019608 [6,] 9.2917647 -1.8682353 [7,] -5.4482353 9.2917647 [8,] 5.8917647 -5.4482353 [9,] 6.4717647 5.8917647 [10,] -5.3482353 6.4717647 [11,] -1.4082353 -5.3482353 [12,] 1.5975490 -1.4082353 [13,] 1.4808824 1.5975490 [14,] 10.0308824 1.4808824 [15,] -1.1524510 10.0308824 [16,] -4.6524510 -1.1524510 [17,] 2.6812745 -4.6524510 [18,] 0.3412745 2.6812745 [19,] 0.3012745 0.3412745 [20,] 0.9412745 0.3012745 [21,] -2.0787255 0.9412745 [22,] -3.3987255 -2.0787255 [23,] 4.3412745 -3.3987255 [24,] -8.7529412 4.3412745 [25,] -5.2696078 -8.7529412 [26,] -8.8196078 -5.2696078 [27,] 3.9970588 -8.8196078 [28,] -2.7029412 3.9970588 [29,] 2.8307843 -2.7029412 [30,] -4.2092157 2.8307843 [31,] 1.4507843 -4.2092157 [32,] 1.0907843 1.4507843 [33,] -8.6292157 1.0907843 [34,] -0.4492157 -8.6292157 [35,] 1.4907843 -0.4492157 [36,] -6.4803922 1.4907843 [37,] -6.6970588 -6.4803922 [38,] 1.8529412 -6.6970588 [39,] -10.7303922 1.8529412 [40,] 3.0696078 -10.7303922 [41,] -2.5966667 3.0696078 [42,] -6.1366667 -2.5966667 [43,] -0.6766667 -6.1366667 [44,] -1.7366667 -0.6766667 [45,] -2.8566667 -1.7366667 [46,] 5.9233333 -2.8566667 [47,] 0.1633333 5.9233333 [48,] 2.4691176 0.1633333 [49,] 1.0524510 2.4691176 [50,] 5.5024510 1.0524510 [51,] -6.3808824 5.5024510 [52,] 2.0191176 -6.3808824 [53,] -1.0471569 2.0191176 [54,] 0.7128431 -1.0471569 [55,] 4.3728431 0.7128431 [56,] -6.1871569 4.3728431 [57,] 7.0928431 -6.1871569 [58,] 3.2728431 7.0928431 [59,] -4.5871569 3.2728431 [60,] 10.0186275 -4.5871569 [61,] 9.6019608 10.0186275 [62,] -14.6480392 9.6019608 [63,] 11.0686275 -14.6480392 [64,] 2.5686275 11.0686275 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -0.1686275 1.1480392 2 6.0813725 -0.1686275 3 3.1980392 6.0813725 4 -0.3019608 3.1980392 5 -1.8682353 -0.3019608 6 9.2917647 -1.8682353 7 -5.4482353 9.2917647 8 5.8917647 -5.4482353 9 6.4717647 5.8917647 10 -5.3482353 6.4717647 11 -1.4082353 -5.3482353 12 1.5975490 -1.4082353 13 1.4808824 1.5975490 14 10.0308824 1.4808824 15 -1.1524510 10.0308824 16 -4.6524510 -1.1524510 17 2.6812745 -4.6524510 18 0.3412745 2.6812745 19 0.3012745 0.3412745 20 0.9412745 0.3012745 21 -2.0787255 0.9412745 22 -3.3987255 -2.0787255 23 4.3412745 -3.3987255 24 -8.7529412 4.3412745 25 -5.2696078 -8.7529412 26 -8.8196078 -5.2696078 27 3.9970588 -8.8196078 28 -2.7029412 3.9970588 29 2.8307843 -2.7029412 30 -4.2092157 2.8307843 31 1.4507843 -4.2092157 32 1.0907843 1.4507843 33 -8.6292157 1.0907843 34 -0.4492157 -8.6292157 35 1.4907843 -0.4492157 36 -6.4803922 1.4907843 37 -6.6970588 -6.4803922 38 1.8529412 -6.6970588 39 -10.7303922 1.8529412 40 3.0696078 -10.7303922 41 -2.5966667 3.0696078 42 -6.1366667 -2.5966667 43 -0.6766667 -6.1366667 44 -1.7366667 -0.6766667 45 -2.8566667 -1.7366667 46 5.9233333 -2.8566667 47 0.1633333 5.9233333 48 2.4691176 0.1633333 49 1.0524510 2.4691176 50 5.5024510 1.0524510 51 -6.3808824 5.5024510 52 2.0191176 -6.3808824 53 -1.0471569 2.0191176 54 0.7128431 -1.0471569 55 4.3728431 0.7128431 56 -6.1871569 4.3728431 57 7.0928431 -6.1871569 58 3.2728431 7.0928431 59 -4.5871569 3.2728431 60 10.0186275 -4.5871569 61 9.6019608 10.0186275 62 -14.6480392 9.6019608 63 11.0686275 -14.6480392 64 2.5686275 11.0686275 > 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/7tpi41229035030.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/8nlxk1229035030.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/9vsn91229035030.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/10f5571229035030.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/11jcfm1229035030.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/12j7751229035030.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/13a4au1229035030.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/14xk7h1229035030.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/158zqd1229035031.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/16pt1w1229035031.tab") + } > > system("convert tmp/16s0a1229035030.ps tmp/16s0a1229035030.png") > system("convert tmp/2mq5e1229035030.ps tmp/2mq5e1229035030.png") > system("convert tmp/3e8xl1229035030.ps tmp/3e8xl1229035030.png") > system("convert tmp/4qc1d1229035030.ps tmp/4qc1d1229035030.png") > system("convert tmp/5n90j1229035030.ps tmp/5n90j1229035030.png") > system("convert tmp/6byp61229035030.ps tmp/6byp61229035030.png") > system("convert tmp/7tpi41229035030.ps tmp/7tpi41229035030.png") > system("convert tmp/8nlxk1229035030.ps tmp/8nlxk1229035030.png") > system("convert tmp/9vsn91229035030.ps tmp/9vsn91229035030.png") > system("convert tmp/10f5571229035030.ps tmp/10f5571229035030.png") > > > proc.time() user system elapsed 2.525 1.635 3.795