R version 2.15.2 (2012-10-26) -- "Trick or Treat" Copyright (C) 2012 The R Foundation for Statistical Computing ISBN 3-900051-07-0 Platform: i686-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 + ,2981.85 + ,10407 + ,0.762253 + ,14448.9 + ,13953.3 + ,2 + ,3080.58 + ,10463 + ,0.768403 + ,15023.9 + ,14657.7 + ,3 + ,3106.22 + ,10556 + ,0.757518 + ,17319.2 + ,16686.2 + ,4 + ,3119.31 + ,10646 + ,0.772917 + ,16080.7 + ,15232.4 + ,5 + ,3061.26 + ,10702 + ,0.787774 + ,15486.3 + ,15014.1 + ,6 + ,3097.31 + ,11353 + ,0.82203 + ,17046.4 + ,16688.6 + ,7 + ,3161.69 + ,11346 + ,0.830772 + ,14793.9 + ,13969.6 + ,8 + ,3257.16 + ,11451 + ,0.813537 + ,13666.7 + ,14546.8 + ,9 + ,3277.01 + ,11964 + ,0.815927 + ,17358.8 + ,16292 + ,10 + ,3295.32 + ,12574 + ,0.832293 + ,16091.8 + ,15039 + ,11 + ,3363.99 + ,13031 + ,0.848464 + ,17401.7 + ,17433.8 + ,12 + ,3494.17 + ,13812 + ,0.843455 + ,16467 + ,17798.4 + ,13 + ,3667.03 + ,14544 + ,0.826241 + ,16103.8 + ,16870.9 + ,14 + ,3813.06 + ,14931 + ,0.837661 + ,16422.6 + ,16659.3 + ,15 + ,3917.96 + ,14886 + ,0.831947 + ,19435.5 + ,19620.4 + ,16 + ,3895.51 + ,16005 + ,0.81493 + ,15810.1 + ,15953.5 + ,17 + ,3801.06 + ,17064 + ,0.783085 + ,17914.8 + ,17420.9 + ,18 + ,3570.12 + ,15168 + ,0.790514 + ,18197.2 + ,17647.5 + ,19 + ,3701.61 + ,16050 + ,0.788395 + ,16183.5 + ,15200.8 + ,20 + ,3862.27 + ,15839 + ,0.780579 + ,14781 + ,15637.3 + ,21 + ,3970.1 + ,15137 + ,0.785731 + ,18091.5 + ,17124.5 + ,22 + ,4138.52 + ,14954 + ,0.792959 + ,18318.8 + ,17659.4 + ,23 + ,4199.75 + ,15648 + ,0.776337 + ,18392.2 + ,17815 + ,24 + ,4290.89 + ,15305 + ,0.75683 + ,15952.5 + ,16165.6 + ,25 + ,4443.91 + ,15579 + ,0.76929 + ,17434.3 + ,17416.6 + ,26 + ,4502.64 + ,16348 + ,0.764877 + ,17214 + ,16823.9 + ,27 + ,4356.98 + ,15928 + ,0.755173 + ,19680.5 + ,19171.2 + ,28 + ,4591.27 + ,16171 + ,0.739864 + ,17216.8 + ,16806.8 + ,29 + ,4696.96 + ,15937 + ,0.740138 + ,18325.3 + ,18112.8 + ,30 + ,4621.4 + ,15713 + ,0.745212 + ,19303.5 + ,18485.5 + ,31 + ,4562.84 + ,15594 + ,0.729076 + ,18090.7 + ,17668 + ,32 + ,4202.52 + ,15683 + ,0.734107 + ,16166.3 + ,16324.3 + ,33 + ,4296.49 + ,16438 + ,0.719632 + ,18304.7 + ,17877.5 + ,34 + ,4435.23 + ,17032 + ,0.702889 + ,20380.1 + ,20136.7 + ,35 + ,4105.18 + ,17696 + ,0.681013 + ,18887.7 + ,19307 + ,36 + ,4116.68 + ,17745 + ,0.686342 + ,16316.5 + ,17776.3 + ,37 + ,3844.49 + ,19394 + ,0.67944 + ,18471.5 + ,19861.3 + ,38 + ,3720.98 + ,20148 + ,0.678058 + ,18754.9 + ,18757 + ,39 + ,3674.4 + ,20108 + ,0.644039 + ,18940.7 + ,19879.3 + ,40 + ,3857.62 + ,18584 + ,0.63488 + ,20228.5 + ,21068.4 + ,41 + ,3801.06 + ,18441 + ,0.642797 + ,19060.4 + ,19358 + ,42 + ,3504.37 + ,18391 + ,0.642963 + ,20262.9 + ,20639.2 + ,43 + ,3032.6 + ,19178 + ,0.634115 + ,19928.7 + ,20008.1 + ,44 + ,3047.03 + ,18079 + ,0.66778 + ,16058.8 + ,18150.1 + ,45 + ,2962.34 + ,18483 + ,0.695894 + ,20157.4 + ,21180.4 + ,46 + ,2197.82 + ,19644 + ,0.750638 + ,19663.3 + ,20428.9 + ,47 + ,2014.45 + ,19195 + ,0.785423 + ,15648.9 + ,17241.2 + ,48 + ,1862.83 + ,19650 + ,0.74355 + ,14380.5 + ,15969.3 + ,49 + ,1905.41 + ,20830 + ,0.755344 + ,13654.4 + ,14972.4 + ,50 + ,1810.99 + ,23595 + ,0.782167 + ,14085.9 + ,14488.3 + ,51 + ,1670.07 + ,22937 + ,0.766284 + ,15070.6 + ,15885.1 + ,52 + ,1864.44 + ,21814 + ,0.75815 + ,14206.9 + ,14305.3 + ,53 + ,2052.02 + ,21928 + ,0.732601 + ,13585.6 + ,13891.5 + ,54 + ,2029.6 + ,21777 + ,0.71347 + ,15413.2 + ,15431.6 + ,55 + ,2070.83 + ,21383 + ,0.709824 + ,14809.6 + ,14199.3 + ,56 + ,2293.41 + ,21467 + ,0.700869 + ,12625.3 + ,13542.6 + ,57 + ,2443.27 + ,22052 + ,0.686719 + ,16314.7 + ,16226.3 + ,58 + ,2513.17 + ,22680 + ,0.674946 + ,16045.9 + ,16786.1 + ,59 + ,2466.92 + ,24320 + ,0.670511 + ,16063.6 + ,16034.3 + ,60 + ,2502.66 + ,24977 + ,0.684275 + ,15851.3 + ,16744.5 + ,61 + ,2539.91 + ,25204 + ,0.700673 + ,14925.2 + ,15955.4) + ,dim=c(6 + ,61) + ,dimnames=list(c('Periodes' + ,'BEL20' + ,'GoudkoersTeBrussel' + ,'EurosPerUSdollar' + ,'Uitvoer' + ,'Invoer') + ,1:61)) > y <- array(NA,dim=c(6,61),dimnames=list(c('Periodes','BEL20','GoudkoersTeBrussel','EurosPerUSdollar','Uitvoer','Invoer'),1:61)) > 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 = '4' > library(lattice) > library(lmtest) Loading required package: zoo Attaching package: 'zoo' The following object(s) are masked from 'package:base': as.Date, 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 EurosPerUSdollar Periodes BEL20 GoudkoersTeBrussel Uitvoer Invoer 1 0.762253 1 2981.85 10407 14448.9 13953.3 2 0.768403 2 3080.58 10463 15023.9 14657.7 3 0.757518 3 3106.22 10556 17319.2 16686.2 4 0.772917 4 3119.31 10646 16080.7 15232.4 5 0.787774 5 3061.26 10702 15486.3 15014.1 6 0.822030 6 3097.31 11353 17046.4 16688.6 7 0.830772 7 3161.69 11346 14793.9 13969.6 8 0.813537 8 3257.16 11451 13666.7 14546.8 9 0.815927 9 3277.01 11964 17358.8 16292.0 10 0.832293 10 3295.32 12574 16091.8 15039.0 11 0.848464 11 3363.99 13031 17401.7 17433.8 12 0.843455 12 3494.17 13812 16467.0 17798.4 13 0.826241 13 3667.03 14544 16103.8 16870.9 14 0.837661 14 3813.06 14931 16422.6 16659.3 15 0.831947 15 3917.96 14886 19435.5 19620.4 16 0.814930 16 3895.51 16005 15810.1 15953.5 17 0.783085 17 3801.06 17064 17914.8 17420.9 18 0.790514 18 3570.12 15168 18197.2 17647.5 19 0.788395 19 3701.61 16050 16183.5 15200.8 20 0.780579 20 3862.27 15839 14781.0 15637.3 21 0.785731 21 3970.10 15137 18091.5 17124.5 22 0.792959 22 4138.52 14954 18318.8 17659.4 23 0.776337 23 4199.75 15648 18392.2 17815.0 24 0.756830 24 4290.89 15305 15952.5 16165.6 25 0.769290 25 4443.91 15579 17434.3 17416.6 26 0.764877 26 4502.64 16348 17214.0 16823.9 27 0.755173 27 4356.98 15928 19680.5 19171.2 28 0.739864 28 4591.27 16171 17216.8 16806.8 29 0.740138 29 4696.96 15937 18325.3 18112.8 30 0.745212 30 4621.40 15713 19303.5 18485.5 31 0.729076 31 4562.84 15594 18090.7 17668.0 32 0.734107 32 4202.52 15683 16166.3 16324.3 33 0.719632 33 4296.49 16438 18304.7 17877.5 34 0.702889 34 4435.23 17032 20380.1 20136.7 35 0.681013 35 4105.18 17696 18887.7 19307.0 36 0.686342 36 4116.68 17745 16316.5 17776.3 37 0.679440 37 3844.49 19394 18471.5 19861.3 38 0.678058 38 3720.98 20148 18754.9 18757.0 39 0.644039 39 3674.40 20108 18940.7 19879.3 40 0.634880 40 3857.62 18584 20228.5 21068.4 41 0.642797 41 3801.06 18441 19060.4 19358.0 42 0.642963 42 3504.37 18391 20262.9 20639.2 43 0.634115 43 3032.60 19178 19928.7 20008.1 44 0.667780 44 3047.03 18079 16058.8 18150.1 45 0.695894 45 2962.34 18483 20157.4 21180.4 46 0.750638 46 2197.82 19644 19663.3 20428.9 47 0.785423 47 2014.45 19195 15648.9 17241.2 48 0.743550 48 1862.83 19650 14380.5 15969.3 49 0.755344 49 1905.41 20830 13654.4 14972.4 50 0.782167 50 1810.99 23595 14085.9 14488.3 51 0.766284 51 1670.07 22937 15070.6 15885.1 52 0.758150 52 1864.44 21814 14206.9 14305.3 53 0.732601 53 2052.02 21928 13585.6 13891.5 54 0.713470 54 2029.60 21777 15413.2 15431.6 55 0.709824 55 2070.83 21383 14809.6 14199.3 56 0.700869 56 2293.41 21467 12625.3 13542.6 57 0.686719 57 2443.27 22052 16314.7 16226.3 58 0.674946 58 2513.17 22680 16045.9 16786.1 59 0.670511 59 2466.92 24320 16063.6 16034.3 60 0.684275 60 2502.66 24977 15851.3 16744.5 61 0.700673 61 2539.91 25204 14925.2 15955.4 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) Periodes BEL20 GoudkoersTeBrussel 8.882e-01 -4.533e-03 -1.150e-05 9.512e-06 Uitvoer Invoer -2.517e-06 -4.899e-06 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -0.081419 -0.027546 0.007701 0.023799 0.074687 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 8.882e-01 6.623e-02 13.411 < 2e-16 *** Periodes -4.533e-03 9.879e-04 -4.589 2.63e-05 *** BEL20 -1.150e-05 8.047e-06 -1.429 0.159 GoudkoersTeBrussel 9.512e-06 4.374e-06 2.175 0.034 * Uitvoer -2.517e-06 7.440e-06 -0.338 0.736 Invoer -4.899e-06 7.123e-06 -0.688 0.494 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 0.03631 on 55 degrees of freedom Multiple R-squared: 0.6475, Adjusted R-squared: 0.6154 F-statistic: 20.2 on 5 and 55 DF, p-value: 2.193e-11 > 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.134426944 0.2688538878 0.8655730561 [2,] 0.101222222 0.2024444440 0.8987777780 [3,] 0.043713580 0.0874271592 0.9562864204 [4,] 0.018581851 0.0371637012 0.9814181494 [5,] 0.007173238 0.0143464768 0.9928267616 [6,] 0.006366835 0.0127336703 0.9936331649 [7,] 0.004672277 0.0093445534 0.9953277233 [8,] 0.014427381 0.0288547622 0.9855726189 [9,] 0.070330959 0.1406619177 0.9296690412 [10,] 0.398901118 0.7978022369 0.6010988815 [11,] 0.459579437 0.9191588732 0.5404205634 [12,] 0.723559318 0.5528813639 0.2764406820 [13,] 0.728074577 0.5438508453 0.2719254227 [14,] 0.663096670 0.6738066598 0.3369033299 [15,] 0.615817903 0.7683641946 0.3841820973 [16,] 0.612587723 0.7748245533 0.3874122767 [17,] 0.537920292 0.9241594155 0.4620797077 [18,] 0.456511109 0.9130222185 0.5434888907 [19,] 0.456550397 0.9131007943 0.5434496029 [20,] 0.387115733 0.7742314658 0.6128842671 [21,] 0.360000644 0.7200012873 0.6399993563 [22,] 0.387438793 0.7748775863 0.6125612069 [23,] 0.400875474 0.8017509478 0.5991245261 [24,] 0.395650638 0.7913012756 0.6043493622 [25,] 0.498325869 0.9966517388 0.5016741306 [26,] 0.869891167 0.2602176656 0.1301088328 [27,] 0.941519455 0.1169610903 0.0584805451 [28,] 0.967351127 0.0652977465 0.0326488732 [29,] 0.965317992 0.0693640161 0.0346820081 [30,] 0.969846203 0.0603075936 0.0301537968 [31,] 0.960931825 0.0781363506 0.0390681753 [32,] 0.941477359 0.1170452812 0.0585226406 [33,] 0.955660076 0.0886798480 0.0443399240 [34,] 0.955173101 0.0896537975 0.0448268988 [35,] 0.981701568 0.0365968646 0.0182984323 [36,] 0.991816076 0.0163678475 0.0081839238 [37,] 0.994440035 0.0111199300 0.0055599650 [38,] 0.996369707 0.0072605852 0.0036302926 [39,] 0.999840292 0.0003194157 0.0001597079 [40,] 0.999405889 0.0011882222 0.0005941111 [41,] 0.997738200 0.0045236009 0.0022618005 [42,] 0.992230301 0.0155393984 0.0077696992 [43,] 0.977160746 0.0456785073 0.0228392537 [44,] 0.950034407 0.0999311864 0.0499655932 > postscript(file="/var/fisher/rcomp/tmp/155b41353252111.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/fisher/rcomp/tmp/2jfbb1353252111.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/fisher/rcomp/tmp/3xtny1353252111.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/fisher/rcomp/tmp/4jjbq1353252111.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/fisher/rcomp/tmp/5oq791353252111.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 = 61 Frequency = 1 1 2 3 4 5 -0.0814189913 -0.0652348821 -0.0564609812 -0.0474743490 -0.0318501116 6 7 8 9 10 0.0132919822 0.0083832278 -0.0042289887 0.0158862438 0.0218657583 11 12 13 14 15 0.0540424162 0.0470682727 0.0239542025 0.0376712179 0.0602154860 16 17 18 19 20 0.0097391804 -0.0162450681 0.0129168767 -0.0086020718 -0.0094221682 21 22 23 24 25 0.0237991843 0.0424304115 0.0253914468 0.0005064381 0.0265116715 26 27 28 29 30 0.0165341982 0.0313916555 0.0032134510 0.0206502858 0.0358073061 31 32 33 34 35 0.0176050691 0.0107521829 0.0077014327 0.0077292099 -0.0275463307 36 37 38 39 40 -0.0319892587 -0.0375340272 -0.0476720637 -0.0713470386 -0.0503027483 41 42 43 44 45 -0.0484627220 -0.0373960765 -0.0585549949 -0.0285810492 0.0244120454 46 47 48 49 50 0.0589289009 0.0746873148 0.0218519659 0.0207329845 0.0234173713 51 52 53 54 55 0.0260276238 0.0254298603 0.0018954828 0.0006215947 -0.0018261576 56 57 58 59 60 -0.0132029224 -0.0042263713 -0.0145699233 -0.0342418471 -0.0188380002 61 -0.0058348086 > postscript(file="/var/fisher/rcomp/tmp/6k5oj1353252111.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 = 61 Frequency = 1 lag(myerror, k = 1) myerror 0 -0.0814189913 NA 1 -0.0652348821 -0.0814189913 2 -0.0564609812 -0.0652348821 3 -0.0474743490 -0.0564609812 4 -0.0318501116 -0.0474743490 5 0.0132919822 -0.0318501116 6 0.0083832278 0.0132919822 7 -0.0042289887 0.0083832278 8 0.0158862438 -0.0042289887 9 0.0218657583 0.0158862438 10 0.0540424162 0.0218657583 11 0.0470682727 0.0540424162 12 0.0239542025 0.0470682727 13 0.0376712179 0.0239542025 14 0.0602154860 0.0376712179 15 0.0097391804 0.0602154860 16 -0.0162450681 0.0097391804 17 0.0129168767 -0.0162450681 18 -0.0086020718 0.0129168767 19 -0.0094221682 -0.0086020718 20 0.0237991843 -0.0094221682 21 0.0424304115 0.0237991843 22 0.0253914468 0.0424304115 23 0.0005064381 0.0253914468 24 0.0265116715 0.0005064381 25 0.0165341982 0.0265116715 26 0.0313916555 0.0165341982 27 0.0032134510 0.0313916555 28 0.0206502858 0.0032134510 29 0.0358073061 0.0206502858 30 0.0176050691 0.0358073061 31 0.0107521829 0.0176050691 32 0.0077014327 0.0107521829 33 0.0077292099 0.0077014327 34 -0.0275463307 0.0077292099 35 -0.0319892587 -0.0275463307 36 -0.0375340272 -0.0319892587 37 -0.0476720637 -0.0375340272 38 -0.0713470386 -0.0476720637 39 -0.0503027483 -0.0713470386 40 -0.0484627220 -0.0503027483 41 -0.0373960765 -0.0484627220 42 -0.0585549949 -0.0373960765 43 -0.0285810492 -0.0585549949 44 0.0244120454 -0.0285810492 45 0.0589289009 0.0244120454 46 0.0746873148 0.0589289009 47 0.0218519659 0.0746873148 48 0.0207329845 0.0218519659 49 0.0234173713 0.0207329845 50 0.0260276238 0.0234173713 51 0.0254298603 0.0260276238 52 0.0018954828 0.0254298603 53 0.0006215947 0.0018954828 54 -0.0018261576 0.0006215947 55 -0.0132029224 -0.0018261576 56 -0.0042263713 -0.0132029224 57 -0.0145699233 -0.0042263713 58 -0.0342418471 -0.0145699233 59 -0.0188380002 -0.0342418471 60 -0.0058348086 -0.0188380002 61 NA -0.0058348086 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -0.0652348821 -0.0814189913 [2,] -0.0564609812 -0.0652348821 [3,] -0.0474743490 -0.0564609812 [4,] -0.0318501116 -0.0474743490 [5,] 0.0132919822 -0.0318501116 [6,] 0.0083832278 0.0132919822 [7,] -0.0042289887 0.0083832278 [8,] 0.0158862438 -0.0042289887 [9,] 0.0218657583 0.0158862438 [10,] 0.0540424162 0.0218657583 [11,] 0.0470682727 0.0540424162 [12,] 0.0239542025 0.0470682727 [13,] 0.0376712179 0.0239542025 [14,] 0.0602154860 0.0376712179 [15,] 0.0097391804 0.0602154860 [16,] -0.0162450681 0.0097391804 [17,] 0.0129168767 -0.0162450681 [18,] -0.0086020718 0.0129168767 [19,] -0.0094221682 -0.0086020718 [20,] 0.0237991843 -0.0094221682 [21,] 0.0424304115 0.0237991843 [22,] 0.0253914468 0.0424304115 [23,] 0.0005064381 0.0253914468 [24,] 0.0265116715 0.0005064381 [25,] 0.0165341982 0.0265116715 [26,] 0.0313916555 0.0165341982 [27,] 0.0032134510 0.0313916555 [28,] 0.0206502858 0.0032134510 [29,] 0.0358073061 0.0206502858 [30,] 0.0176050691 0.0358073061 [31,] 0.0107521829 0.0176050691 [32,] 0.0077014327 0.0107521829 [33,] 0.0077292099 0.0077014327 [34,] -0.0275463307 0.0077292099 [35,] -0.0319892587 -0.0275463307 [36,] -0.0375340272 -0.0319892587 [37,] -0.0476720637 -0.0375340272 [38,] -0.0713470386 -0.0476720637 [39,] -0.0503027483 -0.0713470386 [40,] -0.0484627220 -0.0503027483 [41,] -0.0373960765 -0.0484627220 [42,] -0.0585549949 -0.0373960765 [43,] -0.0285810492 -0.0585549949 [44,] 0.0244120454 -0.0285810492 [45,] 0.0589289009 0.0244120454 [46,] 0.0746873148 0.0589289009 [47,] 0.0218519659 0.0746873148 [48,] 0.0207329845 0.0218519659 [49,] 0.0234173713 0.0207329845 [50,] 0.0260276238 0.0234173713 [51,] 0.0254298603 0.0260276238 [52,] 0.0018954828 0.0254298603 [53,] 0.0006215947 0.0018954828 [54,] -0.0018261576 0.0006215947 [55,] -0.0132029224 -0.0018261576 [56,] -0.0042263713 -0.0132029224 [57,] -0.0145699233 -0.0042263713 [58,] -0.0342418471 -0.0145699233 [59,] -0.0188380002 -0.0342418471 [60,] -0.0058348086 -0.0188380002 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -0.0652348821 -0.0814189913 2 -0.0564609812 -0.0652348821 3 -0.0474743490 -0.0564609812 4 -0.0318501116 -0.0474743490 5 0.0132919822 -0.0318501116 6 0.0083832278 0.0132919822 7 -0.0042289887 0.0083832278 8 0.0158862438 -0.0042289887 9 0.0218657583 0.0158862438 10 0.0540424162 0.0218657583 11 0.0470682727 0.0540424162 12 0.0239542025 0.0470682727 13 0.0376712179 0.0239542025 14 0.0602154860 0.0376712179 15 0.0097391804 0.0602154860 16 -0.0162450681 0.0097391804 17 0.0129168767 -0.0162450681 18 -0.0086020718 0.0129168767 19 -0.0094221682 -0.0086020718 20 0.0237991843 -0.0094221682 21 0.0424304115 0.0237991843 22 0.0253914468 0.0424304115 23 0.0005064381 0.0253914468 24 0.0265116715 0.0005064381 25 0.0165341982 0.0265116715 26 0.0313916555 0.0165341982 27 0.0032134510 0.0313916555 28 0.0206502858 0.0032134510 29 0.0358073061 0.0206502858 30 0.0176050691 0.0358073061 31 0.0107521829 0.0176050691 32 0.0077014327 0.0107521829 33 0.0077292099 0.0077014327 34 -0.0275463307 0.0077292099 35 -0.0319892587 -0.0275463307 36 -0.0375340272 -0.0319892587 37 -0.0476720637 -0.0375340272 38 -0.0713470386 -0.0476720637 39 -0.0503027483 -0.0713470386 40 -0.0484627220 -0.0503027483 41 -0.0373960765 -0.0484627220 42 -0.0585549949 -0.0373960765 43 -0.0285810492 -0.0585549949 44 0.0244120454 -0.0285810492 45 0.0589289009 0.0244120454 46 0.0746873148 0.0589289009 47 0.0218519659 0.0746873148 48 0.0207329845 0.0218519659 49 0.0234173713 0.0207329845 50 0.0260276238 0.0234173713 51 0.0254298603 0.0260276238 52 0.0018954828 0.0254298603 53 0.0006215947 0.0018954828 54 -0.0018261576 0.0006215947 55 -0.0132029224 -0.0018261576 56 -0.0042263713 -0.0132029224 57 -0.0145699233 -0.0042263713 58 -0.0342418471 -0.0145699233 59 -0.0188380002 -0.0342418471 60 -0.0058348086 -0.0188380002 > 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/fisher/rcomp/tmp/7jiex1353252111.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/fisher/rcomp/tmp/8iggp1353252111.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/fisher/rcomp/tmp/96h7w1353252111.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/fisher/rcomp/tmp/10rd691353252111.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/fisher/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/fisher/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/fisher/rcomp/tmp/11k59u1353252111.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/fisher/rcomp/tmp/12zkz71353252111.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/fisher/rcomp/tmp/13yjho1353252111.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/fisher/rcomp/tmp/1476111353252111.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/fisher/rcomp/tmp/15j9aw1353252111.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/fisher/rcomp/tmp/16wp331353252111.tab") + } > > try(system("convert tmp/155b41353252111.ps tmp/155b41353252111.png",intern=TRUE)) character(0) > try(system("convert tmp/2jfbb1353252111.ps tmp/2jfbb1353252111.png",intern=TRUE)) character(0) > try(system("convert tmp/3xtny1353252111.ps tmp/3xtny1353252111.png",intern=TRUE)) character(0) > try(system("convert tmp/4jjbq1353252111.ps tmp/4jjbq1353252111.png",intern=TRUE)) character(0) > try(system("convert tmp/5oq791353252111.ps tmp/5oq791353252111.png",intern=TRUE)) character(0) > try(system("convert tmp/6k5oj1353252111.ps tmp/6k5oj1353252111.png",intern=TRUE)) character(0) > try(system("convert tmp/7jiex1353252111.ps tmp/7jiex1353252111.png",intern=TRUE)) character(0) > try(system("convert tmp/8iggp1353252111.ps tmp/8iggp1353252111.png",intern=TRUE)) character(0) > try(system("convert tmp/96h7w1353252111.ps tmp/96h7w1353252111.png",intern=TRUE)) character(0) > try(system("convert tmp/10rd691353252111.ps tmp/10rd691353252111.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 6.167 1.272 7.439