R version 2.8.0 (2008-10-20) Copyright (C) 2008 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(6340.5 + ,0 + ,7901.5 + ,0 + ,8191.1 + ,0 + ,7181.7 + ,0 + ,7594.4 + ,0 + ,7384.7 + ,0 + ,7876.7 + ,0 + ,8463.4 + ,0 + ,8317.2 + ,0 + ,7778.7 + ,0 + ,8532.8 + ,0 + ,7272.2 + ,0 + ,6680.1 + ,0 + ,8427.6 + ,0 + ,8752.8 + ,0 + ,7952.7 + ,0 + ,8694.3 + ,0 + ,7787 + ,0 + ,8474.2 + ,0 + ,9154.7 + ,0 + ,8557.2 + ,0 + ,7951.1 + ,0 + ,9156.7 + ,0 + ,7865.7 + ,0 + ,7337.4 + ,0 + ,9131.7 + ,0 + ,8814.6 + ,0 + ,8598.8 + ,0 + ,8439.6 + ,0 + ,7451.8 + ,0 + ,8016.2 + ,0 + ,9544.1 + ,0 + ,8270.7 + ,0 + ,8102.2 + ,0 + ,9369 + ,0 + ,7657.7 + ,0 + ,7816.6 + ,0 + ,9391.3 + ,0 + ,9445.4 + ,0 + ,9533.1 + ,0 + ,10068.7 + ,0 + ,8955.5 + ,0 + ,10423.9 + ,0 + ,11617.2 + ,0 + ,9391.1 + ,0 + ,10872 + ,0 + ,10230.4 + ,0 + ,9221 + ,0 + ,9428.6 + ,0 + ,10934.5 + ,0 + ,10986 + ,0 + ,11724.6 + ,0 + ,11180.9 + ,0 + ,11163.2 + ,0 + ,11240.9 + ,0 + ,12107.1 + ,0 + ,10762.3 + ,0 + ,11340.4 + ,0 + ,11266.8 + ,0 + ,9542.7 + ,0 + ,9227.7 + ,0 + ,10571.9 + ,1 + ,10774.4 + ,1 + ,10392.8 + ,1 + ,9920.2 + ,1 + ,9884.9 + ,1 + ,10174.5 + ,1 + ,11395.4 + ,1 + ,10760.2 + ,1 + ,10570.1 + ,1 + ,10536 + ,1 + ,9902.6 + ,1 + ,8889 + ,1 + ,10837.3 + ,1 + ,11624.1 + ,1 + ,10509 + ,1 + ,10984.9 + ,1 + ,10649.1 + ,1 + ,10855.7 + ,1 + ,11677.4 + ,1 + ,10760.2 + ,1 + ,10046.2 + ,1 + ,10772.8 + ,1 + ,9987.7 + ,1 + ,8638.7 + ,1 + ,11063.7 + ,1 + ,11855.7 + ,1 + ,10684.5 + ,1 + ,11337.4 + ,1 + ,10478 + ,1 + ,11123.9 + ,1 + ,12909.3 + ,1 + ,11339.9 + ,1 + ,10462.2 + ,1 + ,12733.5 + ,1 + ,10519.2 + ,1 + ,10414.9 + ,1 + ,12476.8 + ,1 + ,12384.6 + ,1 + ,12266.7 + ,1 + ,12919.9 + ,1 + ,11497.3 + ,1 + ,12142 + ,1 + ,13919.4 + ,1 + ,12656.8 + ,1 + ,12034.1 + ,1 + ,13199.7 + ,1 + ,10881.3 + ,1 + ,11301.2 + ,1 + ,13643.9 + ,1 + ,12517 + ,1 + ,13981.1 + ,1 + ,14275.7 + ,1 + ,13435 + ,1 + ,13565.7 + ,1 + ,16216.3 + ,1 + ,12970 + ,1 + ,14079.9 + ,1 + ,14235 + ,1 + ,12213.4 + ,1 + ,12581 + ,1) + ,dim=c(2 + ,121) + ,dimnames=list(c('y' + ,'x') + ,1:121)) > y <- array(NA,dim=c(2,121),dimnames=list(c('y','x'),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' > #'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 1 6340.5 0 2 7901.5 0 3 8191.1 0 4 7181.7 0 5 7594.4 0 6 7384.7 0 7 7876.7 0 8 8463.4 0 9 8317.2 0 10 7778.7 0 11 8532.8 0 12 7272.2 0 13 6680.1 0 14 8427.6 0 15 8752.8 0 16 7952.7 0 17 8694.3 0 18 7787.0 0 19 8474.2 0 20 9154.7 0 21 8557.2 0 22 7951.1 0 23 9156.7 0 24 7865.7 0 25 7337.4 0 26 9131.7 0 27 8814.6 0 28 8598.8 0 29 8439.6 0 30 7451.8 0 31 8016.2 0 32 9544.1 0 33 8270.7 0 34 8102.2 0 35 9369.0 0 36 7657.7 0 37 7816.6 0 38 9391.3 0 39 9445.4 0 40 9533.1 0 41 10068.7 0 42 8955.5 0 43 10423.9 0 44 11617.2 0 45 9391.1 0 46 10872.0 0 47 10230.4 0 48 9221.0 0 49 9428.6 0 50 10934.5 0 51 10986.0 0 52 11724.6 0 53 11180.9 0 54 11163.2 0 55 11240.9 0 56 12107.1 0 57 10762.3 0 58 11340.4 0 59 11266.8 0 60 9542.7 0 61 9227.7 0 62 10571.9 1 63 10774.4 1 64 10392.8 1 65 9920.2 1 66 9884.9 1 67 10174.5 1 68 11395.4 1 69 10760.2 1 70 10570.1 1 71 10536.0 1 72 9902.6 1 73 8889.0 1 74 10837.3 1 75 11624.1 1 76 10509.0 1 77 10984.9 1 78 10649.1 1 79 10855.7 1 80 11677.4 1 81 10760.2 1 82 10046.2 1 83 10772.8 1 84 9987.7 1 85 8638.7 1 86 11063.7 1 87 11855.7 1 88 10684.5 1 89 11337.4 1 90 10478.0 1 91 11123.9 1 92 12909.3 1 93 11339.9 1 94 10462.2 1 95 12733.5 1 96 10519.2 1 97 10414.9 1 98 12476.8 1 99 12384.6 1 100 12266.7 1 101 12919.9 1 102 11497.3 1 103 12142.0 1 104 13919.4 1 105 12656.8 1 106 12034.1 1 107 13199.7 1 108 10881.3 1 109 11301.2 1 110 13643.9 1 111 12517.0 1 112 13981.1 1 113 14275.7 1 114 13435.0 1 115 13565.7 1 116 16216.3 1 117 12970.0 1 118 14079.9 1 119 14235.0 1 120 12213.4 1 121 12581.0 1 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) x 9031 2593 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -2985.2 -1080.0 -286.5 957.1 4592.4 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 9031.1 183.6 49.177 <2e-16 *** x 2592.8 260.8 9.942 <2e-16 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 1434 on 119 degrees of freedom Multiple R-squared: 0.4537, Adjusted R-squared: 0.4491 F-statistic: 98.84 on 1 and 119 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,] 2.068952e-01 4.137904e-01 0.7931048 [2,] 9.714454e-02 1.942891e-01 0.9028555 [3,] 4.894396e-02 9.788793e-02 0.9510560 [4,] 4.330869e-02 8.661738e-02 0.9566913 [5,] 2.798157e-02 5.596314e-02 0.9720184 [6,] 1.275137e-02 2.550274e-02 0.9872486 [7,] 9.857934e-03 1.971587e-02 0.9901421 [8,] 5.737244e-03 1.147449e-02 0.9942628 [9,] 7.206726e-03 1.441345e-02 0.9927933 [10,] 5.329433e-03 1.065887e-02 0.9946706 [11,] 5.462660e-03 1.092532e-02 0.9945373 [12,] 2.835139e-03 5.670278e-03 0.9971649 [13,] 2.443574e-03 4.887148e-03 0.9975564 [14,] 1.268899e-03 2.537798e-03 0.9987311 [15,] 8.314943e-04 1.662989e-03 0.9991685 [16,] 1.262807e-03 2.525614e-03 0.9987372 [17,] 8.249354e-04 1.649871e-03 0.9991751 [18,] 4.407676e-04 8.815351e-04 0.9995592 [19,] 5.595318e-04 1.119064e-03 0.9994405 [20,] 3.176285e-04 6.352570e-04 0.9996824 [21,] 2.695600e-04 5.391200e-04 0.9997304 [22,] 3.191288e-04 6.382576e-04 0.9996809 [23,] 2.457780e-04 4.915559e-04 0.9997542 [24,] 1.587385e-04 3.174770e-04 0.9998413 [25,] 9.477579e-05 1.895516e-04 0.9999052 [26,] 8.527750e-05 1.705550e-04 0.9999147 [27,] 5.279118e-05 1.055824e-04 0.9999472 [28,] 1.079584e-04 2.159168e-04 0.9998920 [29,] 6.817583e-05 1.363517e-04 0.9999318 [30,] 4.512532e-05 9.025064e-05 0.9999549 [31,] 6.293803e-05 1.258761e-04 0.9999371 [32,] 6.042116e-05 1.208423e-04 0.9999396 [33,] 5.416966e-05 1.083393e-04 0.9999458 [34,] 7.814077e-05 1.562815e-04 0.9999219 [35,] 1.106877e-04 2.213755e-04 0.9998893 [36,] 1.601489e-04 3.202977e-04 0.9998399 [37,] 4.113993e-04 8.227986e-04 0.9995886 [38,] 3.581688e-04 7.163377e-04 0.9996418 [39,] 1.138558e-03 2.277115e-03 0.9988614 [40,] 1.279269e-02 2.558539e-02 0.9872073 [41,] 1.184901e-02 2.369801e-02 0.9881510 [42,] 2.452942e-02 4.905884e-02 0.9754706 [43,] 2.894871e-02 5.789743e-02 0.9710513 [44,] 2.606514e-02 5.213027e-02 0.9739349 [45,] 2.426010e-02 4.852021e-02 0.9757399 [46,] 3.953863e-02 7.907726e-02 0.9604614 [47,] 5.878577e-02 1.175715e-01 0.9412142 [48,] 1.171904e-01 2.343807e-01 0.8828096 [49,] 1.513858e-01 3.027716e-01 0.8486142 [50,] 1.831681e-01 3.663362e-01 0.8168319 [51,] 2.173641e-01 4.347282e-01 0.7826359 [52,] 3.307212e-01 6.614424e-01 0.6692788 [53,] 3.293365e-01 6.586730e-01 0.6706635 [54,] 3.685368e-01 7.370736e-01 0.6314632 [55,] 4.107391e-01 8.214782e-01 0.5892609 [56,] 3.642753e-01 7.285505e-01 0.6357247 [57,] 3.165118e-01 6.330237e-01 0.6834882 [58,] 2.823637e-01 5.647275e-01 0.7176363 [59,] 2.469786e-01 4.939572e-01 0.7530214 [60,] 2.221160e-01 4.442321e-01 0.7778840 [61,] 2.149205e-01 4.298410e-01 0.7850795 [62,] 2.098358e-01 4.196716e-01 0.7901642 [63,] 1.955877e-01 3.911753e-01 0.8044123 [64,] 1.708888e-01 3.417776e-01 0.8291112 [65,] 1.479140e-01 2.958280e-01 0.8520860 [66,] 1.299458e-01 2.598917e-01 0.8700542 [67,] 1.145795e-01 2.291589e-01 0.8854205 [68,] 1.166165e-01 2.332330e-01 0.8833835 [69,] 1.788624e-01 3.577247e-01 0.8211376 [70,] 1.593146e-01 3.186292e-01 0.8406854 [71,] 1.399872e-01 2.799743e-01 0.8600128 [72,] 1.295050e-01 2.590099e-01 0.8704950 [73,] 1.125824e-01 2.251649e-01 0.8874176 [74,] 1.022612e-01 2.045225e-01 0.8977388 [75,] 9.015984e-02 1.803197e-01 0.9098402 [76,] 7.630731e-02 1.526146e-01 0.9236927 [77,] 6.815764e-02 1.363153e-01 0.9318424 [78,] 7.678745e-02 1.535749e-01 0.9232125 [79,] 7.039410e-02 1.407882e-01 0.9296059 [80,] 8.608643e-02 1.721729e-01 0.9139136 [81,] 2.415489e-01 4.830978e-01 0.7584511 [82,] 2.320739e-01 4.641477e-01 0.7679261 [83,] 2.094556e-01 4.189112e-01 0.7905444 [84,] 2.220438e-01 4.440876e-01 0.7779562 [85,] 2.084152e-01 4.168304e-01 0.7915848 [86,] 2.470382e-01 4.940764e-01 0.7529618 [87,] 2.493461e-01 4.986921e-01 0.7506539 [88,] 2.434483e-01 4.868966e-01 0.7565517 [89,] 2.359791e-01 4.719582e-01 0.7640209 [90,] 3.069525e-01 6.139050e-01 0.6930475 [91,] 2.842278e-01 5.684556e-01 0.7157722 [92,] 3.757616e-01 7.515232e-01 0.6242384 [93,] 5.288670e-01 9.422660e-01 0.4711330 [94,] 4.946806e-01 9.893612e-01 0.5053194 [95,] 4.599889e-01 9.199779e-01 0.5400111 [96,] 4.280213e-01 8.560425e-01 0.5719787 [97,] 3.888210e-01 7.776420e-01 0.6111790 [98,] 4.165074e-01 8.330149e-01 0.5834926 [99,] 3.946276e-01 7.892553e-01 0.6053724 [100,] 3.954924e-01 7.909847e-01 0.6045076 [101,] 3.458625e-01 6.917250e-01 0.6541375 [102,] 3.295272e-01 6.590544e-01 0.6704728 [103,] 2.781943e-01 5.563886e-01 0.7218057 [104,] 4.547599e-01 9.095198e-01 0.5452401 [105,] 6.389009e-01 7.221982e-01 0.3610991 [106,] 5.684011e-01 8.631978e-01 0.4315989 [107,] 5.575446e-01 8.849108e-01 0.4424554 [108,] 4.787486e-01 9.574972e-01 0.5212514 [109,] 4.132228e-01 8.264455e-01 0.5867772 [110,] 3.107866e-01 6.215731e-01 0.6892134 [111,] 2.120050e-01 4.240099e-01 0.7879950 [112,] 6.539059e-01 6.921883e-01 0.3460941 > postscript(file="/var/www/html/freestat/rcomp/tmp/1qcia1229349354.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/freestat/rcomp/tmp/250lo1229349354.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/freestat/rcomp/tmp/3ki741229349354.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/freestat/rcomp/tmp/4h8u21229349354.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/freestat/rcomp/tmp/5y5cv1229349354.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 = 121 Frequency = 1 1 2 3 4 5 -2690.5606557 -1129.5606557 -839.9606557 -1849.3606557 -1436.6606557 6 7 8 9 10 -1646.3606557 -1154.3606557 -567.6606557 -713.8606557 -1252.3606557 11 12 13 14 15 -498.2606557 -1758.8606557 -2350.9606557 -603.4606557 -278.2606557 16 17 18 19 20 -1078.3606557 -336.7606557 -1244.0606557 -556.8606557 123.6393443 21 22 23 24 25 -473.8606557 -1079.9606557 125.6393443 -1165.3606557 -1693.6606557 26 27 28 29 30 100.6393443 -216.4606557 -432.2606557 -591.4606557 -1579.2606557 31 32 33 34 35 -1014.8606557 513.0393443 -760.3606557 -928.8606557 337.9393443 36 37 38 39 40 -1373.3606557 -1214.4606557 360.2393443 414.3393443 502.0393443 41 42 43 44 45 1037.6393443 -75.5606557 1392.8393443 2586.1393443 360.0393443 46 47 48 49 50 1840.9393443 1199.3393443 189.9393443 397.5393443 1903.4393443 51 52 53 54 55 1954.9393443 2693.5393443 2149.8393443 2132.1393443 2209.8393443 56 57 58 59 60 3076.0393443 1731.2393443 2309.3393443 2235.7393443 511.6393443 61 62 63 64 65 196.6393443 -1051.9516667 -849.4516667 -1231.0516667 -1703.6516667 66 67 68 69 70 -1738.9516667 -1449.3516667 -228.4516667 -863.6516667 -1053.7516667 71 72 73 74 75 -1087.8516667 -1721.2516667 -2734.8516667 -786.5516667 0.2483333 76 77 78 79 80 -1114.8516667 -638.9516667 -974.7516667 -768.1516667 53.5483333 81 82 83 84 85 -863.6516667 -1577.6516667 -851.0516667 -1636.1516667 -2985.1516667 86 87 88 89 90 -560.1516667 231.8483333 -939.3516667 -286.4516667 -1145.8516667 91 92 93 94 95 -499.9516667 1285.4483333 -283.9516667 -1161.6516667 1109.6483333 96 97 98 99 100 -1104.6516667 -1208.9516667 852.9483333 760.7483333 642.8483333 101 102 103 104 105 1296.0483333 -126.5516667 518.1483333 2295.5483333 1032.9483333 106 107 108 109 110 410.2483333 1575.8483333 -742.5516667 -322.6516667 2020.0483333 111 112 113 114 115 893.1483333 2357.2483333 2651.8483333 1811.1483333 1941.8483333 116 117 118 119 120 4592.4483333 1346.1483333 2456.0483333 2611.1483333 589.5483333 121 957.1483333 > postscript(file="/var/www/html/freestat/rcomp/tmp/64rne1229349354.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 = 121 Frequency = 1 lag(myerror, k = 1) myerror 0 -2690.5606557 NA 1 -1129.5606557 -2690.5606557 2 -839.9606557 -1129.5606557 3 -1849.3606557 -839.9606557 4 -1436.6606557 -1849.3606557 5 -1646.3606557 -1436.6606557 6 -1154.3606557 -1646.3606557 7 -567.6606557 -1154.3606557 8 -713.8606557 -567.6606557 9 -1252.3606557 -713.8606557 10 -498.2606557 -1252.3606557 11 -1758.8606557 -498.2606557 12 -2350.9606557 -1758.8606557 13 -603.4606557 -2350.9606557 14 -278.2606557 -603.4606557 15 -1078.3606557 -278.2606557 16 -336.7606557 -1078.3606557 17 -1244.0606557 -336.7606557 18 -556.8606557 -1244.0606557 19 123.6393443 -556.8606557 20 -473.8606557 123.6393443 21 -1079.9606557 -473.8606557 22 125.6393443 -1079.9606557 23 -1165.3606557 125.6393443 24 -1693.6606557 -1165.3606557 25 100.6393443 -1693.6606557 26 -216.4606557 100.6393443 27 -432.2606557 -216.4606557 28 -591.4606557 -432.2606557 29 -1579.2606557 -591.4606557 30 -1014.8606557 -1579.2606557 31 513.0393443 -1014.8606557 32 -760.3606557 513.0393443 33 -928.8606557 -760.3606557 34 337.9393443 -928.8606557 35 -1373.3606557 337.9393443 36 -1214.4606557 -1373.3606557 37 360.2393443 -1214.4606557 38 414.3393443 360.2393443 39 502.0393443 414.3393443 40 1037.6393443 502.0393443 41 -75.5606557 1037.6393443 42 1392.8393443 -75.5606557 43 2586.1393443 1392.8393443 44 360.0393443 2586.1393443 45 1840.9393443 360.0393443 46 1199.3393443 1840.9393443 47 189.9393443 1199.3393443 48 397.5393443 189.9393443 49 1903.4393443 397.5393443 50 1954.9393443 1903.4393443 51 2693.5393443 1954.9393443 52 2149.8393443 2693.5393443 53 2132.1393443 2149.8393443 54 2209.8393443 2132.1393443 55 3076.0393443 2209.8393443 56 1731.2393443 3076.0393443 57 2309.3393443 1731.2393443 58 2235.7393443 2309.3393443 59 511.6393443 2235.7393443 60 196.6393443 511.6393443 61 -1051.9516667 196.6393443 62 -849.4516667 -1051.9516667 63 -1231.0516667 -849.4516667 64 -1703.6516667 -1231.0516667 65 -1738.9516667 -1703.6516667 66 -1449.3516667 -1738.9516667 67 -228.4516667 -1449.3516667 68 -863.6516667 -228.4516667 69 -1053.7516667 -863.6516667 70 -1087.8516667 -1053.7516667 71 -1721.2516667 -1087.8516667 72 -2734.8516667 -1721.2516667 73 -786.5516667 -2734.8516667 74 0.2483333 -786.5516667 75 -1114.8516667 0.2483333 76 -638.9516667 -1114.8516667 77 -974.7516667 -638.9516667 78 -768.1516667 -974.7516667 79 53.5483333 -768.1516667 80 -863.6516667 53.5483333 81 -1577.6516667 -863.6516667 82 -851.0516667 -1577.6516667 83 -1636.1516667 -851.0516667 84 -2985.1516667 -1636.1516667 85 -560.1516667 -2985.1516667 86 231.8483333 -560.1516667 87 -939.3516667 231.8483333 88 -286.4516667 -939.3516667 89 -1145.8516667 -286.4516667 90 -499.9516667 -1145.8516667 91 1285.4483333 -499.9516667 92 -283.9516667 1285.4483333 93 -1161.6516667 -283.9516667 94 1109.6483333 -1161.6516667 95 -1104.6516667 1109.6483333 96 -1208.9516667 -1104.6516667 97 852.9483333 -1208.9516667 98 760.7483333 852.9483333 99 642.8483333 760.7483333 100 1296.0483333 642.8483333 101 -126.5516667 1296.0483333 102 518.1483333 -126.5516667 103 2295.5483333 518.1483333 104 1032.9483333 2295.5483333 105 410.2483333 1032.9483333 106 1575.8483333 410.2483333 107 -742.5516667 1575.8483333 108 -322.6516667 -742.5516667 109 2020.0483333 -322.6516667 110 893.1483333 2020.0483333 111 2357.2483333 893.1483333 112 2651.8483333 2357.2483333 113 1811.1483333 2651.8483333 114 1941.8483333 1811.1483333 115 4592.4483333 1941.8483333 116 1346.1483333 4592.4483333 117 2456.0483333 1346.1483333 118 2611.1483333 2456.0483333 119 589.5483333 2611.1483333 120 957.1483333 589.5483333 121 NA 957.1483333 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -1129.5606557 -2690.5606557 [2,] -839.9606557 -1129.5606557 [3,] -1849.3606557 -839.9606557 [4,] -1436.6606557 -1849.3606557 [5,] -1646.3606557 -1436.6606557 [6,] -1154.3606557 -1646.3606557 [7,] -567.6606557 -1154.3606557 [8,] -713.8606557 -567.6606557 [9,] -1252.3606557 -713.8606557 [10,] -498.2606557 -1252.3606557 [11,] -1758.8606557 -498.2606557 [12,] -2350.9606557 -1758.8606557 [13,] -603.4606557 -2350.9606557 [14,] -278.2606557 -603.4606557 [15,] -1078.3606557 -278.2606557 [16,] -336.7606557 -1078.3606557 [17,] -1244.0606557 -336.7606557 [18,] -556.8606557 -1244.0606557 [19,] 123.6393443 -556.8606557 [20,] -473.8606557 123.6393443 [21,] -1079.9606557 -473.8606557 [22,] 125.6393443 -1079.9606557 [23,] -1165.3606557 125.6393443 [24,] -1693.6606557 -1165.3606557 [25,] 100.6393443 -1693.6606557 [26,] -216.4606557 100.6393443 [27,] -432.2606557 -216.4606557 [28,] -591.4606557 -432.2606557 [29,] -1579.2606557 -591.4606557 [30,] -1014.8606557 -1579.2606557 [31,] 513.0393443 -1014.8606557 [32,] -760.3606557 513.0393443 [33,] -928.8606557 -760.3606557 [34,] 337.9393443 -928.8606557 [35,] -1373.3606557 337.9393443 [36,] -1214.4606557 -1373.3606557 [37,] 360.2393443 -1214.4606557 [38,] 414.3393443 360.2393443 [39,] 502.0393443 414.3393443 [40,] 1037.6393443 502.0393443 [41,] -75.5606557 1037.6393443 [42,] 1392.8393443 -75.5606557 [43,] 2586.1393443 1392.8393443 [44,] 360.0393443 2586.1393443 [45,] 1840.9393443 360.0393443 [46,] 1199.3393443 1840.9393443 [47,] 189.9393443 1199.3393443 [48,] 397.5393443 189.9393443 [49,] 1903.4393443 397.5393443 [50,] 1954.9393443 1903.4393443 [51,] 2693.5393443 1954.9393443 [52,] 2149.8393443 2693.5393443 [53,] 2132.1393443 2149.8393443 [54,] 2209.8393443 2132.1393443 [55,] 3076.0393443 2209.8393443 [56,] 1731.2393443 3076.0393443 [57,] 2309.3393443 1731.2393443 [58,] 2235.7393443 2309.3393443 [59,] 511.6393443 2235.7393443 [60,] 196.6393443 511.6393443 [61,] -1051.9516667 196.6393443 [62,] -849.4516667 -1051.9516667 [63,] -1231.0516667 -849.4516667 [64,] -1703.6516667 -1231.0516667 [65,] -1738.9516667 -1703.6516667 [66,] -1449.3516667 -1738.9516667 [67,] -228.4516667 -1449.3516667 [68,] -863.6516667 -228.4516667 [69,] -1053.7516667 -863.6516667 [70,] -1087.8516667 -1053.7516667 [71,] -1721.2516667 -1087.8516667 [72,] -2734.8516667 -1721.2516667 [73,] -786.5516667 -2734.8516667 [74,] 0.2483333 -786.5516667 [75,] -1114.8516667 0.2483333 [76,] -638.9516667 -1114.8516667 [77,] -974.7516667 -638.9516667 [78,] -768.1516667 -974.7516667 [79,] 53.5483333 -768.1516667 [80,] -863.6516667 53.5483333 [81,] -1577.6516667 -863.6516667 [82,] -851.0516667 -1577.6516667 [83,] -1636.1516667 -851.0516667 [84,] -2985.1516667 -1636.1516667 [85,] -560.1516667 -2985.1516667 [86,] 231.8483333 -560.1516667 [87,] -939.3516667 231.8483333 [88,] -286.4516667 -939.3516667 [89,] -1145.8516667 -286.4516667 [90,] -499.9516667 -1145.8516667 [91,] 1285.4483333 -499.9516667 [92,] -283.9516667 1285.4483333 [93,] -1161.6516667 -283.9516667 [94,] 1109.6483333 -1161.6516667 [95,] -1104.6516667 1109.6483333 [96,] -1208.9516667 -1104.6516667 [97,] 852.9483333 -1208.9516667 [98,] 760.7483333 852.9483333 [99,] 642.8483333 760.7483333 [100,] 1296.0483333 642.8483333 [101,] -126.5516667 1296.0483333 [102,] 518.1483333 -126.5516667 [103,] 2295.5483333 518.1483333 [104,] 1032.9483333 2295.5483333 [105,] 410.2483333 1032.9483333 [106,] 1575.8483333 410.2483333 [107,] -742.5516667 1575.8483333 [108,] -322.6516667 -742.5516667 [109,] 2020.0483333 -322.6516667 [110,] 893.1483333 2020.0483333 [111,] 2357.2483333 893.1483333 [112,] 2651.8483333 2357.2483333 [113,] 1811.1483333 2651.8483333 [114,] 1941.8483333 1811.1483333 [115,] 4592.4483333 1941.8483333 [116,] 1346.1483333 4592.4483333 [117,] 2456.0483333 1346.1483333 [118,] 2611.1483333 2456.0483333 [119,] 589.5483333 2611.1483333 [120,] 957.1483333 589.5483333 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -1129.5606557 -2690.5606557 2 -839.9606557 -1129.5606557 3 -1849.3606557 -839.9606557 4 -1436.6606557 -1849.3606557 5 -1646.3606557 -1436.6606557 6 -1154.3606557 -1646.3606557 7 -567.6606557 -1154.3606557 8 -713.8606557 -567.6606557 9 -1252.3606557 -713.8606557 10 -498.2606557 -1252.3606557 11 -1758.8606557 -498.2606557 12 -2350.9606557 -1758.8606557 13 -603.4606557 -2350.9606557 14 -278.2606557 -603.4606557 15 -1078.3606557 -278.2606557 16 -336.7606557 -1078.3606557 17 -1244.0606557 -336.7606557 18 -556.8606557 -1244.0606557 19 123.6393443 -556.8606557 20 -473.8606557 123.6393443 21 -1079.9606557 -473.8606557 22 125.6393443 -1079.9606557 23 -1165.3606557 125.6393443 24 -1693.6606557 -1165.3606557 25 100.6393443 -1693.6606557 26 -216.4606557 100.6393443 27 -432.2606557 -216.4606557 28 -591.4606557 -432.2606557 29 -1579.2606557 -591.4606557 30 -1014.8606557 -1579.2606557 31 513.0393443 -1014.8606557 32 -760.3606557 513.0393443 33 -928.8606557 -760.3606557 34 337.9393443 -928.8606557 35 -1373.3606557 337.9393443 36 -1214.4606557 -1373.3606557 37 360.2393443 -1214.4606557 38 414.3393443 360.2393443 39 502.0393443 414.3393443 40 1037.6393443 502.0393443 41 -75.5606557 1037.6393443 42 1392.8393443 -75.5606557 43 2586.1393443 1392.8393443 44 360.0393443 2586.1393443 45 1840.9393443 360.0393443 46 1199.3393443 1840.9393443 47 189.9393443 1199.3393443 48 397.5393443 189.9393443 49 1903.4393443 397.5393443 50 1954.9393443 1903.4393443 51 2693.5393443 1954.9393443 52 2149.8393443 2693.5393443 53 2132.1393443 2149.8393443 54 2209.8393443 2132.1393443 55 3076.0393443 2209.8393443 56 1731.2393443 3076.0393443 57 2309.3393443 1731.2393443 58 2235.7393443 2309.3393443 59 511.6393443 2235.7393443 60 196.6393443 511.6393443 61 -1051.9516667 196.6393443 62 -849.4516667 -1051.9516667 63 -1231.0516667 -849.4516667 64 -1703.6516667 -1231.0516667 65 -1738.9516667 -1703.6516667 66 -1449.3516667 -1738.9516667 67 -228.4516667 -1449.3516667 68 -863.6516667 -228.4516667 69 -1053.7516667 -863.6516667 70 -1087.8516667 -1053.7516667 71 -1721.2516667 -1087.8516667 72 -2734.8516667 -1721.2516667 73 -786.5516667 -2734.8516667 74 0.2483333 -786.5516667 75 -1114.8516667 0.2483333 76 -638.9516667 -1114.8516667 77 -974.7516667 -638.9516667 78 -768.1516667 -974.7516667 79 53.5483333 -768.1516667 80 -863.6516667 53.5483333 81 -1577.6516667 -863.6516667 82 -851.0516667 -1577.6516667 83 -1636.1516667 -851.0516667 84 -2985.1516667 -1636.1516667 85 -560.1516667 -2985.1516667 86 231.8483333 -560.1516667 87 -939.3516667 231.8483333 88 -286.4516667 -939.3516667 89 -1145.8516667 -286.4516667 90 -499.9516667 -1145.8516667 91 1285.4483333 -499.9516667 92 -283.9516667 1285.4483333 93 -1161.6516667 -283.9516667 94 1109.6483333 -1161.6516667 95 -1104.6516667 1109.6483333 96 -1208.9516667 -1104.6516667 97 852.9483333 -1208.9516667 98 760.7483333 852.9483333 99 642.8483333 760.7483333 100 1296.0483333 642.8483333 101 -126.5516667 1296.0483333 102 518.1483333 -126.5516667 103 2295.5483333 518.1483333 104 1032.9483333 2295.5483333 105 410.2483333 1032.9483333 106 1575.8483333 410.2483333 107 -742.5516667 1575.8483333 108 -322.6516667 -742.5516667 109 2020.0483333 -322.6516667 110 893.1483333 2020.0483333 111 2357.2483333 893.1483333 112 2651.8483333 2357.2483333 113 1811.1483333 2651.8483333 114 1941.8483333 1811.1483333 115 4592.4483333 1941.8483333 116 1346.1483333 4592.4483333 117 2456.0483333 1346.1483333 118 2611.1483333 2456.0483333 119 589.5483333 2611.1483333 120 957.1483333 589.5483333 > 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/freestat/rcomp/tmp/7ih1a1229349354.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/freestat/rcomp/tmp/8jps01229349354.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/freestat/rcomp/tmp/9l3uc1229349354.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/freestat/rcomp/tmp/10dn6l1229349354.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/freestat/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/html/freestat/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/freestat/rcomp/tmp/11dmv41229349354.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/freestat/rcomp/tmp/12sqjb1229349354.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/freestat/rcomp/tmp/135w7k1229349355.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/freestat/rcomp/tmp/149phr1229349355.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/freestat/rcomp/tmp/15hbhl1229349355.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/freestat/rcomp/tmp/1639301229349355.tab") + } > > system("convert tmp/1qcia1229349354.ps tmp/1qcia1229349354.png") > system("convert tmp/250lo1229349354.ps tmp/250lo1229349354.png") > system("convert tmp/3ki741229349354.ps tmp/3ki741229349354.png") > system("convert tmp/4h8u21229349354.ps tmp/4h8u21229349354.png") > system("convert tmp/5y5cv1229349354.ps tmp/5y5cv1229349354.png") > system("convert tmp/64rne1229349354.ps tmp/64rne1229349354.png") > system("convert tmp/7ih1a1229349354.ps tmp/7ih1a1229349354.png") > system("convert tmp/8jps01229349354.ps tmp/8jps01229349354.png") > system("convert tmp/9l3uc1229349354.ps tmp/9l3uc1229349354.png") > system("convert tmp/10dn6l1229349354.ps tmp/10dn6l1229349354.png") > > > proc.time() user system elapsed 4.510 2.584 4.953