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(8.1 + ,10.9 + ,115.6 + ,92.9 + ,7.7 + ,10 + ,127.1 + ,107.7 + ,7.5 + ,9.2 + ,123 + ,103.5 + ,7.6 + ,9.2 + ,122.2 + ,91.1 + ,7.8 + ,9.5 + ,126.4 + ,79.8 + ,7.8 + ,9.6 + ,112.7 + ,71.9 + ,7.8 + ,9.5 + ,105.8 + ,82.9 + ,7.5 + ,9.1 + ,120.9 + ,90.1 + ,7.5 + ,8.9 + ,116.3 + ,100.7 + ,7.1 + ,9 + ,115.7 + ,90.7 + ,7.5 + ,10.1 + ,127.9 + ,108.8 + ,7.5 + ,10.3 + ,108.3 + ,44.1 + ,7.6 + ,10.2 + ,121.1 + ,93.6 + ,7.7 + ,9.6 + ,128.6 + ,107.4 + ,7.7 + ,9.2 + ,123.1 + ,96.5 + ,7.9 + ,9.3 + ,127.7 + ,93.6 + ,8.1 + ,9.4 + ,126.6 + ,76.5 + ,8.2 + ,9.4 + ,118.4 + ,76.7 + ,8.2 + ,9.2 + ,110 + ,84 + ,8.2 + ,9 + ,129.6 + ,103.3 + ,7.9 + ,9 + ,115.8 + ,88.5 + ,7.3 + ,9 + ,125.9 + ,99 + ,6.9 + ,9.8 + ,128.4 + ,105.9 + ,6.6 + ,10 + ,114 + ,44.7 + ,6.7 + ,9.8 + ,125.6 + ,94 + ,6.9 + ,9.3 + ,128.5 + ,107.1 + ,7 + ,9 + ,136.6 + ,104.8 + ,7.1 + ,9 + ,133.1 + ,102.5 + ,7.2 + ,9.1 + ,124.6 + ,77.7 + ,7.1 + ,9.1 + ,123.5 + ,85.2 + ,6.9 + ,9.1 + ,117.2 + ,91.3 + ,7 + ,9.2 + ,135.5 + ,106.5 + ,6.8 + ,8.8 + ,124.8 + ,92.4 + ,6.4 + ,8.3 + ,127.8 + ,97.5 + ,6.7 + ,8.4 + ,133.1 + ,107 + ,6.6 + ,8.1 + ,125.7 + ,51.1 + ,6.4 + ,7.7 + ,128.4 + ,98.6 + ,6.3 + ,7.9 + ,131.9 + ,102.2 + ,6.2 + ,7.9 + ,146.3 + ,114.3 + ,6.5 + ,8 + ,140.6 + ,99.4 + ,6.8 + ,7.9 + ,129.5 + ,72.5 + ,6.8 + ,7.6 + ,132.4 + ,92.3 + ,6.4 + ,7.1 + ,125.9 + ,99.4 + ,6.1 + ,6.8 + ,126.9 + ,85.9 + ,5.8 + ,6.5 + ,135.8 + ,109.4 + ,6.1 + ,6.9 + ,129.5 + ,97.6 + ,7.2 + ,8.2 + ,130.2 + ,104.7 + ,7.3 + ,8.7 + ,133.8 + ,56.9 + ,6.9 + ,8.3 + ,123.3 + ,86.7 + ,6.1 + ,7.9 + ,140.7 + ,108.5 + ,5.8 + ,7.5 + ,145.9 + ,103.4 + ,6.2 + ,7.8 + ,128.5 + ,86.2 + ,7.1 + ,8.3 + ,135.9 + ,71 + ,7.7 + ,8.4 + ,120.2 + ,75.9 + ,7.9 + ,8.2 + ,119.2 + ,87.1 + ,7.7 + ,7.7 + ,132.5 + ,102 + ,7.4 + ,7.2 + ,130.5 + ,88.5 + ,7.5 + ,7.3 + ,124.8 + ,87.8 + ,8 + ,8.1 + ,136.7 + ,100.8 + ,8.1 + ,8.5 + ,129.2 + ,50.6 + ,8 + ,8.4 + ,127.9 + ,85.9) + ,dim=c(4 + ,61) + ,dimnames=list(c('mannen' + ,'vrouwen' + ,'voeding' + ,'bouw') + ,1:61)) > y <- array(NA,dim=c(4,61),dimnames=list(c('mannen','vrouwen','voeding','bouw'),1:61)) > 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 = '4' > #'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 bouw mannen vrouwen voeding M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 1 92.9 8.1 10.9 115.6 1 0 0 0 0 0 0 0 0 0 0 2 107.7 7.7 10.0 127.1 0 1 0 0 0 0 0 0 0 0 0 3 103.5 7.5 9.2 123.0 0 0 1 0 0 0 0 0 0 0 0 4 91.1 7.6 9.2 122.2 0 0 0 1 0 0 0 0 0 0 0 5 79.8 7.8 9.5 126.4 0 0 0 0 1 0 0 0 0 0 0 6 71.9 7.8 9.6 112.7 0 0 0 0 0 1 0 0 0 0 0 7 82.9 7.8 9.5 105.8 0 0 0 0 0 0 1 0 0 0 0 8 90.1 7.5 9.1 120.9 0 0 0 0 0 0 0 1 0 0 0 9 100.7 7.5 8.9 116.3 0 0 0 0 0 0 0 0 1 0 0 10 90.7 7.1 9.0 115.7 0 0 0 0 0 0 0 0 0 1 0 11 108.8 7.5 10.1 127.9 0 0 0 0 0 0 0 0 0 0 1 12 44.1 7.5 10.3 108.3 0 0 0 0 0 0 0 0 0 0 0 13 93.6 7.6 10.2 121.1 1 0 0 0 0 0 0 0 0 0 0 14 107.4 7.7 9.6 128.6 0 1 0 0 0 0 0 0 0 0 0 15 96.5 7.7 9.2 123.1 0 0 1 0 0 0 0 0 0 0 0 16 93.6 7.9 9.3 127.7 0 0 0 1 0 0 0 0 0 0 0 17 76.5 8.1 9.4 126.6 0 0 0 0 1 0 0 0 0 0 0 18 76.7 8.2 9.4 118.4 0 0 0 0 0 1 0 0 0 0 0 19 84.0 8.2 9.2 110.0 0 0 0 0 0 0 1 0 0 0 0 20 103.3 8.2 9.0 129.6 0 0 0 0 0 0 0 1 0 0 0 21 88.5 7.9 9.0 115.8 0 0 0 0 0 0 0 0 1 0 0 22 99.0 7.3 9.0 125.9 0 0 0 0 0 0 0 0 0 1 0 23 105.9 6.9 9.8 128.4 0 0 0 0 0 0 0 0 0 0 1 24 44.7 6.6 10.0 114.0 0 0 0 0 0 0 0 0 0 0 0 25 94.0 6.7 9.8 125.6 1 0 0 0 0 0 0 0 0 0 0 26 107.1 6.9 9.3 128.5 0 1 0 0 0 0 0 0 0 0 0 27 104.8 7.0 9.0 136.6 0 0 1 0 0 0 0 0 0 0 0 28 102.5 7.1 9.0 133.1 0 0 0 1 0 0 0 0 0 0 0 29 77.7 7.2 9.1 124.6 0 0 0 0 1 0 0 0 0 0 0 30 85.2 7.1 9.1 123.5 0 0 0 0 0 1 0 0 0 0 0 31 91.3 6.9 9.1 117.2 0 0 0 0 0 0 1 0 0 0 0 32 106.5 7.0 9.2 135.5 0 0 0 0 0 0 0 1 0 0 0 33 92.4 6.8 8.8 124.8 0 0 0 0 0 0 0 0 1 0 0 34 97.5 6.4 8.3 127.8 0 0 0 0 0 0 0 0 0 1 0 35 107.0 6.7 8.4 133.1 0 0 0 0 0 0 0 0 0 0 1 36 51.1 6.6 8.1 125.7 0 0 0 0 0 0 0 0 0 0 0 37 98.6 6.4 7.7 128.4 1 0 0 0 0 0 0 0 0 0 0 38 102.2 6.3 7.9 131.9 0 1 0 0 0 0 0 0 0 0 0 39 114.3 6.2 7.9 146.3 0 0 1 0 0 0 0 0 0 0 0 40 99.4 6.5 8.0 140.6 0 0 0 1 0 0 0 0 0 0 0 41 72.5 6.8 7.9 129.5 0 0 0 0 1 0 0 0 0 0 0 42 92.3 6.8 7.6 132.4 0 0 0 0 0 1 0 0 0 0 0 43 99.4 6.4 7.1 125.9 0 0 0 0 0 0 1 0 0 0 0 44 85.9 6.1 6.8 126.9 0 0 0 0 0 0 0 1 0 0 0 45 109.4 5.8 6.5 135.8 0 0 0 0 0 0 0 0 1 0 0 46 97.6 6.1 6.9 129.5 0 0 0 0 0 0 0 0 0 1 0 47 104.7 7.2 8.2 130.2 0 0 0 0 0 0 0 0 0 0 1 48 56.9 7.3 8.7 133.8 0 0 0 0 0 0 0 0 0 0 0 49 86.7 6.9 8.3 123.3 1 0 0 0 0 0 0 0 0 0 0 50 108.5 6.1 7.9 140.7 0 1 0 0 0 0 0 0 0 0 0 51 103.4 5.8 7.5 145.9 0 0 1 0 0 0 0 0 0 0 0 52 86.2 6.2 7.8 128.5 0 0 0 1 0 0 0 0 0 0 0 53 71.0 7.1 8.3 135.9 0 0 0 0 1 0 0 0 0 0 0 54 75.9 7.7 8.4 120.2 0 0 0 0 0 1 0 0 0 0 0 55 87.1 7.9 8.2 119.2 0 0 0 0 0 0 1 0 0 0 0 56 102.0 7.7 7.7 132.5 0 0 0 0 0 0 0 1 0 0 0 57 88.5 7.4 7.2 130.5 0 0 0 0 0 0 0 0 1 0 0 58 87.8 7.5 7.3 124.8 0 0 0 0 0 0 0 0 0 1 0 59 100.8 8.0 8.1 136.7 0 0 0 0 0 0 0 0 0 0 1 60 50.6 8.1 8.5 129.2 0 0 0 0 0 0 0 0 0 0 0 61 85.9 8.0 8.4 127.9 1 0 0 0 0 0 0 0 0 0 0 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) mannen vrouwen voeding M1 M2 -70.0163 -1.8100 4.0886 0.7797 41.0589 50.1873 M3 M4 M5 M6 M7 M8 46.6575 40.2622 22.5007 33.2821 47.0328 45.9679 M9 M10 M11 48.5163 46.6146 49.7862 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -8.52684 -2.47033 -0.04297 1.82217 8.94188 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) -70.0163 23.6218 -2.964 0.004797 ** mannen -1.8100 1.1742 -1.542 0.130044 vrouwen 4.0886 1.0207 4.006 0.000224 *** voeding 0.7797 0.1279 6.095 2.08e-07 *** M1 41.0589 2.7591 14.881 < 2e-16 *** M2 50.1873 3.0534 16.436 < 2e-16 *** M3 46.6575 3.1485 14.819 < 2e-16 *** M4 40.2622 2.9810 13.506 < 2e-16 *** M5 22.5007 2.9758 7.561 1.32e-09 *** M6 33.2821 2.9261 11.374 5.80e-15 *** M7 47.0328 3.1295 15.029 < 2e-16 *** M8 45.9679 2.9840 15.405 < 2e-16 *** M9 48.5163 2.9909 16.221 < 2e-16 *** M10 46.6146 2.9707 15.692 < 2e-16 *** M11 49.7862 3.0604 16.268 < 2e-16 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 4.536 on 46 degrees of freedom Multiple R-squared: 0.9405, Adjusted R-squared: 0.9223 F-statistic: 51.9 on 14 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.25882608 0.51765216 0.7411739 [2,] 0.13147794 0.26295588 0.8685221 [3,] 0.17095622 0.34191245 0.8290438 [4,] 0.36595550 0.73191101 0.6340445 [5,] 0.31604517 0.63209033 0.6839548 [6,] 0.24229138 0.48458277 0.7577086 [7,] 0.19819865 0.39639731 0.8018013 [8,] 0.13662607 0.27325215 0.8633739 [9,] 0.10246131 0.20492263 0.8975387 [10,] 0.08685476 0.17370952 0.9131452 [11,] 0.13369887 0.26739774 0.8663011 [12,] 0.21967013 0.43934026 0.7803299 [13,] 0.21327187 0.42654373 0.7867281 [14,] 0.14591896 0.29183792 0.8540810 [15,] 0.09513545 0.19027091 0.9048645 [16,] 0.13054966 0.26109932 0.8694503 [17,] 0.08511567 0.17023135 0.9148843 [18,] 0.05170278 0.10340556 0.9482972 [19,] 0.02930997 0.05861994 0.9706900 [20,] 0.02971330 0.05942661 0.9702867 [21,] 0.02658809 0.05317619 0.9734119 [22,] 0.03581727 0.07163455 0.9641827 [23,] 0.02056086 0.04112171 0.9794391 [24,] 0.05027197 0.10054393 0.9497280 [25,] 0.03743779 0.07487559 0.9625622 [26,] 0.02318782 0.04637564 0.9768122 > postscript(file="/var/www/html/rcomp/tmp/1sowk1258714878.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/29dx51258714878.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/331h61258714878.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/4a90z1258714878.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/56sny1258714878.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 = 61 Frequency = 1 1 2 3 4 5 6 1.82217357 1.48316778 6.91849779 1.71855495 4.04084648 -4.36788132 7 8 9 10 11 12 -1.32988222 -3.74576183 8.71010875 -0.05320958 1.58960599 1.13983398 13 14 15 16 17 18 0.19092281 1.64908102 0.20253746 0.06446854 1.53678026 -2.47032504 19 20 21 22 23 24 -1.55394776 4.34690787 -2.78489426 0.65606280 -1.55968208 -3.10680122 25 26 27 28 29 30 -2.91123818 1.20559324 -2.47245181 4.53274116 3.89368052 1.28884007 31 32 33 34 35 36 -1.81183472 -0.04296621 -7.07533915 -1.09235552 1.23783057 1.93925102 37 38 39 40 41 42 7.54867050 -1.70732550 2.51406338 -1.41229844 -0.94446703 7.03955149 43 44 45 46 47 48 6.77709644 -5.75415445 8.94188389 2.86319309 2.92163807 0.23772068 49 50 51 52 53 54 -1.92309243 -2.63051653 -7.16264682 -4.90346621 -8.52684023 -1.49018520 55 56 57 58 59 60 -2.08143174 5.19597463 -7.79175923 -2.37369079 -4.18939256 -0.21000446 61 -4.72743628 > postscript(file="/var/www/html/rcomp/tmp/6hlnw1258714878.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 = 61 Frequency = 1 lag(myerror, k = 1) myerror 0 1.82217357 NA 1 1.48316778 1.82217357 2 6.91849779 1.48316778 3 1.71855495 6.91849779 4 4.04084648 1.71855495 5 -4.36788132 4.04084648 6 -1.32988222 -4.36788132 7 -3.74576183 -1.32988222 8 8.71010875 -3.74576183 9 -0.05320958 8.71010875 10 1.58960599 -0.05320958 11 1.13983398 1.58960599 12 0.19092281 1.13983398 13 1.64908102 0.19092281 14 0.20253746 1.64908102 15 0.06446854 0.20253746 16 1.53678026 0.06446854 17 -2.47032504 1.53678026 18 -1.55394776 -2.47032504 19 4.34690787 -1.55394776 20 -2.78489426 4.34690787 21 0.65606280 -2.78489426 22 -1.55968208 0.65606280 23 -3.10680122 -1.55968208 24 -2.91123818 -3.10680122 25 1.20559324 -2.91123818 26 -2.47245181 1.20559324 27 4.53274116 -2.47245181 28 3.89368052 4.53274116 29 1.28884007 3.89368052 30 -1.81183472 1.28884007 31 -0.04296621 -1.81183472 32 -7.07533915 -0.04296621 33 -1.09235552 -7.07533915 34 1.23783057 -1.09235552 35 1.93925102 1.23783057 36 7.54867050 1.93925102 37 -1.70732550 7.54867050 38 2.51406338 -1.70732550 39 -1.41229844 2.51406338 40 -0.94446703 -1.41229844 41 7.03955149 -0.94446703 42 6.77709644 7.03955149 43 -5.75415445 6.77709644 44 8.94188389 -5.75415445 45 2.86319309 8.94188389 46 2.92163807 2.86319309 47 0.23772068 2.92163807 48 -1.92309243 0.23772068 49 -2.63051653 -1.92309243 50 -7.16264682 -2.63051653 51 -4.90346621 -7.16264682 52 -8.52684023 -4.90346621 53 -1.49018520 -8.52684023 54 -2.08143174 -1.49018520 55 5.19597463 -2.08143174 56 -7.79175923 5.19597463 57 -2.37369079 -7.79175923 58 -4.18939256 -2.37369079 59 -0.21000446 -4.18939256 60 -4.72743628 -0.21000446 61 NA -4.72743628 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] 1.48316778 1.82217357 [2,] 6.91849779 1.48316778 [3,] 1.71855495 6.91849779 [4,] 4.04084648 1.71855495 [5,] -4.36788132 4.04084648 [6,] -1.32988222 -4.36788132 [7,] -3.74576183 -1.32988222 [8,] 8.71010875 -3.74576183 [9,] -0.05320958 8.71010875 [10,] 1.58960599 -0.05320958 [11,] 1.13983398 1.58960599 [12,] 0.19092281 1.13983398 [13,] 1.64908102 0.19092281 [14,] 0.20253746 1.64908102 [15,] 0.06446854 0.20253746 [16,] 1.53678026 0.06446854 [17,] -2.47032504 1.53678026 [18,] -1.55394776 -2.47032504 [19,] 4.34690787 -1.55394776 [20,] -2.78489426 4.34690787 [21,] 0.65606280 -2.78489426 [22,] -1.55968208 0.65606280 [23,] -3.10680122 -1.55968208 [24,] -2.91123818 -3.10680122 [25,] 1.20559324 -2.91123818 [26,] -2.47245181 1.20559324 [27,] 4.53274116 -2.47245181 [28,] 3.89368052 4.53274116 [29,] 1.28884007 3.89368052 [30,] -1.81183472 1.28884007 [31,] -0.04296621 -1.81183472 [32,] -7.07533915 -0.04296621 [33,] -1.09235552 -7.07533915 [34,] 1.23783057 -1.09235552 [35,] 1.93925102 1.23783057 [36,] 7.54867050 1.93925102 [37,] -1.70732550 7.54867050 [38,] 2.51406338 -1.70732550 [39,] -1.41229844 2.51406338 [40,] -0.94446703 -1.41229844 [41,] 7.03955149 -0.94446703 [42,] 6.77709644 7.03955149 [43,] -5.75415445 6.77709644 [44,] 8.94188389 -5.75415445 [45,] 2.86319309 8.94188389 [46,] 2.92163807 2.86319309 [47,] 0.23772068 2.92163807 [48,] -1.92309243 0.23772068 [49,] -2.63051653 -1.92309243 [50,] -7.16264682 -2.63051653 [51,] -4.90346621 -7.16264682 [52,] -8.52684023 -4.90346621 [53,] -1.49018520 -8.52684023 [54,] -2.08143174 -1.49018520 [55,] 5.19597463 -2.08143174 [56,] -7.79175923 5.19597463 [57,] -2.37369079 -7.79175923 [58,] -4.18939256 -2.37369079 [59,] -0.21000446 -4.18939256 [60,] -4.72743628 -0.21000446 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 1.48316778 1.82217357 2 6.91849779 1.48316778 3 1.71855495 6.91849779 4 4.04084648 1.71855495 5 -4.36788132 4.04084648 6 -1.32988222 -4.36788132 7 -3.74576183 -1.32988222 8 8.71010875 -3.74576183 9 -0.05320958 8.71010875 10 1.58960599 -0.05320958 11 1.13983398 1.58960599 12 0.19092281 1.13983398 13 1.64908102 0.19092281 14 0.20253746 1.64908102 15 0.06446854 0.20253746 16 1.53678026 0.06446854 17 -2.47032504 1.53678026 18 -1.55394776 -2.47032504 19 4.34690787 -1.55394776 20 -2.78489426 4.34690787 21 0.65606280 -2.78489426 22 -1.55968208 0.65606280 23 -3.10680122 -1.55968208 24 -2.91123818 -3.10680122 25 1.20559324 -2.91123818 26 -2.47245181 1.20559324 27 4.53274116 -2.47245181 28 3.89368052 4.53274116 29 1.28884007 3.89368052 30 -1.81183472 1.28884007 31 -0.04296621 -1.81183472 32 -7.07533915 -0.04296621 33 -1.09235552 -7.07533915 34 1.23783057 -1.09235552 35 1.93925102 1.23783057 36 7.54867050 1.93925102 37 -1.70732550 7.54867050 38 2.51406338 -1.70732550 39 -1.41229844 2.51406338 40 -0.94446703 -1.41229844 41 7.03955149 -0.94446703 42 6.77709644 7.03955149 43 -5.75415445 6.77709644 44 8.94188389 -5.75415445 45 2.86319309 8.94188389 46 2.92163807 2.86319309 47 0.23772068 2.92163807 48 -1.92309243 0.23772068 49 -2.63051653 -1.92309243 50 -7.16264682 -2.63051653 51 -4.90346621 -7.16264682 52 -8.52684023 -4.90346621 53 -1.49018520 -8.52684023 54 -2.08143174 -1.49018520 55 5.19597463 -2.08143174 56 -7.79175923 5.19597463 57 -2.37369079 -7.79175923 58 -4.18939256 -2.37369079 59 -0.21000446 -4.18939256 60 -4.72743628 -0.21000446 > 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/7rtpk1258714878.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/83cw51258714878.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/9s6co1258714878.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/10nf4x1258714878.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/11rcx11258714878.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/12glnh1258714878.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/13mpby1258714878.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/144d661258714878.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/15uxum1258714878.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/165fy91258714878.tab") + } > > system("convert tmp/1sowk1258714878.ps tmp/1sowk1258714878.png") > system("convert tmp/29dx51258714878.ps tmp/29dx51258714878.png") > system("convert tmp/331h61258714878.ps tmp/331h61258714878.png") > system("convert tmp/4a90z1258714878.ps tmp/4a90z1258714878.png") > system("convert tmp/56sny1258714878.ps tmp/56sny1258714878.png") > system("convert tmp/6hlnw1258714878.ps tmp/6hlnw1258714878.png") > system("convert tmp/7rtpk1258714878.ps tmp/7rtpk1258714878.png") > system("convert tmp/83cw51258714878.ps tmp/83cw51258714878.png") > system("convert tmp/9s6co1258714878.ps tmp/9s6co1258714878.png") > system("convert tmp/10nf4x1258714878.ps tmp/10nf4x1258714878.png") > > > proc.time() user system elapsed 2.386 1.521 2.805