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(423.4 + ,0 + ,404.1 + ,0 + ,500 + ,0 + ,472.6 + ,0 + ,496.1 + ,0 + ,562 + ,0 + ,434.8 + ,0 + ,538.2 + ,0 + ,577.6 + ,0 + ,518.1 + ,0 + ,625.2 + ,0 + ,561.2 + ,0 + ,523.3 + ,0 + ,536.1 + ,0 + ,607.3 + ,0 + ,637.3 + ,0 + ,606.9 + ,0 + ,652.9 + ,0 + ,617.2 + ,0 + ,670.4 + ,0 + ,729.9 + ,0 + ,677.2 + ,0 + ,710 + ,0 + ,844.3 + ,0 + ,748.2 + ,0 + ,653.9 + ,0 + ,742.6 + ,0 + ,854.2 + ,0 + ,808.4 + ,0 + ,1819 + ,1 + ,1936.5 + ,1 + ,1966.1 + ,1 + ,2083.1 + ,1 + ,1620.1 + ,1 + ,1527.6 + ,1 + ,1795 + ,1 + ,1685.1 + ,1 + ,1851.8 + ,1 + ,2164.4 + ,1 + ,1981.8 + ,1 + ,1726.5 + ,1 + ,2144.6 + ,1 + ,1758.2 + ,1 + ,1672.9 + ,1 + ,1837.3 + ,1 + ,1596.1 + ,1 + ,1446 + ,1 + ,1898.4 + ,1 + ,1964.1 + ,1 + ,1755.9 + ,1 + ,2255.3 + ,1 + ,1881.2 + ,1 + ,2117.9 + ,1 + ,1656.5 + ,1 + ,1544.1 + ,1 + ,2098.9 + ,1 + ,2133.3 + ,1 + ,1963.5 + ,1 + ,1801.2 + ,1 + ,2365.4 + ,1 + ,1936.5 + ,1 + ,1667.6 + ,1 + ,1983.5 + ,1 + ,2058.6 + ,1 + ,2448.3 + ,1 + ,1858.1 + ,1 + ,1625.4 + ,1 + ,2130.6 + ,1 + ,2515.7 + ,1 + ,2230.2 + ,1 + ,2086.9 + ,1 + ,2235 + ,1 + ,2100.2 + ,1 + ,2288.6 + ,1 + ,2490 + ,1 + ,2573.7 + ,1 + ,2543.8 + ,1 + ,2004.7 + ,1 + ,2390 + ,1 + ,2338.4 + ,1 + ,2724.5 + ,1 + ,2292.5 + ,1 + ,2386 + ,1 + ,2477.9 + ,1 + ,2337 + ,1 + ,2605.1 + ,1 + ,2560.8 + ,1 + ,2839.3 + ,1 + ,2407.2 + ,1 + ,2085.2 + ,1 + ,2735.6 + ,1 + ,2798.7 + ,1 + ,3053.2 + ,1 + ,2405 + ,1 + ,2471.9 + ,1 + ,2727.3 + ,1 + ,2790.7 + ,1 + ,2385.4 + ,1 + ,3206.6 + ,1 + ,2705.6 + ,1 + ,3518.4 + ,1 + ,1954.9 + ,1 + ,2584.3 + ,1 + ,2535.8 + ,1 + ,2685.9 + ,1 + ,2866 + ,1 + ,2236.6 + ,1 + ,2934.9 + ,1 + ,2668.6 + ,1 + ,2371.2 + ,1 + ,3165.9 + ,1 + ,2887.2 + ,1 + ,3112.2 + ,1 + ,2671.2 + ,1 + ,2432.6 + ,1 + ,2812.3 + ,1 + ,3095.7 + ,1 + ,2862.9 + ,1 + ,2607.3 + ,1 + ,2862.5 + ,1) + ,dim=c(2 + ,120) + ,dimnames=list(c('Y(Export_farma_prod)' + ,'X(sprong)') + ,1:120)) > y <- array(NA,dim=c(2,120),dimnames=list(c('Y(Export_farma_prod)','X(sprong)'),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 = '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(Export_farma_prod) X(sprong) t 1 423.4 0 1 2 404.1 0 2 3 500.0 0 3 4 472.6 0 4 5 496.1 0 5 6 562.0 0 6 7 434.8 0 7 8 538.2 0 8 9 577.6 0 9 10 518.1 0 10 11 625.2 0 11 12 561.2 0 12 13 523.3 0 13 14 536.1 0 14 15 607.3 0 15 16 637.3 0 16 17 606.9 0 17 18 652.9 0 18 19 617.2 0 19 20 670.4 0 20 21 729.9 0 21 22 677.2 0 22 23 710.0 0 23 24 844.3 0 24 25 748.2 0 25 26 653.9 0 26 27 742.6 0 27 28 854.2 0 28 29 808.4 0 29 30 1819.0 1 30 31 1936.5 1 31 32 1966.1 1 32 33 2083.1 1 33 34 1620.1 1 34 35 1527.6 1 35 36 1795.0 1 36 37 1685.1 1 37 38 1851.8 1 38 39 2164.4 1 39 40 1981.8 1 40 41 1726.5 1 41 42 2144.6 1 42 43 1758.2 1 43 44 1672.9 1 44 45 1837.3 1 45 46 1596.1 1 46 47 1446.0 1 47 48 1898.4 1 48 49 1964.1 1 49 50 1755.9 1 50 51 2255.3 1 51 52 1881.2 1 52 53 2117.9 1 53 54 1656.5 1 54 55 1544.1 1 55 56 2098.9 1 56 57 2133.3 1 57 58 1963.5 1 58 59 1801.2 1 59 60 2365.4 1 60 61 1936.5 1 61 62 1667.6 1 62 63 1983.5 1 63 64 2058.6 1 64 65 2448.3 1 65 66 1858.1 1 66 67 1625.4 1 67 68 2130.6 1 68 69 2515.7 1 69 70 2230.2 1 70 71 2086.9 1 71 72 2235.0 1 72 73 2100.2 1 73 74 2288.6 1 74 75 2490.0 1 75 76 2573.7 1 76 77 2543.8 1 77 78 2004.7 1 78 79 2390.0 1 79 80 2338.4 1 80 81 2724.5 1 81 82 2292.5 1 82 83 2386.0 1 83 84 2477.9 1 84 85 2337.0 1 85 86 2605.1 1 86 87 2560.8 1 87 88 2839.3 1 88 89 2407.2 1 89 90 2085.2 1 90 91 2735.6 1 91 92 2798.7 1 92 93 3053.2 1 93 94 2405.0 1 94 95 2471.9 1 95 96 2727.3 1 96 97 2790.7 1 97 98 2385.4 1 98 99 3206.6 1 99 100 2705.6 1 100 101 3518.4 1 101 102 1954.9 1 102 103 2584.3 1 103 104 2535.8 1 104 105 2685.9 1 105 106 2866.0 1 106 107 2236.6 1 107 108 2934.9 1 108 109 2668.6 1 109 110 2371.2 1 110 111 3165.9 1 111 112 2887.2 1 112 113 3112.2 1 113 114 2671.2 1 114 115 2432.6 1 115 116 2812.3 1 116 117 3095.7 1 117 118 2862.9 1 118 119 2607.3 1 119 120 2862.5 1 120 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) `X(sprong)` t 404.66 851.45 13.79 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -707.68 -94.20 -10.92 114.27 869.61 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 404.6621 46.1890 8.761 1.77e-14 *** `X(sprong)` 851.4460 75.3517 11.300 < 2e-16 *** t 13.7890 0.9312 14.807 < 2e-16 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 237.1 on 117 degrees of freedom Multiple R-squared: 0.9187, Adjusted R-squared: 0.9173 F-statistic: 660.9 on 2 and 117 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,] 4.038937e-03 8.077874e-03 0.9959611 [2,] 6.052871e-03 1.210574e-02 0.9939471 [3,] 1.254413e-03 2.508825e-03 0.9987456 [4,] 2.747361e-04 5.494721e-04 0.9997253 [5,] 7.300373e-05 1.460075e-04 0.9999270 [6,] 2.165537e-05 4.331073e-05 0.9999783 [7,] 4.937423e-06 9.874847e-06 0.9999951 [8,] 2.388014e-06 4.776028e-06 0.9999976 [9,] 7.242556e-07 1.448511e-06 0.9999993 [10,] 1.395745e-07 2.791490e-07 0.9999999 [11,] 2.974095e-08 5.948190e-08 1.0000000 [12,] 5.361001e-09 1.072200e-08 1.0000000 [13,] 9.807393e-10 1.961479e-09 1.0000000 [14,] 1.908641e-10 3.817283e-10 1.0000000 [15,] 3.242326e-11 6.484652e-11 1.0000000 [16,] 1.242608e-11 2.485215e-11 1.0000000 [17,] 2.018662e-12 4.037325e-12 1.0000000 [18,] 3.145108e-13 6.290216e-13 1.0000000 [19,] 1.860220e-12 3.720440e-12 1.0000000 [20,] 3.201759e-13 6.403519e-13 1.0000000 [21,] 4.325539e-13 8.651078e-13 1.0000000 [22,] 8.108679e-14 1.621736e-13 1.0000000 [23,] 5.062400e-14 1.012480e-13 1.0000000 [24,] 9.498402e-15 1.899680e-14 1.0000000 [25,] 1.751829e-15 3.503657e-15 1.0000000 [26,] 1.045364e-15 2.090728e-15 1.0000000 [27,] 4.109330e-16 8.218660e-16 1.0000000 [28,] 2.088464e-15 4.176928e-15 1.0000000 [29,] 2.972021e-11 5.944043e-11 1.0000000 [30,] 1.062841e-08 2.125682e-08 1.0000000 [31,] 4.663528e-09 9.327056e-09 1.0000000 [32,] 5.573663e-09 1.114733e-08 1.0000000 [33,] 2.063832e-09 4.127664e-09 1.0000000 [34,] 1.968489e-08 3.936977e-08 1.0000000 [35,] 1.009790e-08 2.019580e-08 1.0000000 [36,] 1.376667e-08 2.753335e-08 1.0000000 [37,] 2.977645e-08 5.955290e-08 1.0000000 [38,] 3.412517e-08 6.825035e-08 1.0000000 [39,] 9.242099e-08 1.848420e-07 0.9999999 [40,] 5.039495e-08 1.007899e-07 0.9999999 [41,] 2.861881e-07 5.723762e-07 0.9999997 [42,] 7.512935e-06 1.502587e-05 0.9999925 [43,] 3.818793e-06 7.637586e-06 0.9999962 [44,] 2.051784e-06 4.103569e-06 0.9999979 [45,] 1.531908e-06 3.063815e-06 0.9999985 [46,] 5.254565e-06 1.050913e-05 0.9999947 [47,] 2.848165e-06 5.696331e-06 0.9999972 [48,] 2.284541e-06 4.569082e-06 0.9999977 [49,] 5.050028e-06 1.010006e-05 0.9999949 [50,] 2.816433e-05 5.632867e-05 0.9999718 [51,] 2.096610e-05 4.193220e-05 0.9999790 [52,] 1.645410e-05 3.290820e-05 0.9999835 [53,] 9.043849e-06 1.808770e-05 0.9999910 [54,] 8.172253e-06 1.634451e-05 0.9999918 [55,] 2.399069e-05 4.798137e-05 0.9999760 [56,] 1.489964e-05 2.979929e-05 0.9999851 [57,] 4.337577e-05 8.675153e-05 0.9999566 [58,] 2.674881e-05 5.349762e-05 0.9999733 [59,] 1.592202e-05 3.184403e-05 0.9999841 [60,] 4.933849e-05 9.867698e-05 0.9999507 [61,] 5.492163e-05 1.098433e-04 0.9999451 [62,] 3.751155e-04 7.502309e-04 0.9996249 [63,] 2.642930e-04 5.285861e-04 0.9997357 [64,] 6.765278e-04 1.353056e-03 0.9993235 [65,] 4.767695e-04 9.535389e-04 0.9995232 [66,] 3.540181e-04 7.080363e-04 0.9996460 [67,] 2.435975e-04 4.871950e-04 0.9997564 [68,] 1.928126e-04 3.856253e-04 0.9998072 [69,] 1.362958e-04 2.725916e-04 0.9998637 [70,] 1.516082e-04 3.032164e-04 0.9998484 [71,] 2.129603e-04 4.259205e-04 0.9997870 [72,] 2.220855e-04 4.441711e-04 0.9997779 [73,] 3.648760e-04 7.297521e-04 0.9996351 [74,] 2.438499e-04 4.876998e-04 0.9997562 [75,] 1.602524e-04 3.205048e-04 0.9998397 [76,] 2.786877e-04 5.573754e-04 0.9997213 [77,] 1.973397e-04 3.946794e-04 0.9998027 [78,] 1.258402e-04 2.516804e-04 0.9998742 [79,] 7.860270e-05 1.572054e-04 0.9999214 [80,] 5.656173e-05 1.131235e-04 0.9999434 [81,] 3.951755e-05 7.903510e-05 0.9999605 [82,] 2.412468e-05 4.824936e-05 0.9999759 [83,] 3.806728e-05 7.613456e-05 0.9999619 [84,] 2.476695e-05 4.953390e-05 0.9999752 [85,] 1.221023e-04 2.442047e-04 0.9998779 [86,] 9.103360e-05 1.820672e-04 0.9999090 [87,] 7.674945e-05 1.534989e-04 0.9999233 [88,] 2.611503e-04 5.223007e-04 0.9997388 [89,] 2.105750e-04 4.211501e-04 0.9997894 [90,] 1.494853e-04 2.989706e-04 0.9998505 [91,] 8.727561e-05 1.745512e-04 0.9999127 [92,] 5.496534e-05 1.099307e-04 0.9999450 [93,] 6.291573e-05 1.258315e-04 0.9999371 [94,] 3.769718e-04 7.539437e-04 0.9996230 [95,] 2.080301e-04 4.160602e-04 0.9997920 [96,] 5.140430e-02 1.028086e-01 0.9485957 [97,] 2.474730e-01 4.949461e-01 0.7525270 [98,] 1.935945e-01 3.871890e-01 0.8064055 [99,] 1.563009e-01 3.126018e-01 0.8436991 [100,] 1.123882e-01 2.247765e-01 0.8876118 [101,] 9.367145e-02 1.873429e-01 0.9063286 [102,] 2.235219e-01 4.470439e-01 0.7764781 [103,] 1.819467e-01 3.638934e-01 0.8180533 [104,] 1.325373e-01 2.650746e-01 0.8674627 [105,] 3.535719e-01 7.071439e-01 0.6464281 [106,] 3.564153e-01 7.128306e-01 0.6435847 [107,] 2.499960e-01 4.999920e-01 0.7500040 [108,] 3.769735e-01 7.539471e-01 0.6230265 [109,] 2.395201e-01 4.790401e-01 0.7604799 > postscript(file="/var/www/html/rcomp/tmp/1w49c1258767904.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/22v6k1258767904.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/3mahc1258767904.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/4jjxz1258767904.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/5meol1258767904.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 4.94891264 -28.14004910 53.97098916 12.78202742 22.49306568 6 7 8 9 10 74.60410394 -66.38485780 23.22618046 48.83721872 -24.45174302 11 12 13 14 15 68.85929524 -8.92966650 -60.61862824 -61.60758998 -4.19655172 16 17 18 19 20 12.01448654 -32.17447520 0.03656306 -49.45239868 -10.04136043 21 22 23 24 25 35.66967783 -30.81928391 -11.80824565 108.70279261 -1.18616913 26 27 28 29 30 -109.27513087 -34.36409261 63.44694565 3.85798391 149.22305853 31 32 33 34 35 252.93409679 268.74513505 371.95617331 -104.83278843 -211.12175017 36 37 38 39 40 42.48928809 -81.19967365 71.71136461 370.52240287 174.13344113 41 42 43 44 45 -94.95552061 309.35551765 -90.83344409 -189.92240583 -39.31136757 46 47 48 49 50 -294.30032931 -458.18929105 -19.57825279 32.33278547 -189.65617628 51 52 53 54 55 295.95486198 -91.93409976 130.97693850 -344.21202324 -470.40098498 56 57 58 59 60 70.61005328 91.22109154 -92.36787020 -268.45683194 281.95420632 61 62 63 64 65 -160.73475542 -443.42371716 -141.31267890 -80.00164064 295.90939762 66 67 68 69 70 -308.07956412 -554.56852586 -63.15748760 308.15355066 8.86458892 71 72 73 74 75 -148.22437282 -13.91333456 -162.50229630 12.10874196 199.71978022 76 77 78 79 80 269.63081848 225.94185674 -326.94710500 44.56393326 -20.82502848 81 82 83 84 85 351.48600978 -94.30295196 -14.59191370 63.51912456 -91.16983718 86 87 88 89 90 163.14120108 105.05223934 369.76327760 -76.12568414 -411.91464588 91 92 93 94 95 224.69639238 274.00743064 514.71846890 -147.27049284 -94.15945458 96 97 98 99 100 147.45158368 197.06262194 -222.02633980 585.38469845 70.59573671 101 102 103 104 105 869.60677497 -707.68218677 -92.07114851 -154.36011025 -18.04907199 106 107 108 109 110 148.26196627 -494.92699547 189.58404279 -90.50491895 -401.69388069 111 112 113 114 115 379.21715757 86.72819583 297.93923409 -156.84972765 -409.23868939 116 117 118 119 120 -43.32765113 226.28338713 -20.30557461 -289.69453635 -48.28349809 > postscript(file="/var/www/html/rcomp/tmp/6ml2h1258767904.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 4.94891264 NA 1 -28.14004910 4.94891264 2 53.97098916 -28.14004910 3 12.78202742 53.97098916 4 22.49306568 12.78202742 5 74.60410394 22.49306568 6 -66.38485780 74.60410394 7 23.22618046 -66.38485780 8 48.83721872 23.22618046 9 -24.45174302 48.83721872 10 68.85929524 -24.45174302 11 -8.92966650 68.85929524 12 -60.61862824 -8.92966650 13 -61.60758998 -60.61862824 14 -4.19655172 -61.60758998 15 12.01448654 -4.19655172 16 -32.17447520 12.01448654 17 0.03656306 -32.17447520 18 -49.45239868 0.03656306 19 -10.04136043 -49.45239868 20 35.66967783 -10.04136043 21 -30.81928391 35.66967783 22 -11.80824565 -30.81928391 23 108.70279261 -11.80824565 24 -1.18616913 108.70279261 25 -109.27513087 -1.18616913 26 -34.36409261 -109.27513087 27 63.44694565 -34.36409261 28 3.85798391 63.44694565 29 149.22305853 3.85798391 30 252.93409679 149.22305853 31 268.74513505 252.93409679 32 371.95617331 268.74513505 33 -104.83278843 371.95617331 34 -211.12175017 -104.83278843 35 42.48928809 -211.12175017 36 -81.19967365 42.48928809 37 71.71136461 -81.19967365 38 370.52240287 71.71136461 39 174.13344113 370.52240287 40 -94.95552061 174.13344113 41 309.35551765 -94.95552061 42 -90.83344409 309.35551765 43 -189.92240583 -90.83344409 44 -39.31136757 -189.92240583 45 -294.30032931 -39.31136757 46 -458.18929105 -294.30032931 47 -19.57825279 -458.18929105 48 32.33278547 -19.57825279 49 -189.65617628 32.33278547 50 295.95486198 -189.65617628 51 -91.93409976 295.95486198 52 130.97693850 -91.93409976 53 -344.21202324 130.97693850 54 -470.40098498 -344.21202324 55 70.61005328 -470.40098498 56 91.22109154 70.61005328 57 -92.36787020 91.22109154 58 -268.45683194 -92.36787020 59 281.95420632 -268.45683194 60 -160.73475542 281.95420632 61 -443.42371716 -160.73475542 62 -141.31267890 -443.42371716 63 -80.00164064 -141.31267890 64 295.90939762 -80.00164064 65 -308.07956412 295.90939762 66 -554.56852586 -308.07956412 67 -63.15748760 -554.56852586 68 308.15355066 -63.15748760 69 8.86458892 308.15355066 70 -148.22437282 8.86458892 71 -13.91333456 -148.22437282 72 -162.50229630 -13.91333456 73 12.10874196 -162.50229630 74 199.71978022 12.10874196 75 269.63081848 199.71978022 76 225.94185674 269.63081848 77 -326.94710500 225.94185674 78 44.56393326 -326.94710500 79 -20.82502848 44.56393326 80 351.48600978 -20.82502848 81 -94.30295196 351.48600978 82 -14.59191370 -94.30295196 83 63.51912456 -14.59191370 84 -91.16983718 63.51912456 85 163.14120108 -91.16983718 86 105.05223934 163.14120108 87 369.76327760 105.05223934 88 -76.12568414 369.76327760 89 -411.91464588 -76.12568414 90 224.69639238 -411.91464588 91 274.00743064 224.69639238 92 514.71846890 274.00743064 93 -147.27049284 514.71846890 94 -94.15945458 -147.27049284 95 147.45158368 -94.15945458 96 197.06262194 147.45158368 97 -222.02633980 197.06262194 98 585.38469845 -222.02633980 99 70.59573671 585.38469845 100 869.60677497 70.59573671 101 -707.68218677 869.60677497 102 -92.07114851 -707.68218677 103 -154.36011025 -92.07114851 104 -18.04907199 -154.36011025 105 148.26196627 -18.04907199 106 -494.92699547 148.26196627 107 189.58404279 -494.92699547 108 -90.50491895 189.58404279 109 -401.69388069 -90.50491895 110 379.21715757 -401.69388069 111 86.72819583 379.21715757 112 297.93923409 86.72819583 113 -156.84972765 297.93923409 114 -409.23868939 -156.84972765 115 -43.32765113 -409.23868939 116 226.28338713 -43.32765113 117 -20.30557461 226.28338713 118 -289.69453635 -20.30557461 119 -48.28349809 -289.69453635 120 NA -48.28349809 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -28.14004910 4.94891264 [2,] 53.97098916 -28.14004910 [3,] 12.78202742 53.97098916 [4,] 22.49306568 12.78202742 [5,] 74.60410394 22.49306568 [6,] -66.38485780 74.60410394 [7,] 23.22618046 -66.38485780 [8,] 48.83721872 23.22618046 [9,] -24.45174302 48.83721872 [10,] 68.85929524 -24.45174302 [11,] -8.92966650 68.85929524 [12,] -60.61862824 -8.92966650 [13,] -61.60758998 -60.61862824 [14,] -4.19655172 -61.60758998 [15,] 12.01448654 -4.19655172 [16,] -32.17447520 12.01448654 [17,] 0.03656306 -32.17447520 [18,] -49.45239868 0.03656306 [19,] -10.04136043 -49.45239868 [20,] 35.66967783 -10.04136043 [21,] -30.81928391 35.66967783 [22,] -11.80824565 -30.81928391 [23,] 108.70279261 -11.80824565 [24,] -1.18616913 108.70279261 [25,] -109.27513087 -1.18616913 [26,] -34.36409261 -109.27513087 [27,] 63.44694565 -34.36409261 [28,] 3.85798391 63.44694565 [29,] 149.22305853 3.85798391 [30,] 252.93409679 149.22305853 [31,] 268.74513505 252.93409679 [32,] 371.95617331 268.74513505 [33,] -104.83278843 371.95617331 [34,] -211.12175017 -104.83278843 [35,] 42.48928809 -211.12175017 [36,] -81.19967365 42.48928809 [37,] 71.71136461 -81.19967365 [38,] 370.52240287 71.71136461 [39,] 174.13344113 370.52240287 [40,] -94.95552061 174.13344113 [41,] 309.35551765 -94.95552061 [42,] -90.83344409 309.35551765 [43,] -189.92240583 -90.83344409 [44,] -39.31136757 -189.92240583 [45,] -294.30032931 -39.31136757 [46,] -458.18929105 -294.30032931 [47,] -19.57825279 -458.18929105 [48,] 32.33278547 -19.57825279 [49,] -189.65617628 32.33278547 [50,] 295.95486198 -189.65617628 [51,] -91.93409976 295.95486198 [52,] 130.97693850 -91.93409976 [53,] -344.21202324 130.97693850 [54,] -470.40098498 -344.21202324 [55,] 70.61005328 -470.40098498 [56,] 91.22109154 70.61005328 [57,] -92.36787020 91.22109154 [58,] -268.45683194 -92.36787020 [59,] 281.95420632 -268.45683194 [60,] -160.73475542 281.95420632 [61,] -443.42371716 -160.73475542 [62,] -141.31267890 -443.42371716 [63,] -80.00164064 -141.31267890 [64,] 295.90939762 -80.00164064 [65,] -308.07956412 295.90939762 [66,] -554.56852586 -308.07956412 [67,] -63.15748760 -554.56852586 [68,] 308.15355066 -63.15748760 [69,] 8.86458892 308.15355066 [70,] -148.22437282 8.86458892 [71,] -13.91333456 -148.22437282 [72,] -162.50229630 -13.91333456 [73,] 12.10874196 -162.50229630 [74,] 199.71978022 12.10874196 [75,] 269.63081848 199.71978022 [76,] 225.94185674 269.63081848 [77,] -326.94710500 225.94185674 [78,] 44.56393326 -326.94710500 [79,] -20.82502848 44.56393326 [80,] 351.48600978 -20.82502848 [81,] -94.30295196 351.48600978 [82,] -14.59191370 -94.30295196 [83,] 63.51912456 -14.59191370 [84,] -91.16983718 63.51912456 [85,] 163.14120108 -91.16983718 [86,] 105.05223934 163.14120108 [87,] 369.76327760 105.05223934 [88,] -76.12568414 369.76327760 [89,] -411.91464588 -76.12568414 [90,] 224.69639238 -411.91464588 [91,] 274.00743064 224.69639238 [92,] 514.71846890 274.00743064 [93,] -147.27049284 514.71846890 [94,] -94.15945458 -147.27049284 [95,] 147.45158368 -94.15945458 [96,] 197.06262194 147.45158368 [97,] -222.02633980 197.06262194 [98,] 585.38469845 -222.02633980 [99,] 70.59573671 585.38469845 [100,] 869.60677497 70.59573671 [101,] -707.68218677 869.60677497 [102,] -92.07114851 -707.68218677 [103,] -154.36011025 -92.07114851 [104,] -18.04907199 -154.36011025 [105,] 148.26196627 -18.04907199 [106,] -494.92699547 148.26196627 [107,] 189.58404279 -494.92699547 [108,] -90.50491895 189.58404279 [109,] -401.69388069 -90.50491895 [110,] 379.21715757 -401.69388069 [111,] 86.72819583 379.21715757 [112,] 297.93923409 86.72819583 [113,] -156.84972765 297.93923409 [114,] -409.23868939 -156.84972765 [115,] -43.32765113 -409.23868939 [116,] 226.28338713 -43.32765113 [117,] -20.30557461 226.28338713 [118,] -289.69453635 -20.30557461 [119,] -48.28349809 -289.69453635 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -28.14004910 4.94891264 2 53.97098916 -28.14004910 3 12.78202742 53.97098916 4 22.49306568 12.78202742 5 74.60410394 22.49306568 6 -66.38485780 74.60410394 7 23.22618046 -66.38485780 8 48.83721872 23.22618046 9 -24.45174302 48.83721872 10 68.85929524 -24.45174302 11 -8.92966650 68.85929524 12 -60.61862824 -8.92966650 13 -61.60758998 -60.61862824 14 -4.19655172 -61.60758998 15 12.01448654 -4.19655172 16 -32.17447520 12.01448654 17 0.03656306 -32.17447520 18 -49.45239868 0.03656306 19 -10.04136043 -49.45239868 20 35.66967783 -10.04136043 21 -30.81928391 35.66967783 22 -11.80824565 -30.81928391 23 108.70279261 -11.80824565 24 -1.18616913 108.70279261 25 -109.27513087 -1.18616913 26 -34.36409261 -109.27513087 27 63.44694565 -34.36409261 28 3.85798391 63.44694565 29 149.22305853 3.85798391 30 252.93409679 149.22305853 31 268.74513505 252.93409679 32 371.95617331 268.74513505 33 -104.83278843 371.95617331 34 -211.12175017 -104.83278843 35 42.48928809 -211.12175017 36 -81.19967365 42.48928809 37 71.71136461 -81.19967365 38 370.52240287 71.71136461 39 174.13344113 370.52240287 40 -94.95552061 174.13344113 41 309.35551765 -94.95552061 42 -90.83344409 309.35551765 43 -189.92240583 -90.83344409 44 -39.31136757 -189.92240583 45 -294.30032931 -39.31136757 46 -458.18929105 -294.30032931 47 -19.57825279 -458.18929105 48 32.33278547 -19.57825279 49 -189.65617628 32.33278547 50 295.95486198 -189.65617628 51 -91.93409976 295.95486198 52 130.97693850 -91.93409976 53 -344.21202324 130.97693850 54 -470.40098498 -344.21202324 55 70.61005328 -470.40098498 56 91.22109154 70.61005328 57 -92.36787020 91.22109154 58 -268.45683194 -92.36787020 59 281.95420632 -268.45683194 60 -160.73475542 281.95420632 61 -443.42371716 -160.73475542 62 -141.31267890 -443.42371716 63 -80.00164064 -141.31267890 64 295.90939762 -80.00164064 65 -308.07956412 295.90939762 66 -554.56852586 -308.07956412 67 -63.15748760 -554.56852586 68 308.15355066 -63.15748760 69 8.86458892 308.15355066 70 -148.22437282 8.86458892 71 -13.91333456 -148.22437282 72 -162.50229630 -13.91333456 73 12.10874196 -162.50229630 74 199.71978022 12.10874196 75 269.63081848 199.71978022 76 225.94185674 269.63081848 77 -326.94710500 225.94185674 78 44.56393326 -326.94710500 79 -20.82502848 44.56393326 80 351.48600978 -20.82502848 81 -94.30295196 351.48600978 82 -14.59191370 -94.30295196 83 63.51912456 -14.59191370 84 -91.16983718 63.51912456 85 163.14120108 -91.16983718 86 105.05223934 163.14120108 87 369.76327760 105.05223934 88 -76.12568414 369.76327760 89 -411.91464588 -76.12568414 90 224.69639238 -411.91464588 91 274.00743064 224.69639238 92 514.71846890 274.00743064 93 -147.27049284 514.71846890 94 -94.15945458 -147.27049284 95 147.45158368 -94.15945458 96 197.06262194 147.45158368 97 -222.02633980 197.06262194 98 585.38469845 -222.02633980 99 70.59573671 585.38469845 100 869.60677497 70.59573671 101 -707.68218677 869.60677497 102 -92.07114851 -707.68218677 103 -154.36011025 -92.07114851 104 -18.04907199 -154.36011025 105 148.26196627 -18.04907199 106 -494.92699547 148.26196627 107 189.58404279 -494.92699547 108 -90.50491895 189.58404279 109 -401.69388069 -90.50491895 110 379.21715757 -401.69388069 111 86.72819583 379.21715757 112 297.93923409 86.72819583 113 -156.84972765 297.93923409 114 -409.23868939 -156.84972765 115 -43.32765113 -409.23868939 116 226.28338713 -43.32765113 117 -20.30557461 226.28338713 118 -289.69453635 -20.30557461 119 -48.28349809 -289.69453635 > 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/7qp9x1258767904.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/81cgm1258767904.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/90ztl1258767904.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/10d18q1258767904.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/11f5js1258767904.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/1281601258767904.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/13ujii1258767904.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/14e9861258767904.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/15xl1u1258767904.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/16jcq81258767904.tab") + } > system("convert tmp/1w49c1258767904.ps tmp/1w49c1258767904.png") > system("convert tmp/22v6k1258767904.ps tmp/22v6k1258767904.png") > system("convert tmp/3mahc1258767904.ps tmp/3mahc1258767904.png") > system("convert tmp/4jjxz1258767904.ps tmp/4jjxz1258767904.png") > system("convert tmp/5meol1258767904.ps tmp/5meol1258767904.png") > system("convert tmp/6ml2h1258767904.ps tmp/6ml2h1258767904.png") > system("convert tmp/7qp9x1258767904.ps tmp/7qp9x1258767904.png") > system("convert tmp/81cgm1258767904.ps tmp/81cgm1258767904.png") > system("convert tmp/90ztl1258767904.ps tmp/90ztl1258767904.png") > system("convert tmp/10d18q1258767904.ps tmp/10d18q1258767904.png") > > > proc.time() user system elapsed 3.216 1.611 5.738