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(10284.5 + ,1.038351422 + ,1.4 + ,12792 + ,0.933031106 + ,1.3 + ,12823.61538 + ,0.932783124 + ,1.3 + ,13845.66667 + ,0.953755367 + ,1.2 + ,15335.63636 + ,1.009865664 + ,1.1 + ,11188.5 + ,0.979532493 + ,1.4 + ,13633.25 + ,0.98651077 + ,1.2 + ,12298.46667 + ,0.964661281 + ,1.5 + ,15353.63636 + ,0.946761816 + ,1.1 + ,12696.15385 + ,0.959068881 + ,1.3 + ,12213.93333 + ,0.985710058 + ,1.5 + ,13683.72727 + ,0.92582159 + ,1.1 + ,11214.14286 + ,1.036865325 + ,1.4 + ,13950.23077 + ,0.944443576 + ,1.3 + ,11179.13333 + ,0.944901812 + ,1.5 + ,11801.875 + ,0.989151445 + ,1.6 + ,11188.82353 + ,1.054361624 + ,1.7 + ,16456.27273 + ,1.033478919 + ,1.1 + ,11110.0625 + ,1.001368875 + ,1.6 + ,16530.69231 + ,1.019812646 + ,1.3 + ,10038.41176 + ,0.993902155 + ,1.7 + ,11681.25 + ,0.961444482 + ,1.6 + ,11148.88235 + ,0.957449711 + ,1.7 + ,8631 + ,0.93308639 + ,1.9 + ,9386.444444 + ,1.045170549 + ,1.8 + ,9764.736842 + ,0.953166261 + ,1.9 + ,12043.75 + ,0.966782226 + ,1.6 + ,12948.06667 + ,0.972992606 + ,1.5 + ,10987.125 + ,1.013607482 + ,1.6 + ,11648.3125 + ,0.984839518 + ,1.6 + ,10633.35294 + ,0.973220775 + ,1.7 + ,10219.3 + ,0.957284573 + ,2 + ,9037.6 + ,0.972067159 + ,2 + ,10296.31579 + ,0.986878944 + ,1.9 + ,11705.41176 + ,0.954654488 + ,1.7 + ,10681.94444 + ,0.978986976 + ,1.8 + ,9362.947368 + ,1.003056035 + ,1.9 + ,11306.35294 + ,0.970081156 + ,1.7 + ,10984.45 + ,0.991376354 + ,2 + ,10062.61905 + ,1.022609041 + ,2.1 + ,8118.583333 + ,1.089901216 + ,2.4 + ,8867.48 + ,1.060373568 + ,2.5 + ,8346.72 + ,0.985952627 + ,2.5 + ,8529.307692 + ,1.037512164 + ,2.6 + ,10697.18182 + ,1.025335152 + ,2.2 + ,8591.84 + ,1.006376649 + ,2.5 + ,8695.607143 + ,1.018762056 + ,2.8 + ,8125.571429 + ,1.01601847 + ,2.8 + ,7009.758621 + ,1.112410461 + ,2.9 + ,7883.466667 + ,1.037903689 + ,3 + ,7527.645161 + ,1.045436015 + ,3.1 + ,6763.758621 + ,1.09935434 + ,2.9 + ,6682.333333 + ,1.101920787 + ,2.7 + ,7855.681818 + ,1.080574973 + ,2.2 + ,6738.88 + ,1.024388761 + ,2.5 + ,7895.434783 + ,1.024282249 + ,2.3 + ,6361.884615 + ,0.993865289 + ,2.6 + ,6935.956522 + ,0.984935203 + ,2.3 + ,8344.454545 + ,1.005791114 + ,2.2 + ,9107.944444 + ,0.94742834 + ,1.8) + ,dim=c(3 + ,60) + ,dimnames=list(c('Invoer/inflatie' + ,'Uitvoer/inflatie' + ,'Inflatie') + ,1:60)) > y <- array(NA,dim=c(3,60),dimnames=list(c('Invoer/inflatie','Uitvoer/inflatie','Inflatie'),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 = 'No Linear Trend' > par2 = 'Do not include Seasonal 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 Invoer/inflatie Uitvoer/inflatie Inflatie 1 10284.500 1.0383514 1.4 2 12792.000 0.9330311 1.3 3 12823.615 0.9327831 1.3 4 13845.667 0.9537554 1.2 5 15335.636 1.0098657 1.1 6 11188.500 0.9795325 1.4 7 13633.250 0.9865108 1.2 8 12298.467 0.9646613 1.5 9 15353.636 0.9467618 1.1 10 12696.154 0.9590689 1.3 11 12213.933 0.9857101 1.5 12 13683.727 0.9258216 1.1 13 11214.143 1.0368653 1.4 14 13950.231 0.9444436 1.3 15 11179.133 0.9449018 1.5 16 11801.875 0.9891514 1.6 17 11188.824 1.0543616 1.7 18 16456.273 1.0334789 1.1 19 11110.062 1.0013689 1.6 20 16530.692 1.0198126 1.3 21 10038.412 0.9939022 1.7 22 11681.250 0.9614445 1.6 23 11148.882 0.9574497 1.7 24 8631.000 0.9330864 1.9 25 9386.444 1.0451705 1.8 26 9764.737 0.9531663 1.9 27 12043.750 0.9667822 1.6 28 12948.067 0.9729926 1.5 29 10987.125 1.0136075 1.6 30 11648.312 0.9848395 1.6 31 10633.353 0.9732208 1.7 32 10219.300 0.9572846 2.0 33 9037.600 0.9720672 2.0 34 10296.316 0.9868789 1.9 35 11705.412 0.9546545 1.7 36 10681.944 0.9789870 1.8 37 9362.947 1.0030560 1.9 38 11306.353 0.9700812 1.7 39 10984.450 0.9913764 2.0 40 10062.619 1.0226090 2.1 41 8118.583 1.0899012 2.4 42 8867.480 1.0603736 2.5 43 8346.720 0.9859526 2.5 44 8529.308 1.0375122 2.6 45 10697.182 1.0253352 2.2 46 8591.840 1.0063766 2.5 47 8695.607 1.0187621 2.8 48 8125.571 1.0160185 2.8 49 7009.759 1.1124105 2.9 50 7883.467 1.0379037 3.0 51 7527.645 1.0454360 3.1 52 6763.759 1.0993543 2.9 53 6682.333 1.1019208 2.7 54 7855.682 1.0805750 2.2 55 6738.880 1.0243888 2.5 56 7895.435 1.0242822 2.3 57 6361.885 0.9938653 2.6 58 6935.957 0.9849352 2.3 59 8344.455 1.0057911 2.2 60 9107.944 0.9474283 1.8 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) `Uitvoer/inflatie` Inflatie 14822 3534 -4143 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -2405.8 -863.6 82.2 585.6 3491.6 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 14822.0 3900.9 3.800 0.000354 *** `Uitvoer/inflatie` 3533.5 4263.0 0.829 0.410628 Inflatie -4143.4 350.7 -11.814 < 2e-16 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 1185 on 57 degrees of freedom Multiple R-squared: 0.7784, Adjusted R-squared: 0.7706 F-statistic: 100.1 on 2 and 57 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.014757816 0.029515632 0.98524218 [2,] 0.003704922 0.007409843 0.99629508 [3,] 0.292412323 0.584824646 0.70758768 [4,] 0.202605023 0.405210045 0.79739498 [5,] 0.124847972 0.249695944 0.87515203 [6,] 0.180824311 0.361648621 0.81917569 [7,] 0.198783931 0.397567863 0.80121607 [8,] 0.152822719 0.305645438 0.84717728 [9,] 0.141039507 0.282079015 0.85896049 [10,] 0.096458802 0.192917605 0.90354120 [11,] 0.112541275 0.225082549 0.88745873 [12,] 0.129860346 0.259720693 0.87013965 [13,] 0.314499865 0.628999730 0.68550013 [14,] 0.243879439 0.487758878 0.75612056 [15,] 0.878638493 0.242723014 0.12136151 [16,] 0.840190797 0.319618406 0.15980920 [17,] 0.814619299 0.370761403 0.18538070 [18,] 0.787547798 0.424904405 0.21245220 [19,] 0.790810972 0.418378055 0.20918903 [20,] 0.756889815 0.486220370 0.24311018 [21,] 0.729357082 0.541285836 0.27064292 [22,] 0.709291127 0.581417746 0.29070887 [23,] 0.755699871 0.488600259 0.24430013 [24,] 0.696184270 0.607631459 0.30381573 [25,] 0.657190386 0.685619228 0.34280961 [26,] 0.583830020 0.832339960 0.41616998 [27,] 0.600714206 0.798571588 0.39928579 [28,] 0.546339049 0.907321902 0.45366095 [29,] 0.492029471 0.984058942 0.50797053 [30,] 0.499203040 0.998406079 0.50079696 [31,] 0.446462139 0.892924279 0.55353786 [32,] 0.373297906 0.746595812 0.62670209 [33,] 0.365924080 0.731848160 0.63407592 [34,] 0.544969807 0.910060385 0.45503019 [35,] 0.615019376 0.769961249 0.38498062 [36,] 0.545005125 0.909989750 0.45499487 [37,] 0.583909468 0.832181065 0.41609053 [38,] 0.528750954 0.942498093 0.47124905 [39,] 0.511259013 0.977481974 0.48874099 [40,] 0.889169719 0.221660562 0.11083028 [41,] 0.873572523 0.252854953 0.12642748 [42,] 0.920640539 0.158718921 0.07935946 [43,] 0.913861766 0.172276468 0.08613823 [44,] 0.857771146 0.284457707 0.14222885 [45,] 0.885893589 0.228212823 0.11410641 [46,] 0.984396681 0.031206637 0.01560332 [47,] 0.988536958 0.022926085 0.01146304 [48,] 0.970733800 0.058532399 0.02926620 [49,] 0.964664184 0.070671632 0.03533582 > postscript(file="/var/www/html/rcomp/tmp/14qom1258724249.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/29s971258724249.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/30ku81258724249.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/42thc1258724249.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/5mjfl1258724249.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 -2405.78884 59.52556 92.01720 625.62223 1502.98372 -1293.94941 7 8 9 10 11 12 297.46282 282.90523 1743.96411 -128.32628 123.99506 148.04829 13 14 15 16 17 18 -1470.89479 1177.42983 -766.60710 114.11628 -315.01855 2540.18155 19 20 21 22 23 24 -620.86708 3491.57125 -1251.79397 91.39512 -12.51696 -1615.63068 25 26 27 28 29 30 -1670.58069 -552.84700 435.03396 903.06611 -787.05027 -24.20983 31 32 33 34 35 36 -583.77417 301.50376 -932.43120 -140.39339 553.88950 -141.21795 37 38 39 40 41 42 -1130.92432 100.31982 946.18886 328.33561 -610.46060 657.11325 43 44 45 46 47 48 399.32311 814.06263 1367.60539 572.27388 1875.29616 1314.95504 49 50 51 52 53 54 272.87648 1824.19754 1856.10006 73.01090 -846.16276 -1669.08710 55 56 57 58 59 60 -1344.33276 -1016.08131 -1199.13218 -1836.52495 -916.06212 -1603.70404 > postscript(file="/var/www/html/rcomp/tmp/660r41258724249.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 -2405.78884 NA 1 59.52556 -2405.78884 2 92.01720 59.52556 3 625.62223 92.01720 4 1502.98372 625.62223 5 -1293.94941 1502.98372 6 297.46282 -1293.94941 7 282.90523 297.46282 8 1743.96411 282.90523 9 -128.32628 1743.96411 10 123.99506 -128.32628 11 148.04829 123.99506 12 -1470.89479 148.04829 13 1177.42983 -1470.89479 14 -766.60710 1177.42983 15 114.11628 -766.60710 16 -315.01855 114.11628 17 2540.18155 -315.01855 18 -620.86708 2540.18155 19 3491.57125 -620.86708 20 -1251.79397 3491.57125 21 91.39512 -1251.79397 22 -12.51696 91.39512 23 -1615.63068 -12.51696 24 -1670.58069 -1615.63068 25 -552.84700 -1670.58069 26 435.03396 -552.84700 27 903.06611 435.03396 28 -787.05027 903.06611 29 -24.20983 -787.05027 30 -583.77417 -24.20983 31 301.50376 -583.77417 32 -932.43120 301.50376 33 -140.39339 -932.43120 34 553.88950 -140.39339 35 -141.21795 553.88950 36 -1130.92432 -141.21795 37 100.31982 -1130.92432 38 946.18886 100.31982 39 328.33561 946.18886 40 -610.46060 328.33561 41 657.11325 -610.46060 42 399.32311 657.11325 43 814.06263 399.32311 44 1367.60539 814.06263 45 572.27388 1367.60539 46 1875.29616 572.27388 47 1314.95504 1875.29616 48 272.87648 1314.95504 49 1824.19754 272.87648 50 1856.10006 1824.19754 51 73.01090 1856.10006 52 -846.16276 73.01090 53 -1669.08710 -846.16276 54 -1344.33276 -1669.08710 55 -1016.08131 -1344.33276 56 -1199.13218 -1016.08131 57 -1836.52495 -1199.13218 58 -916.06212 -1836.52495 59 -1603.70404 -916.06212 60 NA -1603.70404 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] 59.52556 -2405.78884 [2,] 92.01720 59.52556 [3,] 625.62223 92.01720 [4,] 1502.98372 625.62223 [5,] -1293.94941 1502.98372 [6,] 297.46282 -1293.94941 [7,] 282.90523 297.46282 [8,] 1743.96411 282.90523 [9,] -128.32628 1743.96411 [10,] 123.99506 -128.32628 [11,] 148.04829 123.99506 [12,] -1470.89479 148.04829 [13,] 1177.42983 -1470.89479 [14,] -766.60710 1177.42983 [15,] 114.11628 -766.60710 [16,] -315.01855 114.11628 [17,] 2540.18155 -315.01855 [18,] -620.86708 2540.18155 [19,] 3491.57125 -620.86708 [20,] -1251.79397 3491.57125 [21,] 91.39512 -1251.79397 [22,] -12.51696 91.39512 [23,] -1615.63068 -12.51696 [24,] -1670.58069 -1615.63068 [25,] -552.84700 -1670.58069 [26,] 435.03396 -552.84700 [27,] 903.06611 435.03396 [28,] -787.05027 903.06611 [29,] -24.20983 -787.05027 [30,] -583.77417 -24.20983 [31,] 301.50376 -583.77417 [32,] -932.43120 301.50376 [33,] -140.39339 -932.43120 [34,] 553.88950 -140.39339 [35,] -141.21795 553.88950 [36,] -1130.92432 -141.21795 [37,] 100.31982 -1130.92432 [38,] 946.18886 100.31982 [39,] 328.33561 946.18886 [40,] -610.46060 328.33561 [41,] 657.11325 -610.46060 [42,] 399.32311 657.11325 [43,] 814.06263 399.32311 [44,] 1367.60539 814.06263 [45,] 572.27388 1367.60539 [46,] 1875.29616 572.27388 [47,] 1314.95504 1875.29616 [48,] 272.87648 1314.95504 [49,] 1824.19754 272.87648 [50,] 1856.10006 1824.19754 [51,] 73.01090 1856.10006 [52,] -846.16276 73.01090 [53,] -1669.08710 -846.16276 [54,] -1344.33276 -1669.08710 [55,] -1016.08131 -1344.33276 [56,] -1199.13218 -1016.08131 [57,] -1836.52495 -1199.13218 [58,] -916.06212 -1836.52495 [59,] -1603.70404 -916.06212 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 59.52556 -2405.78884 2 92.01720 59.52556 3 625.62223 92.01720 4 1502.98372 625.62223 5 -1293.94941 1502.98372 6 297.46282 -1293.94941 7 282.90523 297.46282 8 1743.96411 282.90523 9 -128.32628 1743.96411 10 123.99506 -128.32628 11 148.04829 123.99506 12 -1470.89479 148.04829 13 1177.42983 -1470.89479 14 -766.60710 1177.42983 15 114.11628 -766.60710 16 -315.01855 114.11628 17 2540.18155 -315.01855 18 -620.86708 2540.18155 19 3491.57125 -620.86708 20 -1251.79397 3491.57125 21 91.39512 -1251.79397 22 -12.51696 91.39512 23 -1615.63068 -12.51696 24 -1670.58069 -1615.63068 25 -552.84700 -1670.58069 26 435.03396 -552.84700 27 903.06611 435.03396 28 -787.05027 903.06611 29 -24.20983 -787.05027 30 -583.77417 -24.20983 31 301.50376 -583.77417 32 -932.43120 301.50376 33 -140.39339 -932.43120 34 553.88950 -140.39339 35 -141.21795 553.88950 36 -1130.92432 -141.21795 37 100.31982 -1130.92432 38 946.18886 100.31982 39 328.33561 946.18886 40 -610.46060 328.33561 41 657.11325 -610.46060 42 399.32311 657.11325 43 814.06263 399.32311 44 1367.60539 814.06263 45 572.27388 1367.60539 46 1875.29616 572.27388 47 1314.95504 1875.29616 48 272.87648 1314.95504 49 1824.19754 272.87648 50 1856.10006 1824.19754 51 73.01090 1856.10006 52 -846.16276 73.01090 53 -1669.08710 -846.16276 54 -1344.33276 -1669.08710 55 -1016.08131 -1344.33276 56 -1199.13218 -1016.08131 57 -1836.52495 -1199.13218 58 -916.06212 -1836.52495 59 -1603.70404 -916.06212 > 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/7klxs1258724249.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/8tzek1258724249.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/9rmuf1258724249.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/1048m31258724249.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/1199mh1258724249.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/12cy0u1258724249.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/13ndle1258724249.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/14ixs11258724249.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/15o9wy1258724249.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/16oyhf1258724250.tab") + } > > system("convert tmp/14qom1258724249.ps tmp/14qom1258724249.png") > system("convert tmp/29s971258724249.ps tmp/29s971258724249.png") > system("convert tmp/30ku81258724249.ps tmp/30ku81258724249.png") > system("convert tmp/42thc1258724249.ps tmp/42thc1258724249.png") > system("convert tmp/5mjfl1258724249.ps tmp/5mjfl1258724249.png") > system("convert tmp/660r41258724249.ps tmp/660r41258724249.png") > system("convert tmp/7klxs1258724249.ps tmp/7klxs1258724249.png") > system("convert tmp/8tzek1258724249.ps tmp/8tzek1258724249.png") > system("convert tmp/9rmuf1258724249.ps tmp/9rmuf1258724249.png") > system("convert tmp/1048m31258724249.ps tmp/1048m31258724249.png") > > > proc.time() user system elapsed 2.494 1.578 2.914