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(634 + ,0 + ,627 + ,691 + ,651 + ,608 + ,731 + ,0 + ,634 + ,627 + ,691 + ,651 + ,475 + ,0 + ,731 + ,634 + ,627 + ,691 + ,337 + ,0 + ,475 + ,731 + ,634 + ,627 + ,803 + ,0 + ,337 + ,475 + ,731 + ,634 + ,722 + ,0 + ,803 + ,337 + ,475 + ,731 + ,590 + ,0 + ,722 + ,803 + ,337 + ,475 + ,724 + ,0 + ,590 + ,722 + ,803 + ,337 + ,627 + ,0 + ,724 + ,590 + ,722 + ,803 + ,696 + ,0 + ,627 + ,724 + ,590 + ,722 + ,825 + ,0 + ,696 + ,627 + ,724 + ,590 + ,677 + ,0 + ,825 + ,696 + ,627 + ,724 + ,656 + ,0 + ,677 + ,825 + ,696 + ,627 + ,785 + ,0 + ,656 + ,677 + ,825 + ,696 + ,412 + ,0 + ,785 + ,656 + ,677 + ,825 + ,352 + ,0 + ,412 + ,785 + ,656 + ,677 + ,839 + ,0 + ,352 + ,412 + ,785 + ,656 + ,729 + ,0 + ,839 + ,352 + ,412 + ,785 + ,696 + ,0 + ,729 + ,839 + ,352 + ,412 + ,641 + ,0 + ,696 + ,729 + ,839 + ,352 + ,695 + ,0 + ,641 + ,696 + ,729 + ,839 + ,638 + ,0 + ,695 + ,641 + ,696 + ,729 + ,762 + ,0 + ,638 + ,695 + ,641 + ,696 + ,635 + ,0 + ,762 + ,638 + ,695 + ,641 + ,721 + ,0 + ,635 + ,762 + ,638 + ,695 + ,854 + ,0 + ,721 + ,635 + ,762 + ,638 + ,418 + ,0 + ,854 + ,721 + ,635 + ,762 + ,367 + ,0 + ,418 + ,854 + ,721 + ,635 + ,824 + ,0 + ,367 + ,418 + ,854 + ,721 + ,687 + ,0 + ,824 + ,367 + ,418 + ,854 + ,601 + ,0 + ,687 + ,824 + ,367 + ,418 + ,676 + ,0 + ,601 + ,687 + ,824 + ,367 + ,740 + ,0 + ,676 + ,601 + ,687 + ,824 + ,691 + ,0 + ,740 + ,676 + ,601 + ,687 + ,683 + ,0 + ,691 + ,740 + ,676 + ,601 + ,594 + ,0 + ,683 + ,691 + ,740 + ,676 + ,729 + ,0 + ,594 + ,683 + ,691 + ,740 + ,731 + ,0 + ,729 + ,594 + ,683 + ,691 + ,386 + ,0 + ,731 + ,729 + ,594 + ,683 + ,331 + ,0 + ,386 + ,731 + ,729 + ,594 + ,706 + ,0 + ,331 + ,386 + ,731 + ,729 + ,715 + ,0 + ,706 + ,331 + ,386 + ,731 + ,657 + ,0 + ,715 + ,706 + ,331 + ,386 + ,653 + ,0 + ,657 + ,715 + ,706 + ,331 + ,642 + ,0 + ,653 + ,657 + ,715 + ,706 + ,643 + ,0 + ,642 + ,653 + ,657 + ,715 + ,718 + ,0 + ,643 + ,642 + ,653 + ,657 + ,654 + ,0 + ,718 + ,643 + ,642 + ,653 + ,632 + ,0 + ,654 + ,718 + ,643 + ,642 + ,731 + ,0 + ,632 + ,654 + ,718 + ,643 + ,392 + ,1 + ,731 + ,632 + ,654 + ,718 + ,344 + ,1 + ,392 + ,731 + ,632 + ,654 + ,792 + ,1 + ,344 + ,392 + ,731 + ,632 + ,852 + ,1 + ,792 + ,344 + ,392 + ,731 + ,649 + ,1 + ,852 + ,792 + ,344 + ,392 + ,629 + ,1 + ,649 + ,852 + ,792 + ,344 + ,685 + ,1 + ,629 + ,649 + ,852 + ,792 + ,617 + ,1 + ,685 + ,629 + ,649 + ,852 + ,715 + ,1 + ,617 + ,685 + ,629 + ,649 + ,715 + ,1 + ,715 + ,617 + ,685 + ,629 + ,629 + ,1 + ,715 + ,715 + ,617 + ,685 + ,916 + ,1 + ,629 + ,715 + ,715 + ,617 + ,531 + ,1 + ,916 + ,629 + ,715 + ,715 + ,357 + ,1 + ,531 + ,916 + ,629 + ,715 + ,917 + ,1 + ,357 + ,531 + ,916 + ,629 + ,828 + ,1 + ,917 + ,357 + ,531 + ,916 + ,708 + ,1 + ,828 + ,917 + ,357 + ,531 + ,858 + ,1 + ,708 + ,828 + ,917 + ,357 + ,775 + ,1 + ,858 + ,708 + ,828 + ,917 + ,785 + ,1 + ,775 + ,858 + ,708 + ,828 + ,1006 + ,1 + ,785 + ,775 + ,858 + ,708 + ,789 + ,1 + ,1006 + ,785 + ,775 + ,858 + ,734 + ,1 + ,789 + ,1006 + ,785 + ,775 + ,906 + ,1 + ,734 + ,789 + ,1006 + ,785 + ,532 + ,1 + ,906 + ,734 + ,789 + ,1006 + ,387 + ,1 + ,532 + ,906 + ,734 + ,789 + ,991 + ,1 + ,387 + ,532 + ,906 + ,734 + ,841 + ,1 + ,991 + ,387 + ,532 + ,906 + ,892 + ,1 + ,841 + ,991 + ,387 + ,532 + ,782 + ,1 + ,892 + ,841 + ,991 + ,387) + ,dim=c(6 + ,80) + ,dimnames=list(c('faillissement' + ,'crisis' + ,'t-1' + ,'t-2' + ,'t-3' + ,'t-4') + ,1:80)) > y <- array(NA,dim=c(6,80),dimnames=list(c('faillissement','crisis','t-1','t-2','t-3','t-4'),1:80)) > 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 faillissement crisis t-1 t-2 t-3 t-4 1 634 0 627 691 651 608 2 731 0 634 627 691 651 3 475 0 731 634 627 691 4 337 0 475 731 634 627 5 803 0 337 475 731 634 6 722 0 803 337 475 731 7 590 0 722 803 337 475 8 724 0 590 722 803 337 9 627 0 724 590 722 803 10 696 0 627 724 590 722 11 825 0 696 627 724 590 12 677 0 825 696 627 724 13 656 0 677 825 696 627 14 785 0 656 677 825 696 15 412 0 785 656 677 825 16 352 0 412 785 656 677 17 839 0 352 412 785 656 18 729 0 839 352 412 785 19 696 0 729 839 352 412 20 641 0 696 729 839 352 21 695 0 641 696 729 839 22 638 0 695 641 696 729 23 762 0 638 695 641 696 24 635 0 762 638 695 641 25 721 0 635 762 638 695 26 854 0 721 635 762 638 27 418 0 854 721 635 762 28 367 0 418 854 721 635 29 824 0 367 418 854 721 30 687 0 824 367 418 854 31 601 0 687 824 367 418 32 676 0 601 687 824 367 33 740 0 676 601 687 824 34 691 0 740 676 601 687 35 683 0 691 740 676 601 36 594 0 683 691 740 676 37 729 0 594 683 691 740 38 731 0 729 594 683 691 39 386 0 731 729 594 683 40 331 0 386 731 729 594 41 706 0 331 386 731 729 42 715 0 706 331 386 731 43 657 0 715 706 331 386 44 653 0 657 715 706 331 45 642 0 653 657 715 706 46 643 0 642 653 657 715 47 718 0 643 642 653 657 48 654 0 718 643 642 653 49 632 0 654 718 643 642 50 731 0 632 654 718 643 51 392 1 731 632 654 718 52 344 1 392 731 632 654 53 792 1 344 392 731 632 54 852 1 792 344 392 731 55 649 1 852 792 344 392 56 629 1 649 852 792 344 57 685 1 629 649 852 792 58 617 1 685 629 649 852 59 715 1 617 685 629 649 60 715 1 715 617 685 629 61 629 1 715 715 617 685 62 916 1 629 715 715 617 63 531 1 916 629 715 715 64 357 1 531 916 629 715 65 917 1 357 531 916 629 66 828 1 917 357 531 916 67 708 1 828 917 357 531 68 858 1 708 828 917 357 69 775 1 858 708 828 917 70 785 1 775 858 708 828 71 1006 1 785 775 858 708 72 789 1 1006 785 775 858 73 734 1 789 1006 785 775 74 906 1 734 789 1006 785 75 532 1 906 734 789 1006 76 387 1 532 906 734 789 77 991 1 387 532 906 734 78 841 1 991 387 532 906 79 892 1 841 991 387 532 80 782 1 892 841 991 387 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) crisis `t-1` `t-2` `t-3` `t-4` 778.6048 76.3934 0.2801 -0.4954 0.3116 -0.2963 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -345.76 -67.78 14.62 100.61 329.34 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 778.6048 148.3171 5.250 1.41e-06 *** crisis 76.3934 34.1333 2.238 0.0282 * `t-1` 0.2801 0.1117 2.507 0.0144 * `t-2` -0.4954 0.1132 -4.376 3.91e-05 *** `t-3` 0.3116 0.1110 2.806 0.0064 ** `t-4` -0.2963 0.1176 -2.518 0.0140 * --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 136.6 on 74 degrees of freedom Multiple R-squared: 0.2842, Adjusted R-squared: 0.2359 F-statistic: 5.878 on 5 and 74 DF, p-value: 0.0001257 > 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.727985493 0.54402901 0.2720145 [2,] 0.781913763 0.43617247 0.2180862 [3,] 0.748089493 0.50382101 0.2519105 [4,] 0.656085366 0.68782927 0.3439146 [5,] 0.565942783 0.86811443 0.4340572 [6,] 0.493867075 0.98773415 0.5061329 [7,] 0.603183250 0.79363350 0.3968167 [8,] 0.583526526 0.83294695 0.4164735 [9,] 0.518813482 0.96237304 0.4811865 [10,] 0.425541550 0.85108310 0.5744584 [11,] 0.405852948 0.81170590 0.5941471 [12,] 0.458929965 0.91785993 0.5410700 [13,] 0.456287331 0.91257466 0.5437127 [14,] 0.374737425 0.74947485 0.6252626 [15,] 0.394682606 0.78936521 0.6053174 [16,] 0.331422684 0.66284537 0.6685773 [17,] 0.338129496 0.67625899 0.6618705 [18,] 0.345218365 0.69043673 0.6547816 [19,] 0.411837577 0.82367515 0.5881624 [20,] 0.423093193 0.84618639 0.5769068 [21,] 0.372114619 0.74422924 0.6278854 [22,] 0.307042941 0.61408588 0.6929571 [23,] 0.249702353 0.49940471 0.7502976 [24,] 0.217282768 0.43456554 0.7827172 [25,] 0.195915791 0.39183158 0.8040842 [26,] 0.158827749 0.31765550 0.8411723 [27,] 0.124741744 0.24948349 0.8752583 [28,] 0.096441253 0.19288251 0.9035587 [29,] 0.092332155 0.18466431 0.9076678 [30,] 0.068691057 0.13738211 0.9313089 [31,] 0.103774092 0.20754818 0.8962259 [32,] 0.194683208 0.38936642 0.8053168 [33,] 0.152165244 0.30433049 0.8478348 [34,] 0.117413313 0.23482663 0.8825867 [35,] 0.087849015 0.17569803 0.9121510 [36,] 0.071185371 0.14237074 0.9288146 [37,] 0.050884677 0.10176935 0.9491153 [38,] 0.035314665 0.07062933 0.9646853 [39,] 0.025511559 0.05102312 0.9744884 [40,] 0.017023859 0.03404772 0.9829761 [41,] 0.011106519 0.02221304 0.9888935 [42,] 0.007364876 0.01472975 0.9926351 [43,] 0.016708471 0.03341694 0.9832915 [44,] 0.029244098 0.05848820 0.9707559 [45,] 0.029577676 0.05915535 0.9704223 [46,] 0.027356760 0.05471352 0.9726432 [47,] 0.021330758 0.04266152 0.9786692 [48,] 0.022810751 0.04562150 0.9771892 [49,] 0.017367297 0.03473459 0.9826327 [50,] 0.012537393 0.02507479 0.9874626 [51,] 0.009234959 0.01846992 0.9907650 [52,] 0.006626469 0.01325294 0.9933735 [53,] 0.005020180 0.01004036 0.9949798 [54,] 0.008035806 0.01607161 0.9919642 [55,] 0.032861623 0.06572325 0.9671384 [56,] 0.087667950 0.17533590 0.9123321 [57,] 0.065428265 0.13085653 0.9345717 [58,] 0.042262239 0.08452448 0.9577378 [59,] 0.034713719 0.06942744 0.9652863 [60,] 0.024076990 0.04815398 0.9759230 [61,] 0.013567771 0.02713554 0.9864322 [62,] 0.009680002 0.01936000 0.9903200 [63,] 0.015706629 0.03141326 0.9842934 > postscript(file="/var/www/html/rcomp/tmp/1jqbx1292786491.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > plot(x[,1], type='l', main='Actuals and Interpolation', ylab='value of Actuals and Interpolation (dots)', xlab='time or index') > points(x[,1]-mysum$resid) > grid() > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/2c0si1292786491.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > plot(mysum$resid, type='b', pch=19, main='Residuals', ylab='value of Residuals', xlab='time or index') > grid() > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/3c0si1292786491.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > hist(mysum$resid, main='Residual Histogram', xlab='values of Residuals') > grid() > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/4c0si1292786491.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > densityplot(~mysum$resid,col='black',main='Residual Density Plot', xlab='values of Residuals') > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/54ra31292786491.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 = 80 Frequency = 1 1 2 3 4 5 6 -0.6607781 62.9516431 -184.9655543 -224.3382365 125.3620680 -46.0529101 7 8 9 10 11 12 42.6321526 -12.5805038 -49.2176689 130.4641983 111.2295025 31.1894229 13 14 15 16 17 18 65.3194431 107.1396903 -228.0751428 -156.9806102 115.6455287 -6.0820701 19 20 21 22 23 24 141.1668129 -128.5809257 103.0276339 -18.6522252 155.4250516 -67.6672277 25 26 27 28 29 30 149.0933132 139.5698488 -214.7855388 -142.1751694 97.1747741 -17.8770833 31 32 33 34 35 36 47.6068249 -78.6548904 99.8042876 56.2338092 44.8198556 -63.9321716 37 38 39 40 41 42 126.2647308 34.3330951 -218.9946790 -244.7791012 14.0997978 -1.1222236 43 44 45 46 47 48 39.0454761 -77.3747511 -7.6935449 15.1431270 68.4773848 -13.7963613 49 50 51 52 53 54 15.7151460 66.1047491 -345.7627359 -261.8572067 -5.7000802 39.9619847 55 56 57 58 59 60 -43.3996914 -130.6044277 -55.5313174 -68.1059804 22.7758444 -61.7357361 61 62 63 64 65 66 -61.4140055 199.0010823 -279.9700612 -177.1493317 125.9871696 -1.1158541 67 68 69 70 71 72 121.3736898 34.8849692 44.0502232 162.6271264 257.4265196 53.7645329 73 74 75 76 77 78 141.3276802 155.3507489 -161.0001062 -163.1735067 226.3004105 2.7399204 79 80 329.3383088 -100.3901696 > postscript(file="/var/www/html/rcomp/tmp/64ra31292786491.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 = 80 Frequency = 1 lag(myerror, k = 1) myerror 0 -0.6607781 NA 1 62.9516431 -0.6607781 2 -184.9655543 62.9516431 3 -224.3382365 -184.9655543 4 125.3620680 -224.3382365 5 -46.0529101 125.3620680 6 42.6321526 -46.0529101 7 -12.5805038 42.6321526 8 -49.2176689 -12.5805038 9 130.4641983 -49.2176689 10 111.2295025 130.4641983 11 31.1894229 111.2295025 12 65.3194431 31.1894229 13 107.1396903 65.3194431 14 -228.0751428 107.1396903 15 -156.9806102 -228.0751428 16 115.6455287 -156.9806102 17 -6.0820701 115.6455287 18 141.1668129 -6.0820701 19 -128.5809257 141.1668129 20 103.0276339 -128.5809257 21 -18.6522252 103.0276339 22 155.4250516 -18.6522252 23 -67.6672277 155.4250516 24 149.0933132 -67.6672277 25 139.5698488 149.0933132 26 -214.7855388 139.5698488 27 -142.1751694 -214.7855388 28 97.1747741 -142.1751694 29 -17.8770833 97.1747741 30 47.6068249 -17.8770833 31 -78.6548904 47.6068249 32 99.8042876 -78.6548904 33 56.2338092 99.8042876 34 44.8198556 56.2338092 35 -63.9321716 44.8198556 36 126.2647308 -63.9321716 37 34.3330951 126.2647308 38 -218.9946790 34.3330951 39 -244.7791012 -218.9946790 40 14.0997978 -244.7791012 41 -1.1222236 14.0997978 42 39.0454761 -1.1222236 43 -77.3747511 39.0454761 44 -7.6935449 -77.3747511 45 15.1431270 -7.6935449 46 68.4773848 15.1431270 47 -13.7963613 68.4773848 48 15.7151460 -13.7963613 49 66.1047491 15.7151460 50 -345.7627359 66.1047491 51 -261.8572067 -345.7627359 52 -5.7000802 -261.8572067 53 39.9619847 -5.7000802 54 -43.3996914 39.9619847 55 -130.6044277 -43.3996914 56 -55.5313174 -130.6044277 57 -68.1059804 -55.5313174 58 22.7758444 -68.1059804 59 -61.7357361 22.7758444 60 -61.4140055 -61.7357361 61 199.0010823 -61.4140055 62 -279.9700612 199.0010823 63 -177.1493317 -279.9700612 64 125.9871696 -177.1493317 65 -1.1158541 125.9871696 66 121.3736898 -1.1158541 67 34.8849692 121.3736898 68 44.0502232 34.8849692 69 162.6271264 44.0502232 70 257.4265196 162.6271264 71 53.7645329 257.4265196 72 141.3276802 53.7645329 73 155.3507489 141.3276802 74 -161.0001062 155.3507489 75 -163.1735067 -161.0001062 76 226.3004105 -163.1735067 77 2.7399204 226.3004105 78 329.3383088 2.7399204 79 -100.3901696 329.3383088 80 NA -100.3901696 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] 62.951643 -0.6607781 [2,] -184.965554 62.9516431 [3,] -224.338236 -184.9655543 [4,] 125.362068 -224.3382365 [5,] -46.052910 125.3620680 [6,] 42.632153 -46.0529101 [7,] -12.580504 42.6321526 [8,] -49.217669 -12.5805038 [9,] 130.464198 -49.2176689 [10,] 111.229503 130.4641983 [11,] 31.189423 111.2295025 [12,] 65.319443 31.1894229 [13,] 107.139690 65.3194431 [14,] -228.075143 107.1396903 [15,] -156.980610 -228.0751428 [16,] 115.645529 -156.9806102 [17,] -6.082070 115.6455287 [18,] 141.166813 -6.0820701 [19,] -128.580926 141.1668129 [20,] 103.027634 -128.5809257 [21,] -18.652225 103.0276339 [22,] 155.425052 -18.6522252 [23,] -67.667228 155.4250516 [24,] 149.093313 -67.6672277 [25,] 139.569849 149.0933132 [26,] -214.785539 139.5698488 [27,] -142.175169 -214.7855388 [28,] 97.174774 -142.1751694 [29,] -17.877083 97.1747741 [30,] 47.606825 -17.8770833 [31,] -78.654890 47.6068249 [32,] 99.804288 -78.6548904 [33,] 56.233809 99.8042876 [34,] 44.819856 56.2338092 [35,] -63.932172 44.8198556 [36,] 126.264731 -63.9321716 [37,] 34.333095 126.2647308 [38,] -218.994679 34.3330951 [39,] -244.779101 -218.9946790 [40,] 14.099798 -244.7791012 [41,] -1.122224 14.0997978 [42,] 39.045476 -1.1222236 [43,] -77.374751 39.0454761 [44,] -7.693545 -77.3747511 [45,] 15.143127 -7.6935449 [46,] 68.477385 15.1431270 [47,] -13.796361 68.4773848 [48,] 15.715146 -13.7963613 [49,] 66.104749 15.7151460 [50,] -345.762736 66.1047491 [51,] -261.857207 -345.7627359 [52,] -5.700080 -261.8572067 [53,] 39.961985 -5.7000802 [54,] -43.399691 39.9619847 [55,] -130.604428 -43.3996914 [56,] -55.531317 -130.6044277 [57,] -68.105980 -55.5313174 [58,] 22.775844 -68.1059804 [59,] -61.735736 22.7758444 [60,] -61.414005 -61.7357361 [61,] 199.001082 -61.4140055 [62,] -279.970061 199.0010823 [63,] -177.149332 -279.9700612 [64,] 125.987170 -177.1493317 [65,] -1.115854 125.9871696 [66,] 121.373690 -1.1158541 [67,] 34.884969 121.3736898 [68,] 44.050223 34.8849692 [69,] 162.627126 44.0502232 [70,] 257.426520 162.6271264 [71,] 53.764533 257.4265196 [72,] 141.327680 53.7645329 [73,] 155.350749 141.3276802 [74,] -161.000106 155.3507489 [75,] -163.173507 -161.0001062 [76,] 226.300411 -163.1735067 [77,] 2.739920 226.3004105 [78,] 329.338309 2.7399204 [79,] -100.390170 329.3383088 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 62.951643 -0.6607781 2 -184.965554 62.9516431 3 -224.338236 -184.9655543 4 125.362068 -224.3382365 5 -46.052910 125.3620680 6 42.632153 -46.0529101 7 -12.580504 42.6321526 8 -49.217669 -12.5805038 9 130.464198 -49.2176689 10 111.229503 130.4641983 11 31.189423 111.2295025 12 65.319443 31.1894229 13 107.139690 65.3194431 14 -228.075143 107.1396903 15 -156.980610 -228.0751428 16 115.645529 -156.9806102 17 -6.082070 115.6455287 18 141.166813 -6.0820701 19 -128.580926 141.1668129 20 103.027634 -128.5809257 21 -18.652225 103.0276339 22 155.425052 -18.6522252 23 -67.667228 155.4250516 24 149.093313 -67.6672277 25 139.569849 149.0933132 26 -214.785539 139.5698488 27 -142.175169 -214.7855388 28 97.174774 -142.1751694 29 -17.877083 97.1747741 30 47.606825 -17.8770833 31 -78.654890 47.6068249 32 99.804288 -78.6548904 33 56.233809 99.8042876 34 44.819856 56.2338092 35 -63.932172 44.8198556 36 126.264731 -63.9321716 37 34.333095 126.2647308 38 -218.994679 34.3330951 39 -244.779101 -218.9946790 40 14.099798 -244.7791012 41 -1.122224 14.0997978 42 39.045476 -1.1222236 43 -77.374751 39.0454761 44 -7.693545 -77.3747511 45 15.143127 -7.6935449 46 68.477385 15.1431270 47 -13.796361 68.4773848 48 15.715146 -13.7963613 49 66.104749 15.7151460 50 -345.762736 66.1047491 51 -261.857207 -345.7627359 52 -5.700080 -261.8572067 53 39.961985 -5.7000802 54 -43.399691 39.9619847 55 -130.604428 -43.3996914 56 -55.531317 -130.6044277 57 -68.105980 -55.5313174 58 22.775844 -68.1059804 59 -61.735736 22.7758444 60 -61.414005 -61.7357361 61 199.001082 -61.4140055 62 -279.970061 199.0010823 63 -177.149332 -279.9700612 64 125.987170 -177.1493317 65 -1.115854 125.9871696 66 121.373690 -1.1158541 67 34.884969 121.3736898 68 44.050223 34.8849692 69 162.627126 44.0502232 70 257.426520 162.6271264 71 53.764533 257.4265196 72 141.327680 53.7645329 73 155.350749 141.3276802 74 -161.000106 155.3507489 75 -163.173507 -161.0001062 76 226.300411 -163.1735067 77 2.739920 226.3004105 78 329.338309 2.7399204 79 -100.390170 329.3383088 > 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/7xir61292786491.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > acf(mysum$resid, lag.max=length(mysum$resid)/2, main='Residual Autocorrelation Function') > grid() > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/8xir61292786491.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > pacf(mysum$resid, lag.max=length(mysum$resid)/2, main='Residual Partial Autocorrelation Function') > grid() > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/9q9qq1292786491.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > opar <- par(mfrow = c(2,2), oma = c(0, 0, 1.1, 0)) > plot(mylm, las = 1, sub='Residual Diagnostics') > par(opar) > dev.off() null device 1 > if (n > n25) { + postscript(file="/var/www/html/rcomp/tmp/10q9qq1292786491.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) + plot(kp3:nmkm3,gqarr[,2], main='Goldfeld-Quandt test',ylab='2-sided p-value',xlab='breakpoint') + grid() + dev.off() + } null device 1 > > #Note: the /var/www/html/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/11ta7w1292786491.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/12fank1292786491.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/133bkw1292786491.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/14elkh1292786491.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/150lin1292786491.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/16vdxv1292786491.tab") + } > > try(system("convert tmp/1jqbx1292786491.ps tmp/1jqbx1292786491.png",intern=TRUE)) character(0) > try(system("convert tmp/2c0si1292786491.ps tmp/2c0si1292786491.png",intern=TRUE)) character(0) > try(system("convert tmp/3c0si1292786491.ps tmp/3c0si1292786491.png",intern=TRUE)) character(0) > try(system("convert tmp/4c0si1292786491.ps tmp/4c0si1292786491.png",intern=TRUE)) character(0) > try(system("convert tmp/54ra31292786491.ps tmp/54ra31292786491.png",intern=TRUE)) character(0) > try(system("convert tmp/64ra31292786491.ps tmp/64ra31292786491.png",intern=TRUE)) character(0) > try(system("convert tmp/7xir61292786491.ps tmp/7xir61292786491.png",intern=TRUE)) character(0) > try(system("convert tmp/8xir61292786491.ps tmp/8xir61292786491.png",intern=TRUE)) character(0) > try(system("convert tmp/9q9qq1292786491.ps tmp/9q9qq1292786491.png",intern=TRUE)) character(0) > try(system("convert tmp/10q9qq1292786491.ps tmp/10q9qq1292786491.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.778 1.693 7.559