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(555,0,562,0,561,0,555,0,544,0,537,0,543,0,594,0,611,0,613,0,611,0,594,0,595,0,591,0,589,0,584,0,573,0,567,0,569,0,621,0,629,0,628,0,612,0,595,0,597,0,593,0,590,0,580,0,574,0,573,0,573,0,620,0,626,0,620,0,588,0,566,0,557,0,561,0,549,0,532,0,526,0,511,0,499,0,555,0,565,0,542,0,527,0,510,0,514,0,517,0,508,0,493,0,490,1,469,1,478,1,528,1,534,1,518,1,506,1,502,1,516,1,528,1,533,1,536,1,537,1,524,1,536,1,587,1,597,1,581,1),dim=c(2,70),dimnames=list(c('Y','X'),1:70)) > y <- array(NA,dim=c(2,70),dimnames=list(c('Y','X'),1:70)) > 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 Y X M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t 1 555 0 1 0 0 0 0 0 0 0 0 0 0 1 2 562 0 0 1 0 0 0 0 0 0 0 0 0 2 3 561 0 0 0 1 0 0 0 0 0 0 0 0 3 4 555 0 0 0 0 1 0 0 0 0 0 0 0 4 5 544 0 0 0 0 0 1 0 0 0 0 0 0 5 6 537 0 0 0 0 0 0 1 0 0 0 0 0 6 7 543 0 0 0 0 0 0 0 1 0 0 0 0 7 8 594 0 0 0 0 0 0 0 0 1 0 0 0 8 9 611 0 0 0 0 0 0 0 0 0 1 0 0 9 10 613 0 0 0 0 0 0 0 0 0 0 1 0 10 11 611 0 0 0 0 0 0 0 0 0 0 0 1 11 12 594 0 0 0 0 0 0 0 0 0 0 0 0 12 13 595 0 1 0 0 0 0 0 0 0 0 0 0 13 14 591 0 0 1 0 0 0 0 0 0 0 0 0 14 15 589 0 0 0 1 0 0 0 0 0 0 0 0 15 16 584 0 0 0 0 1 0 0 0 0 0 0 0 16 17 573 0 0 0 0 0 1 0 0 0 0 0 0 17 18 567 0 0 0 0 0 0 1 0 0 0 0 0 18 19 569 0 0 0 0 0 0 0 1 0 0 0 0 19 20 621 0 0 0 0 0 0 0 0 1 0 0 0 20 21 629 0 0 0 0 0 0 0 0 0 1 0 0 21 22 628 0 0 0 0 0 0 0 0 0 0 1 0 22 23 612 0 0 0 0 0 0 0 0 0 0 0 1 23 24 595 0 0 0 0 0 0 0 0 0 0 0 0 24 25 597 0 1 0 0 0 0 0 0 0 0 0 0 25 26 593 0 0 1 0 0 0 0 0 0 0 0 0 26 27 590 0 0 0 1 0 0 0 0 0 0 0 0 27 28 580 0 0 0 0 1 0 0 0 0 0 0 0 28 29 574 0 0 0 0 0 1 0 0 0 0 0 0 29 30 573 0 0 0 0 0 0 1 0 0 0 0 0 30 31 573 0 0 0 0 0 0 0 1 0 0 0 0 31 32 620 0 0 0 0 0 0 0 0 1 0 0 0 32 33 626 0 0 0 0 0 0 0 0 0 1 0 0 33 34 620 0 0 0 0 0 0 0 0 0 0 1 0 34 35 588 0 0 0 0 0 0 0 0 0 0 0 1 35 36 566 0 0 0 0 0 0 0 0 0 0 0 0 36 37 557 0 1 0 0 0 0 0 0 0 0 0 0 37 38 561 0 0 1 0 0 0 0 0 0 0 0 0 38 39 549 0 0 0 1 0 0 0 0 0 0 0 0 39 40 532 0 0 0 0 1 0 0 0 0 0 0 0 40 41 526 0 0 0 0 0 1 0 0 0 0 0 0 41 42 511 0 0 0 0 0 0 1 0 0 0 0 0 42 43 499 0 0 0 0 0 0 0 1 0 0 0 0 43 44 555 0 0 0 0 0 0 0 0 1 0 0 0 44 45 565 0 0 0 0 0 0 0 0 0 1 0 0 45 46 542 0 0 0 0 0 0 0 0 0 0 1 0 46 47 527 0 0 0 0 0 0 0 0 0 0 0 1 47 48 510 0 0 0 0 0 0 0 0 0 0 0 0 48 49 514 0 1 0 0 0 0 0 0 0 0 0 0 49 50 517 0 0 1 0 0 0 0 0 0 0 0 0 50 51 508 0 0 0 1 0 0 0 0 0 0 0 0 51 52 493 0 0 0 0 1 0 0 0 0 0 0 0 52 53 490 1 0 0 0 0 1 0 0 0 0 0 0 53 54 469 1 0 0 0 0 0 1 0 0 0 0 0 54 55 478 1 0 0 0 0 0 0 1 0 0 0 0 55 56 528 1 0 0 0 0 0 0 0 1 0 0 0 56 57 534 1 0 0 0 0 0 0 0 0 1 0 0 57 58 518 1 0 0 0 0 0 0 0 0 0 1 0 58 59 506 1 0 0 0 0 0 0 0 0 0 0 1 59 60 502 1 0 0 0 0 0 0 0 0 0 0 0 60 61 516 1 1 0 0 0 0 0 0 0 0 0 0 61 62 528 1 0 1 0 0 0 0 0 0 0 0 0 62 63 533 1 0 0 1 0 0 0 0 0 0 0 0 63 64 536 1 0 0 0 1 0 0 0 0 0 0 0 64 65 537 1 0 0 0 0 1 0 0 0 0 0 0 65 66 524 1 0 0 0 0 0 1 0 0 0 0 0 66 67 536 1 0 0 0 0 0 0 1 0 0 0 0 67 68 587 1 0 0 0 0 0 0 0 1 0 0 0 68 69 597 1 0 0 0 0 0 0 0 0 1 0 0 69 70 581 1 0 0 0 0 0 0 0 0 0 1 0 70 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) X M1 M2 M3 M4 591.5037 -8.2904 -3.0716 0.9408 -1.7135 -9.0344 M5 M6 M7 M8 M9 M10 -12.6403 -22.1280 -18.2822 33.8968 44.4092 35.4216 M11 t 14.3876 -1.0124 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -41.92 -25.83 6.82 24.25 39.23 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 591.5037 15.0270 39.363 <2e-16 *** X -8.2904 12.2340 -0.678 0.5008 M1 -3.0716 17.4489 -0.176 0.8609 M2 0.9408 17.4357 0.054 0.9572 M3 -1.7135 17.4265 -0.098 0.9220 M4 -9.0344 17.4213 -0.519 0.6061 M5 -12.6403 17.5146 -0.722 0.4735 M6 -22.1280 17.4941 -1.265 0.2112 M7 -18.2822 17.4775 -1.046 0.3000 M8 33.8968 17.4649 1.941 0.0573 . M9 44.4092 17.4562 2.544 0.0137 * M10 35.4216 17.4515 2.030 0.0471 * M11 14.3876 18.1943 0.791 0.4324 t -1.0124 0.2626 -3.856 0.0003 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 28.76 on 56 degrees of freedom Multiple R-squared: 0.5829, Adjusted R-squared: 0.486 F-statistic: 6.019 on 13 and 56 DF, p-value: 7.926e-07 > 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,] 4.119040e-03 8.238080e-03 0.9958809602 [2,] 4.821346e-04 9.642692e-04 0.9995178654 [3,] 7.766971e-05 1.553394e-04 0.9999223303 [4,] 9.809967e-06 1.961993e-05 0.9999901900 [5,] 9.410108e-06 1.882022e-05 0.9999905899 [6,] 8.187331e-06 1.637466e-05 0.9999918127 [7,] 6.582610e-05 1.316522e-04 0.9999341739 [8,] 1.009787e-04 2.019575e-04 0.9998990213 [9,] 4.496792e-05 8.993585e-05 0.9999550321 [10,] 2.549175e-05 5.098349e-05 0.9999745083 [11,] 1.343070e-05 2.686140e-05 0.9999865693 [12,] 9.025185e-06 1.805037e-05 0.9999909748 [13,] 3.550652e-06 7.101303e-06 0.9999964493 [14,] 1.353380e-06 2.706760e-06 0.9999986466 [15,] 6.106353e-07 1.221271e-06 0.9999993894 [16,] 3.609351e-07 7.218703e-07 0.9999996391 [17,] 4.023880e-07 8.047761e-07 0.9999995976 [18,] 1.718331e-06 3.436662e-06 0.9999982817 [19,] 1.457917e-04 2.915834e-04 0.9998542083 [20,] 3.607436e-03 7.214872e-03 0.9963925642 [21,] 2.614948e-02 5.229896e-02 0.9738505184 [22,] 1.004174e-01 2.008348e-01 0.8995826042 [23,] 3.407568e-01 6.815136e-01 0.6592431754 [24,] 7.511962e-01 4.976077e-01 0.2488038457 [25,] 8.308152e-01 3.383696e-01 0.1691847777 [26,] 9.257291e-01 1.485417e-01 0.0742708686 [27,] 9.472264e-01 1.055473e-01 0.0527736317 [28,] 9.610235e-01 7.795299e-02 0.0389764966 [29,] 9.788759e-01 4.224829e-02 0.0211241432 [30,] 9.918736e-01 1.625286e-02 0.0081264279 [31,] 9.978455e-01 4.309003e-03 0.0021545016 [32,] 9.990850e-01 1.830059e-03 0.0009150293 [33,] 9.994337e-01 1.132617e-03 0.0005663085 [34,] 9.997161e-01 5.677367e-04 0.0002838684 [35,] 9.997022e-01 5.955246e-04 0.0002977623 [36,] 9.981088e-01 3.782453e-03 0.0018912265 [37,] 9.983858e-01 3.228378e-03 0.0016141889 > postscript(file="/var/www/html/rcomp/tmp/1pn411258729741.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/2yz751258729741.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/3jsap1258729741.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/4wra41258729741.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/55c7g1258729741.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 = 70 Frequency = 1 1 2 3 4 5 6 7 -32.419759 -28.419759 -25.753092 -23.419759 -29.801484 -26.301484 -23.134818 8 9 10 11 12 13 14 -23.301484 -15.801484 -3.801484 16.244836 14.644836 19.728788 12.728788 15 16 17 18 19 20 21 14.395455 17.728788 11.347062 15.847062 15.013729 15.847062 14.347062 22 23 24 25 26 27 28 23.347062 29.393383 27.793383 33.877335 26.877335 27.544001 25.877335 29 30 31 32 33 34 35 24.495609 33.995609 31.162276 26.995609 23.495609 27.495609 17.541929 36 37 38 39 40 41 42 10.941929 6.025881 7.025881 -1.307452 -9.974119 -11.355844 -15.855844 43 44 45 46 47 48 49 -30.689177 -25.855844 -25.355844 -38.355844 -31.309524 -32.909524 -24.825572 50 51 52 53 54 55 56 -24.825572 -30.158905 -36.825572 -26.916945 -37.416945 -31.250278 -32.416945 57 58 59 60 61 62 63 -35.916945 -41.916945 -31.870625 -20.470625 -2.386673 6.613327 15.279994 64 65 66 67 68 69 70 26.613327 32.231602 29.731602 38.898268 38.731602 39.231602 33.231602 > postscript(file="/var/www/html/rcomp/tmp/6w4hl1258729741.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 = 70 Frequency = 1 lag(myerror, k = 1) myerror 0 -32.419759 NA 1 -28.419759 -32.419759 2 -25.753092 -28.419759 3 -23.419759 -25.753092 4 -29.801484 -23.419759 5 -26.301484 -29.801484 6 -23.134818 -26.301484 7 -23.301484 -23.134818 8 -15.801484 -23.301484 9 -3.801484 -15.801484 10 16.244836 -3.801484 11 14.644836 16.244836 12 19.728788 14.644836 13 12.728788 19.728788 14 14.395455 12.728788 15 17.728788 14.395455 16 11.347062 17.728788 17 15.847062 11.347062 18 15.013729 15.847062 19 15.847062 15.013729 20 14.347062 15.847062 21 23.347062 14.347062 22 29.393383 23.347062 23 27.793383 29.393383 24 33.877335 27.793383 25 26.877335 33.877335 26 27.544001 26.877335 27 25.877335 27.544001 28 24.495609 25.877335 29 33.995609 24.495609 30 31.162276 33.995609 31 26.995609 31.162276 32 23.495609 26.995609 33 27.495609 23.495609 34 17.541929 27.495609 35 10.941929 17.541929 36 6.025881 10.941929 37 7.025881 6.025881 38 -1.307452 7.025881 39 -9.974119 -1.307452 40 -11.355844 -9.974119 41 -15.855844 -11.355844 42 -30.689177 -15.855844 43 -25.855844 -30.689177 44 -25.355844 -25.855844 45 -38.355844 -25.355844 46 -31.309524 -38.355844 47 -32.909524 -31.309524 48 -24.825572 -32.909524 49 -24.825572 -24.825572 50 -30.158905 -24.825572 51 -36.825572 -30.158905 52 -26.916945 -36.825572 53 -37.416945 -26.916945 54 -31.250278 -37.416945 55 -32.416945 -31.250278 56 -35.916945 -32.416945 57 -41.916945 -35.916945 58 -31.870625 -41.916945 59 -20.470625 -31.870625 60 -2.386673 -20.470625 61 6.613327 -2.386673 62 15.279994 6.613327 63 26.613327 15.279994 64 32.231602 26.613327 65 29.731602 32.231602 66 38.898268 29.731602 67 38.731602 38.898268 68 39.231602 38.731602 69 33.231602 39.231602 70 NA 33.231602 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -28.419759 -32.419759 [2,] -25.753092 -28.419759 [3,] -23.419759 -25.753092 [4,] -29.801484 -23.419759 [5,] -26.301484 -29.801484 [6,] -23.134818 -26.301484 [7,] -23.301484 -23.134818 [8,] -15.801484 -23.301484 [9,] -3.801484 -15.801484 [10,] 16.244836 -3.801484 [11,] 14.644836 16.244836 [12,] 19.728788 14.644836 [13,] 12.728788 19.728788 [14,] 14.395455 12.728788 [15,] 17.728788 14.395455 [16,] 11.347062 17.728788 [17,] 15.847062 11.347062 [18,] 15.013729 15.847062 [19,] 15.847062 15.013729 [20,] 14.347062 15.847062 [21,] 23.347062 14.347062 [22,] 29.393383 23.347062 [23,] 27.793383 29.393383 [24,] 33.877335 27.793383 [25,] 26.877335 33.877335 [26,] 27.544001 26.877335 [27,] 25.877335 27.544001 [28,] 24.495609 25.877335 [29,] 33.995609 24.495609 [30,] 31.162276 33.995609 [31,] 26.995609 31.162276 [32,] 23.495609 26.995609 [33,] 27.495609 23.495609 [34,] 17.541929 27.495609 [35,] 10.941929 17.541929 [36,] 6.025881 10.941929 [37,] 7.025881 6.025881 [38,] -1.307452 7.025881 [39,] -9.974119 -1.307452 [40,] -11.355844 -9.974119 [41,] -15.855844 -11.355844 [42,] -30.689177 -15.855844 [43,] -25.855844 -30.689177 [44,] -25.355844 -25.855844 [45,] -38.355844 -25.355844 [46,] -31.309524 -38.355844 [47,] -32.909524 -31.309524 [48,] -24.825572 -32.909524 [49,] -24.825572 -24.825572 [50,] -30.158905 -24.825572 [51,] -36.825572 -30.158905 [52,] -26.916945 -36.825572 [53,] -37.416945 -26.916945 [54,] -31.250278 -37.416945 [55,] -32.416945 -31.250278 [56,] -35.916945 -32.416945 [57,] -41.916945 -35.916945 [58,] -31.870625 -41.916945 [59,] -20.470625 -31.870625 [60,] -2.386673 -20.470625 [61,] 6.613327 -2.386673 [62,] 15.279994 6.613327 [63,] 26.613327 15.279994 [64,] 32.231602 26.613327 [65,] 29.731602 32.231602 [66,] 38.898268 29.731602 [67,] 38.731602 38.898268 [68,] 39.231602 38.731602 [69,] 33.231602 39.231602 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -28.419759 -32.419759 2 -25.753092 -28.419759 3 -23.419759 -25.753092 4 -29.801484 -23.419759 5 -26.301484 -29.801484 6 -23.134818 -26.301484 7 -23.301484 -23.134818 8 -15.801484 -23.301484 9 -3.801484 -15.801484 10 16.244836 -3.801484 11 14.644836 16.244836 12 19.728788 14.644836 13 12.728788 19.728788 14 14.395455 12.728788 15 17.728788 14.395455 16 11.347062 17.728788 17 15.847062 11.347062 18 15.013729 15.847062 19 15.847062 15.013729 20 14.347062 15.847062 21 23.347062 14.347062 22 29.393383 23.347062 23 27.793383 29.393383 24 33.877335 27.793383 25 26.877335 33.877335 26 27.544001 26.877335 27 25.877335 27.544001 28 24.495609 25.877335 29 33.995609 24.495609 30 31.162276 33.995609 31 26.995609 31.162276 32 23.495609 26.995609 33 27.495609 23.495609 34 17.541929 27.495609 35 10.941929 17.541929 36 6.025881 10.941929 37 7.025881 6.025881 38 -1.307452 7.025881 39 -9.974119 -1.307452 40 -11.355844 -9.974119 41 -15.855844 -11.355844 42 -30.689177 -15.855844 43 -25.855844 -30.689177 44 -25.355844 -25.855844 45 -38.355844 -25.355844 46 -31.309524 -38.355844 47 -32.909524 -31.309524 48 -24.825572 -32.909524 49 -24.825572 -24.825572 50 -30.158905 -24.825572 51 -36.825572 -30.158905 52 -26.916945 -36.825572 53 -37.416945 -26.916945 54 -31.250278 -37.416945 55 -32.416945 -31.250278 56 -35.916945 -32.416945 57 -41.916945 -35.916945 58 -31.870625 -41.916945 59 -20.470625 -31.870625 60 -2.386673 -20.470625 61 6.613327 -2.386673 62 15.279994 6.613327 63 26.613327 15.279994 64 32.231602 26.613327 65 29.731602 32.231602 66 38.898268 29.731602 67 38.731602 38.898268 68 39.231602 38.731602 69 33.231602 39.231602 > 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/7jxn41258729741.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/81wtx1258729741.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/9hm4c1258729741.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/10tez91258729741.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/11y7nh1258729741.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/12ndvj1258729741.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/13nsp01258729741.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/143z7m1258729741.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/15kqbx1258729741.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/16cgum1258729741.tab") + } > > system("convert tmp/1pn411258729741.ps tmp/1pn411258729741.png") > system("convert tmp/2yz751258729741.ps tmp/2yz751258729741.png") > system("convert tmp/3jsap1258729741.ps tmp/3jsap1258729741.png") > system("convert tmp/4wra41258729741.ps tmp/4wra41258729741.png") > system("convert tmp/55c7g1258729741.ps tmp/55c7g1258729741.png") > system("convert tmp/6w4hl1258729741.ps tmp/6w4hl1258729741.png") > system("convert tmp/7jxn41258729741.ps tmp/7jxn41258729741.png") > system("convert tmp/81wtx1258729741.ps tmp/81wtx1258729741.png") > system("convert tmp/9hm4c1258729741.ps tmp/9hm4c1258729741.png") > system("convert tmp/10tez91258729741.ps tmp/10tez91258729741.png") > > > proc.time() user system elapsed 2.552 1.583 3.048