R version 2.9.0 (2009-04-17) Copyright (C) 2009 The R Foundation for Statistical Computing ISBN 3-900051-07-0 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > x <- array(list(1635.25 + ,8169.75 + ,7977.64 + ,10171 + ,-14.9 + ,-18 + ,1.8 + ,2.05 + ,1833.42 + ,7905.84 + ,8334.59 + ,9721 + ,-16.2 + ,-11 + ,1.5 + ,2.05 + ,1910.43 + ,8145.82 + ,8623.36 + ,9897 + ,-14.4 + ,-9 + ,1 + ,1.81 + ,1959.67 + ,8895.71 + ,9098.03 + ,9828 + ,-17.3 + ,-10 + ,1.6 + ,1.58 + ,1969.6 + ,9676.31 + ,9154.34 + ,9924 + ,-15.7 + ,-13 + ,1.5 + ,1.57 + ,2061.41 + ,9884.59 + ,9284.73 + ,10371 + ,-12.6 + ,-11 + ,1.8 + ,1.76 + ,2093.48 + ,10637.44 + ,9492.49 + ,10846 + ,-9.4 + ,-5 + ,1.8 + ,1.76 + ,2120.88 + ,10717.13 + ,9682.35 + ,10413 + ,-8.1 + ,-15 + ,1.6 + ,1.89 + ,2174.56 + ,10205.29 + ,9762.12 + ,10709 + ,-5.4 + ,-6 + ,1.9 + ,1.9 + ,2196.72 + ,10295.98 + ,10124.63 + ,10662 + ,-4.6 + ,-6 + ,1.7 + ,1.9 + ,2350.44 + ,10892.76 + ,10540.05 + ,10570 + ,-4.9 + ,-3 + ,1.6 + ,1.92 + ,2440.25 + ,10631.92 + ,10601.61 + ,10297 + ,-4 + ,-1 + ,1.3 + ,1.76 + ,2408.64 + ,11441.08 + ,10323.73 + ,10635 + ,-3.1 + ,-3 + ,1.1 + ,1.64 + ,2472.81 + ,11950.95 + ,10418.4 + ,10872 + ,-1.3 + ,-4 + ,1.9 + ,1.57 + ,2407.6 + ,11037.54 + ,10092.96 + ,10296 + ,0 + ,-6 + ,2.6 + ,1.69 + ,2454.62 + ,11527.72 + ,10364.91 + ,10383 + ,-0.4 + ,0 + ,2.3 + ,1.76 + ,2448.05 + ,11383.89 + ,10152.09 + ,10431 + ,3 + ,-4 + ,2.4 + ,1.89 + ,2497.84 + ,10989.34 + ,10032.8 + ,10574 + ,0.4 + ,-2 + ,2.2 + ,1.78 + ,2645.64 + ,11079.42 + ,10204.59 + ,10653 + ,1.2 + ,-2 + ,2 + ,1.88 + ,2756.76 + ,11028.93 + ,10001.6 + ,10805 + ,0.6 + ,-6 + ,2.9 + ,1.86 + ,2849.27 + ,10973 + ,10411.75 + ,10872 + ,-1.3 + ,-7 + ,2.6 + ,1.88 + ,2921.44 + ,11068.05 + ,10673.38 + ,10625 + ,-3.2 + ,-6 + ,2.3 + ,1.87 + ,2981.85 + ,11394.84 + ,10539.51 + ,10407 + ,-1.8 + ,-6 + ,2.3 + ,1.86 + ,3080.58 + ,11545.71 + ,10723.78 + ,10463 + ,-3.6 + ,-3 + ,2.6 + ,1.89 + ,3106.22 + ,11809.38 + ,10682.06 + ,10556 + ,-4.2 + ,-2 + ,3.1 + ,1.9 + ,3119.31 + ,11395.64 + ,10283.19 + ,10646 + ,-6.9 + ,-5 + ,2.8 + ,1.89 + ,3061.26 + ,11082.38 + ,10377.18 + ,10702 + ,-8 + ,-11 + ,2.5 + ,1.85 + ,3097.31 + ,11402.75 + ,10486.64 + ,11353 + ,-7.5 + ,-11 + ,2.9 + ,1.78 + ,3161.69 + ,11716.87 + ,10545.38 + ,11346 + ,-8.2 + ,-11 + ,3.1 + ,1.71 + ,3257.16 + ,12204.98 + ,10554.27 + ,11451 + ,-7.6 + ,-10 + ,3.1 + ,1.69 + ,3277.01 + ,12986.62 + ,10532.54 + ,11964 + ,-3.7 + ,-14 + ,3.2 + ,1.72 + ,3295.32 + ,13392.79 + ,10324.31 + ,12574 + ,-1.7 + ,-8 + ,2.5 + ,1.77 + ,3363.99 + ,14368.05 + ,10695.25 + ,13031 + ,-0.7 + ,-9 + ,2.6 + ,1.98 + ,3494.17 + ,15650.83 + ,10827.81 + ,13812 + ,0.2 + ,-5 + ,2.9 + ,2.2 + ,3667.03 + ,16102.64 + ,10872.48 + ,14544 + ,0.6 + ,-1 + ,2.6 + ,2.25 + ,3813.06 + ,16187.64 + ,10971.19 + ,14931 + ,2.2 + ,-2 + ,2.4 + ,2.24 + ,3917.96 + ,16311.54 + ,11145.65 + ,14886 + ,3.3 + ,-5 + ,1.7 + ,2.51 + ,3895.51 + ,17232.97 + ,11234.68 + ,16005 + ,5.3 + ,-4 + ,2 + ,2.79 + ,3801.06 + ,16397.83 + ,11333.88 + ,17064 + ,5.5 + ,-6 + ,2.2 + ,3.07 + ,3570.12 + ,14990.31 + ,10997.97 + ,15168 + ,6.3 + ,-2 + ,1.9 + ,3.08 + ,3701.61 + ,15147.55 + ,11036.89 + ,16050 + ,7.7 + ,-2 + ,1.6 + ,3.05 + ,3862.27 + ,15786.78 + ,11257.35 + ,15839 + ,6.5 + ,-2 + ,1.6 + ,3.08 + ,3970.1 + ,15934.09 + ,11533.59 + ,15137 + ,5.5 + ,-2 + ,1.2 + ,3.15 + ,4138.52 + ,16519.44 + ,11963.12 + ,14954 + ,6.9 + ,2 + ,1.2 + ,3.16 + ,4199.75 + ,16101.07 + ,12185.15 + ,15648 + ,5.7 + ,1 + ,1.5 + ,3.16 + ,4290.89 + ,16775.08 + ,12377.62 + ,15305 + ,6.9 + ,-8 + ,1.6 + ,3.19 + ,4443.91 + ,17286.32 + ,12512.89 + ,15579 + ,6.1 + ,-1 + ,1.7 + ,3.44 + ,4502.64 + ,17741.23 + ,12631.48 + ,16348 + ,4.8 + ,1 + ,1.8 + ,3.55 + ,4356.98 + ,17128.37 + ,12268.53 + ,15928 + ,3.7 + ,-1 + ,1.8 + ,3.6 + ,4591.27 + ,17460.53 + ,12754.8 + ,16171 + ,5.8 + ,2 + ,1.8 + ,3.62 + ,4696.96 + ,17611.14 + ,13407.75 + ,15937 + ,6.8 + ,2 + ,1.3 + ,3.69) + ,dim=c(8 + ,51) + ,dimnames=list(c('BEL_20' + ,'Nikkei' + ,'DJ_Indust' + ,'Goudprijs' + ,'Conjunct_Seizoenzuiver' + ,'Cons_vertrouw' + ,'Alg_consumptie_index_BE' + ,'Gem_rente_kasbon_1j') + ,1:51)) > y <- array(NA,dim=c(8,51),dimnames=list(c('BEL_20','Nikkei','DJ_Indust','Goudprijs','Conjunct_Seizoenzuiver','Cons_vertrouw','Alg_consumptie_index_BE','Gem_rente_kasbon_1j'),1:51)) > for (i in 1:dim(x)[1]) + { + for (j in 1:dim(x)[2]) + { + y[i,j] <- as.numeric(x[i,j]) + } + } > par3 = 'No Linear Trend' > par2 = 'Do not include Seasonal Dummies' > par1 = '1' > #'GNU S' R Code compiled by R2WASP v. 1.0.44 () > #Author: Prof. Dr. P. Wessa > #To cite this work: AUTHOR(S), (YEAR), YOUR SOFTWARE TITLE (vNUMBER) in Free Statistics Software (v$_version), Office for Research Development and Education, URL http://www.wessa.net/rwasp_YOURPAGE.wasp/ > #Source of accompanying publication: Office for Research, Development, and Education > #Technical description: Write here your technical program description (don't use hard returns!) > library(lattice) > library(lmtest) Loading required package: zoo Attaching package: 'zoo' The following object(s) are masked from package:base : as.Date.numeric > n25 <- 25 #minimum number of obs. for Goldfeld-Quandt test > par1 <- as.numeric(par1) > x <- t(y) > k <- length(x[1,]) > n <- length(x[,1]) > x1 <- cbind(x[,par1], x[,1:k!=par1]) > mycolnames <- c(colnames(x)[par1], colnames(x)[1:k!=par1]) > colnames(x1) <- mycolnames #colnames(x)[par1] > x <- x1 > if (par3 == 'First Differences'){ + x2 <- array(0, dim=c(n-1,k), dimnames=list(1:(n-1), paste('(1-B)',colnames(x),sep=''))) + for (i in 1:n-1) { + for (j in 1:k) { + x2[i,j] <- x[i+1,j] - x[i,j] + } + } + x <- x2 + } > if (par2 == 'Include Monthly Dummies'){ + x2 <- array(0, dim=c(n,11), dimnames=list(1:n, paste('M', seq(1:11), sep =''))) + for (i in 1:11){ + x2[seq(i,n,12),i] <- 1 + } + x <- cbind(x, x2) + } > if (par2 == 'Include Quarterly Dummies'){ + x2 <- array(0, dim=c(n,3), dimnames=list(1:n, paste('Q', seq(1:3), sep =''))) + for (i in 1:3){ + x2[seq(i,n,4),i] <- 1 + } + x <- cbind(x, x2) + } > k <- length(x[1,]) > if (par3 == 'Linear Trend'){ + x <- cbind(x, c(1:n)) + colnames(x)[k+1] <- 't' + } > x BEL_20 Nikkei DJ_Indust Goudprijs Conjunct_Seizoenzuiver Cons_vertrouw 1 1635.25 8169.75 7977.64 10171 -14.9 -18 2 1833.42 7905.84 8334.59 9721 -16.2 -11 3 1910.43 8145.82 8623.36 9897 -14.4 -9 4 1959.67 8895.71 9098.03 9828 -17.3 -10 5 1969.60 9676.31 9154.34 9924 -15.7 -13 6 2061.41 9884.59 9284.73 10371 -12.6 -11 7 2093.48 10637.44 9492.49 10846 -9.4 -5 8 2120.88 10717.13 9682.35 10413 -8.1 -15 9 2174.56 10205.29 9762.12 10709 -5.4 -6 10 2196.72 10295.98 10124.63 10662 -4.6 -6 11 2350.44 10892.76 10540.05 10570 -4.9 -3 12 2440.25 10631.92 10601.61 10297 -4.0 -1 13 2408.64 11441.08 10323.73 10635 -3.1 -3 14 2472.81 11950.95 10418.40 10872 -1.3 -4 15 2407.60 11037.54 10092.96 10296 0.0 -6 16 2454.62 11527.72 10364.91 10383 -0.4 0 17 2448.05 11383.89 10152.09 10431 3.0 -4 18 2497.84 10989.34 10032.80 10574 0.4 -2 19 2645.64 11079.42 10204.59 10653 1.2 -2 20 2756.76 11028.93 10001.60 10805 0.6 -6 21 2849.27 10973.00 10411.75 10872 -1.3 -7 22 2921.44 11068.05 10673.38 10625 -3.2 -6 23 2981.85 11394.84 10539.51 10407 -1.8 -6 24 3080.58 11545.71 10723.78 10463 -3.6 -3 25 3106.22 11809.38 10682.06 10556 -4.2 -2 26 3119.31 11395.64 10283.19 10646 -6.9 -5 27 3061.26 11082.38 10377.18 10702 -8.0 -11 28 3097.31 11402.75 10486.64 11353 -7.5 -11 29 3161.69 11716.87 10545.38 11346 -8.2 -11 30 3257.16 12204.98 10554.27 11451 -7.6 -10 31 3277.01 12986.62 10532.54 11964 -3.7 -14 32 3295.32 13392.79 10324.31 12574 -1.7 -8 33 3363.99 14368.05 10695.25 13031 -0.7 -9 34 3494.17 15650.83 10827.81 13812 0.2 -5 35 3667.03 16102.64 10872.48 14544 0.6 -1 36 3813.06 16187.64 10971.19 14931 2.2 -2 37 3917.96 16311.54 11145.65 14886 3.3 -5 38 3895.51 17232.97 11234.68 16005 5.3 -4 39 3801.06 16397.83 11333.88 17064 5.5 -6 40 3570.12 14990.31 10997.97 15168 6.3 -2 41 3701.61 15147.55 11036.89 16050 7.7 -2 42 3862.27 15786.78 11257.35 15839 6.5 -2 43 3970.10 15934.09 11533.59 15137 5.5 -2 44 4138.52 16519.44 11963.12 14954 6.9 2 45 4199.75 16101.07 12185.15 15648 5.7 1 46 4290.89 16775.08 12377.62 15305 6.9 -8 47 4443.91 17286.32 12512.89 15579 6.1 -1 48 4502.64 17741.23 12631.48 16348 4.8 1 49 4356.98 17128.37 12268.53 15928 3.7 -1 50 4591.27 17460.53 12754.80 16171 5.8 2 51 4696.96 17611.14 13407.75 15937 6.8 2 Alg_consumptie_index_BE Gem_rente_kasbon_1j 1 1.8 2.05 2 1.5 2.05 3 1.0 1.81 4 1.6 1.58 5 1.5 1.57 6 1.8 1.76 7 1.8 1.76 8 1.6 1.89 9 1.9 1.90 10 1.7 1.90 11 1.6 1.92 12 1.3 1.76 13 1.1 1.64 14 1.9 1.57 15 2.6 1.69 16 2.3 1.76 17 2.4 1.89 18 2.2 1.78 19 2.0 1.88 20 2.9 1.86 21 2.6 1.88 22 2.3 1.87 23 2.3 1.86 24 2.6 1.89 25 3.1 1.90 26 2.8 1.89 27 2.5 1.85 28 2.9 1.78 29 3.1 1.71 30 3.1 1.69 31 3.2 1.72 32 2.5 1.77 33 2.6 1.98 34 2.9 2.20 35 2.6 2.25 36 2.4 2.24 37 1.7 2.51 38 2.0 2.79 39 2.2 3.07 40 1.9 3.08 41 1.6 3.05 42 1.6 3.08 43 1.2 3.15 44 1.2 3.16 45 1.5 3.16 46 1.6 3.19 47 1.7 3.44 48 1.8 3.55 49 1.8 3.60 50 1.8 3.62 51 1.3 3.69 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) Nikkei DJ_Indust -3.817e+03 9.453e-02 3.604e-01 Goudprijs Conjunct_Seizoenzuiver Cons_vertrouw 6.537e-02 -1.461e+01 -3.862e+00 Alg_consumptie_index_BE Gem_rente_kasbon_1j 2.466e+02 2.230e+02 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -302.418 -120.773 7.501 98.352 307.226 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) -3.817e+03 6.162e+02 -6.195 1.90e-07 *** Nikkei 9.453e-02 5.050e-02 1.872 0.0680 . DJ_Indust 3.604e-01 6.999e-02 5.150 6.18e-06 *** Goudprijs 6.537e-02 5.824e-02 1.122 0.2679 Conjunct_Seizoenzuiver -1.461e+01 7.768e+00 -1.880 0.0669 . Cons_vertrouw -3.862e+00 8.350e+00 -0.463 0.6461 Alg_consumptie_index_BE 2.466e+02 5.289e+01 4.662 3.04e-05 *** Gem_rente_kasbon_1j 2.230e+02 1.185e+02 1.882 0.0666 . --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 163.4 on 43 degrees of freedom Multiple R-squared: 0.9673, Adjusted R-squared: 0.962 F-statistic: 181.9 on 7 and 43 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.049742577 9.948515e-02 9.502574e-01 [2,] 0.014832143 2.966429e-02 9.851679e-01 [3,] 0.005098960 1.019792e-02 9.949010e-01 [4,] 0.004268944 8.537888e-03 9.957311e-01 [5,] 0.002487970 4.975940e-03 9.975120e-01 [6,] 0.007529687 1.505937e-02 9.924703e-01 [7,] 0.005465010 1.093002e-02 9.945350e-01 [8,] 0.044318420 8.863684e-02 9.556816e-01 [9,] 0.597273941 8.054521e-01 4.027261e-01 [10,] 0.979489691 4.102062e-02 2.051031e-02 [11,] 0.994398110 1.120378e-02 5.601890e-03 [12,] 0.999591096 8.178084e-04 4.089042e-04 [13,] 0.999939825 1.203509e-04 6.017543e-05 [14,] 0.999959841 8.031894e-05 4.015947e-05 [15,] 0.999916746 1.665070e-04 8.325351e-05 [16,] 0.999932954 1.340915e-04 6.704577e-05 [17,] 0.999909031 1.819387e-04 9.096936e-05 [18,] 0.999806962 3.860754e-04 1.930377e-04 [19,] 0.999584411 8.311774e-04 4.155887e-04 [20,] 0.999018873 1.962253e-03 9.811267e-04 [21,] 0.998688432 2.623135e-03 1.311568e-03 [22,] 0.999068370 1.863260e-03 9.316302e-04 [23,] 0.997551003 4.897993e-03 2.448997e-03 [24,] 0.997244734 5.510531e-03 2.755266e-03 [25,] 0.996554919 6.890162e-03 3.445081e-03 [26,] 0.990968239 1.806352e-02 9.031761e-03 [27,] 0.987201599 2.559680e-02 1.279840e-02 [28,] 0.968003728 6.399254e-02 3.199627e-02 [29,] 0.980317125 3.936575e-02 1.968288e-02 [30,] 0.990179486 1.964103e-02 9.820514e-03 > postscript(file="/var/www/html/rcomp/tmp/120ki1291647280.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/html/rcomp/tmp/2cr1k1291647280.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/html/rcomp/tmp/3cr1k1291647280.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/html/rcomp/tmp/4cr1k1291647280.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/html/rcomp/tmp/550j51291647280.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 = 51 Frequency = 1 1 2 3 4 5 6 -48.226307 157.661625 307.226008 -23.869117 -75.630561 -143.078181 7 8 9 10 11 12 -218.205072 -237.777967 -185.826866 -238.834527 -257.853495 -17.200629 13 14 15 16 17 18 34.267073 -158.594886 -170.603323 -197.946018 -136.785973 27.549135 19 20 21 22 23 24 138.442730 75.901311 59.378350 96.717935 211.418916 130.436696 25 26 27 28 29 30 9.690697 224.962783 202.643849 50.684621 20.729380 77.075403 31 32 33 34 35 36 7.501319 236.427162 -11.428130 -195.797403 -45.491332 102.678412 37 38 39 40 41 42 252.784215 -65.361923 -302.418356 -56.409152 89.643355 99.985571 43 44 45 46 47 48 208.619650 212.508951 92.529590 24.424067 -2.626171 -140.372172 49 50 51 -104.759029 -55.232774 -61.559439 > postscript(file="/var/www/html/rcomp/tmp/650j51291647280.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 = 51 Frequency = 1 lag(myerror, k = 1) myerror 0 -48.226307 NA 1 157.661625 -48.226307 2 307.226008 157.661625 3 -23.869117 307.226008 4 -75.630561 -23.869117 5 -143.078181 -75.630561 6 -218.205072 -143.078181 7 -237.777967 -218.205072 8 -185.826866 -237.777967 9 -238.834527 -185.826866 10 -257.853495 -238.834527 11 -17.200629 -257.853495 12 34.267073 -17.200629 13 -158.594886 34.267073 14 -170.603323 -158.594886 15 -197.946018 -170.603323 16 -136.785973 -197.946018 17 27.549135 -136.785973 18 138.442730 27.549135 19 75.901311 138.442730 20 59.378350 75.901311 21 96.717935 59.378350 22 211.418916 96.717935 23 130.436696 211.418916 24 9.690697 130.436696 25 224.962783 9.690697 26 202.643849 224.962783 27 50.684621 202.643849 28 20.729380 50.684621 29 77.075403 20.729380 30 7.501319 77.075403 31 236.427162 7.501319 32 -11.428130 236.427162 33 -195.797403 -11.428130 34 -45.491332 -195.797403 35 102.678412 -45.491332 36 252.784215 102.678412 37 -65.361923 252.784215 38 -302.418356 -65.361923 39 -56.409152 -302.418356 40 89.643355 -56.409152 41 99.985571 89.643355 42 208.619650 99.985571 43 212.508951 208.619650 44 92.529590 212.508951 45 24.424067 92.529590 46 -2.626171 24.424067 47 -140.372172 -2.626171 48 -104.759029 -140.372172 49 -55.232774 -104.759029 50 -61.559439 -55.232774 51 NA -61.559439 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] 157.661625 -48.226307 [2,] 307.226008 157.661625 [3,] -23.869117 307.226008 [4,] -75.630561 -23.869117 [5,] -143.078181 -75.630561 [6,] -218.205072 -143.078181 [7,] -237.777967 -218.205072 [8,] -185.826866 -237.777967 [9,] -238.834527 -185.826866 [10,] -257.853495 -238.834527 [11,] -17.200629 -257.853495 [12,] 34.267073 -17.200629 [13,] -158.594886 34.267073 [14,] -170.603323 -158.594886 [15,] -197.946018 -170.603323 [16,] -136.785973 -197.946018 [17,] 27.549135 -136.785973 [18,] 138.442730 27.549135 [19,] 75.901311 138.442730 [20,] 59.378350 75.901311 [21,] 96.717935 59.378350 [22,] 211.418916 96.717935 [23,] 130.436696 211.418916 [24,] 9.690697 130.436696 [25,] 224.962783 9.690697 [26,] 202.643849 224.962783 [27,] 50.684621 202.643849 [28,] 20.729380 50.684621 [29,] 77.075403 20.729380 [30,] 7.501319 77.075403 [31,] 236.427162 7.501319 [32,] -11.428130 236.427162 [33,] -195.797403 -11.428130 [34,] -45.491332 -195.797403 [35,] 102.678412 -45.491332 [36,] 252.784215 102.678412 [37,] -65.361923 252.784215 [38,] -302.418356 -65.361923 [39,] -56.409152 -302.418356 [40,] 89.643355 -56.409152 [41,] 99.985571 89.643355 [42,] 208.619650 99.985571 [43,] 212.508951 208.619650 [44,] 92.529590 212.508951 [45,] 24.424067 92.529590 [46,] -2.626171 24.424067 [47,] -140.372172 -2.626171 [48,] -104.759029 -140.372172 [49,] -55.232774 -104.759029 [50,] -61.559439 -55.232774 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 157.661625 -48.226307 2 307.226008 157.661625 3 -23.869117 307.226008 4 -75.630561 -23.869117 5 -143.078181 -75.630561 6 -218.205072 -143.078181 7 -237.777967 -218.205072 8 -185.826866 -237.777967 9 -238.834527 -185.826866 10 -257.853495 -238.834527 11 -17.200629 -257.853495 12 34.267073 -17.200629 13 -158.594886 34.267073 14 -170.603323 -158.594886 15 -197.946018 -170.603323 16 -136.785973 -197.946018 17 27.549135 -136.785973 18 138.442730 27.549135 19 75.901311 138.442730 20 59.378350 75.901311 21 96.717935 59.378350 22 211.418916 96.717935 23 130.436696 211.418916 24 9.690697 130.436696 25 224.962783 9.690697 26 202.643849 224.962783 27 50.684621 202.643849 28 20.729380 50.684621 29 77.075403 20.729380 30 7.501319 77.075403 31 236.427162 7.501319 32 -11.428130 236.427162 33 -195.797403 -11.428130 34 -45.491332 -195.797403 35 102.678412 -45.491332 36 252.784215 102.678412 37 -65.361923 252.784215 38 -302.418356 -65.361923 39 -56.409152 -302.418356 40 89.643355 -56.409152 41 99.985571 89.643355 42 208.619650 99.985571 43 212.508951 208.619650 44 92.529590 212.508951 45 24.424067 92.529590 46 -2.626171 24.424067 47 -140.372172 -2.626171 48 -104.759029 -140.372172 49 -55.232774 -104.759029 50 -61.559439 -55.232774 > plot(z,main=paste('Residual Lag plot, lowess, and regression line'), ylab='values of Residuals', xlab='lagged values of Residuals') > lines(lowess(z)) > abline(lm(z)) > grid() > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/7ya0q1291647280.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/html/rcomp/tmp/8ya0q1291647280.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/html/rcomp/tmp/9rjhb1291647280.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/html/rcomp/tmp/10rjhb1291647280.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/html/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/html/rcomp/createtable") > > a<-table.start() > a<-table.row.start(a) > a<-table.element(a, 'Multiple Linear Regression - Estimated Regression Equation', 1, TRUE) > a<-table.row.end(a) > myeq <- colnames(x)[1] > myeq <- paste(myeq, '[t] = ', sep='') > for (i in 1:k){ + if (mysum$coefficients[i,1] > 0) myeq <- paste(myeq, '+', '') + myeq <- paste(myeq, mysum$coefficients[i,1], sep=' ') + if (rownames(mysum$coefficients)[i] != '(Intercept)') { + myeq <- paste(myeq, rownames(mysum$coefficients)[i], sep='') + if (rownames(mysum$coefficients)[i] != 't') myeq <- paste(myeq, '[t]', sep='') + } + } > myeq <- paste(myeq, ' + e[t]') > a<-table.row.start(a) > a<-table.element(a, myeq) > a<-table.row.end(a) > a<-table.end(a) > table.save(a,file="/var/www/html/rcomp/tmp/11c1yz1291647280.tab") > a<-table.start() > a<-table.row.start(a) > a<-table.element(a,hyperlink('http://www.xycoon.com/ols1.htm','Multiple Linear Regression - Ordinary Least Squares',''), 6, TRUE) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,'Variable',header=TRUE) > a<-table.element(a,'Parameter',header=TRUE) > a<-table.element(a,'S.D.',header=TRUE) > a<-table.element(a,'T-STAT
H0: parameter = 0',header=TRUE) > a<-table.element(a,'2-tail p-value',header=TRUE) > a<-table.element(a,'1-tail p-value',header=TRUE) > a<-table.row.end(a) > for (i in 1:k){ + a<-table.row.start(a) + a<-table.element(a,rownames(mysum$coefficients)[i],header=TRUE) + a<-table.element(a,mysum$coefficients[i,1]) + a<-table.element(a, round(mysum$coefficients[i,2],6)) + a<-table.element(a, round(mysum$coefficients[i,3],4)) + a<-table.element(a, round(mysum$coefficients[i,4],6)) + a<-table.element(a, round(mysum$coefficients[i,4]/2,6)) + a<-table.row.end(a) + } > a<-table.end(a) > table.save(a,file="/var/www/html/rcomp/tmp/12xkw51291647280.tab") > a<-table.start() > a<-table.row.start(a) > a<-table.element(a, 'Multiple Linear Regression - Regression Statistics', 2, TRUE) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a, 'Multiple R',1,TRUE) > a<-table.element(a, sqrt(mysum$r.squared)) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a, 'R-squared',1,TRUE) > a<-table.element(a, mysum$r.squared) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a, 'Adjusted R-squared',1,TRUE) > a<-table.element(a, mysum$adj.r.squared) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a, 'F-TEST (value)',1,TRUE) > a<-table.element(a, mysum$fstatistic[1]) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a, 'F-TEST (DF numerator)',1,TRUE) > a<-table.element(a, mysum$fstatistic[2]) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a, 'F-TEST (DF denominator)',1,TRUE) > a<-table.element(a, mysum$fstatistic[3]) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a, 'p-value',1,TRUE) > a<-table.element(a, 1-pf(mysum$fstatistic[1],mysum$fstatistic[2],mysum$fstatistic[3])) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a, 'Multiple Linear Regression - Residual Statistics', 2, TRUE) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a, 'Residual Standard Deviation',1,TRUE) > a<-table.element(a, mysum$sigma) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a, 'Sum Squared Residuals',1,TRUE) > a<-table.element(a, sum(myerror*myerror)) > a<-table.row.end(a) > a<-table.end(a) > table.save(a,file="/var/www/html/rcomp/tmp/1343bh1291647280.tab") > a<-table.start() > a<-table.row.start(a) > a<-table.element(a, 'Multiple Linear Regression - Actuals, Interpolation, and Residuals', 4, TRUE) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a, 'Time or Index', 1, TRUE) > a<-table.element(a, 'Actuals', 1, TRUE) > a<-table.element(a, 'Interpolation
Forecast', 1, TRUE) > a<-table.element(a, 'Residuals
Prediction Error', 1, TRUE) > a<-table.row.end(a) > for (i in 1:n) { + a<-table.row.start(a) + a<-table.element(a,i, 1, TRUE) + a<-table.element(a,x[i]) + a<-table.element(a,x[i]-mysum$resid[i]) + a<-table.element(a,mysum$resid[i]) + a<-table.row.end(a) + } > a<-table.end(a) > table.save(a,file="/var/www/html/rcomp/tmp/14fus11291647280.tab") > if (n > n25) { + a<-table.start() + a<-table.row.start(a) + a<-table.element(a,'Goldfeld-Quandt test for Heteroskedasticity',4,TRUE) + a<-table.row.end(a) + a<-table.row.start(a) + a<-table.element(a,'p-values',header=TRUE) + a<-table.element(a,'Alternative Hypothesis',3,header=TRUE) + a<-table.row.end(a) + a<-table.row.start(a) + a<-table.element(a,'breakpoint index',header=TRUE) + a<-table.element(a,'greater',header=TRUE) + a<-table.element(a,'2-sided',header=TRUE) + a<-table.element(a,'less',header=TRUE) + a<-table.row.end(a) + for (mypoint in kp3:nmkm3) { + a<-table.row.start(a) + a<-table.element(a,mypoint,header=TRUE) + a<-table.element(a,gqarr[mypoint-kp3+1,1]) + a<-table.element(a,gqarr[mypoint-kp3+1,2]) + a<-table.element(a,gqarr[mypoint-kp3+1,3]) + a<-table.row.end(a) + } + a<-table.end(a) + table.save(a,file="/var/www/html/rcomp/tmp/150v971291647280.tab") + a<-table.start() + a<-table.row.start(a) + a<-table.element(a,'Meta Analysis of Goldfeld-Quandt test for Heteroskedasticity',4,TRUE) + a<-table.row.end(a) + a<-table.row.start(a) + a<-table.element(a,'Description',header=TRUE) + a<-table.element(a,'# significant tests',header=TRUE) + a<-table.element(a,'% significant tests',header=TRUE) + a<-table.element(a,'OK/NOK',header=TRUE) + a<-table.row.end(a) + a<-table.row.start(a) + a<-table.element(a,'1% type I error level',header=TRUE) + a<-table.element(a,numsignificant1) + a<-table.element(a,numsignificant1/numgqtests) + if (numsignificant1/numgqtests < 0.01) dum <- 'OK' else dum <- 'NOK' + a<-table.element(a,dum) + a<-table.row.end(a) + a<-table.row.start(a) + a<-table.element(a,'5% type I error level',header=TRUE) + a<-table.element(a,numsignificant5) + a<-table.element(a,numsignificant5/numgqtests) + if (numsignificant5/numgqtests < 0.05) dum <- 'OK' else dum <- 'NOK' + a<-table.element(a,dum) + a<-table.row.end(a) + a<-table.row.start(a) + a<-table.element(a,'10% type I error level',header=TRUE) + a<-table.element(a,numsignificant10) + a<-table.element(a,numsignificant10/numgqtests) + if (numsignificant10/numgqtests < 0.1) dum <- 'OK' else dum <- 'NOK' + a<-table.element(a,dum) + a<-table.row.end(a) + a<-table.end(a) + table.save(a,file="/var/www/html/rcomp/tmp/16e46y1291647280.tab") + } > > try(system("convert tmp/120ki1291647280.ps tmp/120ki1291647280.png",intern=TRUE)) character(0) > try(system("convert tmp/2cr1k1291647280.ps tmp/2cr1k1291647280.png",intern=TRUE)) character(0) > try(system("convert tmp/3cr1k1291647280.ps tmp/3cr1k1291647280.png",intern=TRUE)) character(0) > try(system("convert tmp/4cr1k1291647280.ps tmp/4cr1k1291647280.png",intern=TRUE)) character(0) > try(system("convert tmp/550j51291647280.ps tmp/550j51291647280.png",intern=TRUE)) character(0) > try(system("convert tmp/650j51291647280.ps tmp/650j51291647280.png",intern=TRUE)) character(0) > try(system("convert tmp/7ya0q1291647280.ps tmp/7ya0q1291647280.png",intern=TRUE)) character(0) > try(system("convert tmp/8ya0q1291647280.ps tmp/8ya0q1291647280.png",intern=TRUE)) character(0) > try(system("convert tmp/9rjhb1291647280.ps tmp/9rjhb1291647280.png",intern=TRUE)) character(0) > try(system("convert tmp/10rjhb1291647280.ps tmp/10rjhb1291647280.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.466 1.642 6.527