R version 2.15.1 (2012-06-22) -- "Roasted Marshmallows" 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' + ,'vlaams_man' + ,'vlaams_vrouw' + ,'waals_man' + ,'waals_vrouw' + ,'brussel_man' + ,'brussel_vrouw') + ,1:50)) > y <- array(NA,dim=c(8,50),dimnames=list(c('jaar','totaal','vlaams_man','vlaams_vrouw','waals_man','waals_vrouw','brussel_man','brussel_vrouw'),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 = '2' > 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 totaal jaar vlaams_man vlaams_vrouw waals_man waals_vrouw brussel_man 1 9190 0.001317355 2514 2550 1512 1591 472 2 9251 0.001316684 2537 2572 1517 1595 476 3 9328 0.001316013 2564 2597 1525 1602 483 4 9428 0.001315343 2595 2623 1540 1613 493 5 9499 0.001314673 2617 2647 1547 1622 498 6 9556 0.001314005 2638 2670 1547 1627 502 7 9606 0.001313337 2657 2690 1547 1632 504 8 9632 0.001312669 2668 2705 1547 1634 503 9 9660 0.001312003 2683 2721 1546 1637 501 10 9651 0.001311337 2687 2729 1533 1627 502 11 9695 0.001310671 2705 2747 1538 1632 502 12 9727 0.001310007 2717 2761 1543 1637 500 13 9757 0.001309343 2728 2773 1549 1643 498 14 9788 0.001308680 2741 2786 1556 1650 495 15 9813 0.001308017 2752 2796 1559 1654 494 16 9823 0.001307355 2759 2807 1559 1656 490 17 9837 0.001306694 2767 2817 1563 1661 484 18 9842 0.001306033 2774 2827 1563 1662 477 19 9855 0.001305373 2781 2838 1564 1664 474 20 9863 0.001304714 2788 2847 1564 1665 469 21 9855 0.001304055 2789 2853 1557 1661 466 22 9858 0.001303397 2795 2860 1554 1659 464 23 9853 0.001302740 2798 2864 1552 1656 460 24 9858 0.001302083 2801 2869 1552 1656 458 25 9859 0.001301427 2803 2873 1551 1655 457 26 9865 0.001300772 2808 2877 1552 1654 456 27 9876 0.001300117 2813 2883 1554 1656 455 28 9928 0.001299463 2826 2896 1567 1668 456 29 9948 0.001298810 2835 2905 1572 1672 453 30 9987 0.001298157 2849 2919 1579 1680 453 31 10022 0.001297505 2862 2933 1588 1688 449 32 10068 0.001296854 2877 2948 1597 1696 449 33 10101 0.001296203 2888 2959 1603 1702 449 34 10131 0.001295553 2897 2969 1607 1706 452 35 10143 0.001294904 2902 2978 1607 1708 450 36 10170 0.001294255 2911 2988 1609 1711 452 37 10192 0.001293607 2917 2996 1612 1714 454 38 10214 0.001292960 2924 3003 1615 1717 455 39 10239 0.001292313 2930 3011 1619 1721 458 40 10263 0.001291667 2935 3018 1622 1724 461 41 10310 0.001291021 2945 3028 1628 1730 469 42 10355 0.001290376 2957 3038 1634 1735 477 43 10396 0.001289732 2967 3049 1640 1740 480 44 10446 0.001289088 2980 3063 1648 1748 484 45 10511 0.001288446 2997 3081 1657 1757 490 46 10585 0.001287803 3017 3100 1668 1768 497 47 10667 0.001287162 3040 3122 1678 1778 506 48 10753 0.001286521 3064 3145 1687 1789 516 49 10840 0.001285880 3085 3167 1700 1798 527 50 10951 0.001285240 3113 3193 1714 1811 542 brussel_vrouw t 1 551 1 2 554 2 3 558 3 4 565 4 5 568 5 6 572 6 7 575 7 8 574 8 9 572 9 10 573 10 11 572 11 12 569 12 13 566 13 14 560 14 15 557 15 16 552 16 17 545 17 18 539 18 19 535 19 20 531 20 21 528 21 22 526 22 23 523 23 24 521 24 25 519 25 26 517 26 27 515 27 28 514 28 29 511 29 30 508 30 31 502 31 32 501 32 33 500 33 34 500 34 35 498 35 36 499 36 37 499 37 38 500 38 39 501 39 40 503 40 41 510 41 42 515 42 43 520 43 44 523 44 45 529 45 46 534 46 47 543 47 48 553 48 49 563 49 50 577 50 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) jaar vlaams_man vlaams_vrouw waals_man 3.080e+04 -2.340e+07 8.704e-01 1.096e+00 1.086e+00 waals_vrouw brussel_man brussel_vrouw t 9.728e-01 9.095e-01 1.136e+00 -1.518e+01 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -1.28920 -0.30373 0.04159 0.37386 1.21120 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 3.080e+04 1.741e+04 1.769 0.0843 . jaar -2.340e+07 1.322e+07 -1.770 0.0841 . vlaams_man 8.704e-01 8.397e-02 10.366 5.05e-13 *** vlaams_vrouw 1.096e+00 8.307e-02 13.196 2.39e-16 *** waals_man 1.086e+00 6.539e-02 16.604 < 2e-16 *** waals_vrouw 9.728e-01 7.395e-02 13.154 2.65e-16 *** brussel_man 9.095e-01 6.799e-02 13.378 < 2e-16 *** brussel_vrouw 1.136e+00 7.238e-02 15.699 < 2e-16 *** t -1.518e+01 8.526e+00 -1.780 0.0825 . --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 0.6108 on 41 degrees of freedom Multiple R-squared: 1, Adjusted R-squared: 1 F-statistic: 2.554e+06 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.4261556 0.8523112 0.5738444 [2,] 0.2790843 0.5581686 0.7209157 [3,] 0.2882199 0.5764397 0.7117801 [4,] 0.3074593 0.6149187 0.6925407 [5,] 0.2761776 0.5523552 0.7238224 [6,] 0.2242578 0.4485155 0.7757422 [7,] 0.3078211 0.6156422 0.6921789 [8,] 0.2696434 0.5392868 0.7303566 [9,] 0.2926679 0.5853359 0.7073321 [10,] 0.5634918 0.8730164 0.4365082 [11,] 0.5540982 0.8918035 0.4459018 [12,] 0.6204633 0.7590735 0.3795367 [13,] 0.5566350 0.8867301 0.4433650 [14,] 0.6066557 0.7866886 0.3933443 [15,] 0.5954723 0.8090554 0.4045277 [16,] 0.7635854 0.4728291 0.2364146 [17,] 0.8685599 0.2628802 0.1314401 [18,] 0.8709609 0.2580782 0.1290391 [19,] 0.8081231 0.3837538 0.1918769 [20,] 0.8674420 0.2651161 0.1325580 [21,] 0.8752953 0.2494094 0.1247047 [22,] 0.8333623 0.3332754 0.1666377 [23,] 0.7606345 0.4787310 0.2393655 [24,] 0.6933262 0.6133476 0.3066738 [25,] 0.5757835 0.8484329 0.4242165 [26,] 0.5048775 0.9902450 0.4951225 [27,] 0.3603427 0.7206854 0.6396573 > postscript(file="/var/fisher/rcomp/tmp/13cwk1351876804.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/fisher/rcomp/tmp/2umw41351876804.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/fisher/rcomp/tmp/3vvih1351876804.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/fisher/rcomp/tmp/448yp1351876804.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/fisher/rcomp/tmp/556j01351876804.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 2.265232e-01 1.882982e-01 -6.444565e-01 -6.673823e-01 7.566685e-02 6 7 8 9 10 6.533074e-02 1.055709e+00 6.984478e-01 -6.217742e-02 7.402872e-02 11 12 13 14 15 -8.735634e-01 -1.063482e-01 -3.189832e-01 -9.302892e-02 1.211204e+00 16 17 18 19 20 1.203964e-01 1.016405e-01 -2.400156e-02 -1.199351e+00 -1.289196e+00 21 22 23 24 25 6.559425e-01 -1.657825e-01 -2.296427e-01 5.808092e-01 5.222781e-01 26 27 28 29 30 6.965500e-01 -3.101102e-01 4.363539e-01 -5.570433e-01 -1.159262e+00 31 32 33 34 35 -7.876621e-05 1.784237e-02 1.201388e-01 3.267741e-01 2.350608e-01 36 37 38 39 40 3.895521e-01 4.135463e-01 4.517440e-01 -5.981732e-01 2.558451e-01 41 42 43 44 45 7.983577e-02 -5.766417e-01 -2.568575e-02 -8.622009e-02 -2.845895e-01 46 47 48 49 50 9.343902e-01 -3.726922e-02 -8.935099e-01 -3.340036e-01 6.025921e-01 > postscript(file="/var/fisher/rcomp/tmp/66nno1351876804.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 2.265232e-01 NA 1 1.882982e-01 2.265232e-01 2 -6.444565e-01 1.882982e-01 3 -6.673823e-01 -6.444565e-01 4 7.566685e-02 -6.673823e-01 5 6.533074e-02 7.566685e-02 6 1.055709e+00 6.533074e-02 7 6.984478e-01 1.055709e+00 8 -6.217742e-02 6.984478e-01 9 7.402872e-02 -6.217742e-02 10 -8.735634e-01 7.402872e-02 11 -1.063482e-01 -8.735634e-01 12 -3.189832e-01 -1.063482e-01 13 -9.302892e-02 -3.189832e-01 14 1.211204e+00 -9.302892e-02 15 1.203964e-01 1.211204e+00 16 1.016405e-01 1.203964e-01 17 -2.400156e-02 1.016405e-01 18 -1.199351e+00 -2.400156e-02 19 -1.289196e+00 -1.199351e+00 20 6.559425e-01 -1.289196e+00 21 -1.657825e-01 6.559425e-01 22 -2.296427e-01 -1.657825e-01 23 5.808092e-01 -2.296427e-01 24 5.222781e-01 5.808092e-01 25 6.965500e-01 5.222781e-01 26 -3.101102e-01 6.965500e-01 27 4.363539e-01 -3.101102e-01 28 -5.570433e-01 4.363539e-01 29 -1.159262e+00 -5.570433e-01 30 -7.876621e-05 -1.159262e+00 31 1.784237e-02 -7.876621e-05 32 1.201388e-01 1.784237e-02 33 3.267741e-01 1.201388e-01 34 2.350608e-01 3.267741e-01 35 3.895521e-01 2.350608e-01 36 4.135463e-01 3.895521e-01 37 4.517440e-01 4.135463e-01 38 -5.981732e-01 4.517440e-01 39 2.558451e-01 -5.981732e-01 40 7.983577e-02 2.558451e-01 41 -5.766417e-01 7.983577e-02 42 -2.568575e-02 -5.766417e-01 43 -8.622009e-02 -2.568575e-02 44 -2.845895e-01 -8.622009e-02 45 9.343902e-01 -2.845895e-01 46 -3.726922e-02 9.343902e-01 47 -8.935099e-01 -3.726922e-02 48 -3.340036e-01 -8.935099e-01 49 6.025921e-01 -3.340036e-01 50 NA 6.025921e-01 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] 1.882982e-01 2.265232e-01 [2,] -6.444565e-01 1.882982e-01 [3,] -6.673823e-01 -6.444565e-01 [4,] 7.566685e-02 -6.673823e-01 [5,] 6.533074e-02 7.566685e-02 [6,] 1.055709e+00 6.533074e-02 [7,] 6.984478e-01 1.055709e+00 [8,] -6.217742e-02 6.984478e-01 [9,] 7.402872e-02 -6.217742e-02 [10,] -8.735634e-01 7.402872e-02 [11,] -1.063482e-01 -8.735634e-01 [12,] -3.189832e-01 -1.063482e-01 [13,] -9.302892e-02 -3.189832e-01 [14,] 1.211204e+00 -9.302892e-02 [15,] 1.203964e-01 1.211204e+00 [16,] 1.016405e-01 1.203964e-01 [17,] -2.400156e-02 1.016405e-01 [18,] -1.199351e+00 -2.400156e-02 [19,] -1.289196e+00 -1.199351e+00 [20,] 6.559425e-01 -1.289196e+00 [21,] -1.657825e-01 6.559425e-01 [22,] -2.296427e-01 -1.657825e-01 [23,] 5.808092e-01 -2.296427e-01 [24,] 5.222781e-01 5.808092e-01 [25,] 6.965500e-01 5.222781e-01 [26,] -3.101102e-01 6.965500e-01 [27,] 4.363539e-01 -3.101102e-01 [28,] -5.570433e-01 4.363539e-01 [29,] -1.159262e+00 -5.570433e-01 [30,] -7.876621e-05 -1.159262e+00 [31,] 1.784237e-02 -7.876621e-05 [32,] 1.201388e-01 1.784237e-02 [33,] 3.267741e-01 1.201388e-01 [34,] 2.350608e-01 3.267741e-01 [35,] 3.895521e-01 2.350608e-01 [36,] 4.135463e-01 3.895521e-01 [37,] 4.517440e-01 4.135463e-01 [38,] -5.981732e-01 4.517440e-01 [39,] 2.558451e-01 -5.981732e-01 [40,] 7.983577e-02 2.558451e-01 [41,] -5.766417e-01 7.983577e-02 [42,] -2.568575e-02 -5.766417e-01 [43,] -8.622009e-02 -2.568575e-02 [44,] -2.845895e-01 -8.622009e-02 [45,] 9.343902e-01 -2.845895e-01 [46,] -3.726922e-02 9.343902e-01 [47,] -8.935099e-01 -3.726922e-02 [48,] -3.340036e-01 -8.935099e-01 [49,] 6.025921e-01 -3.340036e-01 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 1.882982e-01 2.265232e-01 2 -6.444565e-01 1.882982e-01 3 -6.673823e-01 -6.444565e-01 4 7.566685e-02 -6.673823e-01 5 6.533074e-02 7.566685e-02 6 1.055709e+00 6.533074e-02 7 6.984478e-01 1.055709e+00 8 -6.217742e-02 6.984478e-01 9 7.402872e-02 -6.217742e-02 10 -8.735634e-01 7.402872e-02 11 -1.063482e-01 -8.735634e-01 12 -3.189832e-01 -1.063482e-01 13 -9.302892e-02 -3.189832e-01 14 1.211204e+00 -9.302892e-02 15 1.203964e-01 1.211204e+00 16 1.016405e-01 1.203964e-01 17 -2.400156e-02 1.016405e-01 18 -1.199351e+00 -2.400156e-02 19 -1.289196e+00 -1.199351e+00 20 6.559425e-01 -1.289196e+00 21 -1.657825e-01 6.559425e-01 22 -2.296427e-01 -1.657825e-01 23 5.808092e-01 -2.296427e-01 24 5.222781e-01 5.808092e-01 25 6.965500e-01 5.222781e-01 26 -3.101102e-01 6.965500e-01 27 4.363539e-01 -3.101102e-01 28 -5.570433e-01 4.363539e-01 29 -1.159262e+00 -5.570433e-01 30 -7.876621e-05 -1.159262e+00 31 1.784237e-02 -7.876621e-05 32 1.201388e-01 1.784237e-02 33 3.267741e-01 1.201388e-01 34 2.350608e-01 3.267741e-01 35 3.895521e-01 2.350608e-01 36 4.135463e-01 3.895521e-01 37 4.517440e-01 4.135463e-01 38 -5.981732e-01 4.517440e-01 39 2.558451e-01 -5.981732e-01 40 7.983577e-02 2.558451e-01 41 -5.766417e-01 7.983577e-02 42 -2.568575e-02 -5.766417e-01 43 -8.622009e-02 -2.568575e-02 44 -2.845895e-01 -8.622009e-02 45 9.343902e-01 -2.845895e-01 46 -3.726922e-02 9.343902e-01 47 -8.935099e-01 -3.726922e-02 48 -3.340036e-01 -8.935099e-01 49 6.025921e-01 -3.340036e-01 > 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/fisher/rcomp/tmp/7596m1351876804.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/fisher/rcomp/tmp/8i0tg1351876804.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/fisher/rcomp/tmp/9igkd1351876804.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/fisher/rcomp/tmp/108lwe1351876804.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/fisher/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/fisher/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/fisher/rcomp/tmp/11upzd1351876804.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/fisher/rcomp/tmp/12fput1351876804.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/fisher/rcomp/tmp/138l6q1351876804.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/fisher/rcomp/tmp/142apo1351876804.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/fisher/rcomp/tmp/15r6go1351876804.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/fisher/rcomp/tmp/16e14t1351876804.tab") + } > > try(system("convert tmp/13cwk1351876804.ps tmp/13cwk1351876804.png",intern=TRUE)) character(0) > try(system("convert tmp/2umw41351876804.ps tmp/2umw41351876804.png",intern=TRUE)) character(0) > try(system("convert tmp/3vvih1351876804.ps tmp/3vvih1351876804.png",intern=TRUE)) character(0) > try(system("convert tmp/448yp1351876804.ps tmp/448yp1351876804.png",intern=TRUE)) character(0) > try(system("convert tmp/556j01351876804.ps tmp/556j01351876804.png",intern=TRUE)) character(0) > try(system("convert tmp/66nno1351876804.ps tmp/66nno1351876804.png",intern=TRUE)) character(0) > try(system("convert tmp/7596m1351876804.ps tmp/7596m1351876804.png",intern=TRUE)) character(0) > try(system("convert tmp/8i0tg1351876804.ps tmp/8i0tg1351876804.png",intern=TRUE)) character(0) > try(system("convert tmp/9igkd1351876804.ps tmp/9igkd1351876804.png",intern=TRUE)) character(0) > try(system("convert tmp/108lwe1351876804.ps tmp/108lwe1351876804.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 6.230 1.196 7.424