R version 2.9.0 (2009-04-17) Copyright (C) 2009 The R Foundation for Statistical Computing ISBN 3-900051-07-0 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > x <- array(list(613,0,611,611,0,613,594,0,611,595,0,594,591,0,595,589,0,591,584,0,589,573,0,584,567,0,573,569,0,567,621,0,569,629,0,621,628,0,629,612,0,628,595,0,612,597,0,595,593,0,597,590,0,593,580,0,590,574,0,580,573,0,574,573,0,573,620,0,573,626,0,620,620,0,626,588,0,620,566,0,588,557,0,566,561,0,557,549,0,561,532,0,549,526,0,532,511,0,526,499,0,511,555,0,499,565,0,555,542,0,565,527,0,542,510,0,527,514,0,510,517,0,514,508,0,517,493,0,508,490,0,493,469,0,490,478,0,469,528,0,478,534,0,528,518,1,534,506,1,518,502,1,506,516,1,502,528,1,516,533,1,528,536,1,533,537,1,536,524,1,537,536,1,524,587,1,536,597,1,587,581,1,597),dim=c(3,61),dimnames=list(c('WklBe','X','Y1'),1:61)) > y <- array(NA,dim=c(3,61),dimnames=list(c('WklBe','X','Y1'),1:61)) > for (i in 1:dim(x)[1]) + { + for (j in 1:dim(x)[2]) + { + y[i,j] <- as.numeric(x[i,j]) + } + } > par3 = 'Linear Trend' > par2 = 'Include Monthly Dummies' > par1 = '1' > #'GNU S' R Code compiled by R2WASP v. 1.0.44 () > #Author: Prof. Dr. P. Wessa > #To cite this work: AUTHOR(S), (YEAR), YOUR SOFTWARE TITLE (vNUMBER) in Free Statistics Software (v$_version), Office for Research Development and Education, URL http://www.wessa.net/rwasp_YOURPAGE.wasp/ > #Source of accompanying publication: Office for Research, Development, and Education > #Technical description: Write here your technical program description (don't use hard returns!) > library(lattice) > library(lmtest) Loading required package: zoo Attaching package: 'zoo' The following object(s) are masked from package:base : as.Date.numeric > n25 <- 25 #minimum number of obs. for Goldfeld-Quandt test > par1 <- as.numeric(par1) > x <- t(y) > k <- length(x[1,]) > n <- length(x[,1]) > x1 <- cbind(x[,par1], x[,1:k!=par1]) > mycolnames <- c(colnames(x)[par1], colnames(x)[1:k!=par1]) > colnames(x1) <- mycolnames #colnames(x)[par1] > x <- x1 > if (par3 == 'First Differences'){ + x2 <- array(0, dim=c(n-1,k), dimnames=list(1:(n-1), paste('(1-B)',colnames(x),sep=''))) + for (i in 1:n-1) { + for (j in 1:k) { + x2[i,j] <- x[i+1,j] - x[i,j] + } + } + x <- x2 + } > if (par2 == 'Include Monthly Dummies'){ + x2 <- array(0, dim=c(n,11), dimnames=list(1:n, paste('M', seq(1:11), sep =''))) + for (i in 1:11){ + x2[seq(i,n,12),i] <- 1 + } + x <- cbind(x, x2) + } > if (par2 == 'Include Quarterly Dummies'){ + x2 <- array(0, dim=c(n,3), dimnames=list(1:n, paste('Q', seq(1:3), sep =''))) + for (i in 1:3){ + x2[seq(i,n,4),i] <- 1 + } + x <- cbind(x, x2) + } > k <- length(x[1,]) > if (par3 == 'Linear Trend'){ + x <- cbind(x, c(1:n)) + colnames(x)[k+1] <- 't' + } > x WklBe X Y1 M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t 1 613 0 611 1 0 0 0 0 0 0 0 0 0 0 1 2 611 0 613 0 1 0 0 0 0 0 0 0 0 0 2 3 594 0 611 0 0 1 0 0 0 0 0 0 0 0 3 4 595 0 594 0 0 0 1 0 0 0 0 0 0 0 4 5 591 0 595 0 0 0 0 1 0 0 0 0 0 0 5 6 589 0 591 0 0 0 0 0 1 0 0 0 0 0 6 7 584 0 589 0 0 0 0 0 0 1 0 0 0 0 7 8 573 0 584 0 0 0 0 0 0 0 1 0 0 0 8 9 567 0 573 0 0 0 0 0 0 0 0 1 0 0 9 10 569 0 567 0 0 0 0 0 0 0 0 0 1 0 10 11 621 0 569 0 0 0 0 0 0 0 0 0 0 1 11 12 629 0 621 0 0 0 0 0 0 0 0 0 0 0 12 13 628 0 629 1 0 0 0 0 0 0 0 0 0 0 13 14 612 0 628 0 1 0 0 0 0 0 0 0 0 0 14 15 595 0 612 0 0 1 0 0 0 0 0 0 0 0 15 16 597 0 595 0 0 0 1 0 0 0 0 0 0 0 16 17 593 0 597 0 0 0 0 1 0 0 0 0 0 0 17 18 590 0 593 0 0 0 0 0 1 0 0 0 0 0 18 19 580 0 590 0 0 0 0 0 0 1 0 0 0 0 19 20 574 0 580 0 0 0 0 0 0 0 1 0 0 0 20 21 573 0 574 0 0 0 0 0 0 0 0 1 0 0 21 22 573 0 573 0 0 0 0 0 0 0 0 0 1 0 22 23 620 0 573 0 0 0 0 0 0 0 0 0 0 1 23 24 626 0 620 0 0 0 0 0 0 0 0 0 0 0 24 25 620 0 626 1 0 0 0 0 0 0 0 0 0 0 25 26 588 0 620 0 1 0 0 0 0 0 0 0 0 0 26 27 566 0 588 0 0 1 0 0 0 0 0 0 0 0 27 28 557 0 566 0 0 0 1 0 0 0 0 0 0 0 28 29 561 0 557 0 0 0 0 1 0 0 0 0 0 0 29 30 549 0 561 0 0 0 0 0 1 0 0 0 0 0 30 31 532 0 549 0 0 0 0 0 0 1 0 0 0 0 31 32 526 0 532 0 0 0 0 0 0 0 1 0 0 0 32 33 511 0 526 0 0 0 0 0 0 0 0 1 0 0 33 34 499 0 511 0 0 0 0 0 0 0 0 0 1 0 34 35 555 0 499 0 0 0 0 0 0 0 0 0 0 1 35 36 565 0 555 0 0 0 0 0 0 0 0 0 0 0 36 37 542 0 565 1 0 0 0 0 0 0 0 0 0 0 37 38 527 0 542 0 1 0 0 0 0 0 0 0 0 0 38 39 510 0 527 0 0 1 0 0 0 0 0 0 0 0 39 40 514 0 510 0 0 0 1 0 0 0 0 0 0 0 40 41 517 0 514 0 0 0 0 1 0 0 0 0 0 0 41 42 508 0 517 0 0 0 0 0 1 0 0 0 0 0 42 43 493 0 508 0 0 0 0 0 0 1 0 0 0 0 43 44 490 0 493 0 0 0 0 0 0 0 1 0 0 0 44 45 469 0 490 0 0 0 0 0 0 0 0 1 0 0 45 46 478 0 469 0 0 0 0 0 0 0 0 0 1 0 46 47 528 0 478 0 0 0 0 0 0 0 0 0 0 1 47 48 534 0 528 0 0 0 0 0 0 0 0 0 0 0 48 49 518 1 534 1 0 0 0 0 0 0 0 0 0 0 49 50 506 1 518 0 1 0 0 0 0 0 0 0 0 0 50 51 502 1 506 0 0 1 0 0 0 0 0 0 0 0 51 52 516 1 502 0 0 0 1 0 0 0 0 0 0 0 52 53 528 1 516 0 0 0 0 1 0 0 0 0 0 0 53 54 533 1 528 0 0 0 0 0 1 0 0 0 0 0 54 55 536 1 533 0 0 0 0 0 0 1 0 0 0 0 55 56 537 1 536 0 0 0 0 0 0 0 1 0 0 0 56 57 524 1 537 0 0 0 0 0 0 0 0 1 0 0 57 58 536 1 524 0 0 0 0 0 0 0 0 0 1 0 58 59 587 1 536 0 0 0 0 0 0 0 0 0 0 1 59 60 597 1 587 0 0 0 0 0 0 0 0 0 0 0 60 61 581 1 597 1 0 0 0 0 0 0 0 0 0 0 61 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) X Y1 M1 M2 M3 78.3799 14.6196 0.8981 -20.7234 -27.0811 -28.2617 M4 M5 M6 M7 M8 M9 -11.6422 -11.2092 -16.9966 -21.6360 -18.3441 -24.6651 M10 M11 t -12.0177 37.5949 -0.3885 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -14.8328 -3.6633 0.5994 3.6862 11.9262 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 78.37991 26.47955 2.960 0.004850 ** X 14.61959 3.28885 4.445 5.50e-05 *** Y1 0.89811 0.03991 22.501 < 2e-16 *** M1 -20.72344 3.95396 -5.241 3.90e-06 *** M2 -27.08114 4.20458 -6.441 6.31e-08 *** M3 -28.26169 4.32882 -6.529 4.65e-08 *** M4 -11.64225 4.51167 -2.580 0.013123 * M5 -11.20923 4.42865 -2.531 0.014855 * M6 -16.99659 4.35600 -3.902 0.000309 *** M7 -21.63602 4.37708 -4.943 1.06e-05 *** M8 -18.34413 4.47327 -4.101 0.000166 *** M9 -24.66507 4.51531 -5.463 1.83e-06 *** M10 -12.01771 4.67794 -2.569 0.013508 * M11 37.59493 4.59018 8.190 1.55e-10 *** t -0.38849 0.11461 -3.390 0.001445 ** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 6.424 on 46 degrees of freedom Multiple R-squared: 0.9821, Adjusted R-squared: 0.9767 F-statistic: 180.4 on 14 and 46 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.184311704 0.36862341 0.81568830 [2,] 0.112462404 0.22492481 0.88753760 [3,] 0.059028232 0.11805646 0.94097177 [4,] 0.066557432 0.13311486 0.93344257 [5,] 0.030795166 0.06159033 0.96920483 [6,] 0.017357242 0.03471448 0.98264276 [7,] 0.008904131 0.01780826 0.99109587 [8,] 0.039742885 0.07948577 0.96025711 [9,] 0.663342194 0.67331561 0.33665781 [10,] 0.567097598 0.86580480 0.43290240 [11,] 0.566784308 0.86643138 0.43321569 [12,] 0.627546104 0.74490779 0.37245390 [13,] 0.587205140 0.82558972 0.41279486 [14,] 0.550303074 0.89939385 0.44969693 [15,] 0.471488502 0.94297700 0.52851150 [16,] 0.498841453 0.99768291 0.50115855 [17,] 0.930639544 0.13872091 0.06936046 [18,] 0.944090046 0.11181991 0.05590995 [19,] 0.939862461 0.12027508 0.06013754 [20,] 0.953888265 0.09222347 0.04611174 [21,] 0.982939449 0.03412110 0.01706055 [22,] 0.966371435 0.06725713 0.03362856 [23,] 0.959030410 0.08193918 0.04096959 [24,] 0.980540750 0.03891850 0.01945925 [25,] 0.980583892 0.03883222 0.01941611 [26,] 0.971032312 0.05793538 0.02896769 > postscript(file="/var/www/html/rcomp/tmp/1umsw1258727879.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > plot(x[,1], type='l', main='Actuals and Interpolation', ylab='value of Actuals and Interpolation (dots)', xlab='time or index') > points(x[,1]-mysum$resid) > grid() > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/274go1258727879.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > plot(mysum$resid, type='b', pch=19, main='Residuals', ylab='value of Residuals', xlab='time or index') > grid() > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/3a2o21258727879.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > hist(mysum$resid, main='Residual Histogram', xlab='values of Residuals') > grid() > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/4raop1258727879.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > densityplot(~mysum$resid,col='black',main='Residual Density Plot', xlab='values of Residuals') > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/5x77e1258727879.ps",horizontal=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 = 61 Frequency = 1 1 2 3 4 5 6 6.98450127 9.93446272 -3.70026194 -3.66327989 -8.60592060 -0.83761516 7 8 9 10 11 12 0.98653452 -8.42629784 2.16238484 -2.70780682 -1.72818406 -2.44667509 13 14 15 16 17 18 10.48034216 2.12464495 1.06351322 2.10049527 -3.74025922 3.02804623 19 20 21 22 23 24 0.75030969 0.82804623 11.92616001 0.56539944 -1.65875024 0.11332764 25 26 27 28 29 30 9.83657245 -10.02855585 -1.71986709 -7.19231614 4.84618096 -4.57042384 31 32 33 34 35 36 -5.76513635 0.59939665 -2.30248957 -13.08965720 4.46355849 2.15261234 37 38 39 40 41 42 -8.71659798 3.68620800 1.72696248 4.76394453 4.12696248 -1.39152854 43 44 45 46 47 48 -3.28058239 4.28772305 -7.30850451 8.29301054 0.98583683 0.06357336 49 50 51 52 53 54 -14.83276932 -5.71675982 2.62965333 3.99115623 3.37303637 3.77152132 55 56 57 58 59 60 7.30887453 2.71113192 -4.47755076 6.93905404 -2.06246101 0.11716175 61 -3.75204857 > postscript(file="/var/www/html/rcomp/tmp/6i6pp1258727879.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > dum <- cbind(lag(myerror,k=1),myerror) > dum Time Series: Start = 0 End = 61 Frequency = 1 lag(myerror, k = 1) myerror 0 6.98450127 NA 1 9.93446272 6.98450127 2 -3.70026194 9.93446272 3 -3.66327989 -3.70026194 4 -8.60592060 -3.66327989 5 -0.83761516 -8.60592060 6 0.98653452 -0.83761516 7 -8.42629784 0.98653452 8 2.16238484 -8.42629784 9 -2.70780682 2.16238484 10 -1.72818406 -2.70780682 11 -2.44667509 -1.72818406 12 10.48034216 -2.44667509 13 2.12464495 10.48034216 14 1.06351322 2.12464495 15 2.10049527 1.06351322 16 -3.74025922 2.10049527 17 3.02804623 -3.74025922 18 0.75030969 3.02804623 19 0.82804623 0.75030969 20 11.92616001 0.82804623 21 0.56539944 11.92616001 22 -1.65875024 0.56539944 23 0.11332764 -1.65875024 24 9.83657245 0.11332764 25 -10.02855585 9.83657245 26 -1.71986709 -10.02855585 27 -7.19231614 -1.71986709 28 4.84618096 -7.19231614 29 -4.57042384 4.84618096 30 -5.76513635 -4.57042384 31 0.59939665 -5.76513635 32 -2.30248957 0.59939665 33 -13.08965720 -2.30248957 34 4.46355849 -13.08965720 35 2.15261234 4.46355849 36 -8.71659798 2.15261234 37 3.68620800 -8.71659798 38 1.72696248 3.68620800 39 4.76394453 1.72696248 40 4.12696248 4.76394453 41 -1.39152854 4.12696248 42 -3.28058239 -1.39152854 43 4.28772305 -3.28058239 44 -7.30850451 4.28772305 45 8.29301054 -7.30850451 46 0.98583683 8.29301054 47 0.06357336 0.98583683 48 -14.83276932 0.06357336 49 -5.71675982 -14.83276932 50 2.62965333 -5.71675982 51 3.99115623 2.62965333 52 3.37303637 3.99115623 53 3.77152132 3.37303637 54 7.30887453 3.77152132 55 2.71113192 7.30887453 56 -4.47755076 2.71113192 57 6.93905404 -4.47755076 58 -2.06246101 6.93905404 59 0.11716175 -2.06246101 60 -3.75204857 0.11716175 61 NA -3.75204857 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] 9.93446272 6.98450127 [2,] -3.70026194 9.93446272 [3,] -3.66327989 -3.70026194 [4,] -8.60592060 -3.66327989 [5,] -0.83761516 -8.60592060 [6,] 0.98653452 -0.83761516 [7,] -8.42629784 0.98653452 [8,] 2.16238484 -8.42629784 [9,] -2.70780682 2.16238484 [10,] -1.72818406 -2.70780682 [11,] -2.44667509 -1.72818406 [12,] 10.48034216 -2.44667509 [13,] 2.12464495 10.48034216 [14,] 1.06351322 2.12464495 [15,] 2.10049527 1.06351322 [16,] -3.74025922 2.10049527 [17,] 3.02804623 -3.74025922 [18,] 0.75030969 3.02804623 [19,] 0.82804623 0.75030969 [20,] 11.92616001 0.82804623 [21,] 0.56539944 11.92616001 [22,] -1.65875024 0.56539944 [23,] 0.11332764 -1.65875024 [24,] 9.83657245 0.11332764 [25,] -10.02855585 9.83657245 [26,] -1.71986709 -10.02855585 [27,] -7.19231614 -1.71986709 [28,] 4.84618096 -7.19231614 [29,] -4.57042384 4.84618096 [30,] -5.76513635 -4.57042384 [31,] 0.59939665 -5.76513635 [32,] -2.30248957 0.59939665 [33,] -13.08965720 -2.30248957 [34,] 4.46355849 -13.08965720 [35,] 2.15261234 4.46355849 [36,] -8.71659798 2.15261234 [37,] 3.68620800 -8.71659798 [38,] 1.72696248 3.68620800 [39,] 4.76394453 1.72696248 [40,] 4.12696248 4.76394453 [41,] -1.39152854 4.12696248 [42,] -3.28058239 -1.39152854 [43,] 4.28772305 -3.28058239 [44,] -7.30850451 4.28772305 [45,] 8.29301054 -7.30850451 [46,] 0.98583683 8.29301054 [47,] 0.06357336 0.98583683 [48,] -14.83276932 0.06357336 [49,] -5.71675982 -14.83276932 [50,] 2.62965333 -5.71675982 [51,] 3.99115623 2.62965333 [52,] 3.37303637 3.99115623 [53,] 3.77152132 3.37303637 [54,] 7.30887453 3.77152132 [55,] 2.71113192 7.30887453 [56,] -4.47755076 2.71113192 [57,] 6.93905404 -4.47755076 [58,] -2.06246101 6.93905404 [59,] 0.11716175 -2.06246101 [60,] -3.75204857 0.11716175 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 9.93446272 6.98450127 2 -3.70026194 9.93446272 3 -3.66327989 -3.70026194 4 -8.60592060 -3.66327989 5 -0.83761516 -8.60592060 6 0.98653452 -0.83761516 7 -8.42629784 0.98653452 8 2.16238484 -8.42629784 9 -2.70780682 2.16238484 10 -1.72818406 -2.70780682 11 -2.44667509 -1.72818406 12 10.48034216 -2.44667509 13 2.12464495 10.48034216 14 1.06351322 2.12464495 15 2.10049527 1.06351322 16 -3.74025922 2.10049527 17 3.02804623 -3.74025922 18 0.75030969 3.02804623 19 0.82804623 0.75030969 20 11.92616001 0.82804623 21 0.56539944 11.92616001 22 -1.65875024 0.56539944 23 0.11332764 -1.65875024 24 9.83657245 0.11332764 25 -10.02855585 9.83657245 26 -1.71986709 -10.02855585 27 -7.19231614 -1.71986709 28 4.84618096 -7.19231614 29 -4.57042384 4.84618096 30 -5.76513635 -4.57042384 31 0.59939665 -5.76513635 32 -2.30248957 0.59939665 33 -13.08965720 -2.30248957 34 4.46355849 -13.08965720 35 2.15261234 4.46355849 36 -8.71659798 2.15261234 37 3.68620800 -8.71659798 38 1.72696248 3.68620800 39 4.76394453 1.72696248 40 4.12696248 4.76394453 41 -1.39152854 4.12696248 42 -3.28058239 -1.39152854 43 4.28772305 -3.28058239 44 -7.30850451 4.28772305 45 8.29301054 -7.30850451 46 0.98583683 8.29301054 47 0.06357336 0.98583683 48 -14.83276932 0.06357336 49 -5.71675982 -14.83276932 50 2.62965333 -5.71675982 51 3.99115623 2.62965333 52 3.37303637 3.99115623 53 3.77152132 3.37303637 54 7.30887453 3.77152132 55 2.71113192 7.30887453 56 -4.47755076 2.71113192 57 6.93905404 -4.47755076 58 -2.06246101 6.93905404 59 0.11716175 -2.06246101 60 -3.75204857 0.11716175 > plot(z,main=paste('Residual Lag plot, lowess, and regression line'), ylab='values of Residuals', xlab='lagged values of Residuals') > lines(lowess(z)) > abline(lm(z)) > grid() > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/71sgd1258727879.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > acf(mysum$resid, lag.max=length(mysum$resid)/2, main='Residual Autocorrelation Function') > grid() > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/8qpia1258727879.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > pacf(mysum$resid, lag.max=length(mysum$resid)/2, main='Residual Partial Autocorrelation Function') > grid() > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/90fjy1258727879.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > opar <- par(mfrow = c(2,2), oma = c(0, 0, 1.1, 0)) > plot(mylm, las = 1, sub='Residual Diagnostics') > par(opar) > dev.off() null device 1 > if (n > n25) { + postscript(file="/var/www/html/rcomp/tmp/10h9pf1258727879.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) + plot(kp3:nmkm3,gqarr[,2], main='Goldfeld-Quandt test',ylab='2-sided p-value',xlab='breakpoint') + grid() + dev.off() + } null device 1 > > #Note: the /var/www/html/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/html/rcomp/createtable") > > a<-table.start() > a<-table.row.start(a) > a<-table.element(a, 'Multiple Linear Regression - Estimated Regression Equation', 1, TRUE) > a<-table.row.end(a) > myeq <- colnames(x)[1] > myeq <- paste(myeq, '[t] = ', sep='') > for (i in 1:k){ + if (mysum$coefficients[i,1] > 0) myeq <- paste(myeq, '+', '') + myeq <- paste(myeq, mysum$coefficients[i,1], sep=' ') + if (rownames(mysum$coefficients)[i] != '(Intercept)') { + myeq <- paste(myeq, rownames(mysum$coefficients)[i], sep='') + if (rownames(mysum$coefficients)[i] != 't') myeq <- paste(myeq, '[t]', sep='') + } + } > myeq <- paste(myeq, ' + e[t]') > a<-table.row.start(a) > a<-table.element(a, myeq) > a<-table.row.end(a) > a<-table.end(a) > table.save(a,file="/var/www/html/rcomp/tmp/11n59q1258727879.tab") > a<-table.start() > a<-table.row.start(a) > a<-table.element(a,hyperlink('http://www.xycoon.com/ols1.htm','Multiple Linear Regression - Ordinary Least Squares',''), 6, TRUE) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,'Variable',header=TRUE) > a<-table.element(a,'Parameter',header=TRUE) > a<-table.element(a,'S.D.',header=TRUE) > a<-table.element(a,'T-STAT
H0: parameter = 0',header=TRUE) > a<-table.element(a,'2-tail p-value',header=TRUE) > a<-table.element(a,'1-tail p-value',header=TRUE) > a<-table.row.end(a) > for (i in 1:k){ + a<-table.row.start(a) + a<-table.element(a,rownames(mysum$coefficients)[i],header=TRUE) + a<-table.element(a,mysum$coefficients[i,1]) + a<-table.element(a, round(mysum$coefficients[i,2],6)) + a<-table.element(a, round(mysum$coefficients[i,3],4)) + a<-table.element(a, round(mysum$coefficients[i,4],6)) + a<-table.element(a, round(mysum$coefficients[i,4]/2,6)) + a<-table.row.end(a) + } > a<-table.end(a) > table.save(a,file="/var/www/html/rcomp/tmp/12ibu91258727879.tab") > a<-table.start() > a<-table.row.start(a) > a<-table.element(a, 'Multiple Linear Regression - Regression Statistics', 2, TRUE) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a, 'Multiple R',1,TRUE) > a<-table.element(a, sqrt(mysum$r.squared)) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a, 'R-squared',1,TRUE) > a<-table.element(a, mysum$r.squared) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a, 'Adjusted R-squared',1,TRUE) > a<-table.element(a, mysum$adj.r.squared) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a, 'F-TEST (value)',1,TRUE) > a<-table.element(a, mysum$fstatistic[1]) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a, 'F-TEST (DF numerator)',1,TRUE) > a<-table.element(a, mysum$fstatistic[2]) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a, 'F-TEST (DF denominator)',1,TRUE) > a<-table.element(a, mysum$fstatistic[3]) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a, 'p-value',1,TRUE) > a<-table.element(a, 1-pf(mysum$fstatistic[1],mysum$fstatistic[2],mysum$fstatistic[3])) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a, 'Multiple Linear Regression - Residual Statistics', 2, TRUE) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a, 'Residual Standard Deviation',1,TRUE) > a<-table.element(a, mysum$sigma) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a, 'Sum Squared Residuals',1,TRUE) > a<-table.element(a, sum(myerror*myerror)) > a<-table.row.end(a) > a<-table.end(a) > table.save(a,file="/var/www/html/rcomp/tmp/13bpst1258727879.tab") > a<-table.start() > a<-table.row.start(a) > a<-table.element(a, 'Multiple Linear Regression - Actuals, Interpolation, and Residuals', 4, TRUE) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a, 'Time or Index', 1, TRUE) > a<-table.element(a, 'Actuals', 1, TRUE) > a<-table.element(a, 'Interpolation
Forecast', 1, TRUE) > a<-table.element(a, 'Residuals
Prediction Error', 1, TRUE) > a<-table.row.end(a) > for (i in 1:n) { + a<-table.row.start(a) + a<-table.element(a,i, 1, TRUE) + a<-table.element(a,x[i]) + a<-table.element(a,x[i]-mysum$resid[i]) + a<-table.element(a,mysum$resid[i]) + a<-table.row.end(a) + } > a<-table.end(a) > table.save(a,file="/var/www/html/rcomp/tmp/14hrhr1258727880.tab") > if (n > n25) { + a<-table.start() + a<-table.row.start(a) + a<-table.element(a,'Goldfeld-Quandt test for Heteroskedasticity',4,TRUE) + a<-table.row.end(a) + a<-table.row.start(a) + a<-table.element(a,'p-values',header=TRUE) + a<-table.element(a,'Alternative Hypothesis',3,header=TRUE) + a<-table.row.end(a) + a<-table.row.start(a) + a<-table.element(a,'breakpoint index',header=TRUE) + a<-table.element(a,'greater',header=TRUE) + a<-table.element(a,'2-sided',header=TRUE) + a<-table.element(a,'less',header=TRUE) + a<-table.row.end(a) + for (mypoint in kp3:nmkm3) { + a<-table.row.start(a) + a<-table.element(a,mypoint,header=TRUE) + a<-table.element(a,gqarr[mypoint-kp3+1,1]) + a<-table.element(a,gqarr[mypoint-kp3+1,2]) + a<-table.element(a,gqarr[mypoint-kp3+1,3]) + a<-table.row.end(a) + } + a<-table.end(a) + table.save(a,file="/var/www/html/rcomp/tmp/15oany1258727880.tab") + a<-table.start() + a<-table.row.start(a) + a<-table.element(a,'Meta Analysis of Goldfeld-Quandt test for Heteroskedasticity',4,TRUE) + a<-table.row.end(a) + a<-table.row.start(a) + a<-table.element(a,'Description',header=TRUE) + a<-table.element(a,'# significant tests',header=TRUE) + a<-table.element(a,'% significant tests',header=TRUE) + a<-table.element(a,'OK/NOK',header=TRUE) + a<-table.row.end(a) + a<-table.row.start(a) + a<-table.element(a,'1% type I error level',header=TRUE) + a<-table.element(a,numsignificant1) + a<-table.element(a,numsignificant1/numgqtests) + if (numsignificant1/numgqtests < 0.01) dum <- 'OK' else dum <- 'NOK' + a<-table.element(a,dum) + a<-table.row.end(a) + a<-table.row.start(a) + a<-table.element(a,'5% type I error level',header=TRUE) + a<-table.element(a,numsignificant5) + a<-table.element(a,numsignificant5/numgqtests) + if (numsignificant5/numgqtests < 0.05) dum <- 'OK' else dum <- 'NOK' + a<-table.element(a,dum) + a<-table.row.end(a) + a<-table.row.start(a) + a<-table.element(a,'10% type I error level',header=TRUE) + a<-table.element(a,numsignificant10) + a<-table.element(a,numsignificant10/numgqtests) + if (numsignificant10/numgqtests < 0.1) dum <- 'OK' else dum <- 'NOK' + a<-table.element(a,dum) + a<-table.row.end(a) + a<-table.end(a) + table.save(a,file="/var/www/html/rcomp/tmp/169mfm1258727880.tab") + } > > system("convert tmp/1umsw1258727879.ps tmp/1umsw1258727879.png") > system("convert tmp/274go1258727879.ps tmp/274go1258727879.png") > system("convert tmp/3a2o21258727879.ps tmp/3a2o21258727879.png") > system("convert tmp/4raop1258727879.ps tmp/4raop1258727879.png") > system("convert tmp/5x77e1258727879.ps tmp/5x77e1258727879.png") > system("convert tmp/6i6pp1258727879.ps tmp/6i6pp1258727879.png") > system("convert tmp/71sgd1258727879.ps tmp/71sgd1258727879.png") > system("convert tmp/8qpia1258727879.ps tmp/8qpia1258727879.png") > system("convert tmp/90fjy1258727879.ps tmp/90fjy1258727879.png") > system("convert tmp/10h9pf1258727879.ps tmp/10h9pf1258727879.png") > > > proc.time() user system elapsed 2.486 1.626 4.770