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 = '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(Export_farma_prod) X(sprong) 1 423.4 0 2 404.1 0 3 500.0 0 4 472.6 0 5 496.1 0 6 562.0 0 7 434.8 0 8 538.2 0 9 577.6 0 10 518.1 0 11 625.2 0 12 561.2 0 13 523.3 0 14 536.1 0 15 607.3 0 16 637.3 0 17 606.9 0 18 652.9 0 19 617.2 0 20 670.4 0 21 729.9 0 22 677.2 0 23 710.0 0 24 844.3 0 25 748.2 0 26 653.9 0 27 742.6 0 28 854.2 0 29 808.4 0 30 1819.0 1 31 1936.5 1 32 1966.1 1 33 2083.1 1 34 1620.1 1 35 1527.6 1 36 1795.0 1 37 1685.1 1 38 1851.8 1 39 2164.4 1 40 1981.8 1 41 1726.5 1 42 2144.6 1 43 1758.2 1 44 1672.9 1 45 1837.3 1 46 1596.1 1 47 1446.0 1 48 1898.4 1 49 1964.1 1 50 1755.9 1 51 2255.3 1 52 1881.2 1 53 2117.9 1 54 1656.5 1 55 1544.1 1 56 2098.9 1 57 2133.3 1 58 1963.5 1 59 1801.2 1 60 2365.4 1 61 1936.5 1 62 1667.6 1 63 1983.5 1 64 2058.6 1 65 2448.3 1 66 1858.1 1 67 1625.4 1 68 2130.6 1 69 2515.7 1 70 2230.2 1 71 2086.9 1 72 2235.0 1 73 2100.2 1 74 2288.6 1 75 2490.0 1 76 2573.7 1 77 2543.8 1 78 2004.7 1 79 2390.0 1 80 2338.4 1 81 2724.5 1 82 2292.5 1 83 2386.0 1 84 2477.9 1 85 2337.0 1 86 2605.1 1 87 2560.8 1 88 2839.3 1 89 2407.2 1 90 2085.2 1 91 2735.6 1 92 2798.7 1 93 3053.2 1 94 2405.0 1 95 2471.9 1 96 2727.3 1 97 2790.7 1 98 2385.4 1 99 3206.6 1 100 2705.6 1 101 3518.4 1 102 1954.9 1 103 2584.3 1 104 2535.8 1 105 2685.9 1 106 2866.0 1 107 2236.6 1 108 2934.9 1 109 2668.6 1 110 2371.2 1 111 3165.9 1 112 2887.2 1 113 3112.2 1 114 2671.2 1 115 2432.6 1 116 2812.3 1 117 3095.7 1 118 2862.9 1 119 2607.3 1 120 2862.5 1 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) `X(sprong)` 611.5 1678.8 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -844.280 -245.155 -2.938 235.278 1228.120 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 611.50 74.32 8.228 2.88e-13 *** `X(sprong)` 1678.78 85.34 19.671 < 2e-16 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 400.2 on 118 degrees of freedom Multiple R-squared: 0.7663, Adjusted R-squared: 0.7643 F-statistic: 386.9 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,] 2.548261e-03 5.096523e-03 0.99745174 [2,] 1.170038e-03 2.340075e-03 0.99882996 [3,] 1.919847e-04 3.839694e-04 0.99980802 [4,] 4.431028e-05 8.862055e-05 0.99995569 [5,] 1.813938e-05 3.627876e-05 0.99998186 [6,] 2.860458e-06 5.720916e-06 0.99999714 [7,] 2.410336e-06 4.820673e-06 0.99999759 [8,] 5.154779e-07 1.030956e-06 0.99999948 [9,] 8.253626e-08 1.650725e-07 0.99999992 [10,] 1.332699e-08 2.665397e-08 0.99999999 [11,] 5.089337e-09 1.017867e-08 0.99999999 [12,] 2.996809e-09 5.993618e-09 1.00000000 [13,] 8.660370e-10 1.732074e-09 1.00000000 [14,] 4.973506e-10 9.947013e-10 1.00000000 [15,] 1.404435e-10 2.808869e-10 1.00000000 [16,] 8.516494e-11 1.703299e-10 1.00000000 [17,] 1.365399e-10 2.730798e-10 1.00000000 [18,] 6.226509e-11 1.245302e-10 1.00000000 [19,] 4.145553e-11 8.291105e-11 1.00000000 [20,] 2.819457e-10 5.638913e-10 1.00000000 [21,] 1.943610e-10 3.887219e-10 1.00000000 [22,] 5.521354e-11 1.104271e-10 1.00000000 [23,] 3.141158e-11 6.282316e-11 1.00000000 [24,] 7.403204e-11 1.480641e-10 1.00000000 [25,] 6.685609e-11 1.337122e-10 1.00000000 [26,] 2.038779e-11 4.077557e-11 1.00000000 [27,] 7.171148e-12 1.434230e-11 1.00000000 [28,] 2.349513e-12 4.699026e-12 1.00000000 [29,] 1.305054e-12 2.610107e-12 1.00000000 [30,] 6.559325e-12 1.311865e-11 1.00000000 [31,] 4.411426e-11 8.822852e-11 1.00000000 [32,] 1.727491e-11 3.454982e-11 1.00000000 [33,] 1.111095e-11 2.222190e-11 1.00000000 [34,] 4.379753e-12 8.759506e-12 1.00000000 [35,] 1.716696e-11 3.433393e-11 1.00000000 [36,] 8.793051e-12 1.758610e-11 1.00000000 [37,] 5.811583e-12 1.162317e-11 1.00000000 [38,] 1.001837e-11 2.003673e-11 1.00000000 [39,] 6.145068e-12 1.229014e-11 1.00000000 [40,] 6.785917e-12 1.357183e-11 1.00000000 [41,] 3.229131e-12 6.458262e-12 1.00000000 [42,] 7.578706e-12 1.515741e-11 1.00000000 [43,] 1.057571e-10 2.115143e-10 1.00000000 [44,] 6.373493e-11 1.274699e-10 1.00000000 [45,] 4.446733e-11 8.893465e-11 1.00000000 [46,] 3.558052e-11 7.116103e-11 1.00000000 [47,] 2.133708e-10 4.267417e-10 1.00000000 [48,] 1.406816e-10 2.813632e-10 1.00000000 [49,] 1.802962e-10 3.605923e-10 1.00000000 [50,] 3.602506e-10 7.205012e-10 1.00000000 [51,] 2.220153e-09 4.440306e-09 1.00000000 [52,] 2.806089e-09 5.612177e-09 1.00000000 [53,] 3.903088e-09 7.806177e-09 1.00000000 [54,] 3.391405e-09 6.782809e-09 1.00000000 [55,] 4.362968e-09 8.725936e-09 1.00000000 [56,] 2.810158e-08 5.620316e-08 0.99999997 [57,] 2.792649e-08 5.585298e-08 0.99999997 [58,] 1.072170e-07 2.144340e-07 0.99999989 [59,] 1.230732e-07 2.461463e-07 0.99999988 [60,] 1.487757e-07 2.975514e-07 0.99999985 [61,] 1.027696e-06 2.055393e-06 0.99999897 [62,] 1.858533e-06 3.717066e-06 0.99999814 [63,] 1.812577e-05 3.625155e-05 0.99998187 [64,] 2.653034e-05 5.306067e-05 0.99997347 [65,] 1.324586e-04 2.649173e-04 0.99986754 [66,] 1.853626e-04 3.707252e-04 0.99981464 [67,] 2.628789e-04 5.257578e-04 0.99973712 [68,] 3.692247e-04 7.384494e-04 0.99963078 [69,] 5.545441e-04 1.109088e-03 0.99944546 [70,] 8.112520e-04 1.622504e-03 0.99918875 [71,] 1.650054e-03 3.300108e-03 0.99834995 [72,] 3.617986e-03 7.235972e-03 0.99638201 [73,] 6.040315e-03 1.208063e-02 0.99395968 [74,] 1.115744e-02 2.231487e-02 0.98884256 [75,] 1.355497e-02 2.710995e-02 0.98644503 [76,] 1.601683e-02 3.203366e-02 0.98398317 [77,] 3.055846e-02 6.111692e-02 0.96944154 [78,] 3.483024e-02 6.966048e-02 0.96516976 [79,] 3.832702e-02 7.665404e-02 0.96167298 [80,] 4.215503e-02 8.431006e-02 0.95784497 [81,] 4.699969e-02 9.399939e-02 0.95300031 [82,] 5.412752e-02 1.082550e-01 0.94587248 [83,] 5.793064e-02 1.158613e-01 0.94206936 [84,] 8.544905e-02 1.708981e-01 0.91455095 [85,] 8.626067e-02 1.725213e-01 0.91373933 [86,] 1.424509e-01 2.849017e-01 0.85754914 [87,] 1.550190e-01 3.100380e-01 0.84498098 [88,] 1.728663e-01 3.457326e-01 0.82713371 [89,] 2.653121e-01 5.306243e-01 0.73468787 [90,] 2.624611e-01 5.249223e-01 0.73753886 [91,] 2.517361e-01 5.034722e-01 0.74826388 [92,] 2.392155e-01 4.784309e-01 0.76078454 [93,] 2.313130e-01 4.626261e-01 0.76868696 [94,] 2.327483e-01 4.654966e-01 0.76725168 [95,] 3.656073e-01 7.312145e-01 0.63439273 [96,] 3.280170e-01 6.560340e-01 0.67198299 [97,] 7.244818e-01 5.510365e-01 0.27551823 [98,] 9.187834e-01 1.624332e-01 0.08121662 [99,] 8.972725e-01 2.054550e-01 0.10272752 [100,] 8.788602e-01 2.422796e-01 0.12113982 [101,] 8.408636e-01 3.182728e-01 0.15913638 [102,] 8.030386e-01 3.939228e-01 0.19696139 [103,] 8.983810e-01 2.032379e-01 0.10161896 [104,] 8.698448e-01 2.603103e-01 0.13015516 [105,] 8.225339e-01 3.549323e-01 0.17746614 [106,] 8.873508e-01 2.252985e-01 0.11264924 [107,] 9.108944e-01 1.782111e-01 0.08910556 [108,] 8.561522e-01 2.876956e-01 0.14384780 [109,] 8.745474e-01 2.509052e-01 0.12545261 [110,] 7.840467e-01 4.319066e-01 0.21595330 [111,] 8.497770e-01 3.004460e-01 0.15022302 > postscript(file="/var/www/html/rcomp/tmp/1yra21258766393.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/2fg881258766393.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/3uchu1258766393.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/48pat1258766393.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/5uo941258766393.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 -188.096552 -207.396552 -111.496552 -138.896552 -115.396552 -49.496552 7 8 9 10 11 12 -176.696552 -73.296552 -33.896552 -93.396552 13.703448 -50.296552 13 14 15 16 17 18 -88.196552 -75.396552 -4.196552 25.803448 -4.596552 41.403448 19 20 21 22 23 24 5.703448 58.903448 118.403448 65.703448 98.503448 232.803448 25 26 27 28 29 30 136.703448 42.403448 131.103448 242.703448 196.903448 -471.280220 31 32 33 34 35 36 -353.780220 -324.180220 -207.180220 -670.180220 -762.680220 -495.280220 37 38 39 40 41 42 -605.180220 -438.480220 -125.880220 -308.480220 -563.780220 -145.680220 43 44 45 46 47 48 -532.080220 -617.380220 -452.980220 -694.180220 -844.280220 -391.880220 49 50 51 52 53 54 -326.180220 -534.380220 -34.980220 -409.080220 -172.380220 -633.780220 55 56 57 58 59 60 -746.180220 -191.380220 -156.980220 -326.780220 -489.080220 75.119780 61 62 63 64 65 66 -353.780220 -622.680220 -306.780220 -231.680220 158.019780 -432.180220 67 68 69 70 71 72 -664.880220 -159.680220 225.419780 -60.080220 -203.380220 -55.280220 73 74 75 76 77 78 -190.080220 -1.680220 199.719780 283.419780 253.519780 -285.580220 79 80 81 82 83 84 99.719780 48.119780 434.219780 2.219780 95.719780 187.619780 85 86 87 88 89 90 46.719780 314.819780 270.519780 549.019780 116.919780 -205.080220 91 92 93 94 95 96 445.319780 508.419780 762.919780 114.719780 181.619780 437.019780 97 98 99 100 101 102 500.419780 95.119780 916.319780 415.319780 1228.119780 -335.380220 103 104 105 106 107 108 294.019780 245.519780 395.619780 575.719780 -53.680220 644.619780 109 110 111 112 113 114 378.319780 80.919780 875.619780 596.919780 821.919780 380.919780 115 116 117 118 119 120 142.319780 522.019780 805.419780 572.619780 317.019780 572.219780 > postscript(file="/var/www/html/rcomp/tmp/623gw1258766393.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 -188.096552 NA 1 -207.396552 -188.096552 2 -111.496552 -207.396552 3 -138.896552 -111.496552 4 -115.396552 -138.896552 5 -49.496552 -115.396552 6 -176.696552 -49.496552 7 -73.296552 -176.696552 8 -33.896552 -73.296552 9 -93.396552 -33.896552 10 13.703448 -93.396552 11 -50.296552 13.703448 12 -88.196552 -50.296552 13 -75.396552 -88.196552 14 -4.196552 -75.396552 15 25.803448 -4.196552 16 -4.596552 25.803448 17 41.403448 -4.596552 18 5.703448 41.403448 19 58.903448 5.703448 20 118.403448 58.903448 21 65.703448 118.403448 22 98.503448 65.703448 23 232.803448 98.503448 24 136.703448 232.803448 25 42.403448 136.703448 26 131.103448 42.403448 27 242.703448 131.103448 28 196.903448 242.703448 29 -471.280220 196.903448 30 -353.780220 -471.280220 31 -324.180220 -353.780220 32 -207.180220 -324.180220 33 -670.180220 -207.180220 34 -762.680220 -670.180220 35 -495.280220 -762.680220 36 -605.180220 -495.280220 37 -438.480220 -605.180220 38 -125.880220 -438.480220 39 -308.480220 -125.880220 40 -563.780220 -308.480220 41 -145.680220 -563.780220 42 -532.080220 -145.680220 43 -617.380220 -532.080220 44 -452.980220 -617.380220 45 -694.180220 -452.980220 46 -844.280220 -694.180220 47 -391.880220 -844.280220 48 -326.180220 -391.880220 49 -534.380220 -326.180220 50 -34.980220 -534.380220 51 -409.080220 -34.980220 52 -172.380220 -409.080220 53 -633.780220 -172.380220 54 -746.180220 -633.780220 55 -191.380220 -746.180220 56 -156.980220 -191.380220 57 -326.780220 -156.980220 58 -489.080220 -326.780220 59 75.119780 -489.080220 60 -353.780220 75.119780 61 -622.680220 -353.780220 62 -306.780220 -622.680220 63 -231.680220 -306.780220 64 158.019780 -231.680220 65 -432.180220 158.019780 66 -664.880220 -432.180220 67 -159.680220 -664.880220 68 225.419780 -159.680220 69 -60.080220 225.419780 70 -203.380220 -60.080220 71 -55.280220 -203.380220 72 -190.080220 -55.280220 73 -1.680220 -190.080220 74 199.719780 -1.680220 75 283.419780 199.719780 76 253.519780 283.419780 77 -285.580220 253.519780 78 99.719780 -285.580220 79 48.119780 99.719780 80 434.219780 48.119780 81 2.219780 434.219780 82 95.719780 2.219780 83 187.619780 95.719780 84 46.719780 187.619780 85 314.819780 46.719780 86 270.519780 314.819780 87 549.019780 270.519780 88 116.919780 549.019780 89 -205.080220 116.919780 90 445.319780 -205.080220 91 508.419780 445.319780 92 762.919780 508.419780 93 114.719780 762.919780 94 181.619780 114.719780 95 437.019780 181.619780 96 500.419780 437.019780 97 95.119780 500.419780 98 916.319780 95.119780 99 415.319780 916.319780 100 1228.119780 415.319780 101 -335.380220 1228.119780 102 294.019780 -335.380220 103 245.519780 294.019780 104 395.619780 245.519780 105 575.719780 395.619780 106 -53.680220 575.719780 107 644.619780 -53.680220 108 378.319780 644.619780 109 80.919780 378.319780 110 875.619780 80.919780 111 596.919780 875.619780 112 821.919780 596.919780 113 380.919780 821.919780 114 142.319780 380.919780 115 522.019780 142.319780 116 805.419780 522.019780 117 572.619780 805.419780 118 317.019780 572.619780 119 572.219780 317.019780 120 NA 572.219780 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -207.396552 -188.096552 [2,] -111.496552 -207.396552 [3,] -138.896552 -111.496552 [4,] -115.396552 -138.896552 [5,] -49.496552 -115.396552 [6,] -176.696552 -49.496552 [7,] -73.296552 -176.696552 [8,] -33.896552 -73.296552 [9,] -93.396552 -33.896552 [10,] 13.703448 -93.396552 [11,] -50.296552 13.703448 [12,] -88.196552 -50.296552 [13,] -75.396552 -88.196552 [14,] -4.196552 -75.396552 [15,] 25.803448 -4.196552 [16,] -4.596552 25.803448 [17,] 41.403448 -4.596552 [18,] 5.703448 41.403448 [19,] 58.903448 5.703448 [20,] 118.403448 58.903448 [21,] 65.703448 118.403448 [22,] 98.503448 65.703448 [23,] 232.803448 98.503448 [24,] 136.703448 232.803448 [25,] 42.403448 136.703448 [26,] 131.103448 42.403448 [27,] 242.703448 131.103448 [28,] 196.903448 242.703448 [29,] -471.280220 196.903448 [30,] -353.780220 -471.280220 [31,] -324.180220 -353.780220 [32,] -207.180220 -324.180220 [33,] -670.180220 -207.180220 [34,] -762.680220 -670.180220 [35,] -495.280220 -762.680220 [36,] -605.180220 -495.280220 [37,] -438.480220 -605.180220 [38,] -125.880220 -438.480220 [39,] -308.480220 -125.880220 [40,] -563.780220 -308.480220 [41,] -145.680220 -563.780220 [42,] -532.080220 -145.680220 [43,] -617.380220 -532.080220 [44,] -452.980220 -617.380220 [45,] -694.180220 -452.980220 [46,] -844.280220 -694.180220 [47,] -391.880220 -844.280220 [48,] -326.180220 -391.880220 [49,] -534.380220 -326.180220 [50,] -34.980220 -534.380220 [51,] -409.080220 -34.980220 [52,] -172.380220 -409.080220 [53,] -633.780220 -172.380220 [54,] -746.180220 -633.780220 [55,] -191.380220 -746.180220 [56,] -156.980220 -191.380220 [57,] -326.780220 -156.980220 [58,] -489.080220 -326.780220 [59,] 75.119780 -489.080220 [60,] -353.780220 75.119780 [61,] -622.680220 -353.780220 [62,] -306.780220 -622.680220 [63,] -231.680220 -306.780220 [64,] 158.019780 -231.680220 [65,] -432.180220 158.019780 [66,] -664.880220 -432.180220 [67,] -159.680220 -664.880220 [68,] 225.419780 -159.680220 [69,] -60.080220 225.419780 [70,] -203.380220 -60.080220 [71,] -55.280220 -203.380220 [72,] -190.080220 -55.280220 [73,] -1.680220 -190.080220 [74,] 199.719780 -1.680220 [75,] 283.419780 199.719780 [76,] 253.519780 283.419780 [77,] -285.580220 253.519780 [78,] 99.719780 -285.580220 [79,] 48.119780 99.719780 [80,] 434.219780 48.119780 [81,] 2.219780 434.219780 [82,] 95.719780 2.219780 [83,] 187.619780 95.719780 [84,] 46.719780 187.619780 [85,] 314.819780 46.719780 [86,] 270.519780 314.819780 [87,] 549.019780 270.519780 [88,] 116.919780 549.019780 [89,] -205.080220 116.919780 [90,] 445.319780 -205.080220 [91,] 508.419780 445.319780 [92,] 762.919780 508.419780 [93,] 114.719780 762.919780 [94,] 181.619780 114.719780 [95,] 437.019780 181.619780 [96,] 500.419780 437.019780 [97,] 95.119780 500.419780 [98,] 916.319780 95.119780 [99,] 415.319780 916.319780 [100,] 1228.119780 415.319780 [101,] -335.380220 1228.119780 [102,] 294.019780 -335.380220 [103,] 245.519780 294.019780 [104,] 395.619780 245.519780 [105,] 575.719780 395.619780 [106,] -53.680220 575.719780 [107,] 644.619780 -53.680220 [108,] 378.319780 644.619780 [109,] 80.919780 378.319780 [110,] 875.619780 80.919780 [111,] 596.919780 875.619780 [112,] 821.919780 596.919780 [113,] 380.919780 821.919780 [114,] 142.319780 380.919780 [115,] 522.019780 142.319780 [116,] 805.419780 522.019780 [117,] 572.619780 805.419780 [118,] 317.019780 572.619780 [119,] 572.219780 317.019780 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -207.396552 -188.096552 2 -111.496552 -207.396552 3 -138.896552 -111.496552 4 -115.396552 -138.896552 5 -49.496552 -115.396552 6 -176.696552 -49.496552 7 -73.296552 -176.696552 8 -33.896552 -73.296552 9 -93.396552 -33.896552 10 13.703448 -93.396552 11 -50.296552 13.703448 12 -88.196552 -50.296552 13 -75.396552 -88.196552 14 -4.196552 -75.396552 15 25.803448 -4.196552 16 -4.596552 25.803448 17 41.403448 -4.596552 18 5.703448 41.403448 19 58.903448 5.703448 20 118.403448 58.903448 21 65.703448 118.403448 22 98.503448 65.703448 23 232.803448 98.503448 24 136.703448 232.803448 25 42.403448 136.703448 26 131.103448 42.403448 27 242.703448 131.103448 28 196.903448 242.703448 29 -471.280220 196.903448 30 -353.780220 -471.280220 31 -324.180220 -353.780220 32 -207.180220 -324.180220 33 -670.180220 -207.180220 34 -762.680220 -670.180220 35 -495.280220 -762.680220 36 -605.180220 -495.280220 37 -438.480220 -605.180220 38 -125.880220 -438.480220 39 -308.480220 -125.880220 40 -563.780220 -308.480220 41 -145.680220 -563.780220 42 -532.080220 -145.680220 43 -617.380220 -532.080220 44 -452.980220 -617.380220 45 -694.180220 -452.980220 46 -844.280220 -694.180220 47 -391.880220 -844.280220 48 -326.180220 -391.880220 49 -534.380220 -326.180220 50 -34.980220 -534.380220 51 -409.080220 -34.980220 52 -172.380220 -409.080220 53 -633.780220 -172.380220 54 -746.180220 -633.780220 55 -191.380220 -746.180220 56 -156.980220 -191.380220 57 -326.780220 -156.980220 58 -489.080220 -326.780220 59 75.119780 -489.080220 60 -353.780220 75.119780 61 -622.680220 -353.780220 62 -306.780220 -622.680220 63 -231.680220 -306.780220 64 158.019780 -231.680220 65 -432.180220 158.019780 66 -664.880220 -432.180220 67 -159.680220 -664.880220 68 225.419780 -159.680220 69 -60.080220 225.419780 70 -203.380220 -60.080220 71 -55.280220 -203.380220 72 -190.080220 -55.280220 73 -1.680220 -190.080220 74 199.719780 -1.680220 75 283.419780 199.719780 76 253.519780 283.419780 77 -285.580220 253.519780 78 99.719780 -285.580220 79 48.119780 99.719780 80 434.219780 48.119780 81 2.219780 434.219780 82 95.719780 2.219780 83 187.619780 95.719780 84 46.719780 187.619780 85 314.819780 46.719780 86 270.519780 314.819780 87 549.019780 270.519780 88 116.919780 549.019780 89 -205.080220 116.919780 90 445.319780 -205.080220 91 508.419780 445.319780 92 762.919780 508.419780 93 114.719780 762.919780 94 181.619780 114.719780 95 437.019780 181.619780 96 500.419780 437.019780 97 95.119780 500.419780 98 916.319780 95.119780 99 415.319780 916.319780 100 1228.119780 415.319780 101 -335.380220 1228.119780 102 294.019780 -335.380220 103 245.519780 294.019780 104 395.619780 245.519780 105 575.719780 395.619780 106 -53.680220 575.719780 107 644.619780 -53.680220 108 378.319780 644.619780 109 80.919780 378.319780 110 875.619780 80.919780 111 596.919780 875.619780 112 821.919780 596.919780 113 380.919780 821.919780 114 142.319780 380.919780 115 522.019780 142.319780 116 805.419780 522.019780 117 572.619780 805.419780 118 317.019780 572.619780 119 572.219780 317.019780 > 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/7kpki1258766393.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/8qksk1258766393.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/9r8dv1258766393.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/1041d71258766393.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/11nkg41258766393.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/129d7m1258766394.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/13ytmn1258766394.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/147fqd1258766394.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/15p6xl1258766394.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/160ni11258766394.tab") + } > system("convert tmp/1yra21258766393.ps tmp/1yra21258766393.png") > system("convert tmp/2fg881258766393.ps tmp/2fg881258766393.png") > system("convert tmp/3uchu1258766393.ps tmp/3uchu1258766393.png") > system("convert tmp/48pat1258766393.ps tmp/48pat1258766393.png") > system("convert tmp/5uo941258766393.ps tmp/5uo941258766393.png") > system("convert tmp/623gw1258766393.ps tmp/623gw1258766393.png") > system("convert tmp/7kpki1258766393.ps tmp/7kpki1258766393.png") > system("convert tmp/8qksk1258766393.ps tmp/8qksk1258766393.png") > system("convert tmp/9r8dv1258766393.ps tmp/9r8dv1258766393.png") > system("convert tmp/1041d71258766393.ps tmp/1041d71258766393.png") > > > proc.time() user system elapsed 3.206 1.622 4.282