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(9144 + ,5272 + ,719 + ,2779 + ,237 + ,138 + ,5456 + ,2332 + ,719 + ,2096 + ,162 + ,148 + ,5057 + ,2436 + ,707 + ,1581 + ,206 + ,127 + ,7779 + ,4605 + ,742 + ,2062 + ,253 + ,117 + ,5858 + ,2452 + ,722 + ,1752 + ,211 + ,722 + ,11493 + ,5609 + ,735 + ,3304 + ,949 + ,897 + ,6848 + ,3887 + ,730 + ,1775 + ,141 + ,316 + ,5772 + ,3011 + ,667 + ,1423 + ,562 + ,109 + ,5251 + ,2387 + ,728 + ,1763 + ,262 + ,111 + ,11232 + ,7120 + ,720 + ,3030 + ,205 + ,157 + ,5908 + ,2823 + ,736 + ,1743 + ,500 + ,107 + ,6812 + ,3954 + ,739 + ,1812 + ,182 + ,125 + ,9962 + ,5943 + ,798 + ,2866 + ,235 + ,120 + ,6155 + ,2816 + ,726 + ,2262 + ,189 + ,163 + ,5673 + ,2711 + ,727 + ,1751 + ,171 + ,313 + ,7985 + ,4703 + ,701 + ,2261 + ,184 + ,136 + ,5780 + ,2633 + ,691 + ,2079 + ,230 + ,146 + ,11999 + ,5540 + ,743 + ,3592 + ,1441 + ,682 + ,6973 + ,3949 + ,786 + ,2063 + ,44 + ,131 + ,5817 + ,3281 + ,643 + ,1624 + ,138 + ,132 + ,5844 + ,2792 + ,766 + ,1878 + ,278 + ,131 + ,11178 + ,6790 + ,730 + ,3229 + ,304 + ,125 + ,5533 + ,2712 + ,739 + ,1896 + ,68 + ,117 + ,6870 + ,3979 + ,724 + ,1917 + ,71 + ,179 + ,9521 + ,5475 + ,770 + ,3086 + ,45 + ,146 + ,5363 + ,2038 + ,740 + ,2350 + ,70 + ,166 + ,6031 + ,3268 + ,708 + ,1775 + ,120 + ,160 + ,9245 + ,5150 + ,790 + ,2374 + ,765 + ,166 + ,5621 + ,2625 + ,725 + ,2048 + ,76 + ,146 + ,11802 + ,6146 + ,726 + ,3829 + ,789 + ,312 + ,8364 + ,4808 + ,822 + ,2112 + ,64 + ,559 + ,6286 + ,3563 + ,742 + ,1691 + ,72 + ,219 + ,5071 + ,2014 + ,698 + ,2051 + ,167 + ,141 + ,10773 + ,6212 + ,817 + ,3378 + ,305 + ,61 + ,5821 + ,2749 + ,768 + ,2106 + ,60 + ,138 + ,7794 + ,4694 + ,446 + ,2208 + ,289 + ,157 + ,10636 + ,6031 + ,1071 + ,3277 + ,76 + ,182 + ,6405 + ,2914 + ,656 + ,2641 + ,41 + ,152 + ,5811 + ,3079 + ,896 + ,1582 + ,113 + ,140 + ,8981 + ,5397 + ,851 + ,2497 + ,65 + ,170 + ,6228 + ,2987 + ,768 + ,2236 + ,70 + ,168 + ,11950 + ,5949 + ,713 + ,3969 + ,772 + ,547 + ,7523 + ,4362 + ,828 + ,2096 + ,73 + ,164 + ,6067 + ,3484 + ,622 + ,1718 + ,93 + ,149 + ,4825 + ,1572 + ,747 + ,2123 + ,235 + ,148 + ,12162 + ,7402 + ,750 + ,3491 + ,384 + ,134 + ,6989 + ,3614 + ,779 + ,2321 + ,63 + ,212 + ,8012 + ,4942 + ,857 + ,1995 + ,58 + ,160 + ,10893 + ,6538 + ,738 + ,3396 + ,42 + ,179 + ,6647 + ,2941 + ,712 + ,2789 + ,55 + ,151 + ,5938 + ,3120 + ,782 + ,1772 + ,109 + ,155 + ,9005 + ,5415 + ,774 + ,2528 + ,84 + ,204 + ,6262 + ,3070 + ,744 + ,2144 + ,134 + ,170 + ,12022 + ,6299 + ,786 + ,3547 + ,1068 + ,320 + ,7683 + ,4693 + ,710 + ,2089 + ,54 + ,137 + ,6004 + ,3369 + ,773 + ,1485 + ,236 + ,140 + ,4724 + ,1431 + ,785 + ,1857 + ,502 + ,149 + ,10343 + ,4827 + ,683 + ,3237 + ,462 + ,1135 + ,6604 + ,1721 + ,717 + ,1740 + ,83 + ,2343 + ,7241 + ,2870 + ,671 + ,2003 + ,92 + ,1604 + ,9331 + ,5005 + ,756 + ,3271 + ,81 + ,219 + ,6418 + ,2869 + ,683 + ,2530 + ,139 + ,197 + ,7094 + ,3930 + ,954 + ,1915 + ,107 + ,189 + ,10340 + ,6646 + ,740 + ,2611 + ,169 + ,175 + ,6814 + ,3220 + ,671 + ,2119 + ,633 + ,171 + ,12003 + ,6173 + ,439 + ,4026 + ,1113 + ,252 + ,7481 + ,4133 + ,1000 + ,2093 + ,127 + ,129 + ,5452 + ,2866 + ,697 + ,1673 + ,67 + ,148 + ,6380 + ,2642 + ,665 + ,2097 + ,818 + ,157 + ,11425 + ,6530 + ,830 + ,3411 + ,502 + ,153 + ,5905 + ,2914 + ,759 + ,1960 + ,104 + ,168 + ,8536 + ,4656 + ,830 + ,2401 + ,475 + ,174 + ,10785 + ,6098 + ,835 + ,3540 + ,121 + ,191 + ,6672 + ,3003 + ,786 + ,2646 + ,43 + ,194 + ,7293 + ,3074 + ,710 + ,1932 + ,364 + ,1213 + ,9809 + ,4618 + ,844 + ,2795 + ,196 + ,1355 + ,5658 + ,2354 + ,801 + ,2083 + ,245 + ,175 + ,12364 + ,5709 + ,820 + ,4436 + ,1087 + ,311 + ,8078 + ,4356 + ,856 + ,2304 + ,418 + ,144 + ,5269 + ,2772 + ,635 + ,1618 + ,84 + ,160 + ,7787 + ,2987 + ,704 + ,2535 + ,1376 + ,186 + ,11729 + ,6665 + ,794 + ,3614 + ,499 + ,157 + ,6236 + ,3377 + ,728 + ,1887 + ,63 + ,182 + ,8576 + ,4511 + ,754 + ,2789 + ,335 + ,188 + ,11216 + ,6668 + ,827 + ,3351 + ,103 + ,268 + ,6814 + ,3075 + ,743 + ,2748 + ,35 + ,213 + ,6019 + ,3197 + ,786 + ,1654 + ,200 + ,182 + ,9317 + ,4508 + ,801 + ,3119 + ,710 + ,180 + ,5419 + ,2292 + ,772 + ,2075 + ,118 + ,162 + ,12525 + ,5482 + ,890 + ,4812 + ,1122 + ,218 + ,8973 + ,4736 + ,805 + ,2174 + ,1090 + ,168 + ,5960 + ,3389 + ,733 + ,1572 + ,114 + ,152 + ,7921 + ,2868 + ,857 + ,2781 + ,1250 + ,166 + ,12581 + ,7383 + ,866 + ,3807 + ,365 + ,159 + ,7180 + ,3761 + ,765 + ,1978 + ,489 + ,187 + ,9062 + ,4980 + ,825 + ,2697 + ,369 + ,192 + ,13064 + ,6926 + ,790 + ,3757 + ,1399 + ,192 + ,7100 + ,3206 + ,809 + ,2733 + ,161 + ,191 + ,5145 + ,2426 + ,725 + ,1733 + ,85 + ,176) + ,dim=c(6 + ,99) + ,dimnames=list(c('TO' + ,'DB' + ,'DA' + ,'BTW' + ,'NFO' + ,'KO') + ,1:99)) > y <- array(NA,dim=c(6,99),dimnames=list(c('TO','DB','DA','BTW','NFO','KO'),1:99)) > 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' > 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, 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 TO DB DA BTW NFO KO 1 9144 5272 719 2779 237 138 2 5456 2332 719 2096 162 148 3 5057 2436 707 1581 206 127 4 7779 4605 742 2062 253 117 5 5858 2452 722 1752 211 722 6 11493 5609 735 3304 949 897 7 6848 3887 730 1775 141 316 8 5772 3011 667 1423 562 109 9 5251 2387 728 1763 262 111 10 11232 7120 720 3030 205 157 11 5908 2823 736 1743 500 107 12 6812 3954 739 1812 182 125 13 9962 5943 798 2866 235 120 14 6155 2816 726 2262 189 163 15 5673 2711 727 1751 171 313 16 7985 4703 701 2261 184 136 17 5780 2633 691 2079 230 146 18 11999 5540 743 3592 1441 682 19 6973 3949 786 2063 44 131 20 5817 3281 643 1624 138 132 21 5844 2792 766 1878 278 131 22 11178 6790 730 3229 304 125 23 5533 2712 739 1896 68 117 24 6870 3979 724 1917 71 179 25 9521 5475 770 3086 45 146 26 5363 2038 740 2350 70 166 27 6031 3268 708 1775 120 160 28 9245 5150 790 2374 765 166 29 5621 2625 725 2048 76 146 30 11802 6146 726 3829 789 312 31 8364 4808 822 2112 64 559 32 6286 3563 742 1691 72 219 33 5071 2014 698 2051 167 141 34 10773 6212 817 3378 305 61 35 5821 2749 768 2106 60 138 36 7794 4694 446 2208 289 157 37 10636 6031 1071 3277 76 182 38 6405 2914 656 2641 41 152 39 5811 3079 896 1582 113 140 40 8981 5397 851 2497 65 170 41 6228 2987 768 2236 70 168 42 11950 5949 713 3969 772 547 43 7523 4362 828 2096 73 164 44 6067 3484 622 1718 93 149 45 4825 1572 747 2123 235 148 46 12162 7402 750 3491 384 134 47 6989 3614 779 2321 63 212 48 8012 4942 857 1995 58 160 49 10893 6538 738 3396 42 179 50 6647 2941 712 2789 55 151 51 5938 3120 782 1772 109 155 52 9005 5415 774 2528 84 204 53 6262 3070 744 2144 134 170 54 12022 6299 786 3547 1068 320 55 7683 4693 710 2089 54 137 56 6004 3369 773 1485 236 140 57 4724 1431 785 1857 502 149 58 10343 4827 683 3237 462 1135 59 6604 1721 717 1740 83 2343 60 7241 2870 671 2003 92 1604 61 9331 5005 756 3271 81 219 62 6418 2869 683 2530 139 197 63 7094 3930 954 1915 107 189 64 10340 6646 740 2611 169 175 65 6814 3220 671 2119 633 171 66 12003 6173 439 4026 1113 252 67 7481 4133 1000 2093 127 129 68 5452 2866 697 1673 67 148 69 6380 2642 665 2097 818 157 70 11425 6530 830 3411 502 153 71 5905 2914 759 1960 104 168 72 8536 4656 830 2401 475 174 73 10785 6098 835 3540 121 191 74 6672 3003 786 2646 43 194 75 7293 3074 710 1932 364 1213 76 9809 4618 844 2795 196 1355 77 5658 2354 801 2083 245 175 78 12364 5709 820 4436 1087 311 79 8078 4356 856 2304 418 144 80 5269 2772 635 1618 84 160 81 7787 2987 704 2535 1376 186 82 11729 6665 794 3614 499 157 83 6236 3377 728 1887 63 182 84 8576 4511 754 2789 335 188 85 11216 6668 827 3351 103 268 86 6814 3075 743 2748 35 213 87 6019 3197 786 1654 200 182 88 9317 4508 801 3119 710 180 89 5419 2292 772 2075 118 162 90 12525 5482 890 4812 1122 218 91 8973 4736 805 2174 1090 168 92 5960 3389 733 1572 114 152 93 7921 2868 857 2781 1250 166 94 12581 7383 866 3807 365 159 95 7180 3761 765 1978 489 187 96 9062 4980 825 2697 369 192 97 13064 6926 790 3757 1399 192 98 7100 3206 809 2733 161 191 99 5145 2426 725 1733 85 176 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) DB DA BTW NFO KO 0.2970 1.0000 0.9992 1.0000 1.0002 1.0001 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -1.1392 -0.8212 0.1295 0.1841 1.9297 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 2.970e-01 6.742e-01 0.441 0.661 DB 1.000e+00 7.472e-05 13383.735 <2e-16 *** DA 9.992e-01 8.860e-04 1127.822 <2e-16 *** BTW 1.000e+00 1.699e-04 5886.472 <2e-16 *** NFO 1.000e+00 2.457e-04 4071.388 <2e-16 *** KO 1.000e+00 2.201e-04 4543.879 <2e-16 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 0.7161 on 93 degrees of freedom Multiple R-squared: 1, Adjusted R-squared: 1 F-statistic: 2.068e+08 on 5 and 93 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.14935381 0.2987076 0.8506462 [2,] 0.26662345 0.5332469 0.7333765 [3,] 0.32230930 0.6446186 0.6776907 [4,] 0.23405231 0.4681046 0.7659477 [5,] 0.17222268 0.3444454 0.8277773 [6,] 0.11443190 0.2288638 0.8855681 [7,] 0.11280933 0.2256187 0.8871907 [8,] 0.07651279 0.1530256 0.9234872 [9,] 0.33460641 0.6692128 0.6653936 [10,] 0.46179859 0.9235972 0.5382014 [11,] 0.41422833 0.8284567 0.5857717 [12,] 0.39758286 0.7951657 0.6024171 [13,] 0.42409879 0.8481976 0.5759012 [14,] 0.34592146 0.6918429 0.6540785 [15,] 0.54422974 0.9115405 0.4557703 [16,] 0.48961985 0.9792397 0.5103801 [17,] 0.49369360 0.9873872 0.5063064 [18,] 0.46768304 0.9353661 0.5323170 [19,] 0.41115878 0.8223176 0.5888412 [20,] 0.35359139 0.7071828 0.6464086 [21,] 0.51800101 0.9639980 0.4819990 [22,] 0.44967047 0.8993409 0.5503295 [23,] 0.41300867 0.8260173 0.5869913 [24,] 0.40679000 0.8135800 0.5932100 [25,] 0.34699825 0.6939965 0.6530018 [26,] 0.28846864 0.5769373 0.7115314 [27,] 0.24331592 0.4866318 0.7566841 [28,] 0.19809718 0.3961944 0.8019028 [29,] 0.17229693 0.3445939 0.8277031 [30,] 0.23355684 0.4671137 0.7664432 [31,] 0.39573476 0.7914695 0.6042652 [32,] 0.53605326 0.9278935 0.4639467 [33,] 0.54885281 0.9022944 0.4511472 [34,] 0.49128966 0.9825793 0.5087103 [35,] 0.43749673 0.8749935 0.5625033 [36,] 0.51872477 0.9625505 0.4812752 [37,] 0.45936577 0.9187315 0.5406342 [38,] 0.50719930 0.9856014 0.4928007 [39,] 0.45293162 0.9058632 0.5470684 [40,] 0.40106338 0.8021268 0.5989366 [41,] 0.34546612 0.6909322 0.6545339 [42,] 0.36773260 0.7354652 0.6322674 [43,] 0.31605351 0.6321070 0.6839465 [44,] 0.26784620 0.5356924 0.7321538 [45,] 0.22240237 0.4448047 0.7775976 [46,] 0.52897811 0.9420438 0.4710219 [47,] 0.47330911 0.9466182 0.5266909 [48,] 0.59070398 0.8185920 0.4092960 [49,] 0.53077782 0.9384444 0.4692222 [50,] 0.60108364 0.7978327 0.3989164 [51,] 0.75024383 0.4995123 0.2497562 [52,] 0.76731723 0.4653655 0.2326828 [53,] 0.80108155 0.3978369 0.1989185 [54,] 0.75738336 0.4852333 0.2426166 [55,] 0.74239748 0.5152050 0.2576025 [56,] 0.74607195 0.5078561 0.2539280 [57,] 0.69319242 0.6136152 0.3068076 [58,] 0.66688065 0.6662387 0.3331193 [59,] 0.63021251 0.7395750 0.3697875 [60,] 0.73993969 0.5201206 0.2600603 [61,] 0.84828439 0.3034312 0.1517156 [62,] 0.88207100 0.2358580 0.1179290 [63,] 0.84903160 0.3019368 0.1509684 [64,] 0.80625082 0.3874984 0.1937492 [65,] 0.75977040 0.4804592 0.2402296 [66,] 0.70030791 0.5993842 0.2996921 [67,] 0.64184416 0.7163117 0.3581558 [68,] 0.63166203 0.7366759 0.3683380 [69,] 0.56319451 0.8736110 0.4368055 [70,] 0.75412476 0.4917505 0.2458752 [71,] 0.68339829 0.6332034 0.3166017 [72,] 0.63224446 0.7355111 0.3677555 [73,] 0.59750841 0.8049832 0.4024916 [74,] 0.53228599 0.9354280 0.4677140 [75,] 0.51486891 0.9702622 0.4851311 [76,] 0.61383970 0.7723206 0.3861603 [77,] 0.59951018 0.8009796 0.4004898 [78,] 0.49195157 0.9839031 0.5080484 [79,] 0.40818012 0.8163602 0.5918199 [80,] 0.61442600 0.7711480 0.3855740 [81,] 0.46652560 0.9330512 0.5334744 [82,] 0.54781299 0.9043740 0.4521870 > postscript(file="/var/wessaorg/rcomp/tmp/1s9se1353159948.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/26l7u1353159948.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/365371353159948.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/4unv11353159948.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/50aou1353159948.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 = 99 Frequency = 1 1 2 3 4 5 6 -0.914561305 -0.864572537 0.136460802 0.129448822 -0.923617896 -1.139163105 7 8 9 10 11 12 -0.867464779 0.042124939 0.138189656 0.072908782 -0.901779047 0.151117263 13 14 15 16 17 18 0.143142541 -0.873715501 0.131382445 0.101520045 1.100031894 0.788107191 19 20 21 22 23 24 0.205004206 -0.906558337 -0.843216330 0.060482979 1.176940928 0.151016828 25 26 27 28 29 30 -0.850393216 -0.839651078 0.139493174 0.051381433 1.156778602 -0.071692580 31 32 33 34 35 36 -0.823414139 -0.830068721 0.121933041 0.132954886 0.191650505 -0.117428083 37 38 39 40 41 42 -0.634891736 1.088132417 1.296637519 1.225993717 -0.818969536 -0.107940748 43 44 45 46 47 48 0.225480381 1.079686528 0.146207226 1.048277381 0.180242758 0.251822029 49 50 51 52 53 54 0.106255448 -0.875818010 0.200558806 0.157617194 0.152603628 1.929728797 55 56 57 58 59 60 0.138787757 1.179315610 0.134457840 -1.107253302 -0.076623339 0.952447736 61 62 63 64 65 66 -0.879892841 0.089503764 -0.677549755 -0.890561791 0.001073373 -0.356638730 67 68 69 70 71 72 -0.645815756 1.147621100 0.966386113 -0.907011765 0.177006196 0.138200031 73 74 75 76 77 78 0.162885502 0.183760690 -0.024679782 1.060038411 0.180880783 0.927232357 79 80 81 82 83 84 0.177196820 0.097084957 -1.128391320 0.057757903 -0.840745872 -0.907982724 85 86 87 88 89 90 -0.844928208 0.146017943 0.186955562 -0.952506626 0.184390301 0.974009198 91 92 93 94 95 96 0.009778839 0.167052148 -0.990693875 1.129153460 0.101810748 -0.858869553 97 98 99 -0.125929376 0.175750540 0.163120822 > postscript(file="/var/wessaorg/rcomp/tmp/6oq511353159948.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 = 99 Frequency = 1 lag(myerror, k = 1) myerror 0 -0.914561305 NA 1 -0.864572537 -0.914561305 2 0.136460802 -0.864572537 3 0.129448822 0.136460802 4 -0.923617896 0.129448822 5 -1.139163105 -0.923617896 6 -0.867464779 -1.139163105 7 0.042124939 -0.867464779 8 0.138189656 0.042124939 9 0.072908782 0.138189656 10 -0.901779047 0.072908782 11 0.151117263 -0.901779047 12 0.143142541 0.151117263 13 -0.873715501 0.143142541 14 0.131382445 -0.873715501 15 0.101520045 0.131382445 16 1.100031894 0.101520045 17 0.788107191 1.100031894 18 0.205004206 0.788107191 19 -0.906558337 0.205004206 20 -0.843216330 -0.906558337 21 0.060482979 -0.843216330 22 1.176940928 0.060482979 23 0.151016828 1.176940928 24 -0.850393216 0.151016828 25 -0.839651078 -0.850393216 26 0.139493174 -0.839651078 27 0.051381433 0.139493174 28 1.156778602 0.051381433 29 -0.071692580 1.156778602 30 -0.823414139 -0.071692580 31 -0.830068721 -0.823414139 32 0.121933041 -0.830068721 33 0.132954886 0.121933041 34 0.191650505 0.132954886 35 -0.117428083 0.191650505 36 -0.634891736 -0.117428083 37 1.088132417 -0.634891736 38 1.296637519 1.088132417 39 1.225993717 1.296637519 40 -0.818969536 1.225993717 41 -0.107940748 -0.818969536 42 0.225480381 -0.107940748 43 1.079686528 0.225480381 44 0.146207226 1.079686528 45 1.048277381 0.146207226 46 0.180242758 1.048277381 47 0.251822029 0.180242758 48 0.106255448 0.251822029 49 -0.875818010 0.106255448 50 0.200558806 -0.875818010 51 0.157617194 0.200558806 52 0.152603628 0.157617194 53 1.929728797 0.152603628 54 0.138787757 1.929728797 55 1.179315610 0.138787757 56 0.134457840 1.179315610 57 -1.107253302 0.134457840 58 -0.076623339 -1.107253302 59 0.952447736 -0.076623339 60 -0.879892841 0.952447736 61 0.089503764 -0.879892841 62 -0.677549755 0.089503764 63 -0.890561791 -0.677549755 64 0.001073373 -0.890561791 65 -0.356638730 0.001073373 66 -0.645815756 -0.356638730 67 1.147621100 -0.645815756 68 0.966386113 1.147621100 69 -0.907011765 0.966386113 70 0.177006196 -0.907011765 71 0.138200031 0.177006196 72 0.162885502 0.138200031 73 0.183760690 0.162885502 74 -0.024679782 0.183760690 75 1.060038411 -0.024679782 76 0.180880783 1.060038411 77 0.927232357 0.180880783 78 0.177196820 0.927232357 79 0.097084957 0.177196820 80 -1.128391320 0.097084957 81 0.057757903 -1.128391320 82 -0.840745872 0.057757903 83 -0.907982724 -0.840745872 84 -0.844928208 -0.907982724 85 0.146017943 -0.844928208 86 0.186955562 0.146017943 87 -0.952506626 0.186955562 88 0.184390301 -0.952506626 89 0.974009198 0.184390301 90 0.009778839 0.974009198 91 0.167052148 0.009778839 92 -0.990693875 0.167052148 93 1.129153460 -0.990693875 94 0.101810748 1.129153460 95 -0.858869553 0.101810748 96 -0.125929376 -0.858869553 97 0.175750540 -0.125929376 98 0.163120822 0.175750540 99 NA 0.163120822 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -0.864572537 -0.914561305 [2,] 0.136460802 -0.864572537 [3,] 0.129448822 0.136460802 [4,] -0.923617896 0.129448822 [5,] -1.139163105 -0.923617896 [6,] -0.867464779 -1.139163105 [7,] 0.042124939 -0.867464779 [8,] 0.138189656 0.042124939 [9,] 0.072908782 0.138189656 [10,] -0.901779047 0.072908782 [11,] 0.151117263 -0.901779047 [12,] 0.143142541 0.151117263 [13,] -0.873715501 0.143142541 [14,] 0.131382445 -0.873715501 [15,] 0.101520045 0.131382445 [16,] 1.100031894 0.101520045 [17,] 0.788107191 1.100031894 [18,] 0.205004206 0.788107191 [19,] -0.906558337 0.205004206 [20,] -0.843216330 -0.906558337 [21,] 0.060482979 -0.843216330 [22,] 1.176940928 0.060482979 [23,] 0.151016828 1.176940928 [24,] -0.850393216 0.151016828 [25,] -0.839651078 -0.850393216 [26,] 0.139493174 -0.839651078 [27,] 0.051381433 0.139493174 [28,] 1.156778602 0.051381433 [29,] -0.071692580 1.156778602 [30,] -0.823414139 -0.071692580 [31,] -0.830068721 -0.823414139 [32,] 0.121933041 -0.830068721 [33,] 0.132954886 0.121933041 [34,] 0.191650505 0.132954886 [35,] -0.117428083 0.191650505 [36,] -0.634891736 -0.117428083 [37,] 1.088132417 -0.634891736 [38,] 1.296637519 1.088132417 [39,] 1.225993717 1.296637519 [40,] -0.818969536 1.225993717 [41,] -0.107940748 -0.818969536 [42,] 0.225480381 -0.107940748 [43,] 1.079686528 0.225480381 [44,] 0.146207226 1.079686528 [45,] 1.048277381 0.146207226 [46,] 0.180242758 1.048277381 [47,] 0.251822029 0.180242758 [48,] 0.106255448 0.251822029 [49,] -0.875818010 0.106255448 [50,] 0.200558806 -0.875818010 [51,] 0.157617194 0.200558806 [52,] 0.152603628 0.157617194 [53,] 1.929728797 0.152603628 [54,] 0.138787757 1.929728797 [55,] 1.179315610 0.138787757 [56,] 0.134457840 1.179315610 [57,] -1.107253302 0.134457840 [58,] -0.076623339 -1.107253302 [59,] 0.952447736 -0.076623339 [60,] -0.879892841 0.952447736 [61,] 0.089503764 -0.879892841 [62,] -0.677549755 0.089503764 [63,] -0.890561791 -0.677549755 [64,] 0.001073373 -0.890561791 [65,] -0.356638730 0.001073373 [66,] -0.645815756 -0.356638730 [67,] 1.147621100 -0.645815756 [68,] 0.966386113 1.147621100 [69,] -0.907011765 0.966386113 [70,] 0.177006196 -0.907011765 [71,] 0.138200031 0.177006196 [72,] 0.162885502 0.138200031 [73,] 0.183760690 0.162885502 [74,] -0.024679782 0.183760690 [75,] 1.060038411 -0.024679782 [76,] 0.180880783 1.060038411 [77,] 0.927232357 0.180880783 [78,] 0.177196820 0.927232357 [79,] 0.097084957 0.177196820 [80,] -1.128391320 0.097084957 [81,] 0.057757903 -1.128391320 [82,] -0.840745872 0.057757903 [83,] -0.907982724 -0.840745872 [84,] -0.844928208 -0.907982724 [85,] 0.146017943 -0.844928208 [86,] 0.186955562 0.146017943 [87,] -0.952506626 0.186955562 [88,] 0.184390301 -0.952506626 [89,] 0.974009198 0.184390301 [90,] 0.009778839 0.974009198 [91,] 0.167052148 0.009778839 [92,] -0.990693875 0.167052148 [93,] 1.129153460 -0.990693875 [94,] 0.101810748 1.129153460 [95,] -0.858869553 0.101810748 [96,] -0.125929376 -0.858869553 [97,] 0.175750540 -0.125929376 [98,] 0.163120822 0.175750540 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -0.864572537 -0.914561305 2 0.136460802 -0.864572537 3 0.129448822 0.136460802 4 -0.923617896 0.129448822 5 -1.139163105 -0.923617896 6 -0.867464779 -1.139163105 7 0.042124939 -0.867464779 8 0.138189656 0.042124939 9 0.072908782 0.138189656 10 -0.901779047 0.072908782 11 0.151117263 -0.901779047 12 0.143142541 0.151117263 13 -0.873715501 0.143142541 14 0.131382445 -0.873715501 15 0.101520045 0.131382445 16 1.100031894 0.101520045 17 0.788107191 1.100031894 18 0.205004206 0.788107191 19 -0.906558337 0.205004206 20 -0.843216330 -0.906558337 21 0.060482979 -0.843216330 22 1.176940928 0.060482979 23 0.151016828 1.176940928 24 -0.850393216 0.151016828 25 -0.839651078 -0.850393216 26 0.139493174 -0.839651078 27 0.051381433 0.139493174 28 1.156778602 0.051381433 29 -0.071692580 1.156778602 30 -0.823414139 -0.071692580 31 -0.830068721 -0.823414139 32 0.121933041 -0.830068721 33 0.132954886 0.121933041 34 0.191650505 0.132954886 35 -0.117428083 0.191650505 36 -0.634891736 -0.117428083 37 1.088132417 -0.634891736 38 1.296637519 1.088132417 39 1.225993717 1.296637519 40 -0.818969536 1.225993717 41 -0.107940748 -0.818969536 42 0.225480381 -0.107940748 43 1.079686528 0.225480381 44 0.146207226 1.079686528 45 1.048277381 0.146207226 46 0.180242758 1.048277381 47 0.251822029 0.180242758 48 0.106255448 0.251822029 49 -0.875818010 0.106255448 50 0.200558806 -0.875818010 51 0.157617194 0.200558806 52 0.152603628 0.157617194 53 1.929728797 0.152603628 54 0.138787757 1.929728797 55 1.179315610 0.138787757 56 0.134457840 1.179315610 57 -1.107253302 0.134457840 58 -0.076623339 -1.107253302 59 0.952447736 -0.076623339 60 -0.879892841 0.952447736 61 0.089503764 -0.879892841 62 -0.677549755 0.089503764 63 -0.890561791 -0.677549755 64 0.001073373 -0.890561791 65 -0.356638730 0.001073373 66 -0.645815756 -0.356638730 67 1.147621100 -0.645815756 68 0.966386113 1.147621100 69 -0.907011765 0.966386113 70 0.177006196 -0.907011765 71 0.138200031 0.177006196 72 0.162885502 0.138200031 73 0.183760690 0.162885502 74 -0.024679782 0.183760690 75 1.060038411 -0.024679782 76 0.180880783 1.060038411 77 0.927232357 0.180880783 78 0.177196820 0.927232357 79 0.097084957 0.177196820 80 -1.128391320 0.097084957 81 0.057757903 -1.128391320 82 -0.840745872 0.057757903 83 -0.907982724 -0.840745872 84 -0.844928208 -0.907982724 85 0.146017943 -0.844928208 86 0.186955562 0.146017943 87 -0.952506626 0.186955562 88 0.184390301 -0.952506626 89 0.974009198 0.184390301 90 0.009778839 0.974009198 91 0.167052148 0.009778839 92 -0.990693875 0.167052148 93 1.129153460 -0.990693875 94 0.101810748 1.129153460 95 -0.858869553 0.101810748 96 -0.125929376 -0.858869553 97 0.175750540 -0.125929376 98 0.163120822 0.175750540 > 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/7b0in1353159948.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/8nfsh1353159948.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/925bc1353159948.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/10i26t1353159948.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/111ijg1353159948.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/126orv1353159948.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/13uyq01353159948.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/14qj3f1353159948.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/15qggf1353159948.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/16yiqm1353159948.tab") + } > > try(system("convert tmp/1s9se1353159948.ps tmp/1s9se1353159948.png",intern=TRUE)) character(0) > try(system("convert tmp/26l7u1353159948.ps tmp/26l7u1353159948.png",intern=TRUE)) character(0) > try(system("convert tmp/365371353159948.ps tmp/365371353159948.png",intern=TRUE)) character(0) > try(system("convert tmp/4unv11353159948.ps tmp/4unv11353159948.png",intern=TRUE)) character(0) > try(system("convert tmp/50aou1353159948.ps tmp/50aou1353159948.png",intern=TRUE)) character(0) > try(system("convert tmp/6oq511353159948.ps tmp/6oq511353159948.png",intern=TRUE)) character(0) > try(system("convert tmp/7b0in1353159948.ps tmp/7b0in1353159948.png",intern=TRUE)) character(0) > try(system("convert tmp/8nfsh1353159948.ps tmp/8nfsh1353159948.png",intern=TRUE)) character(0) > try(system("convert tmp/925bc1353159948.ps tmp/925bc1353159948.png",intern=TRUE)) character(0) > try(system("convert tmp/10i26t1353159948.ps tmp/10i26t1353159948.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 7.523 0.998 8.583