R version 2.13.0 (2011-04-13) Copyright (C) 2011 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(11 + ,0 + ,8 + ,17 + ,2 + ,6 + ,10 + ,-2 + ,3 + ,23 + ,3 + ,7 + ,9 + ,-4 + ,3 + ,24 + ,1 + ,4 + ,8 + ,-4 + ,7 + ,27 + ,1 + ,3 + ,7 + ,-7 + ,4 + ,31 + ,0 + ,0 + ,6 + ,-9 + ,-4 + ,40 + ,1 + ,6 + ,5 + ,-13 + ,-6 + ,47 + ,-1 + ,3 + ,4 + ,-8 + ,8 + ,43 + ,2 + ,1 + ,3 + ,-13 + ,2 + ,60 + ,2 + ,6 + ,2 + ,-15 + ,-1 + ,64 + ,0 + ,5 + ,1 + ,-15 + ,-2 + ,65 + ,1 + ,7 + ,12 + ,-15 + ,0 + ,65 + ,1 + ,4 + ,11 + ,-10 + ,10 + ,55 + ,3 + ,3 + ,10 + ,-12 + ,3 + ,57 + ,3 + ,6 + ,9 + ,-11 + ,6 + ,57 + ,1 + ,6 + ,8 + ,-11 + ,7 + ,57 + ,1 + ,5 + ,7 + ,-17 + ,-4 + ,65 + ,-2 + ,2 + ,6 + ,-18 + ,-5 + ,69 + ,1 + ,3 + ,5 + ,-19 + ,-7 + ,70 + ,1 + ,-2 + ,4 + ,-22 + ,-10 + ,71 + ,-1 + ,-4 + ,3 + ,-24 + ,-21 + ,71 + ,-4 + ,0 + ,2 + ,-24 + ,-22 + ,73 + ,-2 + ,1 + ,1 + ,-20 + ,-16 + ,68 + ,-1 + ,4 + ,12 + ,-25 + ,-25 + ,65 + ,-5 + ,-3 + ,11 + ,-22 + ,-22 + ,57 + ,-4 + ,-3 + ,10 + ,-17 + ,-22 + ,41 + ,-5 + ,0 + ,9 + ,-9 + ,-19 + ,21 + ,0 + ,6 + ,8 + ,-11 + ,-21 + ,21 + ,-2 + ,-1 + ,7 + ,-13 + ,-31 + ,17 + ,-4 + ,0 + ,6 + ,-11 + ,-28 + ,9 + ,-6 + ,-1 + ,5 + ,-9 + ,-23 + ,11 + ,-2 + ,1 + ,4 + ,-7 + ,-17 + ,6 + ,-2 + ,-4 + ,3 + ,-3 + ,-12 + ,-2 + ,-2 + ,-1 + ,2 + ,-3 + ,-14 + ,0 + ,1 + ,-1 + ,1 + ,-6 + ,-18 + ,5 + ,-2 + ,0 + ,12 + ,-4 + ,-16 + ,3 + ,0 + ,3 + ,11 + ,-8 + ,-22 + ,7 + ,-1 + ,0 + ,10 + ,-1 + ,-9 + ,4 + ,2 + ,8 + ,9 + ,-2 + ,-10 + ,8 + ,3 + ,8 + ,8 + ,-2 + ,-10 + ,9 + ,2 + ,8 + ,7 + ,-1 + ,0 + ,14 + ,3 + ,8 + ,6 + ,1 + ,3 + ,12 + ,4 + ,11 + ,5 + ,2 + ,2 + ,12 + ,5 + ,13 + ,4 + ,2 + ,4 + ,7 + ,5 + ,5 + ,3 + ,-1 + ,-3 + ,15 + ,4 + ,12 + ,2 + ,1 + ,0 + ,14 + ,5 + ,13 + ,1 + ,-1 + ,-1 + ,19 + ,6 + ,9 + ,12 + ,-8 + ,-7 + ,39 + ,4 + ,11 + ,11 + ,1 + ,2 + ,12 + ,6 + ,7 + ,10 + ,2 + ,3 + ,11 + ,6 + ,12 + ,9 + ,-2 + ,-3 + ,17 + ,3 + ,11 + ,8 + ,-2 + ,-5 + ,16 + ,5 + ,10 + ,7 + ,-2 + ,0 + ,25 + ,5 + ,13 + ,6 + ,-2 + ,-3 + ,24 + ,5 + ,14 + ,5 + ,-6 + ,-7 + ,28 + ,3 + ,10 + ,4 + ,-4 + ,-7 + ,25 + ,5 + ,13 + ,3 + ,-5 + ,-7 + ,31 + ,5 + ,12 + ,2 + ,-2 + ,-4 + ,24 + ,6 + ,13 + ,1 + ,-1 + ,-3 + ,24 + ,6 + ,17 + ,12 + ,-5 + ,-6 + ,33 + ,5 + ,15) + ,dim=c(6 + ,60) + ,dimnames=list(c('maand' + ,'indicator' + ,'economie' + ,'werkloosheid' + ,'financiƫn' + ,'spaarvermogen') + ,1:60)) > y <- array(NA,dim=c(6,60),dimnames=list(c('maand','indicator','economie','werkloosheid','financiƫn','spaarvermogen'),1:60)) > for (i in 1:dim(x)[1]) + { + for (j in 1:dim(x)[2]) + { + y[i,j] <- as.numeric(x[i,j]) + } + } > par20 = '' > par19 = '' > par18 = '' > par17 = '' > par16 = '' > par15 = '' > par14 = '' > par13 = '' > par12 = '' > par11 = '' > par10 = '' > par9 = '' > par8 = '' > par7 = '' > par6 = '' > par5 = '' > par4 = '' > par3 = 'Linear Trend' > par2 = 'Do not include Seasonal Dummies' > par1 = '4' > 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 werkloosheid maand indicator economie financi\303\253n spaarvermogen t 1 17 11 0 8 2 6 1 2 23 10 -2 3 3 7 2 3 24 9 -4 3 1 4 3 4 27 8 -4 7 1 3 4 5 31 7 -7 4 0 0 5 6 40 6 -9 -4 1 6 6 7 47 5 -13 -6 -1 3 7 8 43 4 -8 8 2 1 8 9 60 3 -13 2 2 6 9 10 64 2 -15 -1 0 5 10 11 65 1 -15 -2 1 7 11 12 65 12 -15 0 1 4 12 13 55 11 -10 10 3 3 13 14 57 10 -12 3 3 6 14 15 57 9 -11 6 1 6 15 16 57 8 -11 7 1 5 16 17 65 7 -17 -4 -2 2 17 18 69 6 -18 -5 1 3 18 19 70 5 -19 -7 1 -2 19 20 71 4 -22 -10 -1 -4 20 21 71 3 -24 -21 -4 0 21 22 73 2 -24 -22 -2 1 22 23 68 1 -20 -16 -1 4 23 24 65 12 -25 -25 -5 -3 24 25 57 11 -22 -22 -4 -3 25 26 41 10 -17 -22 -5 0 26 27 21 9 -9 -19 0 6 27 28 21 8 -11 -21 -2 -1 28 29 17 7 -13 -31 -4 0 29 30 9 6 -11 -28 -6 -1 30 31 11 5 -9 -23 -2 1 31 32 6 4 -7 -17 -2 -4 32 33 -2 3 -3 -12 -2 -1 33 34 0 2 -3 -14 1 -1 34 35 5 1 -6 -18 -2 0 35 36 3 12 -4 -16 0 3 36 37 7 11 -8 -22 -1 0 37 38 4 10 -1 -9 2 8 38 39 8 9 -2 -10 3 8 39 40 9 8 -2 -10 2 8 40 41 14 7 -1 0 3 8 41 42 12 6 1 3 4 11 42 43 12 5 2 2 5 13 43 44 7 4 2 4 5 5 44 45 15 3 -1 -3 4 12 45 46 14 2 1 0 5 13 46 47 19 1 -1 -1 6 9 47 48 39 12 -8 -7 4 11 48 49 12 11 1 2 6 7 49 50 11 10 2 3 6 12 50 51 17 9 -2 -3 3 11 51 52 16 8 -2 -5 5 10 52 53 25 7 -2 0 5 13 53 54 24 6 -2 -3 5 14 54 55 28 5 -6 -7 3 10 55 56 25 4 -4 -7 5 13 56 57 31 3 -5 -7 5 12 57 58 24 2 -2 -4 6 13 58 59 24 1 -1 -3 6 17 59 60 33 12 -5 -6 5 15 60 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) maand indicator economie 1.85424 -0.11454 -3.92323 0.97321 `financi\303\253n` spaarvermogen t 1.09728 0.90802 -0.02216 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -2.1369 -0.9040 0.1640 0.9198 2.1294 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 1.85424 0.62094 2.986 0.00427 ** maand -0.11454 0.04435 -2.583 0.01260 * indicator -3.92323 0.03081 -127.321 < 2e-16 *** economie 0.97321 0.03735 26.056 < 2e-16 *** `financi\303\253n` 1.09728 0.15584 7.041 3.87e-09 *** spaarvermogen 0.90802 0.05791 15.680 < 2e-16 *** t -0.02216 0.01922 -1.153 0.25414 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 1.168 on 53 degrees of freedom Multiple R-squared: 0.9977, Adjusted R-squared: 0.9974 F-statistic: 3839 on 6 and 53 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.3232722 0.6465444 0.67672780 [2,] 0.3800068 0.7600136 0.61999321 [3,] 0.2544043 0.5088087 0.74559567 [4,] 0.3066190 0.6132380 0.69338098 [5,] 0.6290597 0.7418806 0.37094030 [6,] 0.6159222 0.7681557 0.38407783 [7,] 0.5352091 0.9295818 0.46479090 [8,] 0.5939627 0.8120745 0.40603726 [9,] 0.5366593 0.9266814 0.46334071 [10,] 0.8275315 0.3449370 0.17246850 [11,] 0.9135910 0.1728179 0.08640897 [12,] 0.8820513 0.2358975 0.11794873 [13,] 0.8349322 0.3301356 0.16506778 [14,] 0.8074462 0.3851077 0.19255384 [15,] 0.8309574 0.3380853 0.16904263 [16,] 0.8609577 0.2780847 0.13904234 [17,] 0.8471780 0.3056440 0.15282202 [18,] 0.9023119 0.1953761 0.09768806 [19,] 0.8965242 0.2069515 0.10347577 [20,] 0.8602464 0.2795073 0.13975364 [21,] 0.8383278 0.3233443 0.16167216 [22,] 0.8164013 0.3671973 0.18359867 [23,] 0.7634257 0.4731486 0.23657431 [24,] 0.7190525 0.5618950 0.28094749 [25,] 0.6732832 0.6534336 0.32671679 [26,] 0.6541591 0.6916819 0.34584093 [27,] 0.6400241 0.7199518 0.35997588 [28,] 0.6448121 0.7103759 0.35518795 [29,] 0.5610338 0.8779323 0.43896615 [30,] 0.5234915 0.9530171 0.47650853 [31,] 0.7812789 0.4374423 0.21872114 [32,] 0.7383629 0.5232743 0.26163713 [33,] 0.7258628 0.5482744 0.27413719 [34,] 0.7089159 0.5821682 0.29108408 [35,] 0.6271637 0.7456725 0.37283627 [36,] 0.5530574 0.8938853 0.44694263 [37,] 0.5303814 0.9392371 0.46961856 [38,] 0.4215782 0.8431564 0.57842179 [39,] 0.3732132 0.7464264 0.62678678 [40,] 0.3861060 0.7722120 0.61389401 [41,] 0.2988353 0.5976706 0.70116469 > postscript(file="/var/wessaorg/rcomp/tmp/1yf771322165408.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/wessaorg/rcomp/tmp/21n6e1322165408.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/wessaorg/rcomp/tmp/3va8i1322165408.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/wessaorg/rcomp/tmp/45fzl1322165408.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/wessaorg/rcomp/tmp/5jx7j1322165408.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.99949712 1.92141486 -0.09880691 -0.17600989 -1.29711364 1.00435878 7 8 9 10 11 12 -0.91590135 -0.49289732 -1.90223583 0.18114322 -0.85133713 1.20836760 13 14 15 16 17 18 -0.28651777 -2.13692587 0.96886373 0.81129234 1.90075144 -1.34151095 19 20 21 22 23 24 2.12938108 -1.80245419 0.62381604 0.40206721 1.34201659 -0.48791439 25 26 27 28 29 30 -0.82751697 1.06949302 -1.49118880 1.06707202 0.14689402 0.08392870 31 32 33 34 35 36 -1.23320701 0.22168989 0.23213367 0.79432689 0.20893986 0.47244396 37 38 39 40 41 42 -1.65225791 -0.48973778 -0.62941706 1.37549056 -0.62304515 -1.60992359 43 44 45 46 47 48 0.28082576 0.50615153 -1.80226394 0.02688839 0.59604093 0.63331277 49 50 51 52 53 54 1.52860290 -1.15383109 -0.89999599 -1.33250352 -0.01497857 0.90426139 55 56 57 58 59 60 -1.16156229 -1.32609300 1.56631643 1.31869846 0.54427986 0.96638689 > postscript(file="/var/wessaorg/rcomp/tmp/6dyd81322165408.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.99949712 NA 1 1.92141486 0.99949712 2 -0.09880691 1.92141486 3 -0.17600989 -0.09880691 4 -1.29711364 -0.17600989 5 1.00435878 -1.29711364 6 -0.91590135 1.00435878 7 -0.49289732 -0.91590135 8 -1.90223583 -0.49289732 9 0.18114322 -1.90223583 10 -0.85133713 0.18114322 11 1.20836760 -0.85133713 12 -0.28651777 1.20836760 13 -2.13692587 -0.28651777 14 0.96886373 -2.13692587 15 0.81129234 0.96886373 16 1.90075144 0.81129234 17 -1.34151095 1.90075144 18 2.12938108 -1.34151095 19 -1.80245419 2.12938108 20 0.62381604 -1.80245419 21 0.40206721 0.62381604 22 1.34201659 0.40206721 23 -0.48791439 1.34201659 24 -0.82751697 -0.48791439 25 1.06949302 -0.82751697 26 -1.49118880 1.06949302 27 1.06707202 -1.49118880 28 0.14689402 1.06707202 29 0.08392870 0.14689402 30 -1.23320701 0.08392870 31 0.22168989 -1.23320701 32 0.23213367 0.22168989 33 0.79432689 0.23213367 34 0.20893986 0.79432689 35 0.47244396 0.20893986 36 -1.65225791 0.47244396 37 -0.48973778 -1.65225791 38 -0.62941706 -0.48973778 39 1.37549056 -0.62941706 40 -0.62304515 1.37549056 41 -1.60992359 -0.62304515 42 0.28082576 -1.60992359 43 0.50615153 0.28082576 44 -1.80226394 0.50615153 45 0.02688839 -1.80226394 46 0.59604093 0.02688839 47 0.63331277 0.59604093 48 1.52860290 0.63331277 49 -1.15383109 1.52860290 50 -0.89999599 -1.15383109 51 -1.33250352 -0.89999599 52 -0.01497857 -1.33250352 53 0.90426139 -0.01497857 54 -1.16156229 0.90426139 55 -1.32609300 -1.16156229 56 1.56631643 -1.32609300 57 1.31869846 1.56631643 58 0.54427986 1.31869846 59 0.96638689 0.54427986 60 NA 0.96638689 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] 1.92141486 0.99949712 [2,] -0.09880691 1.92141486 [3,] -0.17600989 -0.09880691 [4,] -1.29711364 -0.17600989 [5,] 1.00435878 -1.29711364 [6,] -0.91590135 1.00435878 [7,] -0.49289732 -0.91590135 [8,] -1.90223583 -0.49289732 [9,] 0.18114322 -1.90223583 [10,] -0.85133713 0.18114322 [11,] 1.20836760 -0.85133713 [12,] -0.28651777 1.20836760 [13,] -2.13692587 -0.28651777 [14,] 0.96886373 -2.13692587 [15,] 0.81129234 0.96886373 [16,] 1.90075144 0.81129234 [17,] -1.34151095 1.90075144 [18,] 2.12938108 -1.34151095 [19,] -1.80245419 2.12938108 [20,] 0.62381604 -1.80245419 [21,] 0.40206721 0.62381604 [22,] 1.34201659 0.40206721 [23,] -0.48791439 1.34201659 [24,] -0.82751697 -0.48791439 [25,] 1.06949302 -0.82751697 [26,] -1.49118880 1.06949302 [27,] 1.06707202 -1.49118880 [28,] 0.14689402 1.06707202 [29,] 0.08392870 0.14689402 [30,] -1.23320701 0.08392870 [31,] 0.22168989 -1.23320701 [32,] 0.23213367 0.22168989 [33,] 0.79432689 0.23213367 [34,] 0.20893986 0.79432689 [35,] 0.47244396 0.20893986 [36,] -1.65225791 0.47244396 [37,] -0.48973778 -1.65225791 [38,] -0.62941706 -0.48973778 [39,] 1.37549056 -0.62941706 [40,] -0.62304515 1.37549056 [41,] -1.60992359 -0.62304515 [42,] 0.28082576 -1.60992359 [43,] 0.50615153 0.28082576 [44,] -1.80226394 0.50615153 [45,] 0.02688839 -1.80226394 [46,] 0.59604093 0.02688839 [47,] 0.63331277 0.59604093 [48,] 1.52860290 0.63331277 [49,] -1.15383109 1.52860290 [50,] -0.89999599 -1.15383109 [51,] -1.33250352 -0.89999599 [52,] -0.01497857 -1.33250352 [53,] 0.90426139 -0.01497857 [54,] -1.16156229 0.90426139 [55,] -1.32609300 -1.16156229 [56,] 1.56631643 -1.32609300 [57,] 1.31869846 1.56631643 [58,] 0.54427986 1.31869846 [59,] 0.96638689 0.54427986 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 1.92141486 0.99949712 2 -0.09880691 1.92141486 3 -0.17600989 -0.09880691 4 -1.29711364 -0.17600989 5 1.00435878 -1.29711364 6 -0.91590135 1.00435878 7 -0.49289732 -0.91590135 8 -1.90223583 -0.49289732 9 0.18114322 -1.90223583 10 -0.85133713 0.18114322 11 1.20836760 -0.85133713 12 -0.28651777 1.20836760 13 -2.13692587 -0.28651777 14 0.96886373 -2.13692587 15 0.81129234 0.96886373 16 1.90075144 0.81129234 17 -1.34151095 1.90075144 18 2.12938108 -1.34151095 19 -1.80245419 2.12938108 20 0.62381604 -1.80245419 21 0.40206721 0.62381604 22 1.34201659 0.40206721 23 -0.48791439 1.34201659 24 -0.82751697 -0.48791439 25 1.06949302 -0.82751697 26 -1.49118880 1.06949302 27 1.06707202 -1.49118880 28 0.14689402 1.06707202 29 0.08392870 0.14689402 30 -1.23320701 0.08392870 31 0.22168989 -1.23320701 32 0.23213367 0.22168989 33 0.79432689 0.23213367 34 0.20893986 0.79432689 35 0.47244396 0.20893986 36 -1.65225791 0.47244396 37 -0.48973778 -1.65225791 38 -0.62941706 -0.48973778 39 1.37549056 -0.62941706 40 -0.62304515 1.37549056 41 -1.60992359 -0.62304515 42 0.28082576 -1.60992359 43 0.50615153 0.28082576 44 -1.80226394 0.50615153 45 0.02688839 -1.80226394 46 0.59604093 0.02688839 47 0.63331277 0.59604093 48 1.52860290 0.63331277 49 -1.15383109 1.52860290 50 -0.89999599 -1.15383109 51 -1.33250352 -0.89999599 52 -0.01497857 -1.33250352 53 0.90426139 -0.01497857 54 -1.16156229 0.90426139 55 -1.32609300 -1.16156229 56 1.56631643 -1.32609300 57 1.31869846 1.56631643 58 0.54427986 1.31869846 59 0.96638689 0.54427986 > 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/wessaorg/rcomp/tmp/7p9sh1322165408.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/wessaorg/rcomp/tmp/81pxz1322165408.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/wessaorg/rcomp/tmp/954761322165408.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/wessaorg/rcomp/tmp/10rdln1322165408.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/wessaorg/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/wessaorg/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/wessaorg/rcomp/tmp/11ou5t1322165408.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/wessaorg/rcomp/tmp/12a5ft1322165408.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/wessaorg/rcomp/tmp/132mdg1322165408.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/wessaorg/rcomp/tmp/14lroa1322165408.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/wessaorg/rcomp/tmp/150hs21322165408.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/wessaorg/rcomp/tmp/166q2c1322165408.tab") + } > > try(system("convert tmp/1yf771322165408.ps tmp/1yf771322165408.png",intern=TRUE)) character(0) > try(system("convert tmp/21n6e1322165408.ps tmp/21n6e1322165408.png",intern=TRUE)) character(0) > try(system("convert tmp/3va8i1322165408.ps tmp/3va8i1322165408.png",intern=TRUE)) character(0) > try(system("convert tmp/45fzl1322165408.ps tmp/45fzl1322165408.png",intern=TRUE)) character(0) > try(system("convert tmp/5jx7j1322165408.ps tmp/5jx7j1322165408.png",intern=TRUE)) character(0) > try(system("convert tmp/6dyd81322165408.ps tmp/6dyd81322165408.png",intern=TRUE)) character(0) > try(system("convert tmp/7p9sh1322165408.ps tmp/7p9sh1322165408.png",intern=TRUE)) character(0) > try(system("convert tmp/81pxz1322165408.ps tmp/81pxz1322165408.png",intern=TRUE)) character(0) > try(system("convert tmp/954761322165408.ps tmp/954761322165408.png",intern=TRUE)) character(0) > try(system("convert tmp/10rdln1322165408.ps tmp/10rdln1322165408.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 3.328 0.493 3.853