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(15836.8,89.1,17570.4,82.6,18252.1,102.7,16196.7,91.8,16643,94.1,17729,103.1,16446.1,93.2,15993.8,91,16373.5,94.3,17842.2,99.4,22321.5,115.7,22786.7,116.8,18274.1,99.8,22392.9,96,23899.3,115.9,21343.5,109.1,22952.3,117.3,21374.4,109.8,21164.1,112.8,20906.5,110.7,17877.4,100,20664.3,113.3,22160,122.4,19813.6,112.5,17735.4,104.2,19640.2,92.5,20844.4,117.2,19823.1,109.3,18594.6,106.1,21350.6,118.8,18574.1,105.3,18924.2,106,17343.4,102,19961.2,112.9,19932.1,116.5,19464.6,114.8,16165.4,100.5,17574.9,85.4,19795.4,114.6,19439.5,109.9,17170,100.7,21072.4,115.5,17751.8,100.7,17515.5,99,18040.3,102.3,19090.1,108.8,17746.5,105.9,19202.1,113.2,15141.6,95.7,16258.1,80.9,18586.5,113.9,17209.4,98.1,17838.7,102.8,19123.5,104.7,16583.6,95.9,15991.2,94.6,16704.4,101.6,17420.4,103.9,17872,110.3,17823.2,114.1),dim=c(2,60),dimnames=list(c('uitvoer','indproc'),1:60)) > y <- array(NA,dim=c(2,60),dimnames=list(c('uitvoer','indproc'),1:60)) > 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 indproc M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t 1 15836.8 89.1 1 0 0 0 0 0 0 0 0 0 0 1 2 17570.4 82.6 0 1 0 0 0 0 0 0 0 0 0 2 3 18252.1 102.7 0 0 1 0 0 0 0 0 0 0 0 3 4 16196.7 91.8 0 0 0 1 0 0 0 0 0 0 0 4 5 16643.0 94.1 0 0 0 0 1 0 0 0 0 0 0 5 6 17729.0 103.1 0 0 0 0 0 1 0 0 0 0 0 6 7 16446.1 93.2 0 0 0 0 0 0 1 0 0 0 0 7 8 15993.8 91.0 0 0 0 0 0 0 0 1 0 0 0 8 9 16373.5 94.3 0 0 0 0 0 0 0 0 1 0 0 9 10 17842.2 99.4 0 0 0 0 0 0 0 0 0 1 0 10 11 22321.5 115.7 0 0 0 0 0 0 0 0 0 0 1 11 12 22786.7 116.8 0 0 0 0 0 0 0 0 0 0 0 12 13 18274.1 99.8 1 0 0 0 0 0 0 0 0 0 0 13 14 22392.9 96.0 0 1 0 0 0 0 0 0 0 0 0 14 15 23899.3 115.9 0 0 1 0 0 0 0 0 0 0 0 15 16 21343.5 109.1 0 0 0 1 0 0 0 0 0 0 0 16 17 22952.3 117.3 0 0 0 0 1 0 0 0 0 0 0 17 18 21374.4 109.8 0 0 0 0 0 1 0 0 0 0 0 18 19 21164.1 112.8 0 0 0 0 0 0 1 0 0 0 0 19 20 20906.5 110.7 0 0 0 0 0 0 0 1 0 0 0 20 21 17877.4 100.0 0 0 0 0 0 0 0 0 1 0 0 21 22 20664.3 113.3 0 0 0 0 0 0 0 0 0 1 0 22 23 22160.0 122.4 0 0 0 0 0 0 0 0 0 0 1 23 24 19813.6 112.5 0 0 0 0 0 0 0 0 0 0 0 24 25 17735.4 104.2 1 0 0 0 0 0 0 0 0 0 0 25 26 19640.2 92.5 0 1 0 0 0 0 0 0 0 0 0 26 27 20844.4 117.2 0 0 1 0 0 0 0 0 0 0 0 27 28 19823.1 109.3 0 0 0 1 0 0 0 0 0 0 0 28 29 18594.6 106.1 0 0 0 0 1 0 0 0 0 0 0 29 30 21350.6 118.8 0 0 0 0 0 1 0 0 0 0 0 30 31 18574.1 105.3 0 0 0 0 0 0 1 0 0 0 0 31 32 18924.2 106.0 0 0 0 0 0 0 0 1 0 0 0 32 33 17343.4 102.0 0 0 0 0 0 0 0 0 1 0 0 33 34 19961.2 112.9 0 0 0 0 0 0 0 0 0 1 0 34 35 19932.1 116.5 0 0 0 0 0 0 0 0 0 0 1 35 36 19464.6 114.8 0 0 0 0 0 0 0 0 0 0 0 36 37 16165.4 100.5 1 0 0 0 0 0 0 0 0 0 0 37 38 17574.9 85.4 0 1 0 0 0 0 0 0 0 0 0 38 39 19795.4 114.6 0 0 1 0 0 0 0 0 0 0 0 39 40 19439.5 109.9 0 0 0 1 0 0 0 0 0 0 0 40 41 17170.0 100.7 0 0 0 0 1 0 0 0 0 0 0 41 42 21072.4 115.5 0 0 0 0 0 1 0 0 0 0 0 42 43 17751.8 100.7 0 0 0 0 0 0 1 0 0 0 0 43 44 17515.5 99.0 0 0 0 0 0 0 0 1 0 0 0 44 45 18040.3 102.3 0 0 0 0 0 0 0 0 1 0 0 45 46 19090.1 108.8 0 0 0 0 0 0 0 0 0 1 0 46 47 17746.5 105.9 0 0 0 0 0 0 0 0 0 0 1 47 48 19202.1 113.2 0 0 0 0 0 0 0 0 0 0 0 48 49 15141.6 95.7 1 0 0 0 0 0 0 0 0 0 0 49 50 16258.1 80.9 0 1 0 0 0 0 0 0 0 0 0 50 51 18586.5 113.9 0 0 1 0 0 0 0 0 0 0 0 51 52 17209.4 98.1 0 0 0 1 0 0 0 0 0 0 0 52 53 17838.7 102.8 0 0 0 0 1 0 0 0 0 0 0 53 54 19123.5 104.7 0 0 0 0 0 1 0 0 0 0 0 54 55 16583.6 95.9 0 0 0 0 0 0 1 0 0 0 0 55 56 15991.2 94.6 0 0 0 0 0 0 0 1 0 0 0 56 57 16704.4 101.6 0 0 0 0 0 0 0 0 1 0 0 57 58 17420.4 103.9 0 0 0 0 0 0 0 0 0 1 0 58 59 17872.0 110.3 0 0 0 0 0 0 0 0 0 0 1 59 60 17823.2 114.1 0 0 0 0 0 0 0 0 0 0 0 60 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) indproc M1 M2 M3 M4 -8033.87 255.27 600.65 5343.72 489.80 1407.01 M5 M6 M7 M8 M9 M10 1138.03 1087.38 1344.44 1480.38 974.79 794.14 M11 t 182.33 -36.69 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -1423.1 -434.5 -138.6 417.6 2407.5 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) -8033.868 1983.559 -4.050 0.000195 *** indproc 255.273 17.076 14.950 < 2e-16 *** M1 600.651 564.907 1.063 0.293208 M2 5343.716 669.638 7.980 3.17e-10 *** M3 489.804 491.152 0.997 0.323858 M4 1407.012 521.931 2.696 0.009776 ** M5 1138.026 518.307 2.196 0.033198 * M6 1087.383 493.385 2.204 0.032573 * M7 1344.437 534.117 2.517 0.015380 * M8 1480.385 543.435 2.724 0.009084 ** M9 974.792 544.989 1.789 0.080259 . M10 794.136 500.759 1.586 0.119622 M11 182.326 487.853 0.374 0.710322 t -36.687 5.873 -6.246 1.24e-07 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 771.3 on 46 degrees of freedom Multiple R-squared: 0.892, Adjusted R-squared: 0.8615 F-statistic: 29.23 on 13 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.9893879 0.0212242102 0.0106121051 [2,] 0.9819855 0.0360290798 0.0180145399 [3,] 0.9825939 0.0348122971 0.0174061486 [4,] 0.9785540 0.0428920114 0.0214460057 [5,] 0.9899805 0.0200390123 0.0100195062 [6,] 0.9937428 0.0125143612 0.0062571806 [7,] 0.9997948 0.0004104169 0.0002052085 [8,] 0.9997943 0.0004113147 0.0002056574 [9,] 0.9998197 0.0003606596 0.0001803298 [10,] 0.9997498 0.0005003950 0.0002501975 [11,] 0.9997935 0.0004129946 0.0002064973 [12,] 0.9994659 0.0010682951 0.0005341475 [13,] 0.9988750 0.0022500810 0.0011250405 [14,] 0.9990985 0.0018030379 0.0009015189 [15,] 0.9986360 0.0027279518 0.0013639759 [16,] 0.9968867 0.0062266942 0.0031133471 [17,] 0.9985680 0.0028639593 0.0014319796 [18,] 0.9966961 0.0066078342 0.0033039171 [19,] 0.9922388 0.0155223870 0.0077611935 [20,] 0.9849335 0.0301330231 0.0150665116 [21,] 0.9727919 0.0544161890 0.0272080945 [22,] 0.9581846 0.0836308346 0.0418154173 [23,] 0.9294080 0.1411840324 0.0705920162 [24,] 0.8694617 0.2610765697 0.1305382849 [25,] 0.9685392 0.0629215381 0.0314607690 [26,] 0.9384017 0.1231966683 0.0615983341 [27,] 0.9191999 0.1616002833 0.0808001416 > postscript(file="/var/www/html/rcomp/tmp/1u3od1258479779.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/294qr1258479779.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/3o6sx1258479779.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/44ovi1258479779.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/58vk01258479779.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 = 60 Frequency = 1 1 2 3 4 5 6 561.843474 -751.657366 -310.353749 -463.794416 -298.950153 -1423.081176 7 8 9 10 11 12 -399.140423 -389.099820 -309.522231 74.626768 1041.467327 1444.879383 13 14 15 16 17 18 707.963771 1090.424718 2407.483017 707.021359 528.252489 952.232770 19 20 21 22 23 24 -244.253496 -65.040234 179.565127 -211.327855 -390.118727 9.700865 25 26 27 28 29 30 -513.693434 -328.572530 -539.026610 -424.187514 -530.139483 -928.782132 31 32 33 34 35 36 -479.457094 -407.309387 -424.735888 -372.072681 -671.659785 -486.182174 37 38 39 40 41 42 -698.936000 -141.185493 -484.069928 -520.705752 -136.017248 75.665938 43 44 45 46 47 48 312.746412 411.150309 635.827897 243.694119 288.884195 100.001094 49 50 51 52 53 54 -57.177811 130.990672 -1074.032731 701.666323 436.854396 1323.964600 55 56 57 58 59 60 810.104600 450.299132 -81.134905 265.079649 -268.573010 -1068.399168 > postscript(file="/var/www/html/rcomp/tmp/6wyxq1258479779.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 = 60 Frequency = 1 lag(myerror, k = 1) myerror 0 561.843474 NA 1 -751.657366 561.843474 2 -310.353749 -751.657366 3 -463.794416 -310.353749 4 -298.950153 -463.794416 5 -1423.081176 -298.950153 6 -399.140423 -1423.081176 7 -389.099820 -399.140423 8 -309.522231 -389.099820 9 74.626768 -309.522231 10 1041.467327 74.626768 11 1444.879383 1041.467327 12 707.963771 1444.879383 13 1090.424718 707.963771 14 2407.483017 1090.424718 15 707.021359 2407.483017 16 528.252489 707.021359 17 952.232770 528.252489 18 -244.253496 952.232770 19 -65.040234 -244.253496 20 179.565127 -65.040234 21 -211.327855 179.565127 22 -390.118727 -211.327855 23 9.700865 -390.118727 24 -513.693434 9.700865 25 -328.572530 -513.693434 26 -539.026610 -328.572530 27 -424.187514 -539.026610 28 -530.139483 -424.187514 29 -928.782132 -530.139483 30 -479.457094 -928.782132 31 -407.309387 -479.457094 32 -424.735888 -407.309387 33 -372.072681 -424.735888 34 -671.659785 -372.072681 35 -486.182174 -671.659785 36 -698.936000 -486.182174 37 -141.185493 -698.936000 38 -484.069928 -141.185493 39 -520.705752 -484.069928 40 -136.017248 -520.705752 41 75.665938 -136.017248 42 312.746412 75.665938 43 411.150309 312.746412 44 635.827897 411.150309 45 243.694119 635.827897 46 288.884195 243.694119 47 100.001094 288.884195 48 -57.177811 100.001094 49 130.990672 -57.177811 50 -1074.032731 130.990672 51 701.666323 -1074.032731 52 436.854396 701.666323 53 1323.964600 436.854396 54 810.104600 1323.964600 55 450.299132 810.104600 56 -81.134905 450.299132 57 265.079649 -81.134905 58 -268.573010 265.079649 59 -1068.399168 -268.573010 60 NA -1068.399168 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -751.657366 561.843474 [2,] -310.353749 -751.657366 [3,] -463.794416 -310.353749 [4,] -298.950153 -463.794416 [5,] -1423.081176 -298.950153 [6,] -399.140423 -1423.081176 [7,] -389.099820 -399.140423 [8,] -309.522231 -389.099820 [9,] 74.626768 -309.522231 [10,] 1041.467327 74.626768 [11,] 1444.879383 1041.467327 [12,] 707.963771 1444.879383 [13,] 1090.424718 707.963771 [14,] 2407.483017 1090.424718 [15,] 707.021359 2407.483017 [16,] 528.252489 707.021359 [17,] 952.232770 528.252489 [18,] -244.253496 952.232770 [19,] -65.040234 -244.253496 [20,] 179.565127 -65.040234 [21,] -211.327855 179.565127 [22,] -390.118727 -211.327855 [23,] 9.700865 -390.118727 [24,] -513.693434 9.700865 [25,] -328.572530 -513.693434 [26,] -539.026610 -328.572530 [27,] -424.187514 -539.026610 [28,] -530.139483 -424.187514 [29,] -928.782132 -530.139483 [30,] -479.457094 -928.782132 [31,] -407.309387 -479.457094 [32,] -424.735888 -407.309387 [33,] -372.072681 -424.735888 [34,] -671.659785 -372.072681 [35,] -486.182174 -671.659785 [36,] -698.936000 -486.182174 [37,] -141.185493 -698.936000 [38,] -484.069928 -141.185493 [39,] -520.705752 -484.069928 [40,] -136.017248 -520.705752 [41,] 75.665938 -136.017248 [42,] 312.746412 75.665938 [43,] 411.150309 312.746412 [44,] 635.827897 411.150309 [45,] 243.694119 635.827897 [46,] 288.884195 243.694119 [47,] 100.001094 288.884195 [48,] -57.177811 100.001094 [49,] 130.990672 -57.177811 [50,] -1074.032731 130.990672 [51,] 701.666323 -1074.032731 [52,] 436.854396 701.666323 [53,] 1323.964600 436.854396 [54,] 810.104600 1323.964600 [55,] 450.299132 810.104600 [56,] -81.134905 450.299132 [57,] 265.079649 -81.134905 [58,] -268.573010 265.079649 [59,] -1068.399168 -268.573010 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -751.657366 561.843474 2 -310.353749 -751.657366 3 -463.794416 -310.353749 4 -298.950153 -463.794416 5 -1423.081176 -298.950153 6 -399.140423 -1423.081176 7 -389.099820 -399.140423 8 -309.522231 -389.099820 9 74.626768 -309.522231 10 1041.467327 74.626768 11 1444.879383 1041.467327 12 707.963771 1444.879383 13 1090.424718 707.963771 14 2407.483017 1090.424718 15 707.021359 2407.483017 16 528.252489 707.021359 17 952.232770 528.252489 18 -244.253496 952.232770 19 -65.040234 -244.253496 20 179.565127 -65.040234 21 -211.327855 179.565127 22 -390.118727 -211.327855 23 9.700865 -390.118727 24 -513.693434 9.700865 25 -328.572530 -513.693434 26 -539.026610 -328.572530 27 -424.187514 -539.026610 28 -530.139483 -424.187514 29 -928.782132 -530.139483 30 -479.457094 -928.782132 31 -407.309387 -479.457094 32 -424.735888 -407.309387 33 -372.072681 -424.735888 34 -671.659785 -372.072681 35 -486.182174 -671.659785 36 -698.936000 -486.182174 37 -141.185493 -698.936000 38 -484.069928 -141.185493 39 -520.705752 -484.069928 40 -136.017248 -520.705752 41 75.665938 -136.017248 42 312.746412 75.665938 43 411.150309 312.746412 44 635.827897 411.150309 45 243.694119 635.827897 46 288.884195 243.694119 47 100.001094 288.884195 48 -57.177811 100.001094 49 130.990672 -57.177811 50 -1074.032731 130.990672 51 701.666323 -1074.032731 52 436.854396 701.666323 53 1323.964600 436.854396 54 810.104600 1323.964600 55 450.299132 810.104600 56 -81.134905 450.299132 57 265.079649 -81.134905 58 -268.573010 265.079649 59 -1068.399168 -268.573010 > 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/7yued1258479779.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/8czua1258479779.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/930321258479779.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/10rxio1258479779.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/11d67i1258479779.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/12rbrd1258479779.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/135d1x1258479779.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/14kz4k1258479779.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/154dv01258479779.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/1614de1258479779.tab") + } > > system("convert tmp/1u3od1258479779.ps tmp/1u3od1258479779.png") > system("convert tmp/294qr1258479779.ps tmp/294qr1258479779.png") > system("convert tmp/3o6sx1258479779.ps tmp/3o6sx1258479779.png") > system("convert tmp/44ovi1258479779.ps tmp/44ovi1258479779.png") > system("convert tmp/58vk01258479779.ps tmp/58vk01258479779.png") > system("convert tmp/6wyxq1258479779.ps tmp/6wyxq1258479779.png") > system("convert tmp/7yued1258479779.ps tmp/7yued1258479779.png") > system("convert tmp/8czua1258479779.ps tmp/8czua1258479779.png") > system("convert tmp/930321258479779.ps tmp/930321258479779.png") > system("convert tmp/10rxio1258479779.ps tmp/10rxio1258479779.png") > > > proc.time() user system elapsed 2.427 1.561 3.225