R version 2.15.2 (2012-10-26) -- "Trick or Treat" Copyright (C) 2012 The R Foundation for Statistical Computing ISBN 3-900051-07-0 Platform: i686-pc-linux-gnu (32-bit) 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(31/12/1961 + ,9190 + ,2514 + ,2550 + ,1512 + ,1591 + ,472 + ,551 + ,31/12/1962 + ,9251 + ,2537 + ,2572 + ,1517 + ,1595 + ,476 + ,554 + ,31/12/1963 + ,9328 + ,2564 + ,2597 + ,1525 + ,1602 + ,483 + ,558 + ,31/12/1964 + ,9428 + ,2595 + ,2623 + ,1540 + ,1613 + ,493 + ,565 + ,31/12/1965 + ,9499 + ,2617 + ,2647 + ,1547 + ,1622 + ,498 + ,568 + ,31/12/1966 + ,9556 + ,2638 + ,2670 + ,1547 + ,1627 + ,502 + ,572 + ,31/12/1967 + ,9606 + ,2657 + ,2690 + ,1547 + ,1632 + ,504 + ,575 + ,31/12/1968 + ,9632 + ,2668 + ,2705 + ,1547 + ,1634 + ,503 + ,574 + ,31/12/1969 + ,9660 + ,2683 + ,2721 + ,1546 + ,1637 + ,501 + ,572 + ,31/12/1970 + ,9651 + ,2687 + ,2729 + ,1533 + ,1627 + ,502 + ,573 + ,31/12/1971 + ,9695 + ,2705 + ,2747 + ,1538 + ,1632 + ,502 + ,572 + ,31/12/1972 + ,9727 + ,2717 + ,2761 + ,1543 + ,1637 + ,500 + ,569 + ,31/12/1973 + ,9757 + ,2728 + ,2773 + ,1549 + ,1643 + ,498 + ,566 + ,31/12/1974 + ,9788 + ,2741 + ,2786 + ,1556 + ,1650 + ,495 + ,560 + ,31/12/1975 + ,9813 + ,2752 + ,2796 + ,1559 + ,1654 + ,494 + ,557 + ,31/12/1976 + ,9823 + ,2759 + ,2807 + ,1559 + ,1656 + ,490 + ,552 + ,31/12/1977 + ,9837 + ,2767 + ,2817 + ,1563 + ,1661 + ,484 + ,545 + ,31/12/1978 + ,9842 + ,2774 + ,2827 + ,1563 + ,1662 + ,477 + ,539 + ,31/12/1979 + ,9855 + ,2781 + ,2838 + ,1564 + ,1664 + ,474 + ,535 + ,31/12/1980 + ,9863 + ,2788 + ,2847 + ,1564 + ,1665 + ,469 + ,531 + ,31/12/1981 + ,9855 + ,2789 + ,2853 + ,1557 + ,1661 + ,466 + ,528 + ,31/12/1982 + ,9858 + ,2795 + ,2860 + ,1554 + ,1659 + ,464 + ,526 + ,31/12/1983 + ,9853 + ,2798 + ,2864 + ,1552 + ,1656 + ,460 + ,523 + ,31/12/1984 + ,9858 + ,2801 + ,2869 + ,1552 + ,1656 + ,458 + ,521 + ,31/12/1985 + ,9859 + ,2803 + ,2873 + ,1551 + ,1655 + ,457 + ,519 + ,31/12/1986 + ,9865 + ,2808 + ,2877 + ,1552 + ,1654 + ,456 + ,517 + ,31/12/1987 + ,9876 + ,2813 + ,2883 + ,1554 + ,1656 + ,455 + ,515 + ,31/12/1988 + ,9928 + ,2826 + ,2896 + ,1567 + ,1668 + ,456 + ,514 + ,31/12/1989 + ,9948 + ,2835 + ,2905 + ,1572 + ,1672 + ,453 + ,511 + ,31/12/1990 + ,9987 + ,2849 + ,2919 + ,1579 + ,1680 + ,453 + ,508 + ,31/12/1991 + ,10022 + ,2862 + ,2933 + ,1588 + ,1688 + ,449 + ,502 + ,31/12/1992 + ,10068 + ,2877 + ,2948 + ,1597 + ,1696 + ,449 + ,501 + ,31/12/1993 + ,10101 + ,2888 + ,2959 + ,1603 + ,1702 + ,449 + ,500 + ,31/12/1994 + ,10131 + ,2897 + ,2969 + ,1607 + ,1706 + ,452 + ,500 + ,31/12/1995 + ,10143 + ,2902 + ,2978 + ,1607 + ,1708 + ,450 + ,498 + ,31/12/1996 + ,10170 + ,2911 + ,2988 + ,1609 + ,1711 + ,452 + ,499 + ,31/12/1997 + ,10192 + ,2917 + ,2996 + ,1612 + ,1714 + ,454 + ,499 + ,31/12/1998 + ,10214 + ,2924 + ,3003 + ,1615 + ,1717 + ,455 + ,500 + ,31/12/1999 + ,10239 + ,2930 + ,3011 + ,1619 + ,1721 + ,458 + ,501 + ,31/12/2000 + ,10263 + ,2935 + ,3018 + ,1622 + ,1724 + ,461 + ,503 + ,31/12/2001 + ,10310 + ,2945 + ,3028 + ,1628 + ,1730 + ,469 + ,510 + ,31/12/2002 + ,10355 + ,2957 + ,3038 + ,1634 + ,1735 + ,477 + ,515 + ,31/12/2003 + ,10396 + ,2967 + ,3049 + ,1640 + ,1740 + ,480 + ,520 + ,31/12/2004 + ,10446 + ,2980 + ,3063 + ,1648 + ,1748 + ,484 + ,523 + ,31/12/2005 + ,10511 + ,2997 + ,3081 + ,1657 + ,1757 + ,490 + ,529 + ,31/12/2006 + ,10585 + ,3017 + ,3100 + ,1668 + ,1768 + ,497 + ,534 + ,31/12/2007 + ,10667 + ,3040 + ,3122 + ,1678 + ,1778 + ,506 + ,543 + ,31/12/2008 + ,10753 + ,3064 + ,3145 + ,1687 + ,1789 + ,516 + ,553 + ,31/12/2009 + ,10840 + ,3085 + ,3167 + ,1700 + ,1798 + ,527 + ,563 + ,31/12/2010 + ,10951 + ,3113 + ,3193 + ,1714 + ,1811 + ,542 + ,577) + ,dim=c(8 + ,50) + ,dimnames=list(c('jaar' + ,'totaal' + ,'vlaamsm' + ,'vlaamsvr' + ,'waalsm' + ,'waalsvr' + ,'brusselm' + ,'brusselvr') + ,1:50)) > y <- array(NA,dim=c(8,50),dimnames=list(c('jaar','totaal','vlaamsm','vlaamsvr','waalsm','waalsvr','brusselm','brusselvr'),1:50)) > 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 = 'Do not include Seasonal Dummies' > par1 = '1' > par3 <- '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, 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 jaar totaal vlaamsm vlaamsvr waalsm waalsvr brusselm brusselvr t 1 0.001317355 9190 2514 2550 1512 1591 472 551 1 2 0.001316684 9251 2537 2572 1517 1595 476 554 2 3 0.001316013 9328 2564 2597 1525 1602 483 558 3 4 0.001315343 9428 2595 2623 1540 1613 493 565 4 5 0.001314673 9499 2617 2647 1547 1622 498 568 5 6 0.001314005 9556 2638 2670 1547 1627 502 572 6 7 0.001313337 9606 2657 2690 1547 1632 504 575 7 8 0.001312669 9632 2668 2705 1547 1634 503 574 8 9 0.001312003 9660 2683 2721 1546 1637 501 572 9 10 0.001311337 9651 2687 2729 1533 1627 502 573 10 11 0.001310671 9695 2705 2747 1538 1632 502 572 11 12 0.001310007 9727 2717 2761 1543 1637 500 569 12 13 0.001309343 9757 2728 2773 1549 1643 498 566 13 14 0.001308680 9788 2741 2786 1556 1650 495 560 14 15 0.001308017 9813 2752 2796 1559 1654 494 557 15 16 0.001307355 9823 2759 2807 1559 1656 490 552 16 17 0.001306694 9837 2767 2817 1563 1661 484 545 17 18 0.001306033 9842 2774 2827 1563 1662 477 539 18 19 0.001305373 9855 2781 2838 1564 1664 474 535 19 20 0.001304714 9863 2788 2847 1564 1665 469 531 20 21 0.001304055 9855 2789 2853 1557 1661 466 528 21 22 0.001303397 9858 2795 2860 1554 1659 464 526 22 23 0.001302740 9853 2798 2864 1552 1656 460 523 23 24 0.001302083 9858 2801 2869 1552 1656 458 521 24 25 0.001301427 9859 2803 2873 1551 1655 457 519 25 26 0.001300772 9865 2808 2877 1552 1654 456 517 26 27 0.001300117 9876 2813 2883 1554 1656 455 515 27 28 0.001299463 9928 2826 2896 1567 1668 456 514 28 29 0.001298810 9948 2835 2905 1572 1672 453 511 29 30 0.001298157 9987 2849 2919 1579 1680 453 508 30 31 0.001297505 10022 2862 2933 1588 1688 449 502 31 32 0.001296854 10068 2877 2948 1597 1696 449 501 32 33 0.001296203 10101 2888 2959 1603 1702 449 500 33 34 0.001295553 10131 2897 2969 1607 1706 452 500 34 35 0.001294904 10143 2902 2978 1607 1708 450 498 35 36 0.001294255 10170 2911 2988 1609 1711 452 499 36 37 0.001293607 10192 2917 2996 1612 1714 454 499 37 38 0.001292960 10214 2924 3003 1615 1717 455 500 38 39 0.001292313 10239 2930 3011 1619 1721 458 501 39 40 0.001291667 10263 2935 3018 1622 1724 461 503 40 41 0.001291021 10310 2945 3028 1628 1730 469 510 41 42 0.001290376 10355 2957 3038 1634 1735 477 515 42 43 0.001289732 10396 2967 3049 1640 1740 480 520 43 44 0.001289088 10446 2980 3063 1648 1748 484 523 44 45 0.001288446 10511 2997 3081 1657 1757 490 529 45 46 0.001287803 10585 3017 3100 1668 1768 497 534 46 47 0.001287162 10667 3040 3122 1678 1778 506 543 47 48 0.001286521 10753 3064 3145 1687 1789 516 553 48 49 0.001285880 10840 3085 3167 1700 1798 527 563 49 50 0.001285240 10951 3113 3193 1714 1811 542 577 50 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) totaal vlaamsm vlaamsvr waalsm waalsvr 1.317e-03 -3.035e-09 -3.693e-10 4.567e-09 5.001e-09 3.875e-09 brusselm brusselvr t 1.348e-09 6.370e-09 -6.452e-07 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -1.471e-08 -3.735e-09 2.147e-10 4.691e-09 1.167e-08 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 1.317e-03 3.251e-07 4051.727 < 2e-16 *** totaal -3.035e-09 1.714e-09 -1.770 0.08409 . vlaamsm -3.693e-10 1.819e-09 -0.203 0.84010 vlaamsvr 4.567e-09 2.046e-09 2.232 0.03116 * waalsm 5.001e-09 1.916e-09 2.610 0.01260 * waalsvr 3.875e-09 1.827e-09 2.122 0.03997 * brusselm 1.348e-09 1.781e-09 0.757 0.45339 brusselvr 6.370e-09 1.943e-09 3.279 0.00213 ** t -6.452e-07 2.134e-09 -302.288 < 2e-16 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 6.956e-09 on 41 degrees of freedom Multiple R-squared: 1, Adjusted R-squared: 1 F-statistic: 1.155e+07 on 8 and 41 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.0221939854 4.438797e-02 9.778060e-01 [2,] 0.0113995517 2.279910e-02 9.886004e-01 [3,] 0.0092524993 1.850500e-02 9.907475e-01 [4,] 0.0039581200 7.916240e-03 9.960419e-01 [5,] 0.0018454116 3.690823e-03 9.981546e-01 [6,] 0.0008134163 1.626833e-03 9.991866e-01 [7,] 0.0087031391 1.740628e-02 9.912969e-01 [8,] 0.0218670518 4.373410e-02 9.781329e-01 [9,] 0.0645459083 1.290918e-01 9.354541e-01 [10,] 0.2022910469 4.045821e-01 7.977090e-01 [11,] 0.2156064962 4.312130e-01 7.843935e-01 [12,] 0.2896680497 5.793361e-01 7.103320e-01 [13,] 0.3870053840 7.740108e-01 6.129946e-01 [14,] 0.4238814191 8.477628e-01 5.761186e-01 [15,] 0.6278343737 7.443313e-01 3.721656e-01 [16,] 0.9379733374 1.240533e-01 6.202666e-02 [17,] 0.9175612970 1.648774e-01 8.243870e-02 [18,] 0.9044718029 1.910564e-01 9.552820e-02 [19,] 0.9833731569 3.325369e-02 1.662684e-02 [20,] 0.9999168585 1.662829e-04 8.314145e-05 [21,] 0.9999998233 3.534820e-07 1.767410e-07 [22,] 0.9999999444 1.111978e-07 5.559889e-08 [23,] 0.9999997176 5.647622e-07 2.823811e-07 [24,] 0.9999982360 3.528095e-06 1.764047e-06 [25,] 0.9999902990 1.940195e-05 9.700977e-06 [26,] 0.9999858262 2.834754e-05 1.417377e-05 [27,] 0.9998085349 3.829302e-04 1.914651e-04 > postscript(file="/var/wessaorg/rcomp/tmp/1z4a71352027041.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/wessaorg/rcomp/tmp/2mfhm1352027041.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/wessaorg/rcomp/tmp/3v5sk1352027041.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/wessaorg/rcomp/tmp/4tt5m1352027041.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/wessaorg/rcomp/tmp/5icss1352027041.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 = 50 Frequency = 1 1 2 3 4 5 1.847183e-09 3.702314e-09 5.532271e-09 1.093389e-09 -4.882749e-09 6 7 8 9 10 -2.981355e-09 3.843406e-10 -7.377273e-09 -2.636694e-09 1.019969e-08 11 12 13 14 15 1.000075e-08 5.546559e-09 -4.415481e-09 -2.916095e-09 3.831226e-09 16 17 18 19 20 -7.787854e-10 -3.837266e-09 -3.426774e-09 -9.645801e-09 -9.666245e-09 21 22 23 24 25 -7.764113e-10 3.967667e-09 5.629479e-09 3.041426e-09 7.012741e-10 26 27 28 29 30 5.301297e-09 -2.487888e-11 -1.210790e-08 -1.471501e-08 -9.538406e-09 31 32 33 34 35 -1.714364e-09 -9.237716e-10 6.114429e-10 4.861047e-09 5.460880e-09 36 37 38 39 40 1.076389e-08 1.093713e-08 1.167325e-08 5.653042e-09 3.948460e-09 41 42 43 44 45 -4.383075e-09 -7.856277e-10 -7.248220e-09 -8.582504e-09 -1.122522e-08 46 47 48 49 50 -2.103014e-09 4.501262e-11 4.181845e-09 1.847789e-09 5.930256e-09 > postscript(file="/var/wessaorg/rcomp/tmp/6m4eq1352027041.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 = 50 Frequency = 1 lag(myerror, k = 1) myerror 0 1.847183e-09 NA 1 3.702314e-09 1.847183e-09 2 5.532271e-09 3.702314e-09 3 1.093389e-09 5.532271e-09 4 -4.882749e-09 1.093389e-09 5 -2.981355e-09 -4.882749e-09 6 3.843406e-10 -2.981355e-09 7 -7.377273e-09 3.843406e-10 8 -2.636694e-09 -7.377273e-09 9 1.019969e-08 -2.636694e-09 10 1.000075e-08 1.019969e-08 11 5.546559e-09 1.000075e-08 12 -4.415481e-09 5.546559e-09 13 -2.916095e-09 -4.415481e-09 14 3.831226e-09 -2.916095e-09 15 -7.787854e-10 3.831226e-09 16 -3.837266e-09 -7.787854e-10 17 -3.426774e-09 -3.837266e-09 18 -9.645801e-09 -3.426774e-09 19 -9.666245e-09 -9.645801e-09 20 -7.764113e-10 -9.666245e-09 21 3.967667e-09 -7.764113e-10 22 5.629479e-09 3.967667e-09 23 3.041426e-09 5.629479e-09 24 7.012741e-10 3.041426e-09 25 5.301297e-09 7.012741e-10 26 -2.487888e-11 5.301297e-09 27 -1.210790e-08 -2.487888e-11 28 -1.471501e-08 -1.210790e-08 29 -9.538406e-09 -1.471501e-08 30 -1.714364e-09 -9.538406e-09 31 -9.237716e-10 -1.714364e-09 32 6.114429e-10 -9.237716e-10 33 4.861047e-09 6.114429e-10 34 5.460880e-09 4.861047e-09 35 1.076389e-08 5.460880e-09 36 1.093713e-08 1.076389e-08 37 1.167325e-08 1.093713e-08 38 5.653042e-09 1.167325e-08 39 3.948460e-09 5.653042e-09 40 -4.383075e-09 3.948460e-09 41 -7.856277e-10 -4.383075e-09 42 -7.248220e-09 -7.856277e-10 43 -8.582504e-09 -7.248220e-09 44 -1.122522e-08 -8.582504e-09 45 -2.103014e-09 -1.122522e-08 46 4.501262e-11 -2.103014e-09 47 4.181845e-09 4.501262e-11 48 1.847789e-09 4.181845e-09 49 5.930256e-09 1.847789e-09 50 NA 5.930256e-09 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] 3.702314e-09 1.847183e-09 [2,] 5.532271e-09 3.702314e-09 [3,] 1.093389e-09 5.532271e-09 [4,] -4.882749e-09 1.093389e-09 [5,] -2.981355e-09 -4.882749e-09 [6,] 3.843406e-10 -2.981355e-09 [7,] -7.377273e-09 3.843406e-10 [8,] -2.636694e-09 -7.377273e-09 [9,] 1.019969e-08 -2.636694e-09 [10,] 1.000075e-08 1.019969e-08 [11,] 5.546559e-09 1.000075e-08 [12,] -4.415481e-09 5.546559e-09 [13,] -2.916095e-09 -4.415481e-09 [14,] 3.831226e-09 -2.916095e-09 [15,] -7.787854e-10 3.831226e-09 [16,] -3.837266e-09 -7.787854e-10 [17,] -3.426774e-09 -3.837266e-09 [18,] -9.645801e-09 -3.426774e-09 [19,] -9.666245e-09 -9.645801e-09 [20,] -7.764113e-10 -9.666245e-09 [21,] 3.967667e-09 -7.764113e-10 [22,] 5.629479e-09 3.967667e-09 [23,] 3.041426e-09 5.629479e-09 [24,] 7.012741e-10 3.041426e-09 [25,] 5.301297e-09 7.012741e-10 [26,] -2.487888e-11 5.301297e-09 [27,] -1.210790e-08 -2.487888e-11 [28,] -1.471501e-08 -1.210790e-08 [29,] -9.538406e-09 -1.471501e-08 [30,] -1.714364e-09 -9.538406e-09 [31,] -9.237716e-10 -1.714364e-09 [32,] 6.114429e-10 -9.237716e-10 [33,] 4.861047e-09 6.114429e-10 [34,] 5.460880e-09 4.861047e-09 [35,] 1.076389e-08 5.460880e-09 [36,] 1.093713e-08 1.076389e-08 [37,] 1.167325e-08 1.093713e-08 [38,] 5.653042e-09 1.167325e-08 [39,] 3.948460e-09 5.653042e-09 [40,] -4.383075e-09 3.948460e-09 [41,] -7.856277e-10 -4.383075e-09 [42,] -7.248220e-09 -7.856277e-10 [43,] -8.582504e-09 -7.248220e-09 [44,] -1.122522e-08 -8.582504e-09 [45,] -2.103014e-09 -1.122522e-08 [46,] 4.501262e-11 -2.103014e-09 [47,] 4.181845e-09 4.501262e-11 [48,] 1.847789e-09 4.181845e-09 [49,] 5.930256e-09 1.847789e-09 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 3.702314e-09 1.847183e-09 2 5.532271e-09 3.702314e-09 3 1.093389e-09 5.532271e-09 4 -4.882749e-09 1.093389e-09 5 -2.981355e-09 -4.882749e-09 6 3.843406e-10 -2.981355e-09 7 -7.377273e-09 3.843406e-10 8 -2.636694e-09 -7.377273e-09 9 1.019969e-08 -2.636694e-09 10 1.000075e-08 1.019969e-08 11 5.546559e-09 1.000075e-08 12 -4.415481e-09 5.546559e-09 13 -2.916095e-09 -4.415481e-09 14 3.831226e-09 -2.916095e-09 15 -7.787854e-10 3.831226e-09 16 -3.837266e-09 -7.787854e-10 17 -3.426774e-09 -3.837266e-09 18 -9.645801e-09 -3.426774e-09 19 -9.666245e-09 -9.645801e-09 20 -7.764113e-10 -9.666245e-09 21 3.967667e-09 -7.764113e-10 22 5.629479e-09 3.967667e-09 23 3.041426e-09 5.629479e-09 24 7.012741e-10 3.041426e-09 25 5.301297e-09 7.012741e-10 26 -2.487888e-11 5.301297e-09 27 -1.210790e-08 -2.487888e-11 28 -1.471501e-08 -1.210790e-08 29 -9.538406e-09 -1.471501e-08 30 -1.714364e-09 -9.538406e-09 31 -9.237716e-10 -1.714364e-09 32 6.114429e-10 -9.237716e-10 33 4.861047e-09 6.114429e-10 34 5.460880e-09 4.861047e-09 35 1.076389e-08 5.460880e-09 36 1.093713e-08 1.076389e-08 37 1.167325e-08 1.093713e-08 38 5.653042e-09 1.167325e-08 39 3.948460e-09 5.653042e-09 40 -4.383075e-09 3.948460e-09 41 -7.856277e-10 -4.383075e-09 42 -7.248220e-09 -7.856277e-10 43 -8.582504e-09 -7.248220e-09 44 -1.122522e-08 -8.582504e-09 45 -2.103014e-09 -1.122522e-08 46 4.501262e-11 -2.103014e-09 47 4.181845e-09 4.501262e-11 48 1.847789e-09 4.181845e-09 49 5.930256e-09 1.847789e-09 > 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/wessaorg/rcomp/tmp/7sks71352027041.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/wessaorg/rcomp/tmp/8qqpi1352027041.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/wessaorg/rcomp/tmp/9tfb01352027041.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/wessaorg/rcomp/tmp/10hvuk1352027041.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/wessaorg/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/wessaorg/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/wessaorg/rcomp/tmp/11ewgo1352027041.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/wessaorg/rcomp/tmp/1292og1352027041.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/wessaorg/rcomp/tmp/131rwf1352027041.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/wessaorg/rcomp/tmp/14wony1352027041.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/wessaorg/rcomp/tmp/15myjm1352027041.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/wessaorg/rcomp/tmp/16bemm1352027041.tab") + } > > try(system("convert tmp/1z4a71352027041.ps tmp/1z4a71352027041.png",intern=TRUE)) character(0) > try(system("convert tmp/2mfhm1352027041.ps tmp/2mfhm1352027041.png",intern=TRUE)) character(0) > try(system("convert tmp/3v5sk1352027041.ps tmp/3v5sk1352027041.png",intern=TRUE)) character(0) > try(system("convert tmp/4tt5m1352027041.ps tmp/4tt5m1352027041.png",intern=TRUE)) character(0) > try(system("convert tmp/5icss1352027041.ps tmp/5icss1352027041.png",intern=TRUE)) character(0) > try(system("convert tmp/6m4eq1352027041.ps tmp/6m4eq1352027041.png",intern=TRUE)) character(0) > try(system("convert tmp/7sks71352027041.ps tmp/7sks71352027041.png",intern=TRUE)) character(0) > try(system("convert tmp/8qqpi1352027041.ps tmp/8qqpi1352027041.png",intern=TRUE)) character(0) > try(system("convert tmp/9tfb01352027041.ps tmp/9tfb01352027041.png",intern=TRUE)) character(0) > try(system("convert tmp/10hvuk1352027041.ps tmp/10hvuk1352027041.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 6.978 1.334 8.296