R version 2.12.0 (2010-10-15) Copyright (C) 2010 The R Foundation for Statistical Computing ISBN 3-900051-07-0 Platform: i486-pc-linux-gnu (32-bit) 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(1.0622 + ,2.1 + ,8.93 + ,2.5974 + ,5.8 + ,1.0773 + ,2.4 + ,8.96 + ,2.9809 + ,5.9 + ,1.0807 + ,2.5 + ,8.99 + ,3.0201 + ,5.9 + ,1.0848 + ,2.1 + ,8.98 + ,2.2247 + ,6 + ,1.1582 + ,1.8 + ,9 + ,2.0578 + ,6.1 + ,1.1663 + ,1.9 + ,9.03 + ,2.1123 + ,6.3 + ,1.1372 + ,1.9 + ,9.02 + ,2.1099 + ,6.2 + ,1.1139 + ,2.1 + ,9 + ,2.1583 + ,6.1 + ,1.1222 + ,2.2 + ,9.03 + ,2.3204 + ,6.1 + ,1.1692 + ,2 + ,9.03 + ,2.0408 + ,6 + ,1.1702 + ,2.2 + ,9.03 + ,1.765 + ,5.8 + ,1.2286 + ,2 + ,9.07 + ,1.8795 + ,5.7 + ,1.2613 + ,1.9 + ,9.15 + ,1.9263 + ,5.7 + ,1.2646 + ,1.6 + ,9.1 + ,1.6931 + ,5.6 + ,1.2262 + ,1.7 + ,9.15 + ,1.7372 + ,5.8 + ,1.1985 + ,2 + ,9.15 + ,2.2851 + ,5.6 + ,1.2007 + ,2.5 + ,9.22 + ,3.0518 + ,5.6 + ,1.2138 + ,2.4 + ,9.22 + ,3.2662 + ,5.6 + ,1.2266 + ,2.3 + ,9.24 + ,2.9908 + ,5.5 + ,1.2176 + ,2.3 + ,9.26 + ,2.6544 + ,5.4 + ,1.2218 + ,2.1 + ,9.3 + ,2.5378 + ,5.4 + ,1.249 + ,2.4 + ,9.27 + ,3.1892 + ,5.5 + ,1.2991 + ,2.2 + ,9.32 + ,3.523 + ,5.4 + ,1.3408 + ,2.4 + ,9.33 + ,3.2556 + ,5.4 + ,1.3119 + ,1.9 + ,9.32 + ,2.9698 + ,5.3 + ,1.3014 + ,2.1 + ,9.34 + ,3.0075 + ,5.4 + ,1.3201 + ,2.1 + ,9.32 + ,3.1483 + ,5.2 + ,1.2938 + ,2.1 + ,9.32 + ,3.5106 + ,5.2 + ,1.2694 + ,2 + ,9.24 + ,2.8027 + ,5.1 + ,1.2165 + ,2.1 + ,9.24 + ,2.5303 + ,5 + ,1.2037 + ,2.2 + ,9.15 + ,3.1679 + ,5 + ,1.2292 + ,2.2 + ,9.17 + ,3.6412 + ,4.9 + ,1.2256 + ,2.6 + ,9.14 + ,4.6867 + ,5 + ,1.2015 + ,2.5 + ,9.11 + ,4.3478 + ,5 + ,1.1786 + ,2.3 + ,9.04 + ,3.4555 + ,5 + ,1.1856 + ,2.2 + ,8.96 + ,3.4157 + ,4.9 + ,1.2103 + ,2.4 + ,8.86 + ,3.9853 + ,4.7 + ,1.1938 + ,2.3 + ,8.85 + ,3.5975 + ,4.8 + ,1.202 + ,2.2 + ,8.75 + ,3.3626 + ,4.7 + ,1.2271 + ,2.5 + ,8.65 + ,3.5457 + ,4.7 + ,1.277 + ,2.5 + ,8.61 + ,4.1667 + ,4.6 + ,1.265 + ,2.5 + ,8.46 + ,4.3188 + ,4.6 + ,1.2684 + ,2.4 + ,8.38 + ,4.1453 + ,4.7 + ,1.2811 + ,2.3 + ,8.33 + ,3.8187 + ,4.7 + ,1.2727 + ,1.7 + ,8.27 + ,2.0624 + ,4.5 + ,1.2611 + ,1.6 + ,8.21 + ,1.3052 + ,4.4 + ,1.2881 + ,1.9 + ,8.18 + ,1.9737 + ,4.5 + ,1.3213 + ,1.9 + ,8.04 + ,2.5407 + ,4.4 + ,1.2999 + ,1.8 + ,7.97 + ,2.0756 + ,4.6 + ,1.3074 + ,1.8 + ,7.86 + ,2.4152 + ,4.5 + ,1.3242 + ,1.9 + ,7.75 + ,2.7788 + ,4.4 + ,1.3516 + ,1.9 + ,7.65 + ,2.5737 + ,4.5 + ,1.3511 + ,1.9 + ,7.62 + ,2.6909 + ,4.4 + ,1.3419 + ,1.9 + ,7.55 + ,2.687 + ,4.6 + ,1.3716 + ,1.8 + ,7.6 + ,2.3582 + ,4.7 + ,1.3622 + ,1.7 + ,7.54 + ,1.9701 + ,4.6 + ,1.3896 + ,2.1 + ,7.48 + ,2.7551 + ,4.7 + ,1.4227 + ,2.6 + ,7.44 + ,3.5362 + ,4.7 + ,1.4684 + ,3.1 + ,7.41 + ,4.3062 + ,4.7 + ,1.457 + ,3.1 + ,7.45 + ,4.0813 + ,5) + ,dim=c(5 + ,60) + ,dimnames=list(c('Dollar/Euro' + ,'Inf-Eu' + ,'Werkl-Eu' + ,'Inf-USA' + ,'Werkl-USA') + ,1:60)) > y <- array(NA,dim=c(5,60),dimnames=list(c('Dollar/Euro','Inf-Eu','Werkl-Eu','Inf-USA','Werkl-USA'),1:60)) > 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 > 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 Dollar/Euro Inf-Eu Werkl-Eu Inf-USA Werkl-USA 1 1.0622 2.1 8.93 2.5974 5.8 2 1.0773 2.4 8.96 2.9809 5.9 3 1.0807 2.5 8.99 3.0201 5.9 4 1.0848 2.1 8.98 2.2247 6.0 5 1.1582 1.8 9.00 2.0578 6.1 6 1.1663 1.9 9.03 2.1123 6.3 7 1.1372 1.9 9.02 2.1099 6.2 8 1.1139 2.1 9.00 2.1583 6.1 9 1.1222 2.2 9.03 2.3204 6.1 10 1.1692 2.0 9.03 2.0408 6.0 11 1.1702 2.2 9.03 1.7650 5.8 12 1.2286 2.0 9.07 1.8795 5.7 13 1.2613 1.9 9.15 1.9263 5.7 14 1.2646 1.6 9.10 1.6931 5.6 15 1.2262 1.7 9.15 1.7372 5.8 16 1.1985 2.0 9.15 2.2851 5.6 17 1.2007 2.5 9.22 3.0518 5.6 18 1.2138 2.4 9.22 3.2662 5.6 19 1.2266 2.3 9.24 2.9908 5.5 20 1.2176 2.3 9.26 2.6544 5.4 21 1.2218 2.1 9.30 2.5378 5.4 22 1.2490 2.4 9.27 3.1892 5.5 23 1.2991 2.2 9.32 3.5230 5.4 24 1.3408 2.4 9.33 3.2556 5.4 25 1.3119 1.9 9.32 2.9698 5.3 26 1.3014 2.1 9.34 3.0075 5.4 27 1.3201 2.1 9.32 3.1483 5.2 28 1.2938 2.1 9.32 3.5106 5.2 29 1.2694 2.0 9.24 2.8027 5.1 30 1.2165 2.1 9.24 2.5303 5.0 31 1.2037 2.2 9.15 3.1679 5.0 32 1.2292 2.2 9.17 3.6412 4.9 33 1.2256 2.6 9.14 4.6867 5.0 34 1.2015 2.5 9.11 4.3478 5.0 35 1.1786 2.3 9.04 3.4555 5.0 36 1.1856 2.2 8.96 3.4157 4.9 37 1.2103 2.4 8.86 3.9853 4.7 38 1.1938 2.3 8.85 3.5975 4.8 39 1.2020 2.2 8.75 3.3626 4.7 40 1.2271 2.5 8.65 3.5457 4.7 41 1.2770 2.5 8.61 4.1667 4.6 42 1.2650 2.5 8.46 4.3188 4.6 43 1.2684 2.4 8.38 4.1453 4.7 44 1.2811 2.3 8.33 3.8187 4.7 45 1.2727 1.7 8.27 2.0624 4.5 46 1.2611 1.6 8.21 1.3052 4.4 47 1.2881 1.9 8.18 1.9737 4.5 48 1.3213 1.9 8.04 2.5407 4.4 49 1.2999 1.8 7.97 2.0756 4.6 50 1.3074 1.8 7.86 2.4152 4.5 51 1.3242 1.9 7.75 2.7788 4.4 52 1.3516 1.9 7.65 2.5737 4.5 53 1.3511 1.9 7.62 2.6909 4.4 54 1.3419 1.9 7.55 2.6870 4.6 55 1.3716 1.8 7.60 2.3582 4.7 56 1.3622 1.7 7.54 1.9701 4.6 57 1.3896 2.1 7.48 2.7551 4.7 58 1.4227 2.6 7.44 3.5362 4.7 59 1.4684 3.1 7.41 4.3062 4.7 60 1.4570 3.1 7.45 4.0813 5.0 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) `Inf-Eu` `Werkl-Eu` `Inf-USA` `Werkl-USA` 2.018611 0.014703 -0.058657 0.004367 -0.058710 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -0.134306 -0.037821 -0.007457 0.039973 0.136987 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 2.018611 0.129038 15.644 <2e-16 *** `Inf-Eu` 0.014703 0.054838 0.268 0.7896 `Werkl-Eu` -0.058657 0.020246 -2.897 0.0054 ** `Inf-USA` 0.004367 0.024290 0.180 0.8580 `Werkl-USA` -0.058710 0.027100 -2.166 0.0346 * --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 0.06354 on 55 degrees of freedom Multiple R-squared: 0.5293, Adjusted R-squared: 0.4951 F-statistic: 15.46 on 4 and 55 DF, p-value: 1.555e-08 > 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,] 0.024375414 4.875083e-02 9.756246e-01 [2,] 0.007220532 1.444106e-02 9.927795e-01 [3,] 0.006411461 1.282292e-02 9.935885e-01 [4,] 0.006191741 1.238348e-02 9.938083e-01 [5,] 0.002630383 5.260766e-03 9.973696e-01 [6,] 0.005372293 1.074459e-02 9.946277e-01 [7,] 0.001938948 3.877895e-03 9.980611e-01 [8,] 0.012814202 2.562840e-02 9.871858e-01 [9,] 0.019002903 3.800581e-02 9.809971e-01 [10,] 0.014557282 2.911456e-02 9.854427e-01 [11,] 0.015772574 3.154515e-02 9.842274e-01 [12,] 0.012576222 2.515244e-02 9.874238e-01 [13,] 0.026839470 5.367894e-02 9.731605e-01 [14,] 0.104253292 2.085066e-01 8.957467e-01 [15,] 0.163371307 3.267426e-01 8.366287e-01 [16,] 0.182749555 3.654991e-01 8.172504e-01 [17,] 0.398719907 7.974398e-01 6.012801e-01 [18,] 0.371179072 7.423581e-01 6.288209e-01 [19,] 0.311954528 6.239091e-01 6.880455e-01 [20,] 0.504518429 9.909631e-01 4.954816e-01 [21,] 0.750947518 4.981050e-01 2.490525e-01 [22,] 0.940773755 1.184525e-01 5.922625e-02 [23,] 0.973605234 5.278953e-02 2.639477e-02 [24,] 0.968117183 6.376563e-02 3.188282e-02 [25,] 0.997679477 4.641046e-03 2.320523e-03 [26,] 0.999800570 3.988598e-04 1.994299e-04 [27,] 0.999871672 2.566553e-04 1.283277e-04 [28,] 0.999725432 5.491352e-04 2.745676e-04 [29,] 0.999606202 7.875953e-04 3.937977e-04 [30,] 0.999821337 3.573260e-04 1.786630e-04 [31,] 0.999746836 5.063272e-04 2.531636e-04 [32,] 0.999735674 5.286511e-04 2.643256e-04 [33,] 0.999985064 2.987276e-05 1.493638e-05 [34,] 0.999997420 5.160940e-06 2.580470e-06 [35,] 0.999996146 7.707318e-06 3.853659e-06 [36,] 0.999993432 1.313676e-05 6.568380e-06 [37,] 0.999984477 3.104610e-05 1.552305e-05 [38,] 0.999951858 9.628438e-05 4.814219e-05 [39,] 0.999847769 3.044627e-04 1.522314e-04 [40,] 0.999598846 8.023074e-04 4.011537e-04 [41,] 0.999800182 3.996364e-04 1.998182e-04 [42,] 0.999224530 1.550940e-03 7.754700e-04 [43,] 0.997189946 5.620107e-03 2.810054e-03 [44,] 0.990074860 1.985028e-02 9.925140e-03 [45,] 0.965528115 6.894377e-02 3.447189e-02 > postscript(file="/var/www/rcomp/tmp/1s4qf1324494537.ps",horizontal=F,onefile=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/rcomp/tmp/2ppur1324494537.ps",horizontal=F,onefile=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/rcomp/tmp/38t9x1324494537.ps",horizontal=F,onefile=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/rcomp/tmp/4vqwz1324494537.ps",horizontal=F,onefile=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/rcomp/tmp/5ujy51324494537.ps",horizontal=F,onefile=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 = 60 Frequency = 1 1 2 3 4 5 6 -0.134306249 -0.117661178 -0.114142941 -0.095403714 -0.009819864 0.010073582 7 8 9 10 11 12 -0.025473518 -0.058969580 -0.051088077 -0.005797472 -0.018275553 0.039040192 13 14 15 16 17 18 0.077698614 0.077624012 0.052236012 0.005990365 0.001596626 0.015230559 19 20 21 22 23 24 0.026005688 0.013776948 0.023772977 0.047828660 0.096473237 0.136987066 25 26 27 28 29 30 0.110228989 0.103667954 0.108837884 0.080955632 0.050553918 -0.008497729 31 32 33 34 35 36 -0.030831657 -0.012096551 -0.022032267 -0.044941642 -0.065110187 -0.067029654 37 38 39 40 41 42 -0.065365475 -0.073417143 -0.074457697 -0.060433821 -0.021463161 -0.042925929 43 44 45 46 47 48 -0.036119469 -0.023455696 -0.030625327 -0.046838602 -0.023057598 -0.006416781 49 50 51 52 53 54 -0.016679252 -0.022985623 -0.021567076 0.006733985 -0.001908572 -0.003455484 55 56 57 58 59 60 0.037954585 0.022329362 0.042771610 0.062762742 0.095988918 0.105530422 > postscript(file="/var/www/rcomp/tmp/6m3i71324494537.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > dum <- cbind(lag(myerror,k=1),myerror) > dum Time Series: Start = 0 End = 60 Frequency = 1 lag(myerror, k = 1) myerror 0 -0.134306249 NA 1 -0.117661178 -0.134306249 2 -0.114142941 -0.117661178 3 -0.095403714 -0.114142941 4 -0.009819864 -0.095403714 5 0.010073582 -0.009819864 6 -0.025473518 0.010073582 7 -0.058969580 -0.025473518 8 -0.051088077 -0.058969580 9 -0.005797472 -0.051088077 10 -0.018275553 -0.005797472 11 0.039040192 -0.018275553 12 0.077698614 0.039040192 13 0.077624012 0.077698614 14 0.052236012 0.077624012 15 0.005990365 0.052236012 16 0.001596626 0.005990365 17 0.015230559 0.001596626 18 0.026005688 0.015230559 19 0.013776948 0.026005688 20 0.023772977 0.013776948 21 0.047828660 0.023772977 22 0.096473237 0.047828660 23 0.136987066 0.096473237 24 0.110228989 0.136987066 25 0.103667954 0.110228989 26 0.108837884 0.103667954 27 0.080955632 0.108837884 28 0.050553918 0.080955632 29 -0.008497729 0.050553918 30 -0.030831657 -0.008497729 31 -0.012096551 -0.030831657 32 -0.022032267 -0.012096551 33 -0.044941642 -0.022032267 34 -0.065110187 -0.044941642 35 -0.067029654 -0.065110187 36 -0.065365475 -0.067029654 37 -0.073417143 -0.065365475 38 -0.074457697 -0.073417143 39 -0.060433821 -0.074457697 40 -0.021463161 -0.060433821 41 -0.042925929 -0.021463161 42 -0.036119469 -0.042925929 43 -0.023455696 -0.036119469 44 -0.030625327 -0.023455696 45 -0.046838602 -0.030625327 46 -0.023057598 -0.046838602 47 -0.006416781 -0.023057598 48 -0.016679252 -0.006416781 49 -0.022985623 -0.016679252 50 -0.021567076 -0.022985623 51 0.006733985 -0.021567076 52 -0.001908572 0.006733985 53 -0.003455484 -0.001908572 54 0.037954585 -0.003455484 55 0.022329362 0.037954585 56 0.042771610 0.022329362 57 0.062762742 0.042771610 58 0.095988918 0.062762742 59 0.105530422 0.095988918 60 NA 0.105530422 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -0.117661178 -0.134306249 [2,] -0.114142941 -0.117661178 [3,] -0.095403714 -0.114142941 [4,] -0.009819864 -0.095403714 [5,] 0.010073582 -0.009819864 [6,] -0.025473518 0.010073582 [7,] -0.058969580 -0.025473518 [8,] -0.051088077 -0.058969580 [9,] -0.005797472 -0.051088077 [10,] -0.018275553 -0.005797472 [11,] 0.039040192 -0.018275553 [12,] 0.077698614 0.039040192 [13,] 0.077624012 0.077698614 [14,] 0.052236012 0.077624012 [15,] 0.005990365 0.052236012 [16,] 0.001596626 0.005990365 [17,] 0.015230559 0.001596626 [18,] 0.026005688 0.015230559 [19,] 0.013776948 0.026005688 [20,] 0.023772977 0.013776948 [21,] 0.047828660 0.023772977 [22,] 0.096473237 0.047828660 [23,] 0.136987066 0.096473237 [24,] 0.110228989 0.136987066 [25,] 0.103667954 0.110228989 [26,] 0.108837884 0.103667954 [27,] 0.080955632 0.108837884 [28,] 0.050553918 0.080955632 [29,] -0.008497729 0.050553918 [30,] -0.030831657 -0.008497729 [31,] -0.012096551 -0.030831657 [32,] -0.022032267 -0.012096551 [33,] -0.044941642 -0.022032267 [34,] -0.065110187 -0.044941642 [35,] -0.067029654 -0.065110187 [36,] -0.065365475 -0.067029654 [37,] -0.073417143 -0.065365475 [38,] -0.074457697 -0.073417143 [39,] -0.060433821 -0.074457697 [40,] -0.021463161 -0.060433821 [41,] -0.042925929 -0.021463161 [42,] -0.036119469 -0.042925929 [43,] -0.023455696 -0.036119469 [44,] -0.030625327 -0.023455696 [45,] -0.046838602 -0.030625327 [46,] -0.023057598 -0.046838602 [47,] -0.006416781 -0.023057598 [48,] -0.016679252 -0.006416781 [49,] -0.022985623 -0.016679252 [50,] -0.021567076 -0.022985623 [51,] 0.006733985 -0.021567076 [52,] -0.001908572 0.006733985 [53,] -0.003455484 -0.001908572 [54,] 0.037954585 -0.003455484 [55,] 0.022329362 0.037954585 [56,] 0.042771610 0.022329362 [57,] 0.062762742 0.042771610 [58,] 0.095988918 0.062762742 [59,] 0.105530422 0.095988918 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -0.117661178 -0.134306249 2 -0.114142941 -0.117661178 3 -0.095403714 -0.114142941 4 -0.009819864 -0.095403714 5 0.010073582 -0.009819864 6 -0.025473518 0.010073582 7 -0.058969580 -0.025473518 8 -0.051088077 -0.058969580 9 -0.005797472 -0.051088077 10 -0.018275553 -0.005797472 11 0.039040192 -0.018275553 12 0.077698614 0.039040192 13 0.077624012 0.077698614 14 0.052236012 0.077624012 15 0.005990365 0.052236012 16 0.001596626 0.005990365 17 0.015230559 0.001596626 18 0.026005688 0.015230559 19 0.013776948 0.026005688 20 0.023772977 0.013776948 21 0.047828660 0.023772977 22 0.096473237 0.047828660 23 0.136987066 0.096473237 24 0.110228989 0.136987066 25 0.103667954 0.110228989 26 0.108837884 0.103667954 27 0.080955632 0.108837884 28 0.050553918 0.080955632 29 -0.008497729 0.050553918 30 -0.030831657 -0.008497729 31 -0.012096551 -0.030831657 32 -0.022032267 -0.012096551 33 -0.044941642 -0.022032267 34 -0.065110187 -0.044941642 35 -0.067029654 -0.065110187 36 -0.065365475 -0.067029654 37 -0.073417143 -0.065365475 38 -0.074457697 -0.073417143 39 -0.060433821 -0.074457697 40 -0.021463161 -0.060433821 41 -0.042925929 -0.021463161 42 -0.036119469 -0.042925929 43 -0.023455696 -0.036119469 44 -0.030625327 -0.023455696 45 -0.046838602 -0.030625327 46 -0.023057598 -0.046838602 47 -0.006416781 -0.023057598 48 -0.016679252 -0.006416781 49 -0.022985623 -0.016679252 50 -0.021567076 -0.022985623 51 0.006733985 -0.021567076 52 -0.001908572 0.006733985 53 -0.003455484 -0.001908572 54 0.037954585 -0.003455484 55 0.022329362 0.037954585 56 0.042771610 0.022329362 57 0.062762742 0.042771610 58 0.095988918 0.062762742 59 0.105530422 0.095988918 > 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/rcomp/tmp/7z5xf1324494537.ps",horizontal=F,onefile=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/rcomp/tmp/8fco81324494537.ps",horizontal=F,onefile=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/rcomp/tmp/9geo51324494537.ps",horizontal=F,onefile=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/rcomp/tmp/103jwc1324494537.ps",horizontal=F,onefile=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/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/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/rcomp/tmp/11c6971324494537.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/rcomp/tmp/12w67q1324494537.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/rcomp/tmp/13p6wc1324494537.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/rcomp/tmp/14afj91324494537.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/rcomp/tmp/15kho01324494537.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/rcomp/tmp/16tc991324494537.tab") + } > > try(system("convert tmp/1s4qf1324494537.ps tmp/1s4qf1324494537.png",intern=TRUE)) character(0) > try(system("convert tmp/2ppur1324494537.ps tmp/2ppur1324494537.png",intern=TRUE)) character(0) > try(system("convert tmp/38t9x1324494537.ps tmp/38t9x1324494537.png",intern=TRUE)) character(0) > try(system("convert tmp/4vqwz1324494537.ps tmp/4vqwz1324494537.png",intern=TRUE)) character(0) > try(system("convert tmp/5ujy51324494537.ps tmp/5ujy51324494537.png",intern=TRUE)) character(0) > try(system("convert tmp/6m3i71324494537.ps tmp/6m3i71324494537.png",intern=TRUE)) character(0) > try(system("convert tmp/7z5xf1324494537.ps tmp/7z5xf1324494537.png",intern=TRUE)) character(0) > try(system("convert tmp/8fco81324494537.ps tmp/8fco81324494537.png",intern=TRUE)) character(0) > try(system("convert tmp/9geo51324494537.ps tmp/9geo51324494537.png",intern=TRUE)) character(0) > try(system("convert tmp/103jwc1324494537.ps tmp/103jwc1324494537.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 3.750 0.360 4.094