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(16643 + ,16196.7 + ,18252.1 + ,17570.4 + ,89.1 + ,17729 + ,16643 + ,16196.7 + ,18252.1 + ,82.6 + ,16446.1 + ,17729 + ,16643 + ,16196.7 + ,102.7 + ,15993.8 + ,16446.1 + ,17729 + ,16643 + ,91.8 + ,16373.5 + ,15993.8 + ,16446.1 + ,17729 + ,94.1 + ,17842.2 + ,16373.5 + ,15993.8 + ,16446.1 + ,103.1 + ,22321.5 + ,17842.2 + ,16373.5 + ,15993.8 + ,93.2 + ,22786.7 + ,22321.5 + ,17842.2 + ,16373.5 + ,91 + ,18274.1 + ,22786.7 + ,22321.5 + ,17842.2 + ,94.3 + ,22392.9 + ,18274.1 + ,22786.7 + ,22321.5 + ,99.4 + ,23899.3 + ,22392.9 + ,18274.1 + ,22786.7 + ,115.7 + ,21343.5 + ,23899.3 + ,22392.9 + ,18274.1 + ,116.8 + ,22952.3 + ,21343.5 + ,23899.3 + ,22392.9 + ,99.8 + ,21374.4 + ,22952.3 + ,21343.5 + ,23899.3 + ,96 + ,21164.1 + ,21374.4 + ,22952.3 + ,21343.5 + ,115.9 + ,20906.5 + ,21164.1 + ,21374.4 + ,22952.3 + ,109.1 + ,17877.4 + ,20906.5 + ,21164.1 + ,21374.4 + ,117.3 + ,20664.3 + ,17877.4 + ,20906.5 + ,21164.1 + ,109.8 + ,22160 + ,20664.3 + ,17877.4 + ,20906.5 + ,112.8 + ,19813.6 + ,22160 + ,20664.3 + ,17877.4 + ,110.7 + ,17735.4 + ,19813.6 + ,22160 + ,20664.3 + ,100 + ,19640.2 + ,17735.4 + ,19813.6 + ,22160 + ,113.3 + ,20844.4 + ,19640.2 + ,17735.4 + ,19813.6 + ,122.4 + ,19823.1 + ,20844.4 + ,19640.2 + ,17735.4 + ,112.5 + ,18594.6 + ,19823.1 + ,20844.4 + ,19640.2 + ,104.2 + ,21350.6 + ,18594.6 + ,19823.1 + ,20844.4 + ,92.5 + ,18574.1 + ,21350.6 + ,18594.6 + ,19823.1 + ,117.2 + ,18924.2 + ,18574.1 + ,21350.6 + ,18594.6 + ,109.3 + ,17343.4 + ,18924.2 + ,18574.1 + ,21350.6 + ,106.1 + ,19961.2 + ,17343.4 + ,18924.2 + ,18574.1 + ,118.8 + ,19932.1 + ,19961.2 + ,17343.4 + ,18924.2 + ,105.3 + ,19464.6 + ,19932.1 + ,19961.2 + ,17343.4 + ,106 + ,16165.4 + ,19464.6 + ,19932.1 + ,19961.2 + ,102 + ,17574.9 + ,16165.4 + ,19464.6 + ,19932.1 + ,112.9 + ,19795.4 + ,17574.9 + ,16165.4 + ,19464.6 + ,116.5 + ,19439.5 + ,19795.4 + ,17574.9 + ,16165.4 + ,114.8 + ,17170 + ,19439.5 + ,19795.4 + ,17574.9 + ,100.5 + ,21072.4 + ,17170 + ,19439.5 + ,19795.4 + ,85.4 + ,17751.8 + ,21072.4 + ,17170 + ,19439.5 + ,114.6 + ,17515.5 + ,17751.8 + ,21072.4 + ,17170 + ,109.9 + ,18040.3 + ,17515.5 + ,17751.8 + ,21072.4 + ,100.7 + ,19090.1 + ,18040.3 + ,17515.5 + ,17751.8 + ,115.5 + ,17746.5 + ,19090.1 + ,18040.3 + ,17515.5 + ,100.7 + ,19202.1 + ,17746.5 + ,19090.1 + ,18040.3 + ,99 + ,15141.6 + ,19202.1 + ,17746.5 + ,19090.1 + ,102.3 + ,16258.1 + ,15141.6 + ,19202.1 + ,17746.5 + ,108.8 + ,18586.5 + ,16258.1 + ,15141.6 + ,19202.1 + ,105.9 + ,17209.4 + ,18586.5 + ,16258.1 + ,15141.6 + ,113.2 + ,17838.7 + ,17209.4 + ,18586.5 + ,16258.1 + ,95.7 + ,19123.5 + ,17838.7 + ,17209.4 + ,18586.5 + ,80.9 + ,16583.6 + ,19123.5 + ,17838.7 + ,17209.4 + ,113.9 + ,15991.2 + ,16583.6 + ,19123.5 + ,17838.7 + ,98.1 + ,16704.4 + ,15991.2 + ,16583.6 + ,19123.5 + ,102.8 + ,17420.4 + ,16704.4 + ,15991.2 + ,16583.6 + ,104.7 + ,17872 + ,17420.4 + ,16704.4 + ,15991.2 + ,95.9 + ,17823.2 + ,17872 + ,17420.4 + ,16704.4 + ,94.6) + ,dim=c(5 + ,56) + ,dimnames=list(c('uitvoer' + ,'uitvoer1' + ,'uitvoer2' + ,'uitvoer3' + ,'indproc') + ,1:56)) > y <- array(NA,dim=c(5,56),dimnames=list(c('uitvoer','uitvoer1','uitvoer2','uitvoer3','indproc'),1:56)) > 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 uitvoer uitvoer1 uitvoer2 uitvoer3 indproc M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 1 16643.0 16196.7 18252.1 17570.4 89.1 1 0 0 0 0 0 0 0 0 0 2 17729.0 16643.0 16196.7 18252.1 82.6 0 1 0 0 0 0 0 0 0 0 3 16446.1 17729.0 16643.0 16196.7 102.7 0 0 1 0 0 0 0 0 0 0 4 15993.8 16446.1 17729.0 16643.0 91.8 0 0 0 1 0 0 0 0 0 0 5 16373.5 15993.8 16446.1 17729.0 94.1 0 0 0 0 1 0 0 0 0 0 6 17842.2 16373.5 15993.8 16446.1 103.1 0 0 0 0 0 1 0 0 0 0 7 22321.5 17842.2 16373.5 15993.8 93.2 0 0 0 0 0 0 1 0 0 0 8 22786.7 22321.5 17842.2 16373.5 91.0 0 0 0 0 0 0 0 1 0 0 9 18274.1 22786.7 22321.5 17842.2 94.3 0 0 0 0 0 0 0 0 1 0 10 22392.9 18274.1 22786.7 22321.5 99.4 0 0 0 0 0 0 0 0 0 1 11 23899.3 22392.9 18274.1 22786.7 115.7 0 0 0 0 0 0 0 0 0 0 12 21343.5 23899.3 22392.9 18274.1 116.8 0 0 0 0 0 0 0 0 0 0 13 22952.3 21343.5 23899.3 22392.9 99.8 1 0 0 0 0 0 0 0 0 0 14 21374.4 22952.3 21343.5 23899.3 96.0 0 1 0 0 0 0 0 0 0 0 15 21164.1 21374.4 22952.3 21343.5 115.9 0 0 1 0 0 0 0 0 0 0 16 20906.5 21164.1 21374.4 22952.3 109.1 0 0 0 1 0 0 0 0 0 0 17 17877.4 20906.5 21164.1 21374.4 117.3 0 0 0 0 1 0 0 0 0 0 18 20664.3 17877.4 20906.5 21164.1 109.8 0 0 0 0 0 1 0 0 0 0 19 22160.0 20664.3 17877.4 20906.5 112.8 0 0 0 0 0 0 1 0 0 0 20 19813.6 22160.0 20664.3 17877.4 110.7 0 0 0 0 0 0 0 1 0 0 21 17735.4 19813.6 22160.0 20664.3 100.0 0 0 0 0 0 0 0 0 1 0 22 19640.2 17735.4 19813.6 22160.0 113.3 0 0 0 0 0 0 0 0 0 1 23 20844.4 19640.2 17735.4 19813.6 122.4 0 0 0 0 0 0 0 0 0 0 24 19823.1 20844.4 19640.2 17735.4 112.5 0 0 0 0 0 0 0 0 0 0 25 18594.6 19823.1 20844.4 19640.2 104.2 1 0 0 0 0 0 0 0 0 0 26 21350.6 18594.6 19823.1 20844.4 92.5 0 1 0 0 0 0 0 0 0 0 27 18574.1 21350.6 18594.6 19823.1 117.2 0 0 1 0 0 0 0 0 0 0 28 18924.2 18574.1 21350.6 18594.6 109.3 0 0 0 1 0 0 0 0 0 0 29 17343.4 18924.2 18574.1 21350.6 106.1 0 0 0 0 1 0 0 0 0 0 30 19961.2 17343.4 18924.2 18574.1 118.8 0 0 0 0 0 1 0 0 0 0 31 19932.1 19961.2 17343.4 18924.2 105.3 0 0 0 0 0 0 1 0 0 0 32 19464.6 19932.1 19961.2 17343.4 106.0 0 0 0 0 0 0 0 1 0 0 33 16165.4 19464.6 19932.1 19961.2 102.0 0 0 0 0 0 0 0 0 1 0 34 17574.9 16165.4 19464.6 19932.1 112.9 0 0 0 0 0 0 0 0 0 1 35 19795.4 17574.9 16165.4 19464.6 116.5 0 0 0 0 0 0 0 0 0 0 36 19439.5 19795.4 17574.9 16165.4 114.8 0 0 0 0 0 0 0 0 0 0 37 17170.0 19439.5 19795.4 17574.9 100.5 1 0 0 0 0 0 0 0 0 0 38 21072.4 17170.0 19439.5 19795.4 85.4 0 1 0 0 0 0 0 0 0 0 39 17751.8 21072.4 17170.0 19439.5 114.6 0 0 1 0 0 0 0 0 0 0 40 17515.5 17751.8 21072.4 17170.0 109.9 0 0 0 1 0 0 0 0 0 0 41 18040.3 17515.5 17751.8 21072.4 100.7 0 0 0 0 1 0 0 0 0 0 42 19090.1 18040.3 17515.5 17751.8 115.5 0 0 0 0 0 1 0 0 0 0 43 17746.5 19090.1 18040.3 17515.5 100.7 0 0 0 0 0 0 1 0 0 0 44 19202.1 17746.5 19090.1 18040.3 99.0 0 0 0 0 0 0 0 1 0 0 45 15141.6 19202.1 17746.5 19090.1 102.3 0 0 0 0 0 0 0 0 1 0 46 16258.1 15141.6 19202.1 17746.5 108.8 0 0 0 0 0 0 0 0 0 1 47 18586.5 16258.1 15141.6 19202.1 105.9 0 0 0 0 0 0 0 0 0 0 48 17209.4 18586.5 16258.1 15141.6 113.2 0 0 0 0 0 0 0 0 0 0 49 17838.7 17209.4 18586.5 16258.1 95.7 1 0 0 0 0 0 0 0 0 0 50 19123.5 17838.7 17209.4 18586.5 80.9 0 1 0 0 0 0 0 0 0 0 51 16583.6 19123.5 17838.7 17209.4 113.9 0 0 1 0 0 0 0 0 0 0 52 15991.2 16583.6 19123.5 17838.7 98.1 0 0 0 1 0 0 0 0 0 0 53 16704.4 15991.2 16583.6 19123.5 102.8 0 0 0 0 1 0 0 0 0 0 54 17420.4 16704.4 15991.2 16583.6 104.7 0 0 0 0 0 1 0 0 0 0 55 17872.0 17420.4 16704.4 15991.2 95.9 0 0 0 0 0 0 1 0 0 0 56 17823.2 17872.0 17420.4 16704.4 94.6 0 0 0 0 0 0 0 1 0 0 M11 t 1 0 1 2 0 2 3 0 3 4 0 4 5 0 5 6 0 6 7 0 7 8 0 8 9 0 9 10 0 10 11 1 11 12 0 12 13 0 13 14 0 14 15 0 15 16 0 16 17 0 17 18 0 18 19 0 19 20 0 20 21 0 21 22 0 22 23 1 23 24 0 24 25 0 25 26 0 26 27 0 27 28 0 28 29 0 29 30 0 30 31 0 31 32 0 32 33 0 33 34 0 34 35 1 35 36 0 36 37 0 37 38 0 38 39 0 39 40 0 40 41 0 41 42 0 42 43 0 43 44 0 44 45 0 45 46 0 46 47 1 47 48 0 48 49 0 49 50 0 50 51 0 51 52 0 52 53 0 53 54 0 54 55 0 55 56 0 56 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) uitvoer1 uitvoer2 uitvoer3 indproc M1 9486.8777 0.3185 0.3158 0.3473 -70.0797 -2475.7242 M2 M3 M4 M5 M6 M7 -1731.6135 -1874.8436 -2511.5793 -2856.9582 289.2147 420.3258 M8 M9 M10 M11 t -504.4890 -4938.9226 -1376.6297 1409.5134 -15.8575 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -2283.53 -653.57 -28.07 605.72 2647.41 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 9486.8777 2815.2405 3.370 0.00171 ** uitvoer1 0.3185 0.1455 2.189 0.03462 * uitvoer2 0.3158 0.1365 2.313 0.02606 * uitvoer3 0.3473 0.1360 2.554 0.01468 * indproc -70.0797 32.5094 -2.156 0.03734 * M1 -2475.7242 993.9006 -2.491 0.01711 * M2 -1731.6135 1280.4939 -1.352 0.18407 M3 -1874.8436 788.0418 -2.379 0.02234 * M4 -2511.5793 949.3788 -2.645 0.01170 * M5 -2856.9582 1048.2769 -2.725 0.00957 ** M6 289.2147 909.4291 0.318 0.75217 M7 420.3258 871.2041 0.482 0.63217 M8 -504.4890 851.2743 -0.593 0.55685 M9 -4938.9226 995.4248 -4.962 1.41e-05 *** M10 -1376.6297 1177.1471 -1.169 0.24932 M11 1409.5134 1043.0096 1.351 0.18436 t -15.8575 10.6792 -1.485 0.14561 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 1065 on 39 degrees of freedom Multiple R-squared: 0.8124, Adjusted R-squared: 0.7354 F-statistic: 10.55 on 16 and 39 DF, p-value: 1.307e-09 > 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.9577403 0.08451942 0.04225971 [2,] 0.9605745 0.07885105 0.03942553 [3,] 0.9654417 0.06911658 0.03455829 [4,] 0.9457874 0.10842527 0.05421264 [5,] 0.9301623 0.13967538 0.06983769 [6,] 0.8949634 0.21007311 0.10503656 [7,] 0.9273627 0.14527458 0.07263729 [8,] 0.8929315 0.21413696 0.10706848 [9,] 0.8616987 0.27660261 0.13830130 [10,] 0.9314996 0.13700080 0.06850040 [11,] 0.9489435 0.10211310 0.05105655 [12,] 0.9733556 0.05328889 0.02664444 [13,] 0.9674975 0.06500491 0.03250245 [14,] 0.9424284 0.11514328 0.05757164 [15,] 0.8812841 0.23743172 0.11871586 [16,] 0.7780039 0.44399212 0.22199606 [17,] 0.7489530 0.50209400 0.25104700 > postscript(file="/var/www/html/rcomp/tmp/1voh71258481096.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/2es6h1258481096.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/34avh1258481096.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/4kuhx1258481096.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/53gwu1258481096.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 = 56 Frequency = 1 1 2 3 4 5 6 -1134.22958 -961.81584 -450.01422 -1102.92141 -28.76780 -592.19185 7 8 9 10 11 12 2647.41423 1876.58712 -27.36551 637.14728 467.13026 -799.48289 13 14 15 16 17 18 1017.36472 -1783.60929 441.99278 366.97627 -1029.72318 -779.46641 19 20 21 22 23 24 969.58594 -887.79817 41.53842 215.46919 151.63968 -401.40728 25 26 27 28 29 30 -436.54723 1066.87871 45.24594 935.03490 -700.67718 1034.13710 31 32 33 34 35 36 -512.51770 -258.70091 -139.04575 -303.45307 154.36899 1098.15067 37 38 39 40 41 42 -759.34979 1420.67541 -97.21746 603.25950 613.11969 630.56360 43 44 45 46 47 48 -2283.53228 -92.22482 124.87284 -549.16340 -773.13894 102.73950 49 50 51 52 53 54 1312.76188 257.87100 59.99296 -802.34925 1146.04848 -293.04243 55 56 -820.95019 -637.86323 > postscript(file="/var/www/html/rcomp/tmp/6kcxt1258481096.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 = 56 Frequency = 1 lag(myerror, k = 1) myerror 0 -1134.22958 NA 1 -961.81584 -1134.22958 2 -450.01422 -961.81584 3 -1102.92141 -450.01422 4 -28.76780 -1102.92141 5 -592.19185 -28.76780 6 2647.41423 -592.19185 7 1876.58712 2647.41423 8 -27.36551 1876.58712 9 637.14728 -27.36551 10 467.13026 637.14728 11 -799.48289 467.13026 12 1017.36472 -799.48289 13 -1783.60929 1017.36472 14 441.99278 -1783.60929 15 366.97627 441.99278 16 -1029.72318 366.97627 17 -779.46641 -1029.72318 18 969.58594 -779.46641 19 -887.79817 969.58594 20 41.53842 -887.79817 21 215.46919 41.53842 22 151.63968 215.46919 23 -401.40728 151.63968 24 -436.54723 -401.40728 25 1066.87871 -436.54723 26 45.24594 1066.87871 27 935.03490 45.24594 28 -700.67718 935.03490 29 1034.13710 -700.67718 30 -512.51770 1034.13710 31 -258.70091 -512.51770 32 -139.04575 -258.70091 33 -303.45307 -139.04575 34 154.36899 -303.45307 35 1098.15067 154.36899 36 -759.34979 1098.15067 37 1420.67541 -759.34979 38 -97.21746 1420.67541 39 603.25950 -97.21746 40 613.11969 603.25950 41 630.56360 613.11969 42 -2283.53228 630.56360 43 -92.22482 -2283.53228 44 124.87284 -92.22482 45 -549.16340 124.87284 46 -773.13894 -549.16340 47 102.73950 -773.13894 48 1312.76188 102.73950 49 257.87100 1312.76188 50 59.99296 257.87100 51 -802.34925 59.99296 52 1146.04848 -802.34925 53 -293.04243 1146.04848 54 -820.95019 -293.04243 55 -637.86323 -820.95019 56 NA -637.86323 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -961.81584 -1134.22958 [2,] -450.01422 -961.81584 [3,] -1102.92141 -450.01422 [4,] -28.76780 -1102.92141 [5,] -592.19185 -28.76780 [6,] 2647.41423 -592.19185 [7,] 1876.58712 2647.41423 [8,] -27.36551 1876.58712 [9,] 637.14728 -27.36551 [10,] 467.13026 637.14728 [11,] -799.48289 467.13026 [12,] 1017.36472 -799.48289 [13,] -1783.60929 1017.36472 [14,] 441.99278 -1783.60929 [15,] 366.97627 441.99278 [16,] -1029.72318 366.97627 [17,] -779.46641 -1029.72318 [18,] 969.58594 -779.46641 [19,] -887.79817 969.58594 [20,] 41.53842 -887.79817 [21,] 215.46919 41.53842 [22,] 151.63968 215.46919 [23,] -401.40728 151.63968 [24,] -436.54723 -401.40728 [25,] 1066.87871 -436.54723 [26,] 45.24594 1066.87871 [27,] 935.03490 45.24594 [28,] -700.67718 935.03490 [29,] 1034.13710 -700.67718 [30,] -512.51770 1034.13710 [31,] -258.70091 -512.51770 [32,] -139.04575 -258.70091 [33,] -303.45307 -139.04575 [34,] 154.36899 -303.45307 [35,] 1098.15067 154.36899 [36,] -759.34979 1098.15067 [37,] 1420.67541 -759.34979 [38,] -97.21746 1420.67541 [39,] 603.25950 -97.21746 [40,] 613.11969 603.25950 [41,] 630.56360 613.11969 [42,] -2283.53228 630.56360 [43,] -92.22482 -2283.53228 [44,] 124.87284 -92.22482 [45,] -549.16340 124.87284 [46,] -773.13894 -549.16340 [47,] 102.73950 -773.13894 [48,] 1312.76188 102.73950 [49,] 257.87100 1312.76188 [50,] 59.99296 257.87100 [51,] -802.34925 59.99296 [52,] 1146.04848 -802.34925 [53,] -293.04243 1146.04848 [54,] -820.95019 -293.04243 [55,] -637.86323 -820.95019 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -961.81584 -1134.22958 2 -450.01422 -961.81584 3 -1102.92141 -450.01422 4 -28.76780 -1102.92141 5 -592.19185 -28.76780 6 2647.41423 -592.19185 7 1876.58712 2647.41423 8 -27.36551 1876.58712 9 637.14728 -27.36551 10 467.13026 637.14728 11 -799.48289 467.13026 12 1017.36472 -799.48289 13 -1783.60929 1017.36472 14 441.99278 -1783.60929 15 366.97627 441.99278 16 -1029.72318 366.97627 17 -779.46641 -1029.72318 18 969.58594 -779.46641 19 -887.79817 969.58594 20 41.53842 -887.79817 21 215.46919 41.53842 22 151.63968 215.46919 23 -401.40728 151.63968 24 -436.54723 -401.40728 25 1066.87871 -436.54723 26 45.24594 1066.87871 27 935.03490 45.24594 28 -700.67718 935.03490 29 1034.13710 -700.67718 30 -512.51770 1034.13710 31 -258.70091 -512.51770 32 -139.04575 -258.70091 33 -303.45307 -139.04575 34 154.36899 -303.45307 35 1098.15067 154.36899 36 -759.34979 1098.15067 37 1420.67541 -759.34979 38 -97.21746 1420.67541 39 603.25950 -97.21746 40 613.11969 603.25950 41 630.56360 613.11969 42 -2283.53228 630.56360 43 -92.22482 -2283.53228 44 124.87284 -92.22482 45 -549.16340 124.87284 46 -773.13894 -549.16340 47 102.73950 -773.13894 48 1312.76188 102.73950 49 257.87100 1312.76188 50 59.99296 257.87100 51 -802.34925 59.99296 52 1146.04848 -802.34925 53 -293.04243 1146.04848 54 -820.95019 -293.04243 55 -637.86323 -820.95019 > 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/7aiw21258481096.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/825ms1258481096.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/9qs021258481096.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/107ra61258481096.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/11ptk31258481096.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/12x7p61258481096.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/132z761258481097.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/14qfqr1258481097.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/153ri01258481097.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/16rqw61258481097.tab") + } > > system("convert tmp/1voh71258481096.ps tmp/1voh71258481096.png") > system("convert tmp/2es6h1258481096.ps tmp/2es6h1258481096.png") > system("convert tmp/34avh1258481096.ps tmp/34avh1258481096.png") > system("convert tmp/4kuhx1258481096.ps tmp/4kuhx1258481096.png") > system("convert tmp/53gwu1258481096.ps tmp/53gwu1258481096.png") > system("convert tmp/6kcxt1258481096.ps tmp/6kcxt1258481096.png") > system("convert tmp/7aiw21258481096.ps tmp/7aiw21258481096.png") > system("convert tmp/825ms1258481096.ps tmp/825ms1258481096.png") > system("convert tmp/9qs021258481096.ps tmp/9qs021258481096.png") > system("convert tmp/107ra61258481096.ps tmp/107ra61258481096.png") > > > proc.time() user system elapsed 2.330 1.547 2.885