R version 2.7.0 (2008-04-22) 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 = '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 Bouwproductie d M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 1 82.7 0 1 0 0 0 0 0 0 0 0 0 0 2 88.9 0 0 1 0 0 0 0 0 0 0 0 0 3 105.9 0 0 0 1 0 0 0 0 0 0 0 0 4 100.8 0 0 0 0 1 0 0 0 0 0 0 0 5 94.0 0 0 0 0 0 1 0 0 0 0 0 0 6 105.0 0 0 0 0 0 0 1 0 0 0 0 0 7 58.5 0 0 0 0 0 0 0 1 0 0 0 0 8 87.6 0 0 0 0 0 0 0 0 1 0 0 0 9 113.1 0 0 0 0 0 0 0 0 0 1 0 0 10 112.5 0 0 0 0 0 0 0 0 0 0 1 0 11 89.6 0 0 0 0 0 0 0 0 0 0 0 1 12 74.5 0 0 0 0 0 0 0 0 0 0 0 0 13 82.7 0 1 0 0 0 0 0 0 0 0 0 0 14 90.1 0 0 1 0 0 0 0 0 0 0 0 0 15 109.4 0 0 0 1 0 0 0 0 0 0 0 0 16 96.0 0 0 0 0 1 0 0 0 0 0 0 0 17 89.2 0 0 0 0 0 1 0 0 0 0 0 0 18 109.1 0 0 0 0 0 0 1 0 0 0 0 0 19 49.1 0 0 0 0 0 0 0 1 0 0 0 0 20 92.9 0 0 0 0 0 0 0 0 1 0 0 0 21 107.7 0 0 0 0 0 0 0 0 0 1 0 0 22 103.5 0 0 0 0 0 0 0 0 0 0 1 0 23 91.1 0 0 0 0 0 0 0 0 0 0 0 1 24 79.8 0 0 0 0 0 0 0 0 0 0 0 0 25 71.9 0 1 0 0 0 0 0 0 0 0 0 0 26 82.9 0 0 1 0 0 0 0 0 0 0 0 0 27 90.1 0 0 0 1 0 0 0 0 0 0 0 0 28 100.7 0 0 0 0 1 0 0 0 0 0 0 0 29 90.7 0 0 0 0 0 1 0 0 0 0 0 0 30 108.8 0 0 0 0 0 0 1 0 0 0 0 0 31 44.1 0 0 0 0 0 0 0 1 0 0 0 0 32 93.6 0 0 0 0 0 0 0 0 1 0 0 0 33 107.4 0 0 0 0 0 0 0 0 0 1 0 0 34 96.5 0 0 0 0 0 0 0 0 0 0 1 0 35 93.6 0 0 0 0 0 0 0 0 0 0 0 1 36 76.5 0 0 0 0 0 0 0 0 0 0 0 0 37 76.7 1 1 0 0 0 0 0 0 0 0 0 0 38 84.0 1 0 1 0 0 0 0 0 0 0 0 0 39 103.3 1 0 0 1 0 0 0 0 0 0 0 0 40 88.5 1 0 0 0 1 0 0 0 0 0 0 0 41 99.0 1 0 0 0 0 1 0 0 0 0 0 0 42 105.9 1 0 0 0 0 0 1 0 0 0 0 0 43 44.7 1 0 0 0 0 0 0 1 0 0 0 0 44 94.0 1 0 0 0 0 0 0 0 1 0 0 0 45 107.1 1 0 0 0 0 0 0 0 0 1 0 0 46 104.8 1 0 0 0 0 0 0 0 0 0 1 0 47 102.5 1 0 0 0 0 0 0 0 0 0 0 1 48 77.7 1 0 0 0 0 0 0 0 0 0 0 0 49 85.2 1 1 0 0 0 0 0 0 0 0 0 0 50 91.3 1 0 1 0 0 0 0 0 0 0 0 0 51 106.5 1 0 0 1 0 0 0 0 0 0 0 0 52 92.4 1 0 0 0 1 0 0 0 0 0 0 0 53 97.5 1 0 0 0 0 1 0 0 0 0 0 0 54 107.0 1 0 0 0 0 0 1 0 0 0 0 0 55 51.1 1 0 0 0 0 0 0 1 0 0 0 0 56 98.6 1 0 0 0 0 0 0 0 1 0 0 0 57 102.2 1 0 0 0 0 0 0 0 0 1 0 0 58 114.3 1 0 0 0 0 0 0 0 0 0 1 0 59 99.4 1 0 0 0 0 0 0 0 0 0 0 1 60 72.5 1 0 0 0 0 0 0 0 0 0 0 0 61 92.3 1 1 0 0 0 0 0 0 0 0 0 0 62 99.4 1 0 1 0 0 0 0 0 0 0 0 0 63 85.9 1 0 0 1 0 0 0 0 0 0 0 0 64 109.4 1 0 0 0 1 0 0 0 0 0 0 0 65 97.6 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) d M1 M2 M3 M4 75.501 1.747 5.542 13.059 23.809 21.592 M5 M6 M7 M8 M9 M10 18.292 30.960 -26.700 17.140 31.300 30.120 M11 19.040 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -15.1569 -3.4411 0.4517 3.1117 10.5597 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 75.501 2.720 27.758 < 2e-16 *** d 1.747 1.488 1.174 0.245771 M1 5.542 3.597 1.541 0.129414 M2 13.059 3.597 3.631 0.000646 *** M3 23.809 3.597 6.620 2.00e-08 *** M4 21.592 3.597 6.003 1.90e-07 *** M5 18.292 3.597 5.086 5.10e-06 *** M6 30.960 3.753 8.249 5.16e-11 *** M7 -26.700 3.753 -7.114 3.26e-09 *** M8 17.140 3.753 4.567 3.07e-05 *** M9 31.300 3.753 8.339 3.72e-11 *** M10 30.120 3.753 8.025 1.16e-10 *** M11 19.040 3.753 5.073 5.34e-06 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 5.935 on 52 degrees of freedom Multiple R-squared: 0.8916, Adjusted R-squared: 0.8666 F-statistic: 35.65 on 12 and 52 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.088670233 0.17734047 0.9113298 [2,] 0.070159127 0.14031825 0.9298409 [3,] 0.045768092 0.09153618 0.9542319 [4,] 0.112727881 0.22545576 0.8872721 [5,] 0.086103371 0.17220674 0.9138966 [6,] 0.068966678 0.13793336 0.9310333 [7,] 0.091170916 0.18234183 0.9088291 [8,] 0.055043484 0.11008697 0.9449565 [9,] 0.045769552 0.09153910 0.9542304 [10,] 0.113508020 0.22701604 0.8864920 [11,] 0.109899084 0.21979817 0.8901009 [12,] 0.369960565 0.73992113 0.6300394 [13,] 0.314166508 0.62833302 0.6858335 [14,] 0.243668603 0.48733721 0.7563314 [15,] 0.190442769 0.38088554 0.8095572 [16,] 0.196569032 0.39313806 0.8034310 [17,] 0.145418202 0.29083640 0.8545818 [18,] 0.120794339 0.24158868 0.8792057 [19,] 0.164094932 0.32818986 0.8359051 [20,] 0.131081559 0.26216312 0.8689184 [21,] 0.088061029 0.17612206 0.9119390 [22,] 0.093273823 0.18654765 0.9067262 [23,] 0.098573951 0.19714790 0.9014260 [24,] 0.083191439 0.16638288 0.9168086 [25,] 0.136870021 0.27374004 0.8631300 [26,] 0.131699594 0.26339919 0.8683004 [27,] 0.085590461 0.17118092 0.9144095 [28,] 0.065177819 0.13035564 0.9348222 [29,] 0.044719218 0.08943844 0.9552808 [30,] 0.027288477 0.05457695 0.9727115 [31,] 0.022406578 0.04481316 0.9775934 [32,] 0.019718474 0.03943695 0.9802815 [33,] 0.010095136 0.02019027 0.9899049 [34,] 0.006244477 0.01248895 0.9937555 > postscript(file="/var/www/html/rcomp/tmp/197rk1229032645.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/27w2v1229032645.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/3905z1229032645.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/4gbrx1229032645.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/5sfnh1229032645.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.6569182 0.3402516 6.5902516 3.7069182 0.2069182 -1.4611321 7 8 9 10 11 12 9.6988679 -5.0411321 6.2988679 6.8788679 -4.9411321 -1.0011321 13 14 15 16 17 18 1.6569182 1.5402516 10.0902516 -1.0930818 -4.5930818 2.6388679 19 20 21 22 23 24 0.2988679 0.2588679 0.8988679 -2.1211321 -3.4411321 4.2988679 25 26 27 28 29 30 -9.1430818 -5.6597484 -9.2097484 3.6069182 -3.0930818 2.3388679 31 32 33 34 35 36 -4.7011321 0.9588679 0.5988679 -9.1211321 -0.9411321 0.9988679 37 38 39 40 41 42 -6.0902516 -6.3069182 2.2430818 -10.3402516 3.4597484 -2.3083019 43 44 45 46 47 48 -5.8483019 -0.3883019 -1.4483019 -2.5683019 6.2116981 0.4516981 49 50 51 52 53 54 2.4097484 0.9930818 5.4430818 -6.4402516 1.9597484 -1.2083019 55 56 57 58 59 60 0.5516981 4.2116981 -6.3483019 6.9316981 3.1116981 -4.7483019 61 62 63 64 65 9.5097484 9.0930818 -15.1569182 10.5597484 2.0597484 > postscript(file="/var/www/html/rcomp/tmp/60zpq1229032645.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.6569182 NA 1 0.3402516 1.6569182 2 6.5902516 0.3402516 3 3.7069182 6.5902516 4 0.2069182 3.7069182 5 -1.4611321 0.2069182 6 9.6988679 -1.4611321 7 -5.0411321 9.6988679 8 6.2988679 -5.0411321 9 6.8788679 6.2988679 10 -4.9411321 6.8788679 11 -1.0011321 -4.9411321 12 1.6569182 -1.0011321 13 1.5402516 1.6569182 14 10.0902516 1.5402516 15 -1.0930818 10.0902516 16 -4.5930818 -1.0930818 17 2.6388679 -4.5930818 18 0.2988679 2.6388679 19 0.2588679 0.2988679 20 0.8988679 0.2588679 21 -2.1211321 0.8988679 22 -3.4411321 -2.1211321 23 4.2988679 -3.4411321 24 -9.1430818 4.2988679 25 -5.6597484 -9.1430818 26 -9.2097484 -5.6597484 27 3.6069182 -9.2097484 28 -3.0930818 3.6069182 29 2.3388679 -3.0930818 30 -4.7011321 2.3388679 31 0.9588679 -4.7011321 32 0.5988679 0.9588679 33 -9.1211321 0.5988679 34 -0.9411321 -9.1211321 35 0.9988679 -0.9411321 36 -6.0902516 0.9988679 37 -6.3069182 -6.0902516 38 2.2430818 -6.3069182 39 -10.3402516 2.2430818 40 3.4597484 -10.3402516 41 -2.3083019 3.4597484 42 -5.8483019 -2.3083019 43 -0.3883019 -5.8483019 44 -1.4483019 -0.3883019 45 -2.5683019 -1.4483019 46 6.2116981 -2.5683019 47 0.4516981 6.2116981 48 2.4097484 0.4516981 49 0.9930818 2.4097484 50 5.4430818 0.9930818 51 -6.4402516 5.4430818 52 1.9597484 -6.4402516 53 -1.2083019 1.9597484 54 0.5516981 -1.2083019 55 4.2116981 0.5516981 56 -6.3483019 4.2116981 57 6.9316981 -6.3483019 58 3.1116981 6.9316981 59 -4.7483019 3.1116981 60 9.5097484 -4.7483019 61 9.0930818 9.5097484 62 -15.1569182 9.0930818 63 10.5597484 -15.1569182 64 2.0597484 10.5597484 65 NA 2.0597484 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] 0.3402516 1.6569182 [2,] 6.5902516 0.3402516 [3,] 3.7069182 6.5902516 [4,] 0.2069182 3.7069182 [5,] -1.4611321 0.2069182 [6,] 9.6988679 -1.4611321 [7,] -5.0411321 9.6988679 [8,] 6.2988679 -5.0411321 [9,] 6.8788679 6.2988679 [10,] -4.9411321 6.8788679 [11,] -1.0011321 -4.9411321 [12,] 1.6569182 -1.0011321 [13,] 1.5402516 1.6569182 [14,] 10.0902516 1.5402516 [15,] -1.0930818 10.0902516 [16,] -4.5930818 -1.0930818 [17,] 2.6388679 -4.5930818 [18,] 0.2988679 2.6388679 [19,] 0.2588679 0.2988679 [20,] 0.8988679 0.2588679 [21,] -2.1211321 0.8988679 [22,] -3.4411321 -2.1211321 [23,] 4.2988679 -3.4411321 [24,] -9.1430818 4.2988679 [25,] -5.6597484 -9.1430818 [26,] -9.2097484 -5.6597484 [27,] 3.6069182 -9.2097484 [28,] -3.0930818 3.6069182 [29,] 2.3388679 -3.0930818 [30,] -4.7011321 2.3388679 [31,] 0.9588679 -4.7011321 [32,] 0.5988679 0.9588679 [33,] -9.1211321 0.5988679 [34,] -0.9411321 -9.1211321 [35,] 0.9988679 -0.9411321 [36,] -6.0902516 0.9988679 [37,] -6.3069182 -6.0902516 [38,] 2.2430818 -6.3069182 [39,] -10.3402516 2.2430818 [40,] 3.4597484 -10.3402516 [41,] -2.3083019 3.4597484 [42,] -5.8483019 -2.3083019 [43,] -0.3883019 -5.8483019 [44,] -1.4483019 -0.3883019 [45,] -2.5683019 -1.4483019 [46,] 6.2116981 -2.5683019 [47,] 0.4516981 6.2116981 [48,] 2.4097484 0.4516981 [49,] 0.9930818 2.4097484 [50,] 5.4430818 0.9930818 [51,] -6.4402516 5.4430818 [52,] 1.9597484 -6.4402516 [53,] -1.2083019 1.9597484 [54,] 0.5516981 -1.2083019 [55,] 4.2116981 0.5516981 [56,] -6.3483019 4.2116981 [57,] 6.9316981 -6.3483019 [58,] 3.1116981 6.9316981 [59,] -4.7483019 3.1116981 [60,] 9.5097484 -4.7483019 [61,] 9.0930818 9.5097484 [62,] -15.1569182 9.0930818 [63,] 10.5597484 -15.1569182 [64,] 2.0597484 10.5597484 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 0.3402516 1.6569182 2 6.5902516 0.3402516 3 3.7069182 6.5902516 4 0.2069182 3.7069182 5 -1.4611321 0.2069182 6 9.6988679 -1.4611321 7 -5.0411321 9.6988679 8 6.2988679 -5.0411321 9 6.8788679 6.2988679 10 -4.9411321 6.8788679 11 -1.0011321 -4.9411321 12 1.6569182 -1.0011321 13 1.5402516 1.6569182 14 10.0902516 1.5402516 15 -1.0930818 10.0902516 16 -4.5930818 -1.0930818 17 2.6388679 -4.5930818 18 0.2988679 2.6388679 19 0.2588679 0.2988679 20 0.8988679 0.2588679 21 -2.1211321 0.8988679 22 -3.4411321 -2.1211321 23 4.2988679 -3.4411321 24 -9.1430818 4.2988679 25 -5.6597484 -9.1430818 26 -9.2097484 -5.6597484 27 3.6069182 -9.2097484 28 -3.0930818 3.6069182 29 2.3388679 -3.0930818 30 -4.7011321 2.3388679 31 0.9588679 -4.7011321 32 0.5988679 0.9588679 33 -9.1211321 0.5988679 34 -0.9411321 -9.1211321 35 0.9988679 -0.9411321 36 -6.0902516 0.9988679 37 -6.3069182 -6.0902516 38 2.2430818 -6.3069182 39 -10.3402516 2.2430818 40 3.4597484 -10.3402516 41 -2.3083019 3.4597484 42 -5.8483019 -2.3083019 43 -0.3883019 -5.8483019 44 -1.4483019 -0.3883019 45 -2.5683019 -1.4483019 46 6.2116981 -2.5683019 47 0.4516981 6.2116981 48 2.4097484 0.4516981 49 0.9930818 2.4097484 50 5.4430818 0.9930818 51 -6.4402516 5.4430818 52 1.9597484 -6.4402516 53 -1.2083019 1.9597484 54 0.5516981 -1.2083019 55 4.2116981 0.5516981 56 -6.3483019 4.2116981 57 6.9316981 -6.3483019 58 3.1116981 6.9316981 59 -4.7483019 3.1116981 60 9.5097484 -4.7483019 61 9.0930818 9.5097484 62 -15.1569182 9.0930818 63 10.5597484 -15.1569182 64 2.0597484 10.5597484 > 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/757t11229032645.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/8ogrz1229032645.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/91wcc1229032645.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/1017ks1229032645.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/1120pg1229032645.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/12v1il1229032645.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/13n79o1229032645.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/1483cc1229032646.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/152hk91229032646.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/163tmo1229032646.tab") + } > > system("convert tmp/197rk1229032645.ps tmp/197rk1229032645.png") > system("convert tmp/27w2v1229032645.ps tmp/27w2v1229032645.png") > system("convert tmp/3905z1229032645.ps tmp/3905z1229032645.png") > system("convert tmp/4gbrx1229032645.ps tmp/4gbrx1229032645.png") > system("convert tmp/5sfnh1229032645.ps tmp/5sfnh1229032645.png") > system("convert tmp/60zpq1229032645.ps tmp/60zpq1229032645.png") > system("convert tmp/757t11229032645.ps tmp/757t11229032645.png") > system("convert tmp/8ogrz1229032645.ps tmp/8ogrz1229032645.png") > system("convert tmp/91wcc1229032645.ps tmp/91wcc1229032645.png") > system("convert tmp/1017ks1229032645.ps tmp/1017ks1229032645.png") > > > proc.time() user system elapsed 5.352 2.775 5.742