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(-4 + ,-16 + ,3 + ,0 + ,3 + ,-6 + ,-18 + ,5 + ,-2 + ,0 + ,-3 + ,-14 + ,0 + ,1 + ,-1 + ,-3 + ,-12 + ,-2 + ,-2 + ,-1 + ,-7 + ,-17 + ,6 + ,-2 + ,-4 + ,-9 + ,-23 + ,11 + ,-2 + ,1 + ,-11 + ,-28 + ,9 + ,-6 + ,-1 + ,-13 + ,-31 + ,17 + ,-4 + ,0 + ,-11 + ,-21 + ,21 + ,-2 + ,-1 + ,-9 + ,-19 + ,21 + ,0 + ,6 + ,-17 + ,-22 + ,41 + ,-5 + ,0 + ,-22 + ,-22 + ,57 + ,-4 + ,-3 + ,-25 + ,-25 + ,65 + ,-5 + ,-3 + ,-20 + ,-16 + ,68 + ,-1 + ,4 + ,-24 + ,-22 + ,73 + ,-2 + ,1 + ,-24 + ,-21 + ,71 + ,-4 + ,0 + ,-22 + ,-10 + ,71 + ,-1 + ,-4 + ,-19 + ,-7 + ,70 + ,1 + ,-2 + ,-18 + ,-5 + ,69 + ,1 + ,3 + ,-17 + ,-4 + ,65 + ,-2 + ,2 + ,-11 + ,7 + ,57 + ,1 + ,5 + ,-11 + ,6 + ,57 + ,1 + ,6 + ,-12 + ,3 + ,57 + ,3 + ,6 + ,-10 + ,10 + ,55 + ,3 + ,3 + ,-15 + ,0 + ,65 + ,1 + ,4 + ,-15 + ,-2 + ,65 + ,1 + ,7 + ,-15 + ,-1 + ,64 + ,0 + ,5 + ,-13 + ,2 + ,60 + ,2 + ,6 + ,-8 + ,8 + ,43 + ,2 + ,1 + ,-13 + ,-6 + ,47 + ,-1 + ,3 + ,-9 + ,-4 + ,40 + ,1 + ,6 + ,-7 + ,4 + ,31 + ,0 + ,0 + ,-4 + ,7 + ,27 + ,1 + ,3 + ,-4 + ,3 + ,24 + ,1 + ,4 + ,-2 + ,3 + ,23 + ,3 + ,7 + ,0 + ,8 + ,17 + ,2 + ,6 + ,-2 + ,3 + ,16 + ,0 + ,6 + ,-3 + ,-3 + ,15 + ,0 + ,6 + ,1 + ,4 + ,8 + ,3 + ,6 + ,-2 + ,-5 + ,5 + ,-2 + ,2 + ,-1 + ,-1 + ,6 + ,0 + ,2 + ,1 + ,5 + ,5 + ,1 + ,2 + ,-3 + ,0 + ,12 + ,-1 + ,3 + ,-4 + ,-6 + ,8 + ,-2 + ,-1 + ,-9 + ,-13 + ,17 + ,-1 + ,-4 + ,-9 + ,-15 + ,22 + ,-1 + ,4 + ,-7 + ,-8 + ,24 + ,1 + ,5 + ,-14 + ,-20 + ,36 + ,-2 + ,3 + ,-12 + ,-10 + ,31 + ,-5 + ,-1 + ,-16 + ,-22 + ,34 + ,-5 + ,-4 + ,-20 + ,-25 + ,47 + ,-6 + ,0 + ,-12 + ,-10 + ,33 + ,-4 + ,-1 + ,-12 + ,-8 + ,35 + ,-3 + ,-1 + ,-10 + ,-9 + ,31 + ,-3 + ,3 + ,-10 + ,-5 + ,35 + ,-1 + ,2 + ,-13 + ,-7 + ,39 + ,-2 + ,-4 + ,-16 + ,-11 + ,46 + ,-3 + ,-3 + ,-14 + ,-11 + ,40 + ,-3 + ,-1 + ,-17 + ,-16 + ,50 + ,-3 + ,3 + ,-24 + ,-28 + ,62 + ,-5 + ,-2) + ,dim=c(5 + ,60) + ,dimnames=list(c('Consumer_confidence_indicator' + ,'General_economic_situation' + ,'Unemployment_in_Belgium' + ,'Financial_situation_of_households' + ,'Saving_capacity_of_households ') + ,1:60)) > y <- array(NA,dim=c(5,60),dimnames=list(c('Consumer_confidence_indicator','General_economic_situation','Unemployment_in_Belgium','Financial_situation_of_households','Saving_capacity_of_households '),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' > 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 Consumer_confidence_indicator General_economic_situation 1 -4 -16 2 -6 -18 3 -3 -14 4 -3 -12 5 -7 -17 6 -9 -23 7 -11 -28 8 -13 -31 9 -11 -21 10 -9 -19 11 -17 -22 12 -22 -22 13 -25 -25 14 -20 -16 15 -24 -22 16 -24 -21 17 -22 -10 18 -19 -7 19 -18 -5 20 -17 -4 21 -11 7 22 -11 6 23 -12 3 24 -10 10 25 -15 0 26 -15 -2 27 -15 -1 28 -13 2 29 -8 8 30 -13 -6 31 -9 -4 32 -7 4 33 -4 7 34 -4 3 35 -2 3 36 0 8 37 -2 3 38 -3 -3 39 1 4 40 -2 -5 41 -1 -1 42 1 5 43 -3 0 44 -4 -6 45 -9 -13 46 -9 -15 47 -7 -8 48 -14 -20 49 -12 -10 50 -16 -22 51 -20 -25 52 -12 -10 53 -12 -8 54 -10 -9 55 -10 -5 56 -13 -7 57 -16 -11 58 -14 -11 59 -17 -16 60 -24 -28 Unemployment_in_Belgium Financial_situation_of_households 1 3 0 2 5 -2 3 0 1 4 -2 -2 5 6 -2 6 11 -2 7 9 -6 8 17 -4 9 21 -2 10 21 0 11 41 -5 12 57 -4 13 65 -5 14 68 -1 15 73 -2 16 71 -4 17 71 -1 18 70 1 19 69 1 20 65 -2 21 57 1 22 57 1 23 57 3 24 55 3 25 65 1 26 65 1 27 64 0 28 60 2 29 43 2 30 47 -1 31 40 1 32 31 0 33 27 1 34 24 1 35 23 3 36 17 2 37 16 0 38 15 0 39 8 3 40 5 -2 41 6 0 42 5 1 43 12 -1 44 8 -2 45 17 -1 46 22 -1 47 24 1 48 36 -2 49 31 -5 50 34 -5 51 47 -6 52 33 -4 53 35 -3 54 31 -3 55 35 -1 56 39 -2 57 46 -3 58 40 -3 59 50 -3 60 62 -5 Saving_capacity_of_households\r 1 3 2 0 3 -1 4 -1 5 -4 6 1 7 -1 8 0 9 -1 10 6 11 0 12 -3 13 -3 14 4 15 1 16 0 17 -4 18 -2 19 3 20 2 21 5 22 6 23 6 24 3 25 4 26 7 27 5 28 6 29 1 30 3 31 6 32 0 33 3 34 4 35 7 36 6 37 6 38 6 39 6 40 2 41 2 42 2 43 3 44 -1 45 -4 46 4 47 5 48 3 49 -1 50 -4 51 0 52 -1 53 -1 54 3 55 2 56 -4 57 -3 58 -1 59 3 60 -2 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) General_economic_situation 0.1282 0.2515 Unemployment_in_Belgium Financial_situation_of_households -0.2537 0.2683 `Saving_capacity_of_households\\r` 0.2275 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -0.58882 -0.24924 0.02032 0.19597 0.58164 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 0.128163 0.090848 1.411 0.164 General_economic_situation 0.251519 0.006057 41.528 < 2e-16 *** Unemployment_in_Belgium -0.253749 0.001736 -146.164 < 2e-16 *** Financial_situation_of_households 0.268260 0.030223 8.876 3.34e-12 *** `Saving_capacity_of_households\\r` 0.227502 0.016056 14.170 < 2e-16 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 0.3022 on 55 degrees of freedom Multiple R-squared: 0.9982, Adjusted R-squared: 0.9981 F-statistic: 7577 on 4 and 55 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,] 0.14962839 0.29925677 0.85037161 [2,] 0.17359018 0.34718036 0.82640982 [3,] 0.11410975 0.22821951 0.88589025 [4,] 0.06867674 0.13735348 0.93132326 [5,] 0.16439328 0.32878656 0.83560672 [6,] 0.10923565 0.21847131 0.89076435 [7,] 0.51144179 0.97711641 0.48855821 [8,] 0.47401934 0.94803868 0.52598066 [9,] 0.41102655 0.82205310 0.58897345 [10,] 0.56660059 0.86679882 0.43339941 [11,] 0.72078232 0.55843536 0.27921768 [12,] 0.77309379 0.45381243 0.22690621 [13,] 0.78790556 0.42418887 0.21209444 [14,] 0.73440822 0.53118356 0.26559178 [15,] 0.67331371 0.65337259 0.32668629 [16,] 0.85433878 0.29132244 0.14566122 [17,] 0.82491449 0.35017101 0.17508551 [18,] 0.78611444 0.42777111 0.21388556 [19,] 0.72173599 0.55652801 0.27826401 [20,] 0.68724157 0.62551686 0.31275843 [21,] 0.67607156 0.64785688 0.32392844 [22,] 0.60125333 0.79749334 0.39874667 [23,] 0.53485216 0.93029568 0.46514784 [24,] 0.59104995 0.81790010 0.40895005 [25,] 0.58012449 0.83975101 0.41987551 [26,] 0.49913254 0.99826508 0.50086746 [27,] 0.41843193 0.83686385 0.58156807 [28,] 0.66806050 0.66387900 0.33193950 [29,] 0.72779697 0.54440605 0.27220303 [30,] 0.67750008 0.64499984 0.32249992 [31,] 0.63242697 0.73514606 0.36757303 [32,] 0.58044530 0.83910941 0.41955470 [33,] 0.69409791 0.61180418 0.30590209 [34,] 0.71335206 0.57329588 0.28664794 [35,] 0.81738133 0.36523734 0.18261867 [36,] 0.82580455 0.34839091 0.17419545 [37,] 0.86804170 0.26391659 0.13195830 [38,] 0.86261117 0.27477765 0.13738883 [39,] 0.84536567 0.30926867 0.15463433 [40,] 0.82110644 0.35778712 0.17889356 [41,] 0.78654974 0.42690051 0.21345026 [42,] 0.68852579 0.62294843 0.31147421 [43,] 0.58153938 0.83692123 0.41846062 [44,] 0.96935492 0.06129015 0.03064508 [45,] 0.91180435 0.17639130 0.08819565 > postscript(file="/var/fisher/rcomp/tmp/1sr1z1355268344.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/2u9vy1355268344.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/3welf1355268344.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/4hi0z1355268344.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/58wk51355268344.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.025124199 0.204438013 0.352340600 0.146585650 0.116677350 -0.242977239 7 8 9 10 11 12 0.035163128 0.055688238 0.246479391 -0.385593997 0.150254951 -0.375515242 13 14 15 16 17 18 -0.322707587 0.509314979 0.237938611 0.242944504 -0.418532083 0.581638245 19 20 21 22 23 24 -0.312659369 0.453108729 0.169124729 0.193141133 -0.588823041 -0.174444823 25 26 27 28 29 30 0.187249238 0.007779780 0.225776791 -0.307797447 0.006869816 -0.107097279 31 32 33 34 35 36 0.394595790 -0.268020378 0.011660945 0.028986528 0.556210601 0.271885945 37 38 39 40 41 42 -0.187749462 0.067613616 -0.274039961 0.479690767 0.190844845 0.159723786 43 44 45 46 47 48 -0.497422336 0.174963067 -0.366419041 -0.414655109 -0.431810365 -0.108814185 49 50 51 52 53 54 -0.177956265 0.284021408 -0.304435282 0.061281530 -0.202518015 0.123995816 55 56 57 58 59 60 -0.176101009 -0.024794205 -0.201719090 -0.179217285 -0.294143559 0.443099326 > postscript(file="/var/fisher/rcomp/tmp/6bczr1355268344.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.025124199 NA 1 0.204438013 -0.025124199 2 0.352340600 0.204438013 3 0.146585650 0.352340600 4 0.116677350 0.146585650 5 -0.242977239 0.116677350 6 0.035163128 -0.242977239 7 0.055688238 0.035163128 8 0.246479391 0.055688238 9 -0.385593997 0.246479391 10 0.150254951 -0.385593997 11 -0.375515242 0.150254951 12 -0.322707587 -0.375515242 13 0.509314979 -0.322707587 14 0.237938611 0.509314979 15 0.242944504 0.237938611 16 -0.418532083 0.242944504 17 0.581638245 -0.418532083 18 -0.312659369 0.581638245 19 0.453108729 -0.312659369 20 0.169124729 0.453108729 21 0.193141133 0.169124729 22 -0.588823041 0.193141133 23 -0.174444823 -0.588823041 24 0.187249238 -0.174444823 25 0.007779780 0.187249238 26 0.225776791 0.007779780 27 -0.307797447 0.225776791 28 0.006869816 -0.307797447 29 -0.107097279 0.006869816 30 0.394595790 -0.107097279 31 -0.268020378 0.394595790 32 0.011660945 -0.268020378 33 0.028986528 0.011660945 34 0.556210601 0.028986528 35 0.271885945 0.556210601 36 -0.187749462 0.271885945 37 0.067613616 -0.187749462 38 -0.274039961 0.067613616 39 0.479690767 -0.274039961 40 0.190844845 0.479690767 41 0.159723786 0.190844845 42 -0.497422336 0.159723786 43 0.174963067 -0.497422336 44 -0.366419041 0.174963067 45 -0.414655109 -0.366419041 46 -0.431810365 -0.414655109 47 -0.108814185 -0.431810365 48 -0.177956265 -0.108814185 49 0.284021408 -0.177956265 50 -0.304435282 0.284021408 51 0.061281530 -0.304435282 52 -0.202518015 0.061281530 53 0.123995816 -0.202518015 54 -0.176101009 0.123995816 55 -0.024794205 -0.176101009 56 -0.201719090 -0.024794205 57 -0.179217285 -0.201719090 58 -0.294143559 -0.179217285 59 0.443099326 -0.294143559 60 NA 0.443099326 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] 0.204438013 -0.025124199 [2,] 0.352340600 0.204438013 [3,] 0.146585650 0.352340600 [4,] 0.116677350 0.146585650 [5,] -0.242977239 0.116677350 [6,] 0.035163128 -0.242977239 [7,] 0.055688238 0.035163128 [8,] 0.246479391 0.055688238 [9,] -0.385593997 0.246479391 [10,] 0.150254951 -0.385593997 [11,] -0.375515242 0.150254951 [12,] -0.322707587 -0.375515242 [13,] 0.509314979 -0.322707587 [14,] 0.237938611 0.509314979 [15,] 0.242944504 0.237938611 [16,] -0.418532083 0.242944504 [17,] 0.581638245 -0.418532083 [18,] -0.312659369 0.581638245 [19,] 0.453108729 -0.312659369 [20,] 0.169124729 0.453108729 [21,] 0.193141133 0.169124729 [22,] -0.588823041 0.193141133 [23,] -0.174444823 -0.588823041 [24,] 0.187249238 -0.174444823 [25,] 0.007779780 0.187249238 [26,] 0.225776791 0.007779780 [27,] -0.307797447 0.225776791 [28,] 0.006869816 -0.307797447 [29,] -0.107097279 0.006869816 [30,] 0.394595790 -0.107097279 [31,] -0.268020378 0.394595790 [32,] 0.011660945 -0.268020378 [33,] 0.028986528 0.011660945 [34,] 0.556210601 0.028986528 [35,] 0.271885945 0.556210601 [36,] -0.187749462 0.271885945 [37,] 0.067613616 -0.187749462 [38,] -0.274039961 0.067613616 [39,] 0.479690767 -0.274039961 [40,] 0.190844845 0.479690767 [41,] 0.159723786 0.190844845 [42,] -0.497422336 0.159723786 [43,] 0.174963067 -0.497422336 [44,] -0.366419041 0.174963067 [45,] -0.414655109 -0.366419041 [46,] -0.431810365 -0.414655109 [47,] -0.108814185 -0.431810365 [48,] -0.177956265 -0.108814185 [49,] 0.284021408 -0.177956265 [50,] -0.304435282 0.284021408 [51,] 0.061281530 -0.304435282 [52,] -0.202518015 0.061281530 [53,] 0.123995816 -0.202518015 [54,] -0.176101009 0.123995816 [55,] -0.024794205 -0.176101009 [56,] -0.201719090 -0.024794205 [57,] -0.179217285 -0.201719090 [58,] -0.294143559 -0.179217285 [59,] 0.443099326 -0.294143559 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 0.204438013 -0.025124199 2 0.352340600 0.204438013 3 0.146585650 0.352340600 4 0.116677350 0.146585650 5 -0.242977239 0.116677350 6 0.035163128 -0.242977239 7 0.055688238 0.035163128 8 0.246479391 0.055688238 9 -0.385593997 0.246479391 10 0.150254951 -0.385593997 11 -0.375515242 0.150254951 12 -0.322707587 -0.375515242 13 0.509314979 -0.322707587 14 0.237938611 0.509314979 15 0.242944504 0.237938611 16 -0.418532083 0.242944504 17 0.581638245 -0.418532083 18 -0.312659369 0.581638245 19 0.453108729 -0.312659369 20 0.169124729 0.453108729 21 0.193141133 0.169124729 22 -0.588823041 0.193141133 23 -0.174444823 -0.588823041 24 0.187249238 -0.174444823 25 0.007779780 0.187249238 26 0.225776791 0.007779780 27 -0.307797447 0.225776791 28 0.006869816 -0.307797447 29 -0.107097279 0.006869816 30 0.394595790 -0.107097279 31 -0.268020378 0.394595790 32 0.011660945 -0.268020378 33 0.028986528 0.011660945 34 0.556210601 0.028986528 35 0.271885945 0.556210601 36 -0.187749462 0.271885945 37 0.067613616 -0.187749462 38 -0.274039961 0.067613616 39 0.479690767 -0.274039961 40 0.190844845 0.479690767 41 0.159723786 0.190844845 42 -0.497422336 0.159723786 43 0.174963067 -0.497422336 44 -0.366419041 0.174963067 45 -0.414655109 -0.366419041 46 -0.431810365 -0.414655109 47 -0.108814185 -0.431810365 48 -0.177956265 -0.108814185 49 0.284021408 -0.177956265 50 -0.304435282 0.284021408 51 0.061281530 -0.304435282 52 -0.202518015 0.061281530 53 0.123995816 -0.202518015 54 -0.176101009 0.123995816 55 -0.024794205 -0.176101009 56 -0.201719090 -0.024794205 57 -0.179217285 -0.201719090 58 -0.294143559 -0.179217285 59 0.443099326 -0.294143559 > 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/7ego21355268344.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/8wum11355268344.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/9ld521355268344.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/10o5ce1355268344.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/11qdyz1355268344.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/120wf51355268344.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/13mwc41355268344.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/14dqqr1355268344.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/15mgv91355268344.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/16jng31355268344.tab") + } > > try(system("convert tmp/1sr1z1355268344.ps tmp/1sr1z1355268344.png",intern=TRUE)) character(0) > try(system("convert tmp/2u9vy1355268344.ps tmp/2u9vy1355268344.png",intern=TRUE)) character(0) > try(system("convert tmp/3welf1355268344.ps tmp/3welf1355268344.png",intern=TRUE)) character(0) > try(system("convert tmp/4hi0z1355268344.ps tmp/4hi0z1355268344.png",intern=TRUE)) character(0) > try(system("convert tmp/58wk51355268344.ps tmp/58wk51355268344.png",intern=TRUE)) character(0) > try(system("convert tmp/6bczr1355268344.ps tmp/6bczr1355268344.png",intern=TRUE)) character(0) > try(system("convert tmp/7ego21355268344.ps tmp/7ego21355268344.png",intern=TRUE)) character(0) > try(system("convert tmp/8wum11355268344.ps tmp/8wum11355268344.png",intern=TRUE)) character(0) > try(system("convert tmp/9ld521355268344.ps tmp/9ld521355268344.png",intern=TRUE)) character(0) > try(system("convert tmp/10o5ce1355268344.ps tmp/10o5ce1355268344.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 6.051 1.571 7.673