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(101.5 + ,467 + ,99.2 + ,460 + ,107.8 + ,448 + ,92.3 + ,443 + ,99.2 + ,436 + ,101.6 + ,431 + ,87 + ,484 + ,71.4 + ,510 + ,104.7 + ,513 + ,115.1 + ,503 + ,102.5 + ,471 + ,75.3 + ,471 + ,96.7 + ,476 + ,94.6 + ,475 + ,98.6 + ,470 + ,99.5 + ,461 + ,92 + ,455 + ,93.6 + ,456 + ,89.3 + ,517 + ,66.9 + ,525 + ,108.8 + ,523 + ,113.2 + ,519 + ,105.5 + ,509 + ,77.8 + ,512 + ,102.1 + ,519 + ,97 + ,517 + ,95.5 + ,510 + ,99.3 + ,509 + ,86.4 + ,501 + ,92.4 + ,507 + ,85.7 + ,569 + ,61.9 + ,580 + ,104.9 + ,578 + ,107.9 + ,565 + ,95.6 + ,547 + ,79.8 + ,555 + ,94.8 + ,562 + ,93.7 + ,561 + ,108.1 + ,555 + ,96.9 + ,544 + ,88.8 + ,537 + ,106.7 + ,543 + ,86.8 + ,594 + ,69.8 + ,611 + ,110.9 + ,613 + ,105.4 + ,611 + ,99.2 + ,594 + ,84.4 + ,595 + ,87.2 + ,591 + ,91.9 + ,589 + ,97.9 + ,584 + ,94.5 + ,573 + ,85 + ,567 + ,100.3 + ,569 + ,78.7 + ,621 + ,65.8 + ,629 + ,104.8 + ,628 + ,96 + ,612 + ,103.3 + ,595 + ,82.9 + ,597 + ,91.4 + ,593 + ,94.5 + ,590 + ,109.3 + ,580 + ,92.1 + ,574 + ,99.3 + ,573 + ,109.6 + ,573 + ,87.5 + ,620 + ,73.1 + ,626 + ,110.7 + ,620 + ,111.6 + ,588 + ,110.7 + ,566 + ,84 + ,557 + ,101.6 + ,561 + ,102.1 + ,549 + ,113.9 + ,532 + ,99 + ,526 + ,100.4 + ,511 + ,109.5 + ,499 + ,93.1 + ,555 + ,77 + ,565 + ,108 + ,542 + ,119.9 + ,527 + ,105.9 + ,510 + ,78.2 + ,514 + ,100.3 + ,517 + ,102.2 + ,508 + ,97 + ,493 + ,101.3 + ,490 + ,89.2 + ,469 + ,93.3 + ,478 + ,88.5 + ,528 + ,61.5 + ,534 + ,96.3 + ,518 + ,95.4 + ,506 + ,79.9 + ,502 + ,66.7 + ,516 + ,71.2 + ,528 + ,73.1 + ,533 + ,81 + ,536 + ,77.2 + ,537 + ,67.7 + ,524 + ,76.7 + ,536 + ,73.3 + ,587 + ,54.1 + ,597 + ,85 + ,581 + ,85.9 + ,564 + ,79.3 + ,558 + ,67.2 + ,575 + ,72.4 + ,580 + ,76.1 + ,575 + ,89.8 + ,563 + ,84 + ,552 + ,75.4 + ,537 + ,90 + ,545 + ,76.8 + ,601 + ,59.6 + ,604 + ,92.1 + ,586 + ,88.4 + ,564 + ,82.8 + ,549 + ,69.4 + ,551 + ,73.4 + ,556) + ,dim=c(2 + ,121) + ,dimnames=list(c('Textiel' + ,'werkloosheid') + ,1:121)) > y <- array(NA,dim=c(2,121),dimnames=list(c('Textiel','werkloosheid'),1:121)) > 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 Textiel werkloosheid 1 101.5 467 2 99.2 460 3 107.8 448 4 92.3 443 5 99.2 436 6 101.6 431 7 87.0 484 8 71.4 510 9 104.7 513 10 115.1 503 11 102.5 471 12 75.3 471 13 96.7 476 14 94.6 475 15 98.6 470 16 99.5 461 17 92.0 455 18 93.6 456 19 89.3 517 20 66.9 525 21 108.8 523 22 113.2 519 23 105.5 509 24 77.8 512 25 102.1 519 26 97.0 517 27 95.5 510 28 99.3 509 29 86.4 501 30 92.4 507 31 85.7 569 32 61.9 580 33 104.9 578 34 107.9 565 35 95.6 547 36 79.8 555 37 94.8 562 38 93.7 561 39 108.1 555 40 96.9 544 41 88.8 537 42 106.7 543 43 86.8 594 44 69.8 611 45 110.9 613 46 105.4 611 47 99.2 594 48 84.4 595 49 87.2 591 50 91.9 589 51 97.9 584 52 94.5 573 53 85.0 567 54 100.3 569 55 78.7 621 56 65.8 629 57 104.8 628 58 96.0 612 59 103.3 595 60 82.9 597 61 91.4 593 62 94.5 590 63 109.3 580 64 92.1 574 65 99.3 573 66 109.6 573 67 87.5 620 68 73.1 626 69 110.7 620 70 111.6 588 71 110.7 566 72 84.0 557 73 101.6 561 74 102.1 549 75 113.9 532 76 99.0 526 77 100.4 511 78 109.5 499 79 93.1 555 80 77.0 565 81 108.0 542 82 119.9 527 83 105.9 510 84 78.2 514 85 100.3 517 86 102.2 508 87 97.0 493 88 101.3 490 89 89.2 469 90 93.3 478 91 88.5 528 92 61.5 534 93 96.3 518 94 95.4 506 95 79.9 502 96 66.7 516 97 71.2 528 98 73.1 533 99 81.0 536 100 77.2 537 101 67.7 524 102 76.7 536 103 73.3 587 104 54.1 597 105 85.0 581 106 85.9 564 107 79.3 558 108 67.2 575 109 72.4 580 110 76.1 575 111 89.8 563 112 84.0 552 113 75.4 537 114 90.0 545 115 76.8 601 116 59.6 604 117 92.1 586 118 88.4 564 119 82.8 549 120 69.4 551 121 73.4 556 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) werkloosheid 124.08610 -0.06101 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -33.562 -10.384 1.715 9.445 27.967 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 124.08610 14.51219 8.550 4.91e-14 *** werkloosheid -0.06101 0.02667 -2.288 0.0239 * --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 13.76 on 119 degrees of freedom Multiple R-squared: 0.04213, Adjusted R-squared: 0.03408 F-statistic: 5.233 on 1 and 119 DF, p-value: 0.02392 > 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.10273642 0.20547283 0.89726358 [2,] 0.04061215 0.08122430 0.95938785 [3,] 0.04292083 0.08584165 0.95707917 [4,] 0.04860007 0.09720015 0.95139993 [5,] 0.21902186 0.43804371 0.78097814 [6,] 0.41522666 0.83045333 0.58477334 [7,] 0.32629132 0.65258263 0.67370868 [8,] 0.48149905 0.96299811 0.51850095 [9,] 0.38790357 0.77580714 0.61209643 [10,] 0.30344351 0.60688702 0.69655649 [11,] 0.23166625 0.46333251 0.76833375 [12,] 0.17221050 0.34442101 0.82778950 [13,] 0.13117889 0.26235778 0.86882111 [14,] 0.09426996 0.18853991 0.90573004 [15,] 0.06607238 0.13214477 0.93392762 [16,] 0.13662645 0.27325290 0.86337355 [17,] 0.20371653 0.40743307 0.79628347 [18,] 0.28920881 0.57841762 0.71079119 [19,] 0.27041331 0.54082662 0.72958669 [20,] 0.29731621 0.59463242 0.70268379 [21,] 0.26411718 0.52823436 0.73588282 [22,] 0.21473234 0.42946468 0.78526766 [23,] 0.16972588 0.33945176 0.83027412 [24,] 0.13634983 0.27269967 0.86365017 [25,] 0.11620221 0.23240443 0.88379779 [26,] 0.08816272 0.17632543 0.91183728 [27,] 0.06832824 0.13665648 0.93167176 [28,] 0.14130691 0.28261381 0.85869309 [29,] 0.17722732 0.35445464 0.82277268 [30,] 0.21250609 0.42501217 0.78749391 [31,] 0.17508641 0.35017282 0.82491359 [32,] 0.16322451 0.32644902 0.83677549 [33,] 0.13304620 0.26609240 0.86695380 [34,] 0.10553945 0.21107889 0.89446055 [35,] 0.12210849 0.24421698 0.87789151 [36,] 0.09854787 0.19709575 0.90145213 [37,] 0.07770926 0.15541853 0.92229074 [38,] 0.08156964 0.16313927 0.91843036 [39,] 0.06366351 0.12732703 0.93633649 [40,] 0.08227499 0.16454998 0.91772501 [41,] 0.12867282 0.25734565 0.87132718 [42,] 0.14036833 0.28073667 0.85963167 [43,] 0.12363625 0.24727250 0.87636375 [44,] 0.10420124 0.20840249 0.89579876 [45,] 0.08360943 0.16721885 0.91639057 [46,] 0.06537477 0.13074953 0.93462523 [47,] 0.05454117 0.10908235 0.94545883 [48,] 0.04234613 0.08469225 0.95765387 [49,] 0.03412562 0.06825123 0.96587438 [50,] 0.02939580 0.05879161 0.97060420 [51,] 0.02622774 0.05245547 0.97377226 [52,] 0.04329619 0.08659238 0.95670381 [53,] 0.05242612 0.10485224 0.94757388 [54,] 0.04412205 0.08824411 0.95587795 [55,] 0.04637281 0.09274562 0.95362719 [56,] 0.03757355 0.07514710 0.96242645 [57,] 0.02875427 0.05750853 0.97124573 [58,] 0.02272463 0.04544926 0.97727537 [59,] 0.03355170 0.06710340 0.96644830 [60,] 0.02572383 0.05144766 0.97427617 [61,] 0.02285588 0.04571176 0.97714412 [62,] 0.03505053 0.07010107 0.96494947 [63,] 0.02821091 0.05642183 0.97178909 [64,] 0.02853319 0.05706639 0.97146681 [65,] 0.07126648 0.14253297 0.92873352 [66,] 0.15135378 0.30270755 0.84864622 [67,] 0.24865331 0.49730662 0.75134669 [68,] 0.22001054 0.44002108 0.77998946 [69,] 0.24423248 0.48846496 0.75576752 [70,] 0.26242734 0.52485468 0.73757266 [71,] 0.39519858 0.79039716 0.60480142 [72,] 0.37280007 0.74560014 0.62719993 [73,] 0.34520797 0.69041595 0.65479203 [74,] 0.37850291 0.75700583 0.62149709 [75,] 0.36215892 0.72431784 0.63784108 [76,] 0.34767861 0.69535723 0.65232139 [77,] 0.46669696 0.93339391 0.53330304 [78,] 0.79502725 0.40994550 0.20497275 [79,] 0.84059344 0.31881312 0.15940656 [80,] 0.83966134 0.32067732 0.16033866 [81,] 0.85247594 0.29504812 0.14752406 [82,] 0.87429734 0.25140532 0.12570266 [83,] 0.86087255 0.27825491 0.13912745 [84,] 0.87533609 0.24932783 0.12466391 [85,] 0.84598317 0.30803367 0.15401683 [86,] 0.82205739 0.35588523 0.17794261 [87,] 0.80371945 0.39256110 0.19628055 [88,] 0.90367300 0.19265400 0.09632700 [89,] 0.92043325 0.15913351 0.07956675 [90,] 0.93767979 0.12464041 0.06232021 [91,] 0.92211736 0.15576529 0.07788264 [92,] 0.94439959 0.11120081 0.05560041 [93,] 0.94593576 0.10812848 0.05406424 [94,] 0.94138899 0.11722203 0.05861101 [95,] 0.92056361 0.15887277 0.07943639 [96,] 0.89906273 0.20187455 0.10093727 [97,] 0.93916102 0.12167796 0.06083898 [98,] 0.93009024 0.13981951 0.06990976 [99,] 0.90601539 0.18796923 0.09398461 [100,] 0.96613022 0.06773956 0.03386978 [101,] 0.95715476 0.08569047 0.04284524 [102,] 0.94217191 0.11565619 0.05782809 [103,] 0.91174126 0.17651748 0.08825874 [104,] 0.91141717 0.17716567 0.08858283 [105,] 0.87893708 0.24212584 0.12106292 [106,] 0.82405318 0.35189364 0.17594682 [107,] 0.79720871 0.40558258 0.20279129 [108,] 0.71294773 0.57410454 0.28705227 [109,] 0.64755272 0.70489457 0.35244728 [110,] 0.56528154 0.86943691 0.43471846 [111,] 0.42866601 0.85733201 0.57133399 [112,] 0.83131165 0.33737670 0.16868835 > postscript(file="/var/fisher/rcomp/tmp/1zpyq1353236351.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > plot(x[,1], type='l', main='Actuals and Interpolation', ylab='value of Actuals and Interpolation (dots)', xlab='time or index') > points(x[,1]-mysum$resid) > grid() > dev.off() null device 1 > postscript(file="/var/fisher/rcomp/tmp/249ol1353236351.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > plot(mysum$resid, type='b', pch=19, main='Residuals', ylab='value of Residuals', xlab='time or index') > grid() > dev.off() null device 1 > postscript(file="/var/fisher/rcomp/tmp/35g9d1353236351.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > hist(mysum$resid, main='Residual Histogram', xlab='values of Residuals') > grid() > dev.off() null device 1 > postscript(file="/var/fisher/rcomp/tmp/4k1s71353236351.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > densityplot(~mysum$resid,col='black',main='Residual Density Plot', xlab='values of Residuals') > dev.off() null device 1 > postscript(file="/var/fisher/rcomp/tmp/5rh0s1353236351.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 = 121 Frequency = 1 1 2 3 4 5 6 5.90632549 3.17924415 11.04710471 -4.75795339 1.71496526 3.80990716 7 8 9 10 11 12 -7.55647697 -21.57017484 11.91286002 21.70274382 7.15037197 -20.04962803 13 14 15 16 17 18 1.65543007 -0.50558155 3.18936035 3.54025577 -4.32581395 -2.66480233 19 20 21 22 23 24 -3.24309350 -25.15500054 16.62297622 20.77892974 12.46881354 -15.04815160 25 26 27 28 29 30 9.67892974 4.45690650 2.52982516 6.26881354 -7.11927942 -0.75320970 31 32 33 34 35 36 -3.67048925 -26.79936143 16.07861533 18.28546427 4.88725510 -10.42465194 37 38 39 40 41 42 5.00242941 3.84141779 17.87534806 6.00422024 -2.52286110 15.74320862 43 44 45 46 47 48 -1.04519875 -17.00800121 24.21402203 18.59199879 11.35480125 -3.38418713 49 50 51 52 53 54 -0.82823361 3.74974315 9.44468505 5.37355723 -4.49251249 10.92951075 55 56 57 58 59 60 -7.49788500 -19.90979204 19.02919634 9.25301041 15.51581287 -4.76216389 61 62 63 64 65 66 3.49378963 6.41075477 20.60063857 3.03456885 10.17355723 20.47355723 67 68 69 70 71 72 1.24110338 -12.79282690 24.44110338 23.38873153 21.14647589 -6.10262869 73 74 75 76 77 78 11.74141779 11.50927834 22.27208080 7.00601108 7.49083678 15.85869734 79 80 81 82 83 84 2.87534806 -12.61453573 16.98219700 27.96702270 12.92982516 -14.52612836 85 86 87 88 89 90 7.75690650 9.10780192 2.99262761 7.10959275 -6.27165127 -1.62254669 91 92 93 94 95 96 -3.37196568 -30.00589596 3.81791812 2.18577868 -13.55826780 -25.90410512 97 98 99 100 101 102 -20.67196568 -18.46690758 -10.38387272 -14.12286110 -24.41601216 -14.68387272 103 104 105 106 107 108 -14.97228009 -33.56216389 -3.63834981 -3.77554735 -10.74161707 -21.80441953 109 110 111 112 113 114 -16.29936143 -12.90441953 0.06344103 -6.40768680 -15.92286110 -0.83476814 115 116 117 118 119 120 -10.61811741 -27.63508255 3.76670829 -1.27554735 -7.79072166 -21.06869842 121 -16.76364032 > postscript(file="/var/fisher/rcomp/tmp/6x5c31353236351.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 = 121 Frequency = 1 lag(myerror, k = 1) myerror 0 5.90632549 NA 1 3.17924415 5.90632549 2 11.04710471 3.17924415 3 -4.75795339 11.04710471 4 1.71496526 -4.75795339 5 3.80990716 1.71496526 6 -7.55647697 3.80990716 7 -21.57017484 -7.55647697 8 11.91286002 -21.57017484 9 21.70274382 11.91286002 10 7.15037197 21.70274382 11 -20.04962803 7.15037197 12 1.65543007 -20.04962803 13 -0.50558155 1.65543007 14 3.18936035 -0.50558155 15 3.54025577 3.18936035 16 -4.32581395 3.54025577 17 -2.66480233 -4.32581395 18 -3.24309350 -2.66480233 19 -25.15500054 -3.24309350 20 16.62297622 -25.15500054 21 20.77892974 16.62297622 22 12.46881354 20.77892974 23 -15.04815160 12.46881354 24 9.67892974 -15.04815160 25 4.45690650 9.67892974 26 2.52982516 4.45690650 27 6.26881354 2.52982516 28 -7.11927942 6.26881354 29 -0.75320970 -7.11927942 30 -3.67048925 -0.75320970 31 -26.79936143 -3.67048925 32 16.07861533 -26.79936143 33 18.28546427 16.07861533 34 4.88725510 18.28546427 35 -10.42465194 4.88725510 36 5.00242941 -10.42465194 37 3.84141779 5.00242941 38 17.87534806 3.84141779 39 6.00422024 17.87534806 40 -2.52286110 6.00422024 41 15.74320862 -2.52286110 42 -1.04519875 15.74320862 43 -17.00800121 -1.04519875 44 24.21402203 -17.00800121 45 18.59199879 24.21402203 46 11.35480125 18.59199879 47 -3.38418713 11.35480125 48 -0.82823361 -3.38418713 49 3.74974315 -0.82823361 50 9.44468505 3.74974315 51 5.37355723 9.44468505 52 -4.49251249 5.37355723 53 10.92951075 -4.49251249 54 -7.49788500 10.92951075 55 -19.90979204 -7.49788500 56 19.02919634 -19.90979204 57 9.25301041 19.02919634 58 15.51581287 9.25301041 59 -4.76216389 15.51581287 60 3.49378963 -4.76216389 61 6.41075477 3.49378963 62 20.60063857 6.41075477 63 3.03456885 20.60063857 64 10.17355723 3.03456885 65 20.47355723 10.17355723 66 1.24110338 20.47355723 67 -12.79282690 1.24110338 68 24.44110338 -12.79282690 69 23.38873153 24.44110338 70 21.14647589 23.38873153 71 -6.10262869 21.14647589 72 11.74141779 -6.10262869 73 11.50927834 11.74141779 74 22.27208080 11.50927834 75 7.00601108 22.27208080 76 7.49083678 7.00601108 77 15.85869734 7.49083678 78 2.87534806 15.85869734 79 -12.61453573 2.87534806 80 16.98219700 -12.61453573 81 27.96702270 16.98219700 82 12.92982516 27.96702270 83 -14.52612836 12.92982516 84 7.75690650 -14.52612836 85 9.10780192 7.75690650 86 2.99262761 9.10780192 87 7.10959275 2.99262761 88 -6.27165127 7.10959275 89 -1.62254669 -6.27165127 90 -3.37196568 -1.62254669 91 -30.00589596 -3.37196568 92 3.81791812 -30.00589596 93 2.18577868 3.81791812 94 -13.55826780 2.18577868 95 -25.90410512 -13.55826780 96 -20.67196568 -25.90410512 97 -18.46690758 -20.67196568 98 -10.38387272 -18.46690758 99 -14.12286110 -10.38387272 100 -24.41601216 -14.12286110 101 -14.68387272 -24.41601216 102 -14.97228009 -14.68387272 103 -33.56216389 -14.97228009 104 -3.63834981 -33.56216389 105 -3.77554735 -3.63834981 106 -10.74161707 -3.77554735 107 -21.80441953 -10.74161707 108 -16.29936143 -21.80441953 109 -12.90441953 -16.29936143 110 0.06344103 -12.90441953 111 -6.40768680 0.06344103 112 -15.92286110 -6.40768680 113 -0.83476814 -15.92286110 114 -10.61811741 -0.83476814 115 -27.63508255 -10.61811741 116 3.76670829 -27.63508255 117 -1.27554735 3.76670829 118 -7.79072166 -1.27554735 119 -21.06869842 -7.79072166 120 -16.76364032 -21.06869842 121 NA -16.76364032 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] 3.17924415 5.90632549 [2,] 11.04710471 3.17924415 [3,] -4.75795339 11.04710471 [4,] 1.71496526 -4.75795339 [5,] 3.80990716 1.71496526 [6,] -7.55647697 3.80990716 [7,] -21.57017484 -7.55647697 [8,] 11.91286002 -21.57017484 [9,] 21.70274382 11.91286002 [10,] 7.15037197 21.70274382 [11,] -20.04962803 7.15037197 [12,] 1.65543007 -20.04962803 [13,] -0.50558155 1.65543007 [14,] 3.18936035 -0.50558155 [15,] 3.54025577 3.18936035 [16,] -4.32581395 3.54025577 [17,] -2.66480233 -4.32581395 [18,] -3.24309350 -2.66480233 [19,] -25.15500054 -3.24309350 [20,] 16.62297622 -25.15500054 [21,] 20.77892974 16.62297622 [22,] 12.46881354 20.77892974 [23,] -15.04815160 12.46881354 [24,] 9.67892974 -15.04815160 [25,] 4.45690650 9.67892974 [26,] 2.52982516 4.45690650 [27,] 6.26881354 2.52982516 [28,] -7.11927942 6.26881354 [29,] -0.75320970 -7.11927942 [30,] -3.67048925 -0.75320970 [31,] -26.79936143 -3.67048925 [32,] 16.07861533 -26.79936143 [33,] 18.28546427 16.07861533 [34,] 4.88725510 18.28546427 [35,] -10.42465194 4.88725510 [36,] 5.00242941 -10.42465194 [37,] 3.84141779 5.00242941 [38,] 17.87534806 3.84141779 [39,] 6.00422024 17.87534806 [40,] -2.52286110 6.00422024 [41,] 15.74320862 -2.52286110 [42,] -1.04519875 15.74320862 [43,] -17.00800121 -1.04519875 [44,] 24.21402203 -17.00800121 [45,] 18.59199879 24.21402203 [46,] 11.35480125 18.59199879 [47,] -3.38418713 11.35480125 [48,] -0.82823361 -3.38418713 [49,] 3.74974315 -0.82823361 [50,] 9.44468505 3.74974315 [51,] 5.37355723 9.44468505 [52,] -4.49251249 5.37355723 [53,] 10.92951075 -4.49251249 [54,] -7.49788500 10.92951075 [55,] -19.90979204 -7.49788500 [56,] 19.02919634 -19.90979204 [57,] 9.25301041 19.02919634 [58,] 15.51581287 9.25301041 [59,] -4.76216389 15.51581287 [60,] 3.49378963 -4.76216389 [61,] 6.41075477 3.49378963 [62,] 20.60063857 6.41075477 [63,] 3.03456885 20.60063857 [64,] 10.17355723 3.03456885 [65,] 20.47355723 10.17355723 [66,] 1.24110338 20.47355723 [67,] -12.79282690 1.24110338 [68,] 24.44110338 -12.79282690 [69,] 23.38873153 24.44110338 [70,] 21.14647589 23.38873153 [71,] -6.10262869 21.14647589 [72,] 11.74141779 -6.10262869 [73,] 11.50927834 11.74141779 [74,] 22.27208080 11.50927834 [75,] 7.00601108 22.27208080 [76,] 7.49083678 7.00601108 [77,] 15.85869734 7.49083678 [78,] 2.87534806 15.85869734 [79,] -12.61453573 2.87534806 [80,] 16.98219700 -12.61453573 [81,] 27.96702270 16.98219700 [82,] 12.92982516 27.96702270 [83,] -14.52612836 12.92982516 [84,] 7.75690650 -14.52612836 [85,] 9.10780192 7.75690650 [86,] 2.99262761 9.10780192 [87,] 7.10959275 2.99262761 [88,] -6.27165127 7.10959275 [89,] -1.62254669 -6.27165127 [90,] -3.37196568 -1.62254669 [91,] -30.00589596 -3.37196568 [92,] 3.81791812 -30.00589596 [93,] 2.18577868 3.81791812 [94,] -13.55826780 2.18577868 [95,] -25.90410512 -13.55826780 [96,] -20.67196568 -25.90410512 [97,] -18.46690758 -20.67196568 [98,] -10.38387272 -18.46690758 [99,] -14.12286110 -10.38387272 [100,] -24.41601216 -14.12286110 [101,] -14.68387272 -24.41601216 [102,] -14.97228009 -14.68387272 [103,] -33.56216389 -14.97228009 [104,] -3.63834981 -33.56216389 [105,] -3.77554735 -3.63834981 [106,] -10.74161707 -3.77554735 [107,] -21.80441953 -10.74161707 [108,] -16.29936143 -21.80441953 [109,] -12.90441953 -16.29936143 [110,] 0.06344103 -12.90441953 [111,] -6.40768680 0.06344103 [112,] -15.92286110 -6.40768680 [113,] -0.83476814 -15.92286110 [114,] -10.61811741 -0.83476814 [115,] -27.63508255 -10.61811741 [116,] 3.76670829 -27.63508255 [117,] -1.27554735 3.76670829 [118,] -7.79072166 -1.27554735 [119,] -21.06869842 -7.79072166 [120,] -16.76364032 -21.06869842 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 3.17924415 5.90632549 2 11.04710471 3.17924415 3 -4.75795339 11.04710471 4 1.71496526 -4.75795339 5 3.80990716 1.71496526 6 -7.55647697 3.80990716 7 -21.57017484 -7.55647697 8 11.91286002 -21.57017484 9 21.70274382 11.91286002 10 7.15037197 21.70274382 11 -20.04962803 7.15037197 12 1.65543007 -20.04962803 13 -0.50558155 1.65543007 14 3.18936035 -0.50558155 15 3.54025577 3.18936035 16 -4.32581395 3.54025577 17 -2.66480233 -4.32581395 18 -3.24309350 -2.66480233 19 -25.15500054 -3.24309350 20 16.62297622 -25.15500054 21 20.77892974 16.62297622 22 12.46881354 20.77892974 23 -15.04815160 12.46881354 24 9.67892974 -15.04815160 25 4.45690650 9.67892974 26 2.52982516 4.45690650 27 6.26881354 2.52982516 28 -7.11927942 6.26881354 29 -0.75320970 -7.11927942 30 -3.67048925 -0.75320970 31 -26.79936143 -3.67048925 32 16.07861533 -26.79936143 33 18.28546427 16.07861533 34 4.88725510 18.28546427 35 -10.42465194 4.88725510 36 5.00242941 -10.42465194 37 3.84141779 5.00242941 38 17.87534806 3.84141779 39 6.00422024 17.87534806 40 -2.52286110 6.00422024 41 15.74320862 -2.52286110 42 -1.04519875 15.74320862 43 -17.00800121 -1.04519875 44 24.21402203 -17.00800121 45 18.59199879 24.21402203 46 11.35480125 18.59199879 47 -3.38418713 11.35480125 48 -0.82823361 -3.38418713 49 3.74974315 -0.82823361 50 9.44468505 3.74974315 51 5.37355723 9.44468505 52 -4.49251249 5.37355723 53 10.92951075 -4.49251249 54 -7.49788500 10.92951075 55 -19.90979204 -7.49788500 56 19.02919634 -19.90979204 57 9.25301041 19.02919634 58 15.51581287 9.25301041 59 -4.76216389 15.51581287 60 3.49378963 -4.76216389 61 6.41075477 3.49378963 62 20.60063857 6.41075477 63 3.03456885 20.60063857 64 10.17355723 3.03456885 65 20.47355723 10.17355723 66 1.24110338 20.47355723 67 -12.79282690 1.24110338 68 24.44110338 -12.79282690 69 23.38873153 24.44110338 70 21.14647589 23.38873153 71 -6.10262869 21.14647589 72 11.74141779 -6.10262869 73 11.50927834 11.74141779 74 22.27208080 11.50927834 75 7.00601108 22.27208080 76 7.49083678 7.00601108 77 15.85869734 7.49083678 78 2.87534806 15.85869734 79 -12.61453573 2.87534806 80 16.98219700 -12.61453573 81 27.96702270 16.98219700 82 12.92982516 27.96702270 83 -14.52612836 12.92982516 84 7.75690650 -14.52612836 85 9.10780192 7.75690650 86 2.99262761 9.10780192 87 7.10959275 2.99262761 88 -6.27165127 7.10959275 89 -1.62254669 -6.27165127 90 -3.37196568 -1.62254669 91 -30.00589596 -3.37196568 92 3.81791812 -30.00589596 93 2.18577868 3.81791812 94 -13.55826780 2.18577868 95 -25.90410512 -13.55826780 96 -20.67196568 -25.90410512 97 -18.46690758 -20.67196568 98 -10.38387272 -18.46690758 99 -14.12286110 -10.38387272 100 -24.41601216 -14.12286110 101 -14.68387272 -24.41601216 102 -14.97228009 -14.68387272 103 -33.56216389 -14.97228009 104 -3.63834981 -33.56216389 105 -3.77554735 -3.63834981 106 -10.74161707 -3.77554735 107 -21.80441953 -10.74161707 108 -16.29936143 -21.80441953 109 -12.90441953 -16.29936143 110 0.06344103 -12.90441953 111 -6.40768680 0.06344103 112 -15.92286110 -6.40768680 113 -0.83476814 -15.92286110 114 -10.61811741 -0.83476814 115 -27.63508255 -10.61811741 116 3.76670829 -27.63508255 117 -1.27554735 3.76670829 118 -7.79072166 -1.27554735 119 -21.06869842 -7.79072166 120 -16.76364032 -21.06869842 > plot(z,main=paste('Residual Lag plot, lowess, and regression line'), ylab='values of Residuals', xlab='lagged values of Residuals') > lines(lowess(z)) > abline(lm(z)) > grid() > dev.off() null device 1 > postscript(file="/var/fisher/rcomp/tmp/7ujwv1353236352.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > acf(mysum$resid, lag.max=length(mysum$resid)/2, main='Residual Autocorrelation Function') > grid() > dev.off() null device 1 > postscript(file="/var/fisher/rcomp/tmp/8h8wa1353236352.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > pacf(mysum$resid, lag.max=length(mysum$resid)/2, main='Residual Partial Autocorrelation Function') > grid() > dev.off() null device 1 > postscript(file="/var/fisher/rcomp/tmp/905w91353236352.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > opar <- par(mfrow = c(2,2), oma = c(0, 0, 1.1, 0)) > plot(mylm, las = 1, sub='Residual Diagnostics') > par(opar) > dev.off() null device 1 > if (n > n25) { + postscript(file="/var/fisher/rcomp/tmp/103siq1353236352.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) + plot(kp3:nmkm3,gqarr[,2], main='Goldfeld-Quandt test',ylab='2-sided p-value',xlab='breakpoint') + grid() + dev.off() + } null device 1 > > #Note: the /var/fisher/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/fisher/rcomp/createtable") > > a<-table.start() > a<-table.row.start(a) > a<-table.element(a, 'Multiple Linear Regression - Estimated Regression Equation', 1, TRUE) > a<-table.row.end(a) > myeq <- colnames(x)[1] > myeq <- paste(myeq, '[t] = ', sep='') > for (i in 1:k){ + if (mysum$coefficients[i,1] > 0) myeq <- paste(myeq, '+', '') + myeq <- paste(myeq, mysum$coefficients[i,1], sep=' ') + if (rownames(mysum$coefficients)[i] != '(Intercept)') { + myeq <- paste(myeq, rownames(mysum$coefficients)[i], sep='') + if (rownames(mysum$coefficients)[i] != 't') myeq <- paste(myeq, '[t]', sep='') + } + } > myeq <- paste(myeq, ' + e[t]') > a<-table.row.start(a) > a<-table.element(a, myeq) > a<-table.row.end(a) > a<-table.end(a) > table.save(a,file="/var/fisher/rcomp/tmp/11l1wx1353236352.tab") > a<-table.start() > a<-table.row.start(a) > a<-table.element(a,hyperlink('http://www.xycoon.com/ols1.htm','Multiple Linear Regression - Ordinary Least Squares',''), 6, TRUE) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,'Variable',header=TRUE) > a<-table.element(a,'Parameter',header=TRUE) > a<-table.element(a,'S.D.',header=TRUE) > a<-table.element(a,'T-STAT
H0: parameter = 0',header=TRUE) > a<-table.element(a,'2-tail p-value',header=TRUE) > a<-table.element(a,'1-tail p-value',header=TRUE) > a<-table.row.end(a) > for (i in 1:k){ + a<-table.row.start(a) + a<-table.element(a,rownames(mysum$coefficients)[i],header=TRUE) + a<-table.element(a,mysum$coefficients[i,1]) + a<-table.element(a, round(mysum$coefficients[i,2],6)) + a<-table.element(a, round(mysum$coefficients[i,3],4)) + a<-table.element(a, round(mysum$coefficients[i,4],6)) + a<-table.element(a, round(mysum$coefficients[i,4]/2,6)) + a<-table.row.end(a) + } > a<-table.end(a) > table.save(a,file="/var/fisher/rcomp/tmp/1259lc1353236352.tab") > a<-table.start() > a<-table.row.start(a) > a<-table.element(a, 'Multiple Linear Regression - Regression Statistics', 2, TRUE) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a, 'Multiple R',1,TRUE) > a<-table.element(a, sqrt(mysum$r.squared)) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a, 'R-squared',1,TRUE) > a<-table.element(a, mysum$r.squared) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a, 'Adjusted R-squared',1,TRUE) > a<-table.element(a, mysum$adj.r.squared) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a, 'F-TEST (value)',1,TRUE) > a<-table.element(a, mysum$fstatistic[1]) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a, 'F-TEST (DF numerator)',1,TRUE) > a<-table.element(a, mysum$fstatistic[2]) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a, 'F-TEST (DF denominator)',1,TRUE) > a<-table.element(a, mysum$fstatistic[3]) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a, 'p-value',1,TRUE) > a<-table.element(a, 1-pf(mysum$fstatistic[1],mysum$fstatistic[2],mysum$fstatistic[3])) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a, 'Multiple Linear Regression - Residual Statistics', 2, TRUE) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a, 'Residual Standard Deviation',1,TRUE) > a<-table.element(a, mysum$sigma) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a, 'Sum Squared Residuals',1,TRUE) > a<-table.element(a, sum(myerror*myerror)) > a<-table.row.end(a) > a<-table.end(a) > table.save(a,file="/var/fisher/rcomp/tmp/13rou01353236352.tab") > a<-table.start() > a<-table.row.start(a) > a<-table.element(a, 'Multiple Linear Regression - Actuals, Interpolation, and Residuals', 4, TRUE) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a, 'Time or Index', 1, TRUE) > a<-table.element(a, 'Actuals', 1, TRUE) > a<-table.element(a, 'Interpolation
Forecast', 1, TRUE) > a<-table.element(a, 'Residuals
Prediction Error', 1, TRUE) > a<-table.row.end(a) > for (i in 1:n) { + a<-table.row.start(a) + a<-table.element(a,i, 1, TRUE) + a<-table.element(a,x[i]) + a<-table.element(a,x[i]-mysum$resid[i]) + a<-table.element(a,mysum$resid[i]) + a<-table.row.end(a) + } > a<-table.end(a) > table.save(a,file="/var/fisher/rcomp/tmp/14ne191353236352.tab") > if (n > n25) { + a<-table.start() + a<-table.row.start(a) + a<-table.element(a,'Goldfeld-Quandt test for Heteroskedasticity',4,TRUE) + a<-table.row.end(a) + a<-table.row.start(a) + a<-table.element(a,'p-values',header=TRUE) + a<-table.element(a,'Alternative Hypothesis',3,header=TRUE) + a<-table.row.end(a) + a<-table.row.start(a) + a<-table.element(a,'breakpoint index',header=TRUE) + a<-table.element(a,'greater',header=TRUE) + a<-table.element(a,'2-sided',header=TRUE) + a<-table.element(a,'less',header=TRUE) + a<-table.row.end(a) + for (mypoint in kp3:nmkm3) { + a<-table.row.start(a) + a<-table.element(a,mypoint,header=TRUE) + a<-table.element(a,gqarr[mypoint-kp3+1,1]) + a<-table.element(a,gqarr[mypoint-kp3+1,2]) + a<-table.element(a,gqarr[mypoint-kp3+1,3]) + a<-table.row.end(a) + } + a<-table.end(a) + table.save(a,file="/var/fisher/rcomp/tmp/150msv1353236352.tab") + a<-table.start() + a<-table.row.start(a) + a<-table.element(a,'Meta Analysis of Goldfeld-Quandt test for Heteroskedasticity',4,TRUE) + a<-table.row.end(a) + a<-table.row.start(a) + a<-table.element(a,'Description',header=TRUE) + a<-table.element(a,'# significant tests',header=TRUE) + a<-table.element(a,'% significant tests',header=TRUE) + a<-table.element(a,'OK/NOK',header=TRUE) + a<-table.row.end(a) + a<-table.row.start(a) + a<-table.element(a,'1% type I error level',header=TRUE) + a<-table.element(a,numsignificant1) + a<-table.element(a,numsignificant1/numgqtests) + if (numsignificant1/numgqtests < 0.01) dum <- 'OK' else dum <- 'NOK' + a<-table.element(a,dum) + a<-table.row.end(a) + a<-table.row.start(a) + a<-table.element(a,'5% type I error level',header=TRUE) + a<-table.element(a,numsignificant5) + a<-table.element(a,numsignificant5/numgqtests) + if (numsignificant5/numgqtests < 0.05) dum <- 'OK' else dum <- 'NOK' + a<-table.element(a,dum) + a<-table.row.end(a) + a<-table.row.start(a) + a<-table.element(a,'10% type I error level',header=TRUE) + a<-table.element(a,numsignificant10) + a<-table.element(a,numsignificant10/numgqtests) + if (numsignificant10/numgqtests < 0.1) dum <- 'OK' else dum <- 'NOK' + a<-table.element(a,dum) + a<-table.row.end(a) + a<-table.end(a) + table.save(a,file="/var/fisher/rcomp/tmp/1679mr1353236352.tab") + } > > try(system("convert tmp/1zpyq1353236351.ps tmp/1zpyq1353236351.png",intern=TRUE)) character(0) > try(system("convert tmp/249ol1353236351.ps tmp/249ol1353236351.png",intern=TRUE)) character(0) > try(system("convert tmp/35g9d1353236351.ps tmp/35g9d1353236351.png",intern=TRUE)) character(0) > try(system("convert tmp/4k1s71353236351.ps tmp/4k1s71353236351.png",intern=TRUE)) character(0) > try(system("convert tmp/5rh0s1353236351.ps tmp/5rh0s1353236351.png",intern=TRUE)) character(0) > try(system("convert tmp/6x5c31353236351.ps tmp/6x5c31353236351.png",intern=TRUE)) character(0) > try(system("convert tmp/7ujwv1353236352.ps tmp/7ujwv1353236352.png",intern=TRUE)) character(0) > try(system("convert tmp/8h8wa1353236352.ps tmp/8h8wa1353236352.png",intern=TRUE)) character(0) > try(system("convert tmp/905w91353236352.ps tmp/905w91353236352.png",intern=TRUE)) character(0) > try(system("convert tmp/103siq1353236352.ps tmp/103siq1353236352.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 6.944 1.235 8.191