R version 2.12.0 (2010-10-15) Copyright (C) 2010 The R Foundation for Statistical Computing ISBN 3-900051-07-0 Platform: i486-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(33024 + ,31086 + ,19828 + ,18932 + ,32526 + ,30839 + ,19967 + ,18927 + ,31455 + ,30051 + ,19814 + ,19124 + ,31524 + ,29976 + ,20053 + ,19066 + ,31856 + ,30463 + ,20719 + ,19971 + ,32696 + ,31422 + ,21174 + ,20165 + ,32584 + ,31588 + ,20648 + ,19705 + ,33498 + ,31900 + ,20659 + ,19718 + ,34175 + ,32878 + ,20733 + ,19938 + ,34172 + ,33010 + ,21069 + ,20039 + ,34379 + ,32954 + ,20566 + ,19721 + ,34988 + ,33076 + ,20839 + ,19777 + ,36158 + ,35057 + ,21615 + ,20505 + ,37411 + ,35906 + ,22739 + ,21763 + ,38015 + ,36100 + ,23222 + ,22404 + ,37577 + ,35824 + ,23031 + ,22038 + ,36354 + ,34579 + ,23014 + ,22038 + ,36030 + ,34484 + ,22868 + ,21874 + ,35636 + ,33920 + ,22182 + ,21269 + ,35669 + ,34059 + ,22177 + ,21127 + ,34635 + ,33812 + ,21216 + ,20609 + ,35496 + ,34594 + ,21031 + ,20565 + ,36376 + ,36083 + ,20968 + ,19791 + ,37635 + ,36563 + ,21049 + ,20672 + ,38875 + ,37416 + ,21033 + ,20938 + ,38372 + ,37953 + ,21078 + ,20675 + ,38897 + ,37517 + ,20702 + ,19992 + ,38018 + ,37467 + ,20309 + ,19801 + ,37325 + ,36963 + ,20449 + ,20050 + ,36893 + ,36019 + ,20737 + ,20427 + ,36117 + ,35232 + ,20849 + ,20815 + ,37599 + ,36857 + ,21966 + ,21666 + ,39037 + ,37978 + ,23100 + ,22720 + ,40809 + ,40160 + ,23975 + ,23650 + ,42508 + ,42165 + ,24350 + ,24244 + ,44021 + ,43069 + ,24020 + ,23669 + ,44088 + ,43021 + ,24005 + ,23881 + ,44510 + ,43376 + ,23602 + ,23857 + ,45786 + ,43978 + ,24120 + ,23999 + ,47349 + ,45911 + ,24847 + ,24780 + ,48696 + ,47107 + ,25702 + ,25426 + ,50598 + ,49168 + ,26312 + ,26229 + ,50066 + ,48390 + ,25891 + ,25973 + ,49367 + ,47678 + ,25172 + ,25375 + ,48784 + ,47822 + ,25698 + ,25966 + ,47841 + ,46695 + ,25833 + ,25391 + ,48300 + ,47185 + ,25658 + ,26046 + ,47518 + ,45684 + ,25269 + ,25572 + ,46504 + ,44884 + ,24846 + ,24900 + ,45147 + ,44256 + ,24390 + ,24744 + ,44404 + ,43637 + ,23954 + ,24526 + ,43455 + ,42368 + ,23828 + ,24274 + ,42299 + ,40892 + ,23507 + ,23774 + ,42105 + ,40616 + ,23144 + ,23414 + ,40152 + ,39026 + ,22302 + ,23002 + ,39519 + ,38921 + ,23028 + ,23137 + ,39633 + ,38512 + ,22741 + ,22947 + ,39376 + ,38884 + ,23129 + ,23733 + ,38850 + ,38406 + ,22911 + ,23234 + ,39657 + ,38804 + ,22071 + ,22969 + ,34804 + ,34871 + ,16466 + ,17708 + ,34372 + ,34660 + ,16370 + ,17377 + ,32678 + ,33104 + ,15049 + ,16273 + ,28420 + ,28952 + ,13174 + ,14342 + ,25420 + ,26488 + ,12231 + ,13522 + ,27683 + ,29418 + ,13620 + ,15210 + ,29904 + ,32315 + ,14317 + ,16493 + ,30546 + ,32885 + ,14039 + ,16701 + ,29142 + ,31565 + ,13526 + ,15662 + ,27724 + ,30782 + ,12826 + ,15526 + ,27069 + ,30442 + ,12360 + ,15413 + ,26665 + ,30851 + ,12592 + ,15805 + ,26004 + ,30432 + ,12381 + ,15802 + ,25767 + ,31260 + ,12554 + ,16753 + ,24915 + ,30737 + ,12338 + ,16906 + ,23689 + ,30129 + ,11768 + ,16891 + ,20915 + ,27672 + ,10687 + ,15703 + ,19414 + ,26469 + ,9964 + ,15429 + ,17824 + ,24895 + ,9338 + ,14762 + ,16348 + ,24427 + ,8697 + ,14426 + ,15571 + ,23252 + ,8068 + ,14250 + ,13929 + ,21815 + ,7295 + ,13267 + ,12480 + ,20837 + ,6372 + ,12397 + ,10837 + ,18537 + ,5649 + ,11586 + ,9473 + ,17237 + ,4926 + ,10888 + ,8051 + ,15476 + ,4199 + ,9841 + ,5278 + ,10709 + ,2568 + ,6443 + ,3008 + ,6776 + ,1461 + ,4019 + ,2404 + ,5810 + ,1173 + ,3449 + ,2298 + ,5765 + ,1084 + ,3179 + ,2260 + ,5775 + ,978 + ,3341 + ,1938 + ,5589 + ,947 + ,3325 + ,1371 + ,4687 + ,679 + ,2478 + ,1009 + ,3630 + ,457 + ,1982 + ,686 + ,2552 + ,262 + ,1405 + ,493 + ,1928 + ,218 + ,1059 + ,285 + ,1323 + ,132 + ,740 + ,192 + ,1005 + ,70 + ,533 + ,129 + ,678 + ,44 + ,366 + ,60 + ,397 + ,24 + ,224 + ,54 + ,286 + ,20 + ,147 + ,26 + ,166 + ,4 + ,75 + ,11 + ,80 + ,4 + ,54 + ,3 + ,53 + ,1 + ,23 + ,0 + ,32 + ,0 + ,16 + ,2 + ,11 + ,0 + ,6 + ,1 + ,6 + ,0 + ,7 + ,0 + ,4 + ,0 + ,2 + ,0 + ,2 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,0 + ,1 + ,0 + ,0) + ,dim=c(4 + ,111) + ,dimnames=list(c('MVG' + ,'VVG' + ,'MWG' + ,'VWG') + ,1:111)) > y <- array(NA,dim=c(4,111),dimnames=list(c('MVG','VVG','MWG','VWG'),1:111)) > 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 > 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 MVG VVG MWG VWG 1 33024 31086 19828 18932 2 32526 30839 19967 18927 3 31455 30051 19814 19124 4 31524 29976 20053 19066 5 31856 30463 20719 19971 6 32696 31422 21174 20165 7 32584 31588 20648 19705 8 33498 31900 20659 19718 9 34175 32878 20733 19938 10 34172 33010 21069 20039 11 34379 32954 20566 19721 12 34988 33076 20839 19777 13 36158 35057 21615 20505 14 37411 35906 22739 21763 15 38015 36100 23222 22404 16 37577 35824 23031 22038 17 36354 34579 23014 22038 18 36030 34484 22868 21874 19 35636 33920 22182 21269 20 35669 34059 22177 21127 21 34635 33812 21216 20609 22 35496 34594 21031 20565 23 36376 36083 20968 19791 24 37635 36563 21049 20672 25 38875 37416 21033 20938 26 38372 37953 21078 20675 27 38897 37517 20702 19992 28 38018 37467 20309 19801 29 37325 36963 20449 20050 30 36893 36019 20737 20427 31 36117 35232 20849 20815 32 37599 36857 21966 21666 33 39037 37978 23100 22720 34 40809 40160 23975 23650 35 42508 42165 24350 24244 36 44021 43069 24020 23669 37 44088 43021 24005 23881 38 44510 43376 23602 23857 39 45786 43978 24120 23999 40 47349 45911 24847 24780 41 48696 47107 25702 25426 42 50598 49168 26312 26229 43 50066 48390 25891 25973 44 49367 47678 25172 25375 45 48784 47822 25698 25966 46 47841 46695 25833 25391 47 48300 47185 25658 26046 48 47518 45684 25269 25572 49 46504 44884 24846 24900 50 45147 44256 24390 24744 51 44404 43637 23954 24526 52 43455 42368 23828 24274 53 42299 40892 23507 23774 54 42105 40616 23144 23414 55 40152 39026 22302 23002 56 39519 38921 23028 23137 57 39633 38512 22741 22947 58 39376 38884 23129 23733 59 38850 38406 22911 23234 60 39657 38804 22071 22969 61 34804 34871 16466 17708 62 34372 34660 16370 17377 63 32678 33104 15049 16273 64 28420 28952 13174 14342 65 25420 26488 12231 13522 66 27683 29418 13620 15210 67 29904 32315 14317 16493 68 30546 32885 14039 16701 69 29142 31565 13526 15662 70 27724 30782 12826 15526 71 27069 30442 12360 15413 72 26665 30851 12592 15805 73 26004 30432 12381 15802 74 25767 31260 12554 16753 75 24915 30737 12338 16906 76 23689 30129 11768 16891 77 20915 27672 10687 15703 78 19414 26469 9964 15429 79 17824 24895 9338 14762 80 16348 24427 8697 14426 81 15571 23252 8068 14250 82 13929 21815 7295 13267 83 12480 20837 6372 12397 84 10837 18537 5649 11586 85 9473 17237 4926 10888 86 8051 15476 4199 9841 87 5278 10709 2568 6443 88 3008 6776 1461 4019 89 2404 5810 1173 3449 90 2298 5765 1084 3179 91 2260 5775 978 3341 92 1938 5589 947 3325 93 1371 4687 679 2478 94 1009 3630 457 1982 95 686 2552 262 1405 96 493 1928 218 1059 97 285 1323 132 740 98 192 1005 70 533 99 129 678 44 366 100 60 397 24 224 101 54 286 20 147 102 26 166 4 75 103 11 80 4 54 104 3 53 1 23 105 0 32 0 16 106 2 11 0 6 107 1 6 0 7 108 0 4 0 2 109 0 2 0 0 110 0 0 0 0 111 0 1 0 0 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) VVG MWG VWG -351.344 1.085 1.350 -1.447 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -2092.11 -292.89 6.33 340.48 1346.70 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) -351.34356 116.05303 -3.027 0.00309 ** VVG 1.08526 0.02422 44.816 < 2e-16 *** MWG 1.34992 0.02643 51.084 < 2e-16 *** VWG -1.44737 0.05499 -26.322 < 2e-16 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 529.4 on 107 degrees of freedom Multiple R-squared: 0.999, Adjusted R-squared: 0.999 F-statistic: 3.599e+04 on 3 and 107 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.182755549 3.655111e-01 8.172445e-01 [2,] 0.100451329 2.009027e-01 8.995487e-01 [3,] 0.044826341 8.965268e-02 9.551737e-01 [4,] 0.021389027 4.277805e-02 9.786110e-01 [5,] 0.008302752 1.660550e-02 9.916972e-01 [6,] 0.014492908 2.898582e-02 9.855071e-01 [7,] 0.009305866 1.861173e-02 9.906941e-01 [8,] 0.019957225 3.991445e-02 9.800428e-01 [9,] 0.038336440 7.667288e-02 9.616636e-01 [10,] 0.025764066 5.152813e-02 9.742359e-01 [11,] 0.016082728 3.216546e-02 9.839173e-01 [12,] 0.009104535 1.820907e-02 9.908955e-01 [13,] 0.005172749 1.034550e-02 9.948273e-01 [14,] 0.002855944 5.711888e-03 9.971441e-01 [15,] 0.006084675 1.216935e-02 9.939153e-01 [16,] 0.003836454 7.672908e-03 9.961635e-01 [17,] 0.045575554 9.115111e-02 9.544244e-01 [18,] 0.042398448 8.479690e-02 9.576016e-01 [19,] 0.055842362 1.116847e-01 9.441576e-01 [20,] 0.076727866 1.534557e-01 9.232721e-01 [21,] 0.116870217 2.337404e-01 8.831298e-01 [22,] 0.137354507 2.747090e-01 8.626455e-01 [23,] 0.211332679 4.226654e-01 7.886673e-01 [24,] 0.188440325 3.768807e-01 8.115597e-01 [25,] 0.156555277 3.131106e-01 8.434447e-01 [26,] 0.180656613 3.613132e-01 8.193434e-01 [27,] 0.173824875 3.476498e-01 8.261751e-01 [28,] 0.272192041 5.443841e-01 7.278080e-01 [29,] 0.437871773 8.757435e-01 5.621282e-01 [30,] 0.558221184 8.835576e-01 4.417788e-01 [31,] 0.612755770 7.744885e-01 3.872442e-01 [32,] 0.653257706 6.934846e-01 3.467423e-01 [33,] 0.827036892 3.459262e-01 1.729631e-01 [34,] 0.839634566 3.207309e-01 1.603654e-01 [35,] 0.853587359 2.928253e-01 1.464126e-01 [36,] 0.845456936 3.090861e-01 1.545431e-01 [37,] 0.848564905 3.028702e-01 1.514351e-01 [38,] 0.871140827 2.577183e-01 1.288592e-01 [39,] 0.856660162 2.866797e-01 1.433398e-01 [40,] 0.955075593 8.984881e-02 4.492441e-02 [41,] 0.940974496 1.180510e-01 5.902550e-02 [42,] 0.961029716 7.794057e-02 3.897028e-02 [43,] 0.953674539 9.265092e-02 4.632546e-02 [44,] 0.947044472 1.059111e-01 5.295553e-02 [45,] 0.934680771 1.306385e-01 6.531923e-02 [46,] 0.915560485 1.688790e-01 8.443951e-02 [47,] 0.900930490 1.981390e-01 9.906951e-02 [48,] 0.899384947 2.012301e-01 1.006151e-01 [49,] 0.929379984 1.412400e-01 7.062002e-02 [50,] 0.967166263 6.566747e-02 3.283374e-02 [51,] 0.956163485 8.767303e-02 4.383651e-02 [52,] 0.961783254 7.643349e-02 3.821675e-02 [53,] 0.997627354 4.745291e-03 2.372646e-03 [54,] 0.998283685 3.432629e-03 1.716315e-03 [55,] 0.998599034 2.801933e-03 1.400966e-03 [56,] 0.997820220 4.359560e-03 2.179780e-03 [57,] 0.998314395 3.371211e-03 1.685605e-03 [58,] 0.998568350 2.863301e-03 1.431650e-03 [59,] 0.997996906 4.006187e-03 2.003094e-03 [60,] 0.999406117 1.187767e-03 5.938834e-04 [61,] 0.999813683 3.726339e-04 1.863169e-04 [62,] 0.999986957 2.608547e-05 1.304273e-05 [63,] 0.999987034 2.593117e-05 1.296558e-05 [64,] 0.999994541 1.091888e-05 5.459439e-06 [65,] 0.999999973 5.421982e-08 2.710991e-08 [66,] 0.999999994 1.101873e-08 5.509365e-09 [67,] 0.999999999 1.572877e-09 7.864386e-10 [68,] 1.000000000 2.998267e-10 1.499133e-10 [69,] 1.000000000 7.141289e-11 3.570644e-11 [70,] 1.000000000 2.664307e-14 1.332153e-14 [71,] 1.000000000 1.192203e-14 5.961016e-15 [72,] 1.000000000 1.689641e-16 8.448204e-17 [73,] 1.000000000 4.390272e-16 2.195136e-16 [74,] 1.000000000 1.686104e-18 8.430521e-19 [75,] 1.000000000 1.604939e-18 8.024696e-19 [76,] 1.000000000 5.775829e-18 2.887915e-18 [77,] 1.000000000 3.246062e-17 1.623031e-17 [78,] 1.000000000 2.413370e-16 1.206685e-16 [79,] 1.000000000 1.561923e-15 7.809616e-16 [80,] 1.000000000 2.743796e-17 1.371898e-17 [81,] 1.000000000 1.994345e-16 9.971724e-17 [82,] 1.000000000 1.482143e-15 7.410716e-16 [83,] 1.000000000 6.238684e-15 3.119342e-15 [84,] 1.000000000 4.706000e-14 2.353000e-14 [85,] 1.000000000 3.167916e-21 1.583958e-21 [86,] 1.000000000 9.069873e-20 4.534937e-20 [87,] 1.000000000 1.692671e-18 8.463353e-19 [88,] 1.000000000 2.373040e-17 1.186520e-17 [89,] 1.000000000 1.909824e-22 9.549122e-23 [90,] 1.000000000 8.387104e-23 4.193552e-23 [91,] 1.000000000 8.564219e-21 4.282109e-21 [92,] 1.000000000 1.032814e-18 5.164070e-19 [93,] 1.000000000 5.812301e-18 2.906150e-18 [94,] 1.000000000 3.252246e-16 1.626123e-16 [95,] 1.000000000 5.655225e-14 2.827613e-14 [96,] 1.000000000 4.774995e-14 2.387498e-14 [97,] 1.000000000 2.511597e-11 1.255799e-11 [98,] 0.999999992 1.676296e-08 8.381482e-09 > postscript(file="/var/www/rcomp/tmp/1ot2q1292077746.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/rcomp/tmp/2ot2q1292077746.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/rcomp/tmp/3h2jb1292077746.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/rcomp/tmp/4h2jb1292077746.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/rcomp/tmp/5h2jb1292077746.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 = 111 Frequency = 1 1 2 3 4 5 6 274.531775 -150.285458 125.567413 -130.616801 83.690368 -450.493804 7 8 9 10 11 12 -698.380925 -119.014332 -284.867300 -738.509384 -251.990475 -62.866900 13 14 15 16 17 18 -1036.609955 -401.505830 267.710087 -142.663351 8.430137 -252.751581 19 20 21 22 23 24 15.716705 -300.911555 -519.320270 -320.940524 -2092.110819 -188.240890 25 26 27 28 29 30 532.635233 -994.553542 -477.368399 -1048.035651 -1022.658713 -273.292922 31 32 33 34 35 36 215.194493 -342.492637 -126.341938 -557.494067 -680.913696 -535.752694 37 38 39 40 41 42 -89.568224 456.446173 585.390325 199.596497 29.451782 33.527891 43 44 45 46 47 48 543.646092 722.411365 128.474873 -605.919932 505.570251 1191.604182 49 50 51 52 53 54 644.190177 358.504453 560.315820 793.858390 949.334637 1023.831609 55 56 57 58 59 60 1336.704172 33.010072 703.305952 656.457767 221.253275 1346.699274 61 62 63 64 65 66 713.677824 161.178427 341.180731 325.386895 85.587173 -263.086085 67 68 69 70 71 72 -269.988107 429.746939 -353.027067 -173.170112 6.326461 -587.354240 73 74 75 76 77 78 -513.140689 -505.816567 -277.196313 -95.616574 -463.357926 -79.382567 79 80 81 82 83 84 -81.537179 -670.656260 421.882145 -39.884757 -440.743355 214.518854 85 86 87 88 89 90 227.077443 182.205527 -133.833734 -149.592572 -141.460895 -469.272545 91 92 93 94 95 96 -140.559009 -242.011705 -694.257534 -327.356473 -52.350160 -9.544883 97 98 99 100 101 102 93.416239 129.616476 214.881892 272.310330 280.725706 300.344301 103 104 105 106 107 108 348.281536 328.764629 339.773324 350.089976 355.963635 349.897278 109 110 111 349.173043 351.343557 350.258300 > postscript(file="/var/www/rcomp/tmp/6rc0w1292077746.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 = 111 Frequency = 1 lag(myerror, k = 1) myerror 0 274.531775 NA 1 -150.285458 274.531775 2 125.567413 -150.285458 3 -130.616801 125.567413 4 83.690368 -130.616801 5 -450.493804 83.690368 6 -698.380925 -450.493804 7 -119.014332 -698.380925 8 -284.867300 -119.014332 9 -738.509384 -284.867300 10 -251.990475 -738.509384 11 -62.866900 -251.990475 12 -1036.609955 -62.866900 13 -401.505830 -1036.609955 14 267.710087 -401.505830 15 -142.663351 267.710087 16 8.430137 -142.663351 17 -252.751581 8.430137 18 15.716705 -252.751581 19 -300.911555 15.716705 20 -519.320270 -300.911555 21 -320.940524 -519.320270 22 -2092.110819 -320.940524 23 -188.240890 -2092.110819 24 532.635233 -188.240890 25 -994.553542 532.635233 26 -477.368399 -994.553542 27 -1048.035651 -477.368399 28 -1022.658713 -1048.035651 29 -273.292922 -1022.658713 30 215.194493 -273.292922 31 -342.492637 215.194493 32 -126.341938 -342.492637 33 -557.494067 -126.341938 34 -680.913696 -557.494067 35 -535.752694 -680.913696 36 -89.568224 -535.752694 37 456.446173 -89.568224 38 585.390325 456.446173 39 199.596497 585.390325 40 29.451782 199.596497 41 33.527891 29.451782 42 543.646092 33.527891 43 722.411365 543.646092 44 128.474873 722.411365 45 -605.919932 128.474873 46 505.570251 -605.919932 47 1191.604182 505.570251 48 644.190177 1191.604182 49 358.504453 644.190177 50 560.315820 358.504453 51 793.858390 560.315820 52 949.334637 793.858390 53 1023.831609 949.334637 54 1336.704172 1023.831609 55 33.010072 1336.704172 56 703.305952 33.010072 57 656.457767 703.305952 58 221.253275 656.457767 59 1346.699274 221.253275 60 713.677824 1346.699274 61 161.178427 713.677824 62 341.180731 161.178427 63 325.386895 341.180731 64 85.587173 325.386895 65 -263.086085 85.587173 66 -269.988107 -263.086085 67 429.746939 -269.988107 68 -353.027067 429.746939 69 -173.170112 -353.027067 70 6.326461 -173.170112 71 -587.354240 6.326461 72 -513.140689 -587.354240 73 -505.816567 -513.140689 74 -277.196313 -505.816567 75 -95.616574 -277.196313 76 -463.357926 -95.616574 77 -79.382567 -463.357926 78 -81.537179 -79.382567 79 -670.656260 -81.537179 80 421.882145 -670.656260 81 -39.884757 421.882145 82 -440.743355 -39.884757 83 214.518854 -440.743355 84 227.077443 214.518854 85 182.205527 227.077443 86 -133.833734 182.205527 87 -149.592572 -133.833734 88 -141.460895 -149.592572 89 -469.272545 -141.460895 90 -140.559009 -469.272545 91 -242.011705 -140.559009 92 -694.257534 -242.011705 93 -327.356473 -694.257534 94 -52.350160 -327.356473 95 -9.544883 -52.350160 96 93.416239 -9.544883 97 129.616476 93.416239 98 214.881892 129.616476 99 272.310330 214.881892 100 280.725706 272.310330 101 300.344301 280.725706 102 348.281536 300.344301 103 328.764629 348.281536 104 339.773324 328.764629 105 350.089976 339.773324 106 355.963635 350.089976 107 349.897278 355.963635 108 349.173043 349.897278 109 351.343557 349.173043 110 350.258300 351.343557 111 NA 350.258300 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -150.285458 274.531775 [2,] 125.567413 -150.285458 [3,] -130.616801 125.567413 [4,] 83.690368 -130.616801 [5,] -450.493804 83.690368 [6,] -698.380925 -450.493804 [7,] -119.014332 -698.380925 [8,] -284.867300 -119.014332 [9,] -738.509384 -284.867300 [10,] -251.990475 -738.509384 [11,] -62.866900 -251.990475 [12,] -1036.609955 -62.866900 [13,] -401.505830 -1036.609955 [14,] 267.710087 -401.505830 [15,] -142.663351 267.710087 [16,] 8.430137 -142.663351 [17,] -252.751581 8.430137 [18,] 15.716705 -252.751581 [19,] -300.911555 15.716705 [20,] -519.320270 -300.911555 [21,] -320.940524 -519.320270 [22,] -2092.110819 -320.940524 [23,] -188.240890 -2092.110819 [24,] 532.635233 -188.240890 [25,] -994.553542 532.635233 [26,] -477.368399 -994.553542 [27,] -1048.035651 -477.368399 [28,] -1022.658713 -1048.035651 [29,] -273.292922 -1022.658713 [30,] 215.194493 -273.292922 [31,] -342.492637 215.194493 [32,] -126.341938 -342.492637 [33,] -557.494067 -126.341938 [34,] -680.913696 -557.494067 [35,] -535.752694 -680.913696 [36,] -89.568224 -535.752694 [37,] 456.446173 -89.568224 [38,] 585.390325 456.446173 [39,] 199.596497 585.390325 [40,] 29.451782 199.596497 [41,] 33.527891 29.451782 [42,] 543.646092 33.527891 [43,] 722.411365 543.646092 [44,] 128.474873 722.411365 [45,] -605.919932 128.474873 [46,] 505.570251 -605.919932 [47,] 1191.604182 505.570251 [48,] 644.190177 1191.604182 [49,] 358.504453 644.190177 [50,] 560.315820 358.504453 [51,] 793.858390 560.315820 [52,] 949.334637 793.858390 [53,] 1023.831609 949.334637 [54,] 1336.704172 1023.831609 [55,] 33.010072 1336.704172 [56,] 703.305952 33.010072 [57,] 656.457767 703.305952 [58,] 221.253275 656.457767 [59,] 1346.699274 221.253275 [60,] 713.677824 1346.699274 [61,] 161.178427 713.677824 [62,] 341.180731 161.178427 [63,] 325.386895 341.180731 [64,] 85.587173 325.386895 [65,] -263.086085 85.587173 [66,] -269.988107 -263.086085 [67,] 429.746939 -269.988107 [68,] -353.027067 429.746939 [69,] -173.170112 -353.027067 [70,] 6.326461 -173.170112 [71,] -587.354240 6.326461 [72,] -513.140689 -587.354240 [73,] -505.816567 -513.140689 [74,] -277.196313 -505.816567 [75,] -95.616574 -277.196313 [76,] -463.357926 -95.616574 [77,] -79.382567 -463.357926 [78,] -81.537179 -79.382567 [79,] -670.656260 -81.537179 [80,] 421.882145 -670.656260 [81,] -39.884757 421.882145 [82,] -440.743355 -39.884757 [83,] 214.518854 -440.743355 [84,] 227.077443 214.518854 [85,] 182.205527 227.077443 [86,] -133.833734 182.205527 [87,] -149.592572 -133.833734 [88,] -141.460895 -149.592572 [89,] -469.272545 -141.460895 [90,] -140.559009 -469.272545 [91,] -242.011705 -140.559009 [92,] -694.257534 -242.011705 [93,] -327.356473 -694.257534 [94,] -52.350160 -327.356473 [95,] -9.544883 -52.350160 [96,] 93.416239 -9.544883 [97,] 129.616476 93.416239 [98,] 214.881892 129.616476 [99,] 272.310330 214.881892 [100,] 280.725706 272.310330 [101,] 300.344301 280.725706 [102,] 348.281536 300.344301 [103,] 328.764629 348.281536 [104,] 339.773324 328.764629 [105,] 350.089976 339.773324 [106,] 355.963635 350.089976 [107,] 349.897278 355.963635 [108,] 349.173043 349.897278 [109,] 351.343557 349.173043 [110,] 350.258300 351.343557 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -150.285458 274.531775 2 125.567413 -150.285458 3 -130.616801 125.567413 4 83.690368 -130.616801 5 -450.493804 83.690368 6 -698.380925 -450.493804 7 -119.014332 -698.380925 8 -284.867300 -119.014332 9 -738.509384 -284.867300 10 -251.990475 -738.509384 11 -62.866900 -251.990475 12 -1036.609955 -62.866900 13 -401.505830 -1036.609955 14 267.710087 -401.505830 15 -142.663351 267.710087 16 8.430137 -142.663351 17 -252.751581 8.430137 18 15.716705 -252.751581 19 -300.911555 15.716705 20 -519.320270 -300.911555 21 -320.940524 -519.320270 22 -2092.110819 -320.940524 23 -188.240890 -2092.110819 24 532.635233 -188.240890 25 -994.553542 532.635233 26 -477.368399 -994.553542 27 -1048.035651 -477.368399 28 -1022.658713 -1048.035651 29 -273.292922 -1022.658713 30 215.194493 -273.292922 31 -342.492637 215.194493 32 -126.341938 -342.492637 33 -557.494067 -126.341938 34 -680.913696 -557.494067 35 -535.752694 -680.913696 36 -89.568224 -535.752694 37 456.446173 -89.568224 38 585.390325 456.446173 39 199.596497 585.390325 40 29.451782 199.596497 41 33.527891 29.451782 42 543.646092 33.527891 43 722.411365 543.646092 44 128.474873 722.411365 45 -605.919932 128.474873 46 505.570251 -605.919932 47 1191.604182 505.570251 48 644.190177 1191.604182 49 358.504453 644.190177 50 560.315820 358.504453 51 793.858390 560.315820 52 949.334637 793.858390 53 1023.831609 949.334637 54 1336.704172 1023.831609 55 33.010072 1336.704172 56 703.305952 33.010072 57 656.457767 703.305952 58 221.253275 656.457767 59 1346.699274 221.253275 60 713.677824 1346.699274 61 161.178427 713.677824 62 341.180731 161.178427 63 325.386895 341.180731 64 85.587173 325.386895 65 -263.086085 85.587173 66 -269.988107 -263.086085 67 429.746939 -269.988107 68 -353.027067 429.746939 69 -173.170112 -353.027067 70 6.326461 -173.170112 71 -587.354240 6.326461 72 -513.140689 -587.354240 73 -505.816567 -513.140689 74 -277.196313 -505.816567 75 -95.616574 -277.196313 76 -463.357926 -95.616574 77 -79.382567 -463.357926 78 -81.537179 -79.382567 79 -670.656260 -81.537179 80 421.882145 -670.656260 81 -39.884757 421.882145 82 -440.743355 -39.884757 83 214.518854 -440.743355 84 227.077443 214.518854 85 182.205527 227.077443 86 -133.833734 182.205527 87 -149.592572 -133.833734 88 -141.460895 -149.592572 89 -469.272545 -141.460895 90 -140.559009 -469.272545 91 -242.011705 -140.559009 92 -694.257534 -242.011705 93 -327.356473 -694.257534 94 -52.350160 -327.356473 95 -9.544883 -52.350160 96 93.416239 -9.544883 97 129.616476 93.416239 98 214.881892 129.616476 99 272.310330 214.881892 100 280.725706 272.310330 101 300.344301 280.725706 102 348.281536 300.344301 103 328.764629 348.281536 104 339.773324 328.764629 105 350.089976 339.773324 106 355.963635 350.089976 107 349.897278 355.963635 108 349.173043 349.897278 109 351.343557 349.173043 110 350.258300 351.343557 > 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/rcomp/tmp/7k3hy1292077746.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/rcomp/tmp/8k3hy1292077746.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/rcomp/tmp/9k3hy1292077746.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/rcomp/tmp/10dczk1292077746.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/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/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/rcomp/tmp/11ydfp1292077746.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/rcomp/tmp/12c5y81292077747.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/rcomp/tmp/13qxwh1292077747.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/rcomp/tmp/141ov21292077747.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/rcomp/tmp/15m7cq1292077747.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/rcomp/tmp/160y9g1292077747.tab") + } > > try(system("convert tmp/1ot2q1292077746.ps tmp/1ot2q1292077746.png",intern=TRUE)) character(0) > try(system("convert tmp/2ot2q1292077746.ps tmp/2ot2q1292077746.png",intern=TRUE)) character(0) > try(system("convert tmp/3h2jb1292077746.ps tmp/3h2jb1292077746.png",intern=TRUE)) character(0) > try(system("convert tmp/4h2jb1292077746.ps tmp/4h2jb1292077746.png",intern=TRUE)) character(0) > try(system("convert tmp/5h2jb1292077746.ps tmp/5h2jb1292077746.png",intern=TRUE)) character(0) > try(system("convert tmp/6rc0w1292077746.ps tmp/6rc0w1292077746.png",intern=TRUE)) character(0) > try(system("convert tmp/7k3hy1292077746.ps tmp/7k3hy1292077746.png",intern=TRUE)) character(0) > try(system("convert tmp/8k3hy1292077746.ps tmp/8k3hy1292077746.png",intern=TRUE)) character(0) > try(system("convert tmp/9k3hy1292077746.ps tmp/9k3hy1292077746.png",intern=TRUE)) character(0) > try(system("convert tmp/10dczk1292077746.ps tmp/10dczk1292077746.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 3.780 1.180 5.287