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. Natural language support but running in an English locale 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(378.205 + ,0 + ,377.632 + ,376.974 + ,370.861 + ,0 + ,378.205 + ,377.632 + ,369.167 + ,0 + ,370.861 + ,378.205 + ,371.551 + ,0 + ,369.167 + ,370.861 + ,382.842 + ,0 + ,371.551 + ,369.167 + ,381.903 + ,0 + ,382.842 + ,371.551 + ,384.502 + ,0 + ,381.903 + ,382.842 + ,392.058 + ,0 + ,384.502 + ,381.903 + ,384.359 + ,0 + ,392.058 + ,384.502 + ,388.884 + ,0 + ,384.359 + ,392.058 + ,386.586 + ,0 + ,388.884 + ,384.359 + ,387.495 + ,0 + ,386.586 + ,388.884 + ,385.705 + ,0 + ,387.495 + ,386.586 + ,378.67 + ,0 + ,385.705 + ,387.495 + ,377.367 + ,0 + ,378.67 + ,385.705 + ,376.911 + ,0 + ,377.367 + ,378.67 + ,389.827 + ,0 + ,376.911 + ,377.367 + ,387.82 + ,0 + ,389.827 + ,376.911 + ,387.267 + ,0 + ,387.82 + ,389.827 + ,380.575 + ,0 + ,387.267 + ,387.82 + ,372.402 + ,0 + ,380.575 + ,387.267 + ,376.74 + ,0 + ,372.402 + ,380.575 + ,377.795 + ,0 + ,376.74 + ,372.402 + ,376.126 + ,0 + ,377.795 + ,376.74 + ,370.804 + ,0 + ,376.126 + ,377.795 + ,367.98 + ,0 + ,370.804 + ,376.126 + ,367.866 + ,0 + ,367.98 + ,370.804 + ,366.121 + ,0 + ,367.866 + ,367.98 + ,379.421 + ,0 + ,366.121 + ,367.866 + ,378.519 + ,0 + ,379.421 + ,366.121 + ,372.423 + ,0 + ,378.519 + ,379.421 + ,355.072 + ,0 + ,372.423 + ,378.519 + ,344.693 + ,0 + ,355.072 + ,372.423 + ,342.892 + ,0 + ,344.693 + ,355.072 + ,344.178 + ,0 + ,342.892 + ,344.693 + ,337.606 + ,0 + ,344.178 + ,342.892 + ,327.103 + ,0 + ,337.606 + ,344.178 + ,323.953 + ,0 + ,327.103 + ,337.606 + ,316.532 + ,0 + ,323.953 + ,327.103 + ,306.307 + ,0 + ,316.532 + ,323.953 + ,327.225 + ,0 + ,306.307 + ,316.532 + ,329.573 + ,0 + ,327.225 + ,306.307 + ,313.761 + ,0 + ,329.573 + ,327.225 + ,307.836 + ,0 + ,313.761 + ,329.573 + ,300.074 + ,0 + ,307.836 + ,313.761 + ,304.198 + ,0 + ,300.074 + ,307.836 + ,306.122 + ,0 + ,304.198 + ,300.074 + ,300.414 + ,0 + ,306.122 + ,304.198 + ,292.133 + ,0 + ,300.414 + ,306.122 + ,290.616 + ,0 + ,292.133 + ,300.414 + ,280.244 + ,1 + ,290.616 + ,292.133 + ,285.179 + ,1 + ,280.244 + ,290.616 + ,305.486 + ,1 + ,285.179 + ,280.244 + ,305.957 + ,1 + ,305.486 + ,285.179 + ,293.886 + ,1 + ,305.957 + ,305.486 + ,289.441 + ,1 + ,293.886 + ,305.957 + ,288.776 + ,1 + ,289.441 + ,293.886 + ,299.149 + ,1 + ,288.776 + ,289.441 + ,306.532 + ,1 + ,299.149 + ,288.776 + ,309.914 + ,1 + ,306.532 + ,299.149 + ,313.468 + ,1 + ,309.914 + ,306.532 + ,314.901 + ,1 + ,313.468 + ,309.914 + ,309.16 + ,1 + ,314.901 + ,313.468 + ,316.15 + ,1 + ,309.16 + ,314.901 + ,336.544 + ,1 + ,316.15 + ,309.16 + ,339.196 + ,1 + ,336.544 + ,316.15 + ,326.738 + ,1 + ,339.196 + ,336.544 + ,320.838 + ,1 + ,326.738 + ,339.196 + ,318.62 + ,1 + ,320.838 + ,326.738 + ,331.533 + ,1 + ,318.62 + ,320.838 + ,335.378 + ,1 + ,331.533 + ,318.62) + ,dim=c(4 + ,71) + ,dimnames=list(c('Maandelijksewerkloosheid' + ,'x' + ,'y-1' + ,'y-2') + ,1:71)) > y <- array(NA,dim=c(4,71),dimnames=list(c('Maandelijksewerkloosheid','x','y-1','y-2'),1:71)) > 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 Maandelijksewerkloosheid x y-1 y-2 M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 1 378.205 0 377.632 376.974 1 0 0 0 0 0 0 0 0 0 2 370.861 0 378.205 377.632 0 1 0 0 0 0 0 0 0 0 3 369.167 0 370.861 378.205 0 0 1 0 0 0 0 0 0 0 4 371.551 0 369.167 370.861 0 0 0 1 0 0 0 0 0 0 5 382.842 0 371.551 369.167 0 0 0 0 1 0 0 0 0 0 6 381.903 0 382.842 371.551 0 0 0 0 0 1 0 0 0 0 7 384.502 0 381.903 382.842 0 0 0 0 0 0 1 0 0 0 8 392.058 0 384.502 381.903 0 0 0 0 0 0 0 1 0 0 9 384.359 0 392.058 384.502 0 0 0 0 0 0 0 0 1 0 10 388.884 0 384.359 392.058 0 0 0 0 0 0 0 0 0 1 11 386.586 0 388.884 384.359 0 0 0 0 0 0 0 0 0 0 12 387.495 0 386.586 388.884 0 0 0 0 0 0 0 0 0 0 13 385.705 0 387.495 386.586 1 0 0 0 0 0 0 0 0 0 14 378.670 0 385.705 387.495 0 1 0 0 0 0 0 0 0 0 15 377.367 0 378.670 385.705 0 0 1 0 0 0 0 0 0 0 16 376.911 0 377.367 378.670 0 0 0 1 0 0 0 0 0 0 17 389.827 0 376.911 377.367 0 0 0 0 1 0 0 0 0 0 18 387.820 0 389.827 376.911 0 0 0 0 0 1 0 0 0 0 19 387.267 0 387.820 389.827 0 0 0 0 0 0 1 0 0 0 20 380.575 0 387.267 387.820 0 0 0 0 0 0 0 1 0 0 21 372.402 0 380.575 387.267 0 0 0 0 0 0 0 0 1 0 22 376.740 0 372.402 380.575 0 0 0 0 0 0 0 0 0 1 23 377.795 0 376.740 372.402 0 0 0 0 0 0 0 0 0 0 24 376.126 0 377.795 376.740 0 0 0 0 0 0 0 0 0 0 25 370.804 0 376.126 377.795 1 0 0 0 0 0 0 0 0 0 26 367.980 0 370.804 376.126 0 1 0 0 0 0 0 0 0 0 27 367.866 0 367.980 370.804 0 0 1 0 0 0 0 0 0 0 28 366.121 0 367.866 367.980 0 0 0 1 0 0 0 0 0 0 29 379.421 0 366.121 367.866 0 0 0 0 1 0 0 0 0 0 30 378.519 0 379.421 366.121 0 0 0 0 0 1 0 0 0 0 31 372.423 0 378.519 379.421 0 0 0 0 0 0 1 0 0 0 32 355.072 0 372.423 378.519 0 0 0 0 0 0 0 1 0 0 33 344.693 0 355.072 372.423 0 0 0 0 0 0 0 0 1 0 34 342.892 0 344.693 355.072 0 0 0 0 0 0 0 0 0 1 35 344.178 0 342.892 344.693 0 0 0 0 0 0 0 0 0 0 36 337.606 0 344.178 342.892 0 0 0 0 0 0 0 0 0 0 37 327.103 0 337.606 344.178 1 0 0 0 0 0 0 0 0 0 38 323.953 0 327.103 337.606 0 1 0 0 0 0 0 0 0 0 39 316.532 0 323.953 327.103 0 0 1 0 0 0 0 0 0 0 40 306.307 0 316.532 323.953 0 0 0 1 0 0 0 0 0 0 41 327.225 0 306.307 316.532 0 0 0 0 1 0 0 0 0 0 42 329.573 0 327.225 306.307 0 0 0 0 0 1 0 0 0 0 43 313.761 0 329.573 327.225 0 0 0 0 0 0 1 0 0 0 44 307.836 0 313.761 329.573 0 0 0 0 0 0 0 1 0 0 45 300.074 0 307.836 313.761 0 0 0 0 0 0 0 0 1 0 46 304.198 0 300.074 307.836 0 0 0 0 0 0 0 0 0 1 47 306.122 0 304.198 300.074 0 0 0 0 0 0 0 0 0 0 48 300.414 0 306.122 304.198 0 0 0 0 0 0 0 0 0 0 49 292.133 0 300.414 306.122 1 0 0 0 0 0 0 0 0 0 50 290.616 0 292.133 300.414 0 1 0 0 0 0 0 0 0 0 51 280.244 1 290.616 292.133 0 0 1 0 0 0 0 0 0 0 52 285.179 1 280.244 290.616 0 0 0 1 0 0 0 0 0 0 53 305.486 1 285.179 280.244 0 0 0 0 1 0 0 0 0 0 54 305.957 1 305.486 285.179 0 0 0 0 0 1 0 0 0 0 55 293.886 1 305.957 305.486 0 0 0 0 0 0 1 0 0 0 56 289.441 1 293.886 305.957 0 0 0 0 0 0 0 1 0 0 57 288.776 1 289.441 293.886 0 0 0 0 0 0 0 0 1 0 58 299.149 1 288.776 289.441 0 0 0 0 0 0 0 0 0 1 59 306.532 1 299.149 288.776 0 0 0 0 0 0 0 0 0 0 60 309.914 1 306.532 299.149 0 0 0 0 0 0 0 0 0 0 61 313.468 1 309.914 306.532 1 0 0 0 0 0 0 0 0 0 62 314.901 1 313.468 309.914 0 1 0 0 0 0 0 0 0 0 63 309.160 1 314.901 313.468 0 0 1 0 0 0 0 0 0 0 64 316.150 1 309.160 314.901 0 0 0 1 0 0 0 0 0 0 65 336.544 1 316.150 309.160 0 0 0 0 1 0 0 0 0 0 66 339.196 1 336.544 316.150 0 0 0 0 0 1 0 0 0 0 67 326.738 1 339.196 336.544 0 0 0 0 0 0 1 0 0 0 68 320.838 1 326.738 339.196 0 0 0 0 0 0 0 1 0 0 69 318.620 1 320.838 326.738 0 0 0 0 0 0 0 0 1 0 70 331.533 1 318.620 320.838 0 0 0 0 0 0 0 0 0 1 71 335.378 1 331.533 318.620 0 0 0 0 0 0 0 0 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 57 0 57 58 0 58 59 1 59 60 0 60 61 0 61 62 0 62 63 0 63 64 0 64 65 0 65 66 0 66 67 0 67 68 0 68 69 0 69 70 0 70 71 1 71 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) x `y-1` `y-2` M1 M2 6.06645 6.51401 1.04112 -0.05671 -1.78757 -1.38928 M3 M4 M5 M6 M7 M8 -3.46313 1.39315 17.44776 0.64796 -5.98306 -3.61234 M9 M10 M11 t -4.38508 7.56500 3.54606 -0.11219 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -10.0618 -1.9588 0.3919 2.2153 11.8480 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 6.06645 12.97594 0.468 0.6420 x 6.51401 2.26913 2.871 0.0058 ** `y-1` 1.04112 0.13598 7.656 3.17e-10 *** `y-2` -0.05671 0.13901 -0.408 0.6849 M1 -1.78757 2.90107 -0.616 0.5403 M2 -1.38928 2.95834 -0.470 0.6405 M3 -3.46313 3.01557 -1.148 0.2558 M4 1.39315 3.05292 0.456 0.6499 M5 17.44776 2.90074 6.015 1.52e-07 *** M6 0.64796 3.41789 0.190 0.8503 M7 -5.98306 2.91027 -2.056 0.0446 * M8 -3.61234 3.19846 -1.129 0.2636 M9 -4.38508 3.06796 -1.429 0.1586 M10 7.56500 3.08814 2.450 0.0175 * M11 3.54606 2.89520 1.225 0.2259 t -0.11219 0.06722 -1.669 0.1008 --- Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 Residual standard error: 4.711 on 55 degrees of freedom Multiple R-squared: 0.9859, Adjusted R-squared: 0.9821 F-statistic: 256.9 on 15 and 55 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.07422085 0.1484417043 0.9257791479 [2,] 0.46457813 0.9291562544 0.5354218728 [3,] 0.56520314 0.8695937158 0.4347968579 [4,] 0.48652475 0.9730494928 0.5134752536 [5,] 0.39220441 0.7844088117 0.6077955941 [6,] 0.31252646 0.6250529299 0.6874735350 [7,] 0.23967074 0.4793414806 0.7603292597 [8,] 0.25269654 0.5053930791 0.7473034604 [9,] 0.30914514 0.6182902752 0.6908548624 [10,] 0.25367523 0.5073504600 0.7463247700 [11,] 0.19008788 0.3801757618 0.8099121191 [12,] 0.13526082 0.2705216352 0.8647391824 [13,] 0.48804592 0.9760918427 0.5119540786 [14,] 0.88790264 0.2241947132 0.1120973566 [15,] 0.84833265 0.3033347087 0.1516673543 [16,] 0.84914274 0.3017145151 0.1508572576 [17,] 0.81672292 0.3665541609 0.1832770805 [18,] 0.77841907 0.4431618550 0.2215809275 [19,] 0.77418674 0.4516265164 0.2258132582 [20,] 0.77770305 0.4445939099 0.2222969549 [21,] 0.77728165 0.4454367040 0.2227183520 [22,] 0.97726365 0.0454726957 0.0227363479 [23,] 0.99082961 0.0183407892 0.0091703946 [24,] 0.99224255 0.0155149047 0.0077574524 [25,] 0.99267122 0.0146575561 0.0073287781 [26,] 0.99617594 0.0076481258 0.0038240629 [27,] 0.99197537 0.0160492656 0.0080246328 [28,] 0.98337809 0.0332438273 0.0166219136 [29,] 0.99798929 0.0040214112 0.0020107056 [30,] 0.99972249 0.0005550125 0.0002775062 [31,] 0.99879368 0.0024126429 0.0012063214 [32,] 0.99536777 0.0092644652 0.0046322326 [33,] 0.98540928 0.0291814321 0.0145907161 [34,] 0.95386535 0.0922693072 0.0461346536 > postscript(file="/var/www/html/freestat/rcomp/tmp/1j90y1291055358.ps",horizontal=F,onefile=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/freestat/rcomp/tmp/2t0hj1291055358.ps",horizontal=F,onefile=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/freestat/rcomp/tmp/3t0hj1291055358.ps",horizontal=F,onefile=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/freestat/rcomp/tmp/4t0hj1291055358.ps",horizontal=F,onefile=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/freestat/rcomp/tmp/5t0hj1291055358.ps",horizontal=F,onefile=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 = 71 Frequency = 1 1 2 3 4 5 6 2.2578507 -5.9315047 2.2389895 1.2260664 -6.0034436 -1.6505047 7 8 9 10 11 12 9.3096294 11.8479772 -2.6853760 -1.5542100 -4.8687501 2.3475980 13 14 15 16 17 18 1.3806632 -4.0252999 4.0804824 -0.1619937 -2.7875594 -1.3554925 19 20 21 22 23 24 7.6567085 -0.8319118 -1.1841906 -0.5545472 -0.3482793 0.7886007 25 26 27 28 29 30 -0.8361857 1.4998745 6.2102141 -0.3203412 -1.1524791 0.9116992 31 32 33 34 35 36 3.2522435 -10.0618037 -1.8371696 -5.6543011 1.0492767 -3.3054872 37 38 39 40 41 42 -4.9935799 2.1324524 -0.4186213 -7.8402270 7.3599180 4.2619665 43 44 45 46 47 48 -6.0650966 2.3466521 0.7414910 0.7727326 2.0941074 -1.7248788 49 50 51 52 53 54 -2.0543147 4.4403550 -9.1498573 1.7534797 0.3919478 -3.0871499 55 56 57 58 59 60 -7.7536877 -1.8632010 2.2999398 1.2753101 1.9522235 1.8941672 61 62 63 64 65 66 4.2455663 1.8841226 -2.9612074 5.3430158 2.1916162 0.9194815 67 68 69 70 71 -6.3997972 -1.4377128 2.6653054 5.7150156 0.1214218 > postscript(file="/var/www/html/freestat/rcomp/tmp/6mszm1291055358.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > dum <- cbind(lag(myerror,k=1),myerror) > dum Time Series: Start = 0 End = 71 Frequency = 1 lag(myerror, k = 1) myerror 0 2.2578507 NA 1 -5.9315047 2.2578507 2 2.2389895 -5.9315047 3 1.2260664 2.2389895 4 -6.0034436 1.2260664 5 -1.6505047 -6.0034436 6 9.3096294 -1.6505047 7 11.8479772 9.3096294 8 -2.6853760 11.8479772 9 -1.5542100 -2.6853760 10 -4.8687501 -1.5542100 11 2.3475980 -4.8687501 12 1.3806632 2.3475980 13 -4.0252999 1.3806632 14 4.0804824 -4.0252999 15 -0.1619937 4.0804824 16 -2.7875594 -0.1619937 17 -1.3554925 -2.7875594 18 7.6567085 -1.3554925 19 -0.8319118 7.6567085 20 -1.1841906 -0.8319118 21 -0.5545472 -1.1841906 22 -0.3482793 -0.5545472 23 0.7886007 -0.3482793 24 -0.8361857 0.7886007 25 1.4998745 -0.8361857 26 6.2102141 1.4998745 27 -0.3203412 6.2102141 28 -1.1524791 -0.3203412 29 0.9116992 -1.1524791 30 3.2522435 0.9116992 31 -10.0618037 3.2522435 32 -1.8371696 -10.0618037 33 -5.6543011 -1.8371696 34 1.0492767 -5.6543011 35 -3.3054872 1.0492767 36 -4.9935799 -3.3054872 37 2.1324524 -4.9935799 38 -0.4186213 2.1324524 39 -7.8402270 -0.4186213 40 7.3599180 -7.8402270 41 4.2619665 7.3599180 42 -6.0650966 4.2619665 43 2.3466521 -6.0650966 44 0.7414910 2.3466521 45 0.7727326 0.7414910 46 2.0941074 0.7727326 47 -1.7248788 2.0941074 48 -2.0543147 -1.7248788 49 4.4403550 -2.0543147 50 -9.1498573 4.4403550 51 1.7534797 -9.1498573 52 0.3919478 1.7534797 53 -3.0871499 0.3919478 54 -7.7536877 -3.0871499 55 -1.8632010 -7.7536877 56 2.2999398 -1.8632010 57 1.2753101 2.2999398 58 1.9522235 1.2753101 59 1.8941672 1.9522235 60 4.2455663 1.8941672 61 1.8841226 4.2455663 62 -2.9612074 1.8841226 63 5.3430158 -2.9612074 64 2.1916162 5.3430158 65 0.9194815 2.1916162 66 -6.3997972 0.9194815 67 -1.4377128 -6.3997972 68 2.6653054 -1.4377128 69 5.7150156 2.6653054 70 0.1214218 5.7150156 71 NA 0.1214218 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -5.9315047 2.2578507 [2,] 2.2389895 -5.9315047 [3,] 1.2260664 2.2389895 [4,] -6.0034436 1.2260664 [5,] -1.6505047 -6.0034436 [6,] 9.3096294 -1.6505047 [7,] 11.8479772 9.3096294 [8,] -2.6853760 11.8479772 [9,] -1.5542100 -2.6853760 [10,] -4.8687501 -1.5542100 [11,] 2.3475980 -4.8687501 [12,] 1.3806632 2.3475980 [13,] -4.0252999 1.3806632 [14,] 4.0804824 -4.0252999 [15,] -0.1619937 4.0804824 [16,] -2.7875594 -0.1619937 [17,] -1.3554925 -2.7875594 [18,] 7.6567085 -1.3554925 [19,] -0.8319118 7.6567085 [20,] -1.1841906 -0.8319118 [21,] -0.5545472 -1.1841906 [22,] -0.3482793 -0.5545472 [23,] 0.7886007 -0.3482793 [24,] -0.8361857 0.7886007 [25,] 1.4998745 -0.8361857 [26,] 6.2102141 1.4998745 [27,] -0.3203412 6.2102141 [28,] -1.1524791 -0.3203412 [29,] 0.9116992 -1.1524791 [30,] 3.2522435 0.9116992 [31,] -10.0618037 3.2522435 [32,] -1.8371696 -10.0618037 [33,] -5.6543011 -1.8371696 [34,] 1.0492767 -5.6543011 [35,] -3.3054872 1.0492767 [36,] -4.9935799 -3.3054872 [37,] 2.1324524 -4.9935799 [38,] -0.4186213 2.1324524 [39,] -7.8402270 -0.4186213 [40,] 7.3599180 -7.8402270 [41,] 4.2619665 7.3599180 [42,] -6.0650966 4.2619665 [43,] 2.3466521 -6.0650966 [44,] 0.7414910 2.3466521 [45,] 0.7727326 0.7414910 [46,] 2.0941074 0.7727326 [47,] -1.7248788 2.0941074 [48,] -2.0543147 -1.7248788 [49,] 4.4403550 -2.0543147 [50,] -9.1498573 4.4403550 [51,] 1.7534797 -9.1498573 [52,] 0.3919478 1.7534797 [53,] -3.0871499 0.3919478 [54,] -7.7536877 -3.0871499 [55,] -1.8632010 -7.7536877 [56,] 2.2999398 -1.8632010 [57,] 1.2753101 2.2999398 [58,] 1.9522235 1.2753101 [59,] 1.8941672 1.9522235 [60,] 4.2455663 1.8941672 [61,] 1.8841226 4.2455663 [62,] -2.9612074 1.8841226 [63,] 5.3430158 -2.9612074 [64,] 2.1916162 5.3430158 [65,] 0.9194815 2.1916162 [66,] -6.3997972 0.9194815 [67,] -1.4377128 -6.3997972 [68,] 2.6653054 -1.4377128 [69,] 5.7150156 2.6653054 [70,] 0.1214218 5.7150156 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -5.9315047 2.2578507 2 2.2389895 -5.9315047 3 1.2260664 2.2389895 4 -6.0034436 1.2260664 5 -1.6505047 -6.0034436 6 9.3096294 -1.6505047 7 11.8479772 9.3096294 8 -2.6853760 11.8479772 9 -1.5542100 -2.6853760 10 -4.8687501 -1.5542100 11 2.3475980 -4.8687501 12 1.3806632 2.3475980 13 -4.0252999 1.3806632 14 4.0804824 -4.0252999 15 -0.1619937 4.0804824 16 -2.7875594 -0.1619937 17 -1.3554925 -2.7875594 18 7.6567085 -1.3554925 19 -0.8319118 7.6567085 20 -1.1841906 -0.8319118 21 -0.5545472 -1.1841906 22 -0.3482793 -0.5545472 23 0.7886007 -0.3482793 24 -0.8361857 0.7886007 25 1.4998745 -0.8361857 26 6.2102141 1.4998745 27 -0.3203412 6.2102141 28 -1.1524791 -0.3203412 29 0.9116992 -1.1524791 30 3.2522435 0.9116992 31 -10.0618037 3.2522435 32 -1.8371696 -10.0618037 33 -5.6543011 -1.8371696 34 1.0492767 -5.6543011 35 -3.3054872 1.0492767 36 -4.9935799 -3.3054872 37 2.1324524 -4.9935799 38 -0.4186213 2.1324524 39 -7.8402270 -0.4186213 40 7.3599180 -7.8402270 41 4.2619665 7.3599180 42 -6.0650966 4.2619665 43 2.3466521 -6.0650966 44 0.7414910 2.3466521 45 0.7727326 0.7414910 46 2.0941074 0.7727326 47 -1.7248788 2.0941074 48 -2.0543147 -1.7248788 49 4.4403550 -2.0543147 50 -9.1498573 4.4403550 51 1.7534797 -9.1498573 52 0.3919478 1.7534797 53 -3.0871499 0.3919478 54 -7.7536877 -3.0871499 55 -1.8632010 -7.7536877 56 2.2999398 -1.8632010 57 1.2753101 2.2999398 58 1.9522235 1.2753101 59 1.8941672 1.9522235 60 4.2455663 1.8941672 61 1.8841226 4.2455663 62 -2.9612074 1.8841226 63 5.3430158 -2.9612074 64 2.1916162 5.3430158 65 0.9194815 2.1916162 66 -6.3997972 0.9194815 67 -1.4377128 -6.3997972 68 2.6653054 -1.4377128 69 5.7150156 2.6653054 70 0.1214218 5.7150156 > 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/freestat/rcomp/tmp/7fjgp1291055358.ps",horizontal=F,onefile=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/freestat/rcomp/tmp/8fjgp1291055358.ps",horizontal=F,onefile=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/freestat/rcomp/tmp/9fjgp1291055358.ps",horizontal=F,onefile=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/freestat/rcomp/tmp/10qafs1291055358.ps",horizontal=F,onefile=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/freestat/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/html/freestat/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/freestat/rcomp/tmp/11bavx1291055358.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/freestat/rcomp/tmp/12wtcl1291055358.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/freestat/rcomp/tmp/133c9x1291055358.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/freestat/rcomp/tmp/14w38i1291055358.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/freestat/rcomp/tmp/15h4p61291055358.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/freestat/rcomp/tmp/16l4nu1291055358.tab") + } > > try(system("convert tmp/1j90y1291055358.ps tmp/1j90y1291055358.png",intern=TRUE)) character(0) > try(system("convert tmp/2t0hj1291055358.ps tmp/2t0hj1291055358.png",intern=TRUE)) character(0) > try(system("convert tmp/3t0hj1291055358.ps tmp/3t0hj1291055358.png",intern=TRUE)) character(0) > try(system("convert tmp/4t0hj1291055358.ps tmp/4t0hj1291055358.png",intern=TRUE)) character(0) > try(system("convert tmp/5t0hj1291055358.ps tmp/5t0hj1291055358.png",intern=TRUE)) character(0) > try(system("convert tmp/6mszm1291055358.ps tmp/6mszm1291055358.png",intern=TRUE)) character(0) > try(system("convert tmp/7fjgp1291055358.ps tmp/7fjgp1291055358.png",intern=TRUE)) character(0) > try(system("convert tmp/8fjgp1291055358.ps tmp/8fjgp1291055358.png",intern=TRUE)) character(0) > try(system("convert tmp/9fjgp1291055358.ps tmp/9fjgp1291055358.png",intern=TRUE)) character(0) > try(system("convert tmp/10qafs1291055358.ps tmp/10qafs1291055358.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 3.977 2.495 4.404