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(384 + ,257.9 + ,367.6 + ,275.8 + ,457.1 + ,319.4 + ,429.4 + ,299.8 + ,442.2 + ,331.1 + ,507.5 + ,339.3 + ,348.5 + ,209.6 + ,393.2 + ,280.9 + ,426.8 + ,285.5 + ,403 + ,247.6 + ,454.8 + ,275.1 + ,413 + ,262.3 + ,388.9 + ,267.8 + ,406.5 + ,448.2 + ,447.4 + ,563.4 + ,474.4 + ,346.6 + ,428.5 + ,455.1 + ,472.8 + ,424.4 + ,411 + ,381.2 + ,463.9 + ,382.9 + ,497.3 + ,466.6 + ,474 + ,400.2 + ,518.1 + ,493.6 + ,566 + ,367.5 + ,509.4 + ,307.1 + ,445.1 + ,316.7 + ,466.6 + ,314.2 + ,600.5 + ,403.7 + ,538.7 + ,370.6 + ,548 + ,343.7 + ,591.9 + ,383 + ,547.3 + ,365.4 + ,610.2 + ,417.2 + ,621.6 + ,411 + ,582.4 + ,420.8 + ,635.8 + ,493 + ,663.9 + ,471.8 + ,624.2 + ,452.4 + ,654.1 + ,464.8 + ,723.5 + ,541.5 + ,641.2 + ,484 + ,565.5 + ,449.4 + ,698.6 + ,436.8 + ,651 + ,490 + ,721.6 + ,475.4 + ,643.5 + ,393.6 + ,604 + ,486.8 + ,618.2 + ,536.7 + ,783.5 + ,467 + ,672.9 + ,475.5 + ,726.7 + ,532.8 + ,738.6 + ,554.1 + ,692.2 + ,507.3 + ,669.5 + ,455.2 + ,546.2 + ,465.3 + ,715 + ,563.2 + ,789.8 + ,680.1 + ,684 + ,518.2 + ,639 + ,426.6 + ,768.5 + ,612.4 + ,643.8 + ,518.1 + ,623 + ,540 + ,692.8 + ,541.7 + ,936.5 + ,627.6 + ,795.9 + ,637 + ,695.7 + ,564.2 + ,648.3 + ,665 + ,675.2 + ,703.2 + ,826.5 + ,824.4 + ,742.4 + ,700.3 + ,793.9 + ,1219.6 + ,685.3 + ,764.7 + ,756.1 + ,479.9 + ,704 + ,543.4 + ,860.6 + ,593.3 + ,795.9 + ,584.3 + ,816.7 + ,645.9 + ,777.9 + ,548.9 + ,746.4 + ,421.8 + ,694.7 + ,460.3 + ,909.2 + ,553.4 + ,783.6 + ,424.4 + ,730.4 + ,470.2 + ,847.7 + ,547.2 + ,758.7 + ,444.8 + ,839.2 + ,526.7 + ,784.8 + ,598.3 + ,906.1 + ,543.5 + ,838.2 + ,641.2 + ,729 + ,525 + ,768.1 + ,521.5 + ,710.5 + ,551.8 + ,863 + ,543.7 + ,778.3 + ,472.1 + ,827.7 + ,488 + ,853.1 + ,642.8 + ,859.3 + ,601.7 + ,779.2 + ,553.9 + ,724.6 + ,522.5 + ,829.2 + ,568.4 + ,862.9 + ,675.4 + ,601.6 + ,499.1 + ,964.9 + ,549.4 + ,766.3 + ,531.2 + ,847.8 + ,583.3 + ,992.7 + ,526.5 + ,865.3 + ,513.2 + ,1054.1 + ,729.1 + ,972.5 + ,753.7 + ,857.4 + ,571.7 + ,1043.3 + ,680.9 + ,1061 + ,757.6 + ,989.4 + ,805.4 + ,963.2 + ,687.7 + ,1181.9 + ,950.8 + ,1256.4 + ,1062 + ,1492.7 + ,1110.6 + ,1360.8 + ,1098.9 + ,1342.8 + ,1067 + ,1464 + ,1360.1) + ,dim=c(2 + ,120) + ,dimnames=list(c('yt' + ,'xt') + ,1:120)) > y <- array(NA,dim=c(2,120),dimnames=list(c('yt','xt'),1:120)) > 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 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 yt xt 1 384.0 257.9 2 367.6 275.8 3 457.1 319.4 4 429.4 299.8 5 442.2 331.1 6 507.5 339.3 7 348.5 209.6 8 393.2 280.9 9 426.8 285.5 10 403.0 247.6 11 454.8 275.1 12 413.0 262.3 13 388.9 267.8 14 406.5 448.2 15 447.4 563.4 16 474.4 346.6 17 428.5 455.1 18 472.8 424.4 19 411.0 381.2 20 463.9 382.9 21 497.3 466.6 22 474.0 400.2 23 518.1 493.6 24 566.0 367.5 25 509.4 307.1 26 445.1 316.7 27 466.6 314.2 28 600.5 403.7 29 538.7 370.6 30 548.0 343.7 31 591.9 383.0 32 547.3 365.4 33 610.2 417.2 34 621.6 411.0 35 582.4 420.8 36 635.8 493.0 37 663.9 471.8 38 624.2 452.4 39 654.1 464.8 40 723.5 541.5 41 641.2 484.0 42 565.5 449.4 43 698.6 436.8 44 651.0 490.0 45 721.6 475.4 46 643.5 393.6 47 604.0 486.8 48 618.2 536.7 49 783.5 467.0 50 672.9 475.5 51 726.7 532.8 52 738.6 554.1 53 692.2 507.3 54 669.5 455.2 55 546.2 465.3 56 715.0 563.2 57 789.8 680.1 58 684.0 518.2 59 639.0 426.6 60 768.5 612.4 61 643.8 518.1 62 623.0 540.0 63 692.8 541.7 64 936.5 627.6 65 795.9 637.0 66 695.7 564.2 67 648.3 665.0 68 675.2 703.2 69 826.5 824.4 70 742.4 700.3 71 793.9 1219.6 72 685.3 764.7 73 756.1 479.9 74 704.0 543.4 75 860.6 593.3 76 795.9 584.3 77 816.7 645.9 78 777.9 548.9 79 746.4 421.8 80 694.7 460.3 81 909.2 553.4 82 783.6 424.4 83 730.4 470.2 84 847.7 547.2 85 758.7 444.8 86 839.2 526.7 87 784.8 598.3 88 906.1 543.5 89 838.2 641.2 90 729.0 525.0 91 768.1 521.5 92 710.5 551.8 93 863.0 543.7 94 778.3 472.1 95 827.7 488.0 96 853.1 642.8 97 859.3 601.7 98 779.2 553.9 99 724.6 522.5 100 829.2 568.4 101 862.9 675.4 102 601.6 499.1 103 964.9 549.4 104 766.3 531.2 105 847.8 583.3 106 992.7 526.5 107 865.3 513.2 108 1054.1 729.1 109 972.5 753.7 110 857.4 571.7 111 1043.3 680.9 112 1061.0 757.6 113 989.4 805.4 114 963.2 687.7 115 1181.9 950.8 116 1256.4 1062.0 117 1492.7 1110.6 118 1360.8 1098.9 119 1342.8 1067.0 120 1464.0 1360.1 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) xt 196.1934 0.9722 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -588.018 -56.644 6.471 67.935 284.630 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 196.19339 30.88356 6.353 4.12e-09 *** xt 0.97222 0.05457 17.815 < 2e-16 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 117.1 on 118 degrees of freedom Multiple R-squared: 0.729, Adjusted R-squared: 0.7267 F-statistic: 317.4 on 1 and 118 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,] 6.900838e-03 1.380168e-02 0.99309916 [2,] 3.320743e-03 6.641485e-03 0.99667926 [3,] 1.286485e-03 2.572970e-03 0.99871352 [4,] 2.920389e-04 5.840777e-04 0.99970796 [5,] 6.302502e-05 1.260500e-04 0.99993697 [6,] 2.297524e-05 4.595048e-05 0.99997702 [7,] 2.229344e-05 4.458688e-05 0.99997771 [8,] 5.321672e-06 1.064334e-05 0.99999468 [9,] 1.296273e-06 2.592545e-06 0.99999870 [10,] 5.285664e-05 1.057133e-04 0.99994714 [11,] 3.293810e-05 6.587620e-05 0.99996706 [12,] 2.113624e-05 4.227249e-05 0.99997886 [13,] 9.694880e-06 1.938976e-05 0.99999031 [14,] 4.576793e-06 9.153586e-06 0.99999542 [15,] 2.094733e-06 4.189466e-06 0.99999791 [16,] 9.517632e-07 1.903526e-06 0.99999905 [17,] 6.260058e-07 1.252012e-06 0.99999937 [18,] 3.015893e-07 6.031786e-07 0.99999970 [19,] 2.393698e-07 4.787396e-07 0.99999976 [20,] 4.379974e-06 8.759949e-06 0.99999562 [21,] 6.149526e-06 1.229905e-05 0.99999385 [22,] 2.762178e-06 5.524357e-06 0.99999724 [23,] 1.419470e-06 2.838941e-06 0.99999858 [24,] 1.416221e-05 2.832442e-05 0.99998584 [25,] 1.613302e-05 3.226605e-05 0.99998387 [26,] 2.391754e-05 4.783507e-05 0.99997608 [27,] 6.140664e-05 1.228133e-04 0.99993859 [28,] 6.011820e-05 1.202364e-04 0.99993988 [29,] 1.175866e-04 2.351731e-04 0.99988241 [30,] 2.334591e-04 4.669181e-04 0.99976654 [31,] 2.134791e-04 4.269582e-04 0.99978652 [32,] 2.302707e-04 4.605414e-04 0.99976973 [33,] 3.485715e-04 6.971429e-04 0.99965143 [34,] 3.248250e-04 6.496500e-04 0.99967518 [35,] 3.548551e-04 7.097103e-04 0.99964514 [36,] 4.215581e-04 8.431162e-04 0.99957844 [37,] 3.173924e-04 6.347849e-04 0.99968261 [38,] 2.164026e-04 4.328051e-04 0.99978360 [39,] 4.133991e-04 8.267983e-04 0.99958660 [40,] 3.009233e-04 6.018467e-04 0.99969908 [41,] 4.232763e-04 8.465526e-04 0.99957672 [42,] 4.780755e-04 9.561510e-04 0.99952192 [43,] 3.364837e-04 6.729673e-04 0.99966352 [44,] 2.669495e-04 5.338990e-04 0.99973305 [45,] 8.529692e-04 1.705938e-03 0.99914703 [46,] 6.549185e-04 1.309837e-03 0.99934508 [47,] 4.953478e-04 9.906956e-04 0.99950465 [48,] 3.518639e-04 7.037279e-04 0.99964814 [49,] 2.441551e-04 4.883102e-04 0.99975584 [50,] 1.869502e-04 3.739004e-04 0.99981305 [51,] 1.900875e-04 3.801751e-04 0.99980991 [52,] 1.248450e-04 2.496899e-04 0.99987516 [53,] 8.388474e-05 1.677695e-04 0.99991612 [54,] 5.561396e-05 1.112279e-04 0.99994439 [55,] 4.194910e-05 8.389820e-05 0.99995805 [56,] 2.625353e-05 5.250706e-05 0.99997375 [57,] 1.921584e-05 3.843169e-05 0.99998078 [58,] 1.955251e-05 3.910502e-05 0.99998045 [59,] 1.316330e-05 2.632659e-05 0.99998684 [60,] 3.120883e-05 6.241765e-05 0.99996879 [61,] 1.925262e-05 3.850525e-05 0.99998075 [62,] 1.388649e-05 2.777298e-05 0.99998611 [63,] 6.171648e-05 1.234330e-04 0.99993828 [64,] 2.515771e-04 5.031541e-04 0.99974842 [65,] 3.917195e-04 7.834390e-04 0.99960828 [66,] 5.222104e-04 1.044421e-03 0.99947779 [67,] 4.773120e-01 9.546240e-01 0.52268798 [68,] 8.680491e-01 2.639018e-01 0.13195090 [69,] 8.719023e-01 2.561955e-01 0.12809775 [70,] 8.844497e-01 2.311006e-01 0.11555032 [71,] 8.963988e-01 2.072024e-01 0.10360120 [72,] 8.957275e-01 2.085450e-01 0.10427252 [73,] 9.044717e-01 1.910565e-01 0.09552827 [74,] 9.002867e-01 1.994266e-01 0.09971328 [75,] 9.053100e-01 1.893801e-01 0.09469003 [76,] 8.952502e-01 2.094996e-01 0.10474979 [77,] 9.299032e-01 1.401936e-01 0.07009682 [78,] 9.428793e-01 1.142415e-01 0.05712073 [79,] 9.324361e-01 1.351278e-01 0.06756388 [80,] 9.307786e-01 1.384429e-01 0.06922144 [81,] 9.249201e-01 1.501598e-01 0.07507990 [82,] 9.229751e-01 1.540498e-01 0.07702490 [83,] 9.180877e-01 1.638246e-01 0.08191231 [84,] 9.371986e-01 1.256029e-01 0.06280144 [85,] 9.294874e-01 1.410253e-01 0.07051264 [86,] 9.202684e-01 1.594632e-01 0.07973158 [87,] 9.025219e-01 1.949563e-01 0.09747814 [88,] 9.151991e-01 1.696019e-01 0.08480093 [89,] 9.065655e-01 1.868689e-01 0.09343446 [90,] 8.874930e-01 2.250141e-01 0.11250704 [91,] 8.799910e-01 2.400180e-01 0.12000900 [92,] 8.610121e-01 2.779759e-01 0.13898795 [93,] 8.302101e-01 3.395799e-01 0.16978993 [94,] 8.018156e-01 3.963688e-01 0.19818442 [95,] 7.910752e-01 4.178497e-01 0.20892484 [96,] 7.500719e-01 4.998562e-01 0.24992809 [97,] 7.451386e-01 5.097228e-01 0.25486138 [98,] 9.286599e-01 1.426801e-01 0.07134006 [99,] 9.420252e-01 1.159496e-01 0.05797479 [100,] 9.445855e-01 1.108289e-01 0.05541446 [101,] 9.347692e-01 1.304617e-01 0.06523083 [102,] 9.704582e-01 5.908360e-02 0.02954180 [103,] 9.559824e-01 8.803515e-02 0.04401758 [104,] 9.387794e-01 1.224412e-01 0.06122060 [105,] 9.195197e-01 1.609606e-01 0.08048032 [106,] 8.778867e-01 2.442265e-01 0.12211326 [107,] 8.514833e-01 2.970333e-01 0.14851666 [108,] 7.805362e-01 4.389277e-01 0.21946385 [109,] 7.564845e-01 4.870311e-01 0.24351553 [110,] 6.774444e-01 6.451112e-01 0.32255558 [111,] 6.236564e-01 7.526873e-01 0.37634365 > postscript(file="/var/www/html/rcomp/tmp/19usy1259328063.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/2ffd21259328063.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/3v5dp1259328063.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/47u1d1259328063.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/531lr1259328064.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 = 120 Frequency = 1 1 2 3 4 5 6 -62.9300810 -96.7328990 -49.6218859 -58.2662863 -75.8969122 -18.5691528 7 8 9 10 11 12 -51.4716391 -76.0912438 -46.9634764 -33.9161690 -8.8523419 -38.2078687 13 14 15 16 17 18 -67.6551033 -225.4443975 -296.5446564 -58.7663914 -210.1527464 -136.0054551 19 20 21 22 23 24 -155.8053581 -104.5581397 -152.5333277 -111.2776230 -157.9833884 12.5141172 25 26 27 28 29 30 14.6364751 -58.9968798 -35.0663186 11.8195914 -17.7997787 17.6530595 31 32 33 34 35 36 23.3446379 -4.1442115 8.3945610 25.8223527 -22.9054471 -39.7000537 37 38 39 40 41 42 9.0111050 -11.8277403 6.0166763 0.8470595 -25.5500335 -67.6110669 43 44 45 46 47 48 77.7389614 -21.5833803 63.2110969 64.6390585 -65.4722620 -99.7862630 49 50 51 52 53 54 133.2777825 14.4138745 12.5054124 3.6970312 2.7971364 30.7500312 55 56 57 58 59 60 -102.3694359 -28.7502115 -67.6032519 -16.0001104 28.0556510 -23.0836554 61 62 63 64 65 66 -56.1028879 -98.1946038 -30.0473854 130.1385327 -19.6003773 -49.0224359 67 68 69 70 71 72 -194.4226625 -204.6616372 -171.1952429 -134.6421862 -588.0183531 -254.3534420 73 74 75 76 77 78 93.3360868 -20.5001670 87.5858320 31.6358522 -7.4531751 48.0525984 79 80 81 82 83 84 140.1223285 50.9916864 174.9775883 174.7945449 77.0666642 119.5053800 85 86 87 88 89 90 130.0611657 130.9359816 6.9247096 181.5026106 18.6162799 22.3887632 91 92 93 94 95 96 64.8915489 -22.1668525 138.2081657 123.1194377 157.0610686 31.9607208 97 98 99 100 101 102 78.1191465 44.4914761 20.4193244 80.3942213 10.0662031 -79.8306230 103 104 105 106 107 108 234.5664862 53.6609715 84.5080767 284.6304265 170.1610120 149.0577491 109 110 111 112 113 114 43.5410271 105.3858805 185.1189685 128.2493517 10.1770221 98.4078421 115 116 117 118 119 120 61.3155842 27.7042232 216.7541140 96.2291403 109.2431009 -54.5158910 > postscript(file="/var/www/html/rcomp/tmp/6hjlx1259328064.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 = 120 Frequency = 1 lag(myerror, k = 1) myerror 0 -62.9300810 NA 1 -96.7328990 -62.9300810 2 -49.6218859 -96.7328990 3 -58.2662863 -49.6218859 4 -75.8969122 -58.2662863 5 -18.5691528 -75.8969122 6 -51.4716391 -18.5691528 7 -76.0912438 -51.4716391 8 -46.9634764 -76.0912438 9 -33.9161690 -46.9634764 10 -8.8523419 -33.9161690 11 -38.2078687 -8.8523419 12 -67.6551033 -38.2078687 13 -225.4443975 -67.6551033 14 -296.5446564 -225.4443975 15 -58.7663914 -296.5446564 16 -210.1527464 -58.7663914 17 -136.0054551 -210.1527464 18 -155.8053581 -136.0054551 19 -104.5581397 -155.8053581 20 -152.5333277 -104.5581397 21 -111.2776230 -152.5333277 22 -157.9833884 -111.2776230 23 12.5141172 -157.9833884 24 14.6364751 12.5141172 25 -58.9968798 14.6364751 26 -35.0663186 -58.9968798 27 11.8195914 -35.0663186 28 -17.7997787 11.8195914 29 17.6530595 -17.7997787 30 23.3446379 17.6530595 31 -4.1442115 23.3446379 32 8.3945610 -4.1442115 33 25.8223527 8.3945610 34 -22.9054471 25.8223527 35 -39.7000537 -22.9054471 36 9.0111050 -39.7000537 37 -11.8277403 9.0111050 38 6.0166763 -11.8277403 39 0.8470595 6.0166763 40 -25.5500335 0.8470595 41 -67.6110669 -25.5500335 42 77.7389614 -67.6110669 43 -21.5833803 77.7389614 44 63.2110969 -21.5833803 45 64.6390585 63.2110969 46 -65.4722620 64.6390585 47 -99.7862630 -65.4722620 48 133.2777825 -99.7862630 49 14.4138745 133.2777825 50 12.5054124 14.4138745 51 3.6970312 12.5054124 52 2.7971364 3.6970312 53 30.7500312 2.7971364 54 -102.3694359 30.7500312 55 -28.7502115 -102.3694359 56 -67.6032519 -28.7502115 57 -16.0001104 -67.6032519 58 28.0556510 -16.0001104 59 -23.0836554 28.0556510 60 -56.1028879 -23.0836554 61 -98.1946038 -56.1028879 62 -30.0473854 -98.1946038 63 130.1385327 -30.0473854 64 -19.6003773 130.1385327 65 -49.0224359 -19.6003773 66 -194.4226625 -49.0224359 67 -204.6616372 -194.4226625 68 -171.1952429 -204.6616372 69 -134.6421862 -171.1952429 70 -588.0183531 -134.6421862 71 -254.3534420 -588.0183531 72 93.3360868 -254.3534420 73 -20.5001670 93.3360868 74 87.5858320 -20.5001670 75 31.6358522 87.5858320 76 -7.4531751 31.6358522 77 48.0525984 -7.4531751 78 140.1223285 48.0525984 79 50.9916864 140.1223285 80 174.9775883 50.9916864 81 174.7945449 174.9775883 82 77.0666642 174.7945449 83 119.5053800 77.0666642 84 130.0611657 119.5053800 85 130.9359816 130.0611657 86 6.9247096 130.9359816 87 181.5026106 6.9247096 88 18.6162799 181.5026106 89 22.3887632 18.6162799 90 64.8915489 22.3887632 91 -22.1668525 64.8915489 92 138.2081657 -22.1668525 93 123.1194377 138.2081657 94 157.0610686 123.1194377 95 31.9607208 157.0610686 96 78.1191465 31.9607208 97 44.4914761 78.1191465 98 20.4193244 44.4914761 99 80.3942213 20.4193244 100 10.0662031 80.3942213 101 -79.8306230 10.0662031 102 234.5664862 -79.8306230 103 53.6609715 234.5664862 104 84.5080767 53.6609715 105 284.6304265 84.5080767 106 170.1610120 284.6304265 107 149.0577491 170.1610120 108 43.5410271 149.0577491 109 105.3858805 43.5410271 110 185.1189685 105.3858805 111 128.2493517 185.1189685 112 10.1770221 128.2493517 113 98.4078421 10.1770221 114 61.3155842 98.4078421 115 27.7042232 61.3155842 116 216.7541140 27.7042232 117 96.2291403 216.7541140 118 109.2431009 96.2291403 119 -54.5158910 109.2431009 120 NA -54.5158910 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -96.7328990 -62.9300810 [2,] -49.6218859 -96.7328990 [3,] -58.2662863 -49.6218859 [4,] -75.8969122 -58.2662863 [5,] -18.5691528 -75.8969122 [6,] -51.4716391 -18.5691528 [7,] -76.0912438 -51.4716391 [8,] -46.9634764 -76.0912438 [9,] -33.9161690 -46.9634764 [10,] -8.8523419 -33.9161690 [11,] -38.2078687 -8.8523419 [12,] -67.6551033 -38.2078687 [13,] -225.4443975 -67.6551033 [14,] -296.5446564 -225.4443975 [15,] -58.7663914 -296.5446564 [16,] -210.1527464 -58.7663914 [17,] -136.0054551 -210.1527464 [18,] -155.8053581 -136.0054551 [19,] -104.5581397 -155.8053581 [20,] -152.5333277 -104.5581397 [21,] -111.2776230 -152.5333277 [22,] -157.9833884 -111.2776230 [23,] 12.5141172 -157.9833884 [24,] 14.6364751 12.5141172 [25,] -58.9968798 14.6364751 [26,] -35.0663186 -58.9968798 [27,] 11.8195914 -35.0663186 [28,] -17.7997787 11.8195914 [29,] 17.6530595 -17.7997787 [30,] 23.3446379 17.6530595 [31,] -4.1442115 23.3446379 [32,] 8.3945610 -4.1442115 [33,] 25.8223527 8.3945610 [34,] -22.9054471 25.8223527 [35,] -39.7000537 -22.9054471 [36,] 9.0111050 -39.7000537 [37,] -11.8277403 9.0111050 [38,] 6.0166763 -11.8277403 [39,] 0.8470595 6.0166763 [40,] -25.5500335 0.8470595 [41,] -67.6110669 -25.5500335 [42,] 77.7389614 -67.6110669 [43,] -21.5833803 77.7389614 [44,] 63.2110969 -21.5833803 [45,] 64.6390585 63.2110969 [46,] -65.4722620 64.6390585 [47,] -99.7862630 -65.4722620 [48,] 133.2777825 -99.7862630 [49,] 14.4138745 133.2777825 [50,] 12.5054124 14.4138745 [51,] 3.6970312 12.5054124 [52,] 2.7971364 3.6970312 [53,] 30.7500312 2.7971364 [54,] -102.3694359 30.7500312 [55,] -28.7502115 -102.3694359 [56,] -67.6032519 -28.7502115 [57,] -16.0001104 -67.6032519 [58,] 28.0556510 -16.0001104 [59,] -23.0836554 28.0556510 [60,] -56.1028879 -23.0836554 [61,] -98.1946038 -56.1028879 [62,] -30.0473854 -98.1946038 [63,] 130.1385327 -30.0473854 [64,] -19.6003773 130.1385327 [65,] -49.0224359 -19.6003773 [66,] -194.4226625 -49.0224359 [67,] -204.6616372 -194.4226625 [68,] -171.1952429 -204.6616372 [69,] -134.6421862 -171.1952429 [70,] -588.0183531 -134.6421862 [71,] -254.3534420 -588.0183531 [72,] 93.3360868 -254.3534420 [73,] -20.5001670 93.3360868 [74,] 87.5858320 -20.5001670 [75,] 31.6358522 87.5858320 [76,] -7.4531751 31.6358522 [77,] 48.0525984 -7.4531751 [78,] 140.1223285 48.0525984 [79,] 50.9916864 140.1223285 [80,] 174.9775883 50.9916864 [81,] 174.7945449 174.9775883 [82,] 77.0666642 174.7945449 [83,] 119.5053800 77.0666642 [84,] 130.0611657 119.5053800 [85,] 130.9359816 130.0611657 [86,] 6.9247096 130.9359816 [87,] 181.5026106 6.9247096 [88,] 18.6162799 181.5026106 [89,] 22.3887632 18.6162799 [90,] 64.8915489 22.3887632 [91,] -22.1668525 64.8915489 [92,] 138.2081657 -22.1668525 [93,] 123.1194377 138.2081657 [94,] 157.0610686 123.1194377 [95,] 31.9607208 157.0610686 [96,] 78.1191465 31.9607208 [97,] 44.4914761 78.1191465 [98,] 20.4193244 44.4914761 [99,] 80.3942213 20.4193244 [100,] 10.0662031 80.3942213 [101,] -79.8306230 10.0662031 [102,] 234.5664862 -79.8306230 [103,] 53.6609715 234.5664862 [104,] 84.5080767 53.6609715 [105,] 284.6304265 84.5080767 [106,] 170.1610120 284.6304265 [107,] 149.0577491 170.1610120 [108,] 43.5410271 149.0577491 [109,] 105.3858805 43.5410271 [110,] 185.1189685 105.3858805 [111,] 128.2493517 185.1189685 [112,] 10.1770221 128.2493517 [113,] 98.4078421 10.1770221 [114,] 61.3155842 98.4078421 [115,] 27.7042232 61.3155842 [116,] 216.7541140 27.7042232 [117,] 96.2291403 216.7541140 [118,] 109.2431009 96.2291403 [119,] -54.5158910 109.2431009 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -96.7328990 -62.9300810 2 -49.6218859 -96.7328990 3 -58.2662863 -49.6218859 4 -75.8969122 -58.2662863 5 -18.5691528 -75.8969122 6 -51.4716391 -18.5691528 7 -76.0912438 -51.4716391 8 -46.9634764 -76.0912438 9 -33.9161690 -46.9634764 10 -8.8523419 -33.9161690 11 -38.2078687 -8.8523419 12 -67.6551033 -38.2078687 13 -225.4443975 -67.6551033 14 -296.5446564 -225.4443975 15 -58.7663914 -296.5446564 16 -210.1527464 -58.7663914 17 -136.0054551 -210.1527464 18 -155.8053581 -136.0054551 19 -104.5581397 -155.8053581 20 -152.5333277 -104.5581397 21 -111.2776230 -152.5333277 22 -157.9833884 -111.2776230 23 12.5141172 -157.9833884 24 14.6364751 12.5141172 25 -58.9968798 14.6364751 26 -35.0663186 -58.9968798 27 11.8195914 -35.0663186 28 -17.7997787 11.8195914 29 17.6530595 -17.7997787 30 23.3446379 17.6530595 31 -4.1442115 23.3446379 32 8.3945610 -4.1442115 33 25.8223527 8.3945610 34 -22.9054471 25.8223527 35 -39.7000537 -22.9054471 36 9.0111050 -39.7000537 37 -11.8277403 9.0111050 38 6.0166763 -11.8277403 39 0.8470595 6.0166763 40 -25.5500335 0.8470595 41 -67.6110669 -25.5500335 42 77.7389614 -67.6110669 43 -21.5833803 77.7389614 44 63.2110969 -21.5833803 45 64.6390585 63.2110969 46 -65.4722620 64.6390585 47 -99.7862630 -65.4722620 48 133.2777825 -99.7862630 49 14.4138745 133.2777825 50 12.5054124 14.4138745 51 3.6970312 12.5054124 52 2.7971364 3.6970312 53 30.7500312 2.7971364 54 -102.3694359 30.7500312 55 -28.7502115 -102.3694359 56 -67.6032519 -28.7502115 57 -16.0001104 -67.6032519 58 28.0556510 -16.0001104 59 -23.0836554 28.0556510 60 -56.1028879 -23.0836554 61 -98.1946038 -56.1028879 62 -30.0473854 -98.1946038 63 130.1385327 -30.0473854 64 -19.6003773 130.1385327 65 -49.0224359 -19.6003773 66 -194.4226625 -49.0224359 67 -204.6616372 -194.4226625 68 -171.1952429 -204.6616372 69 -134.6421862 -171.1952429 70 -588.0183531 -134.6421862 71 -254.3534420 -588.0183531 72 93.3360868 -254.3534420 73 -20.5001670 93.3360868 74 87.5858320 -20.5001670 75 31.6358522 87.5858320 76 -7.4531751 31.6358522 77 48.0525984 -7.4531751 78 140.1223285 48.0525984 79 50.9916864 140.1223285 80 174.9775883 50.9916864 81 174.7945449 174.9775883 82 77.0666642 174.7945449 83 119.5053800 77.0666642 84 130.0611657 119.5053800 85 130.9359816 130.0611657 86 6.9247096 130.9359816 87 181.5026106 6.9247096 88 18.6162799 181.5026106 89 22.3887632 18.6162799 90 64.8915489 22.3887632 91 -22.1668525 64.8915489 92 138.2081657 -22.1668525 93 123.1194377 138.2081657 94 157.0610686 123.1194377 95 31.9607208 157.0610686 96 78.1191465 31.9607208 97 44.4914761 78.1191465 98 20.4193244 44.4914761 99 80.3942213 20.4193244 100 10.0662031 80.3942213 101 -79.8306230 10.0662031 102 234.5664862 -79.8306230 103 53.6609715 234.5664862 104 84.5080767 53.6609715 105 284.6304265 84.5080767 106 170.1610120 284.6304265 107 149.0577491 170.1610120 108 43.5410271 149.0577491 109 105.3858805 43.5410271 110 185.1189685 105.3858805 111 128.2493517 185.1189685 112 10.1770221 128.2493517 113 98.4078421 10.1770221 114 61.3155842 98.4078421 115 27.7042232 61.3155842 116 216.7541140 27.7042232 117 96.2291403 216.7541140 118 109.2431009 96.2291403 119 -54.5158910 109.2431009 > 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/7mun01259328064.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/81cd91259328064.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/9syoc1259328064.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/101ilo1259328064.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/11dlf21259328064.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/12khoy1259328064.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/13q26b1259328064.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/142yxa1259328064.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/15k2le1259328064.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/16jthg1259328064.tab") + } > system("convert tmp/19usy1259328063.ps tmp/19usy1259328063.png") > system("convert tmp/2ffd21259328063.ps tmp/2ffd21259328063.png") > system("convert tmp/3v5dp1259328063.ps tmp/3v5dp1259328063.png") > system("convert tmp/47u1d1259328063.ps tmp/47u1d1259328063.png") > system("convert tmp/531lr1259328064.ps tmp/531lr1259328064.png") > system("convert tmp/6hjlx1259328064.ps tmp/6hjlx1259328064.png") > system("convert tmp/7mun01259328064.ps tmp/7mun01259328064.png") > system("convert tmp/81cd91259328064.ps tmp/81cd91259328064.png") > system("convert tmp/9syoc1259328064.ps tmp/9syoc1259328064.png") > system("convert tmp/101ilo1259328064.ps tmp/101ilo1259328064.png") > > > proc.time() user system elapsed 3.227 1.625 4.417