R version 2.8.0 (2008-10-20) Copyright (C) 2008 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. Natural language support but running in an English locale 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(608,0,651,0,691,0,627,0,634,0,731,0,475,0,337,0,803,0,722,0,590,0,724,0,627,0,696,0,825,0,677,0,656,0,785,0,412,0,352,0,839,0,729,0,696,0,641,0,695,0,638,0,762,0,635,0,721,0,854,0,418,0,367,0,824,0,687,0,601,0,676,0,740,0,691,0,683,0,594,0,729,0,731,0,386,0,331,0,706,0,715,0,657,0,653,0,642,0,643,0,718,0,654,0,632,0,731,0,392,1,344,1,792,1,852,1,649,1,629,1,685,1,617,1,715,1,715,1,629,1,916,1,531,1,357,1,917,1,828,1,708,1,858,1,775,1,785,1,1.006,1,789,1,734,1,906,1,532,1,387,1,991,1,841,1,892,1,782,1),dim=c(2,84),dimnames=list(c('faillissement','crisis'),1:84)) > y <- array(NA,dim=c(2,84),dimnames=list(c('faillissement','crisis'),1:84)) > 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 1 608.000 0 2 651.000 0 3 691.000 0 4 627.000 0 5 634.000 0 6 731.000 0 7 475.000 0 8 337.000 0 9 803.000 0 10 722.000 0 11 590.000 0 12 724.000 0 13 627.000 0 14 696.000 0 15 825.000 0 16 677.000 0 17 656.000 0 18 785.000 0 19 412.000 0 20 352.000 0 21 839.000 0 22 729.000 0 23 696.000 0 24 641.000 0 25 695.000 0 26 638.000 0 27 762.000 0 28 635.000 0 29 721.000 0 30 854.000 0 31 418.000 0 32 367.000 0 33 824.000 0 34 687.000 0 35 601.000 0 36 676.000 0 37 740.000 0 38 691.000 0 39 683.000 0 40 594.000 0 41 729.000 0 42 731.000 0 43 386.000 0 44 331.000 0 45 706.000 0 46 715.000 0 47 657.000 0 48 653.000 0 49 642.000 0 50 643.000 0 51 718.000 0 52 654.000 0 53 632.000 0 54 731.000 0 55 392.000 1 56 344.000 1 57 792.000 1 58 852.000 1 59 649.000 1 60 629.000 1 61 685.000 1 62 617.000 1 63 715.000 1 64 715.000 1 65 629.000 1 66 916.000 1 67 531.000 1 68 357.000 1 69 917.000 1 70 828.000 1 71 708.000 1 72 858.000 1 73 775.000 1 74 785.000 1 75 1.006 1 76 789.000 1 77 734.000 1 78 906.000 1 79 532.000 1 80 387.000 1 81 991.000 1 82 841.000 1 83 892.000 1 84 782.000 1 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) crisis 648.93 36.04 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -683.96 -42.68 30.03 90.29 306.03 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 648.93 22.50 28.841 <2e-16 *** crisis 36.04 37.65 0.957 0.341 --- Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 Residual standard error: 165.3 on 82 degrees of freedom Multiple R-squared: 0.01105, Adjusted R-squared: -0.001009 F-statistic: 0.9164 on 1 and 82 DF, p-value: 0.3412 > 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,] 1.279218e-02 0.0255843556 0.9872078 [2,] 1.449251e-02 0.0289850204 0.9855075 [3,] 6.924977e-02 0.1384995442 0.9307502 [4,] 3.281654e-01 0.6563307526 0.6718346 [5,] 3.851280e-01 0.7702559059 0.6148720 [6,] 3.164827e-01 0.6329653889 0.6835173 [7,] 2.296147e-01 0.4592294424 0.7703853 [8,] 1.818213e-01 0.3636425874 0.8181787 [9,] 1.217818e-01 0.2435636925 0.8782182 [10,] 8.454516e-02 0.1690903250 0.9154548 [11,] 1.046071e-01 0.2092142000 0.8953929 [12,] 6.933612e-02 0.1386722487 0.9306639 [13,] 4.382174e-02 0.0876434760 0.9561783 [14,] 4.008652e-02 0.0801730485 0.9599135 [15,] 7.953974e-02 0.1590794740 0.9204603 [16,] 1.821500e-01 0.3642999884 0.8178500 [17,] 2.125574e-01 0.4251148353 0.7874426 [18,] 1.742780e-01 0.3485560762 0.8257220 [19,] 1.335515e-01 0.2671030179 0.8664485 [20,] 9.723160e-02 0.1944631944 0.9027684 [21,] 7.120102e-02 0.1424020344 0.9287990 [22,] 4.947132e-02 0.0989426387 0.9505287 [23,] 4.123057e-02 0.0824611371 0.9587694 [24,] 2.777176e-02 0.0555435116 0.9722282 [25,] 1.988214e-02 0.0397642730 0.9801179 [26,] 2.658700e-02 0.0531740099 0.9734130 [27,] 4.319485e-02 0.0863896964 0.9568052 [28,] 8.795884e-02 0.1759176883 0.9120412 [29,] 9.289941e-02 0.1857988274 0.9071006 [30,] 6.929341e-02 0.1385868207 0.9307066 [31,] 5.128898e-02 0.1025779527 0.9487110 [32,] 3.645880e-02 0.0729175944 0.9635412 [33,] 2.837557e-02 0.0567511379 0.9716244 [34,] 1.980158e-02 0.0396031535 0.9801984 [35,] 1.343013e-02 0.0268602519 0.9865699 [36,] 9.206475e-03 0.0184129498 0.9907935 [37,] 6.620074e-03 0.0132401490 0.9933799 [38,] 4.757190e-03 0.0095143807 0.9952428 [39,] 9.972480e-03 0.0199449609 0.9900275 [40,] 3.061170e-02 0.0612234024 0.9693883 [41,] 2.192087e-02 0.0438417353 0.9780791 [42,] 1.564494e-02 0.0312898881 0.9843551 [43,] 1.036004e-02 0.0207200819 0.9896400 [44,] 6.703693e-03 0.0134073854 0.9932963 [45,] 4.254532e-03 0.0085090631 0.9957455 [46,] 2.643952e-03 0.0052879032 0.9973560 [47,] 1.705186e-03 0.0034103720 0.9982948 [48,] 1.006795e-03 0.0020135909 0.9989932 [49,] 6.017086e-04 0.0012034172 0.9993983 [50,] 3.683191e-04 0.0007366381 0.9996317 [51,] 4.334722e-04 0.0008669444 0.9995665 [52,] 7.778103e-04 0.0015556206 0.9992222 [53,] 1.832875e-03 0.0036657491 0.9981671 [54,] 3.029235e-03 0.0060584695 0.9969708 [55,] 1.876077e-03 0.0037521537 0.9981239 [56,] 1.140972e-03 0.0022819441 0.9988590 [57,] 6.733220e-04 0.0013466441 0.9993267 [58,] 3.968222e-04 0.0007936445 0.9996032 [59,] 2.282350e-04 0.0004564701 0.9997718 [60,] 1.253517e-04 0.0002507033 0.9998746 [61,] 6.682442e-05 0.0001336488 0.9999332 [62,] 1.136686e-04 0.0002273373 0.9998863 [63,] 9.167262e-05 0.0001833452 0.9999083 [64,] 4.437050e-04 0.0008874099 0.9995563 [65,] 6.293467e-04 0.0012586934 0.9993707 [66,] 4.553314e-04 0.0009106627 0.9995447 [67,] 2.219366e-04 0.0004438733 0.9997781 [68,] 1.786994e-04 0.0003573988 0.9998213 [69,] 9.127072e-05 0.0001825414 0.9999087 [70,] 4.632265e-05 0.0000926453 0.9999537 [71,] 1.424380e-01 0.2848760290 0.8575620 [72,] 9.274965e-02 0.1854992907 0.9072504 [73,] 5.376640e-02 0.1075327920 0.9462336 [74,] 4.363094e-02 0.0872618711 0.9563691 [75,] 4.559966e-02 0.0911993148 0.9544003 > postscript(file="/var/www/html/freestat/rcomp/tmp/1as4k1292771059.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/freestat/rcomp/tmp/2as4k1292771059.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/freestat/rcomp/tmp/33kln1292771059.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/freestat/rcomp/tmp/43kln1292771059.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/freestat/rcomp/tmp/53kln1292771059.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 = 84 Frequency = 1 1 2 3 4 5 -40.92592593 2.07407407 42.07407407 -21.92592593 -14.92592593 6 7 8 9 10 82.07407407 -173.92592593 -311.92592593 154.07407407 73.07407407 11 12 13 14 15 -58.92592593 75.07407407 -21.92592593 47.07407407 176.07407407 16 17 18 19 20 28.07407407 7.07407407 136.07407407 -236.92592593 -296.92592593 21 22 23 24 25 190.07407407 80.07407407 47.07407407 -7.92592593 46.07407407 26 27 28 29 30 -10.92592593 113.07407407 -13.92592593 72.07407407 205.07407407 31 32 33 34 35 -230.92592593 -281.92592593 175.07407407 38.07407407 -47.92592593 36 37 38 39 40 27.07407407 91.07407407 42.07407407 34.07407407 -54.92592593 41 42 43 44 45 80.07407407 82.07407407 -262.92592593 -317.92592593 57.07407407 46 47 48 49 50 66.07407407 8.07407407 4.07407407 -6.92592593 -5.92592593 51 52 53 54 55 69.07407407 5.07407407 -16.92592593 82.07407407 -292.96686667 56 57 58 59 60 -340.96686667 107.03313333 167.03313333 -35.96686667 -55.96686667 61 62 63 64 65 0.03313333 -67.96686667 30.03313333 30.03313333 -55.96686667 66 67 68 69 70 231.03313333 -153.96686667 -327.96686667 232.03313333 143.03313333 71 72 73 74 75 23.03313333 173.03313333 90.03313333 100.03313333 -683.96086667 76 77 78 79 80 104.03313333 49.03313333 221.03313333 -152.96686667 -297.96686667 81 82 83 84 306.03313333 156.03313333 207.03313333 97.03313333 > postscript(file="/var/www/html/freestat/rcomp/tmp/6wblp1292771059.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 = 84 Frequency = 1 lag(myerror, k = 1) myerror 0 -40.92592593 NA 1 2.07407407 -40.92592593 2 42.07407407 2.07407407 3 -21.92592593 42.07407407 4 -14.92592593 -21.92592593 5 82.07407407 -14.92592593 6 -173.92592593 82.07407407 7 -311.92592593 -173.92592593 8 154.07407407 -311.92592593 9 73.07407407 154.07407407 10 -58.92592593 73.07407407 11 75.07407407 -58.92592593 12 -21.92592593 75.07407407 13 47.07407407 -21.92592593 14 176.07407407 47.07407407 15 28.07407407 176.07407407 16 7.07407407 28.07407407 17 136.07407407 7.07407407 18 -236.92592593 136.07407407 19 -296.92592593 -236.92592593 20 190.07407407 -296.92592593 21 80.07407407 190.07407407 22 47.07407407 80.07407407 23 -7.92592593 47.07407407 24 46.07407407 -7.92592593 25 -10.92592593 46.07407407 26 113.07407407 -10.92592593 27 -13.92592593 113.07407407 28 72.07407407 -13.92592593 29 205.07407407 72.07407407 30 -230.92592593 205.07407407 31 -281.92592593 -230.92592593 32 175.07407407 -281.92592593 33 38.07407407 175.07407407 34 -47.92592593 38.07407407 35 27.07407407 -47.92592593 36 91.07407407 27.07407407 37 42.07407407 91.07407407 38 34.07407407 42.07407407 39 -54.92592593 34.07407407 40 80.07407407 -54.92592593 41 82.07407407 80.07407407 42 -262.92592593 82.07407407 43 -317.92592593 -262.92592593 44 57.07407407 -317.92592593 45 66.07407407 57.07407407 46 8.07407407 66.07407407 47 4.07407407 8.07407407 48 -6.92592593 4.07407407 49 -5.92592593 -6.92592593 50 69.07407407 -5.92592593 51 5.07407407 69.07407407 52 -16.92592593 5.07407407 53 82.07407407 -16.92592593 54 -292.96686667 82.07407407 55 -340.96686667 -292.96686667 56 107.03313333 -340.96686667 57 167.03313333 107.03313333 58 -35.96686667 167.03313333 59 -55.96686667 -35.96686667 60 0.03313333 -55.96686667 61 -67.96686667 0.03313333 62 30.03313333 -67.96686667 63 30.03313333 30.03313333 64 -55.96686667 30.03313333 65 231.03313333 -55.96686667 66 -153.96686667 231.03313333 67 -327.96686667 -153.96686667 68 232.03313333 -327.96686667 69 143.03313333 232.03313333 70 23.03313333 143.03313333 71 173.03313333 23.03313333 72 90.03313333 173.03313333 73 100.03313333 90.03313333 74 -683.96086667 100.03313333 75 104.03313333 -683.96086667 76 49.03313333 104.03313333 77 221.03313333 49.03313333 78 -152.96686667 221.03313333 79 -297.96686667 -152.96686667 80 306.03313333 -297.96686667 81 156.03313333 306.03313333 82 207.03313333 156.03313333 83 97.03313333 207.03313333 84 NA 97.03313333 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] 2.07407407 -40.92592593 [2,] 42.07407407 2.07407407 [3,] -21.92592593 42.07407407 [4,] -14.92592593 -21.92592593 [5,] 82.07407407 -14.92592593 [6,] -173.92592593 82.07407407 [7,] -311.92592593 -173.92592593 [8,] 154.07407407 -311.92592593 [9,] 73.07407407 154.07407407 [10,] -58.92592593 73.07407407 [11,] 75.07407407 -58.92592593 [12,] -21.92592593 75.07407407 [13,] 47.07407407 -21.92592593 [14,] 176.07407407 47.07407407 [15,] 28.07407407 176.07407407 [16,] 7.07407407 28.07407407 [17,] 136.07407407 7.07407407 [18,] -236.92592593 136.07407407 [19,] -296.92592593 -236.92592593 [20,] 190.07407407 -296.92592593 [21,] 80.07407407 190.07407407 [22,] 47.07407407 80.07407407 [23,] -7.92592593 47.07407407 [24,] 46.07407407 -7.92592593 [25,] -10.92592593 46.07407407 [26,] 113.07407407 -10.92592593 [27,] -13.92592593 113.07407407 [28,] 72.07407407 -13.92592593 [29,] 205.07407407 72.07407407 [30,] -230.92592593 205.07407407 [31,] -281.92592593 -230.92592593 [32,] 175.07407407 -281.92592593 [33,] 38.07407407 175.07407407 [34,] -47.92592593 38.07407407 [35,] 27.07407407 -47.92592593 [36,] 91.07407407 27.07407407 [37,] 42.07407407 91.07407407 [38,] 34.07407407 42.07407407 [39,] -54.92592593 34.07407407 [40,] 80.07407407 -54.92592593 [41,] 82.07407407 80.07407407 [42,] -262.92592593 82.07407407 [43,] -317.92592593 -262.92592593 [44,] 57.07407407 -317.92592593 [45,] 66.07407407 57.07407407 [46,] 8.07407407 66.07407407 [47,] 4.07407407 8.07407407 [48,] -6.92592593 4.07407407 [49,] -5.92592593 -6.92592593 [50,] 69.07407407 -5.92592593 [51,] 5.07407407 69.07407407 [52,] -16.92592593 5.07407407 [53,] 82.07407407 -16.92592593 [54,] -292.96686667 82.07407407 [55,] -340.96686667 -292.96686667 [56,] 107.03313333 -340.96686667 [57,] 167.03313333 107.03313333 [58,] -35.96686667 167.03313333 [59,] -55.96686667 -35.96686667 [60,] 0.03313333 -55.96686667 [61,] -67.96686667 0.03313333 [62,] 30.03313333 -67.96686667 [63,] 30.03313333 30.03313333 [64,] -55.96686667 30.03313333 [65,] 231.03313333 -55.96686667 [66,] -153.96686667 231.03313333 [67,] -327.96686667 -153.96686667 [68,] 232.03313333 -327.96686667 [69,] 143.03313333 232.03313333 [70,] 23.03313333 143.03313333 [71,] 173.03313333 23.03313333 [72,] 90.03313333 173.03313333 [73,] 100.03313333 90.03313333 [74,] -683.96086667 100.03313333 [75,] 104.03313333 -683.96086667 [76,] 49.03313333 104.03313333 [77,] 221.03313333 49.03313333 [78,] -152.96686667 221.03313333 [79,] -297.96686667 -152.96686667 [80,] 306.03313333 -297.96686667 [81,] 156.03313333 306.03313333 [82,] 207.03313333 156.03313333 [83,] 97.03313333 207.03313333 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 2.07407407 -40.92592593 2 42.07407407 2.07407407 3 -21.92592593 42.07407407 4 -14.92592593 -21.92592593 5 82.07407407 -14.92592593 6 -173.92592593 82.07407407 7 -311.92592593 -173.92592593 8 154.07407407 -311.92592593 9 73.07407407 154.07407407 10 -58.92592593 73.07407407 11 75.07407407 -58.92592593 12 -21.92592593 75.07407407 13 47.07407407 -21.92592593 14 176.07407407 47.07407407 15 28.07407407 176.07407407 16 7.07407407 28.07407407 17 136.07407407 7.07407407 18 -236.92592593 136.07407407 19 -296.92592593 -236.92592593 20 190.07407407 -296.92592593 21 80.07407407 190.07407407 22 47.07407407 80.07407407 23 -7.92592593 47.07407407 24 46.07407407 -7.92592593 25 -10.92592593 46.07407407 26 113.07407407 -10.92592593 27 -13.92592593 113.07407407 28 72.07407407 -13.92592593 29 205.07407407 72.07407407 30 -230.92592593 205.07407407 31 -281.92592593 -230.92592593 32 175.07407407 -281.92592593 33 38.07407407 175.07407407 34 -47.92592593 38.07407407 35 27.07407407 -47.92592593 36 91.07407407 27.07407407 37 42.07407407 91.07407407 38 34.07407407 42.07407407 39 -54.92592593 34.07407407 40 80.07407407 -54.92592593 41 82.07407407 80.07407407 42 -262.92592593 82.07407407 43 -317.92592593 -262.92592593 44 57.07407407 -317.92592593 45 66.07407407 57.07407407 46 8.07407407 66.07407407 47 4.07407407 8.07407407 48 -6.92592593 4.07407407 49 -5.92592593 -6.92592593 50 69.07407407 -5.92592593 51 5.07407407 69.07407407 52 -16.92592593 5.07407407 53 82.07407407 -16.92592593 54 -292.96686667 82.07407407 55 -340.96686667 -292.96686667 56 107.03313333 -340.96686667 57 167.03313333 107.03313333 58 -35.96686667 167.03313333 59 -55.96686667 -35.96686667 60 0.03313333 -55.96686667 61 -67.96686667 0.03313333 62 30.03313333 -67.96686667 63 30.03313333 30.03313333 64 -55.96686667 30.03313333 65 231.03313333 -55.96686667 66 -153.96686667 231.03313333 67 -327.96686667 -153.96686667 68 232.03313333 -327.96686667 69 143.03313333 232.03313333 70 23.03313333 143.03313333 71 173.03313333 23.03313333 72 90.03313333 173.03313333 73 100.03313333 90.03313333 74 -683.96086667 100.03313333 75 104.03313333 -683.96086667 76 49.03313333 104.03313333 77 221.03313333 49.03313333 78 -152.96686667 221.03313333 79 -297.96686667 -152.96686667 80 306.03313333 -297.96686667 81 156.03313333 306.03313333 82 207.03313333 156.03313333 83 97.03313333 207.03313333 > 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/freestat/rcomp/tmp/76k2a1292771059.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/freestat/rcomp/tmp/86k2a1292771059.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/freestat/rcomp/tmp/96k2a1292771059.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/freestat/rcomp/tmp/10zbjd1292771059.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/freestat/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/html/freestat/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/freestat/rcomp/tmp/11kuz11292771059.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/freestat/rcomp/tmp/126uy71292771059.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/freestat/rcomp/tmp/132mey1292771059.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/freestat/rcomp/tmp/14o5c41292771059.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/freestat/rcomp/tmp/15r5ta1292771059.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/freestat/rcomp/tmp/165f901292771059.tab") + } > > try(system("convert tmp/1as4k1292771059.ps tmp/1as4k1292771059.png",intern=TRUE)) character(0) > try(system("convert tmp/2as4k1292771059.ps tmp/2as4k1292771059.png",intern=TRUE)) character(0) > try(system("convert tmp/33kln1292771059.ps tmp/33kln1292771059.png",intern=TRUE)) character(0) > try(system("convert tmp/43kln1292771059.ps tmp/43kln1292771059.png",intern=TRUE)) character(0) > try(system("convert tmp/53kln1292771059.ps tmp/53kln1292771059.png",intern=TRUE)) character(0) > try(system("convert tmp/6wblp1292771059.ps tmp/6wblp1292771059.png",intern=TRUE)) character(0) > try(system("convert tmp/76k2a1292771059.ps tmp/76k2a1292771059.png",intern=TRUE)) character(0) > try(system("convert tmp/86k2a1292771059.ps tmp/86k2a1292771059.png",intern=TRUE)) character(0) > try(system("convert tmp/96k2a1292771059.ps tmp/96k2a1292771059.png",intern=TRUE)) character(0) > try(system("convert tmp/10zbjd1292771059.ps tmp/10zbjd1292771059.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 4.159 2.551 5.243