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 = 'Linear Trend' > par2 = 'Include Monthly 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 M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 1 1.8 2.05 1 0 0 0 0 0 0 0 0 0 2 1.5 2.05 0 1 0 0 0 0 0 0 0 0 3 1.0 1.81 0 0 1 0 0 0 0 0 0 0 4 1.6 1.58 0 0 0 1 0 0 0 0 0 0 5 1.5 1.57 0 0 0 0 1 0 0 0 0 0 6 1.8 1.76 0 0 0 0 0 1 0 0 0 0 7 1.8 1.76 0 0 0 0 0 0 1 0 0 0 8 1.6 1.89 0 0 0 0 0 0 0 1 0 0 9 1.9 1.90 0 0 0 0 0 0 0 0 1 0 10 1.7 1.90 0 0 0 0 0 0 0 0 0 1 11 1.6 1.92 0 0 0 0 0 0 0 0 0 0 12 1.3 1.76 0 0 0 0 0 0 0 0 0 0 13 1.1 1.64 1 0 0 0 0 0 0 0 0 0 14 1.9 1.57 0 1 0 0 0 0 0 0 0 0 15 2.6 1.69 0 0 1 0 0 0 0 0 0 0 16 2.3 1.76 0 0 0 1 0 0 0 0 0 0 17 2.4 1.89 0 0 0 0 1 0 0 0 0 0 18 2.2 1.78 0 0 0 0 0 1 0 0 0 0 19 2.0 1.88 0 0 0 0 0 0 1 0 0 0 20 2.9 1.86 0 0 0 0 0 0 0 1 0 0 21 2.6 1.88 0 0 0 0 0 0 0 0 1 0 22 2.3 1.87 0 0 0 0 0 0 0 0 0 1 23 2.3 1.86 0 0 0 0 0 0 0 0 0 0 24 2.6 1.89 0 0 0 0 0 0 0 0 0 0 25 3.1 1.90 1 0 0 0 0 0 0 0 0 0 26 2.8 1.89 0 1 0 0 0 0 0 0 0 0 27 2.5 1.85 0 0 1 0 0 0 0 0 0 0 28 2.9 1.78 0 0 0 1 0 0 0 0 0 0 29 3.1 1.71 0 0 0 0 1 0 0 0 0 0 30 3.1 1.69 0 0 0 0 0 1 0 0 0 0 31 3.2 1.72 0 0 0 0 0 0 1 0 0 0 32 2.5 1.77 0 0 0 0 0 0 0 1 0 0 33 2.6 1.98 0 0 0 0 0 0 0 0 1 0 34 2.9 2.20 0 0 0 0 0 0 0 0 0 1 35 2.6 2.25 0 0 0 0 0 0 0 0 0 0 36 2.4 2.24 0 0 0 0 0 0 0 0 0 0 37 1.7 2.51 1 0 0 0 0 0 0 0 0 0 38 2.0 2.79 0 1 0 0 0 0 0 0 0 0 39 2.2 3.07 0 0 1 0 0 0 0 0 0 0 40 1.9 3.08 0 0 0 1 0 0 0 0 0 0 41 1.6 3.05 0 0 0 0 1 0 0 0 0 0 42 1.6 3.08 0 0 0 0 0 1 0 0 0 0 43 1.2 3.15 0 0 0 0 0 0 1 0 0 0 44 1.2 3.16 0 0 0 0 0 0 0 1 0 0 45 1.5 3.16 0 0 0 0 0 0 0 0 1 0 46 1.6 3.19 0 0 0 0 0 0 0 0 0 1 47 1.7 3.44 0 0 0 0 0 0 0 0 0 0 48 1.8 3.55 0 0 0 0 0 0 0 0 0 0 49 1.8 3.60 1 0 0 0 0 0 0 0 0 0 50 1.8 3.62 0 1 0 0 0 0 0 0 0 0 51 1.3 3.69 0 0 1 0 0 0 0 0 0 0 M11 t 1 0 1 2 0 2 3 0 3 4 0 4 5 0 5 6 0 6 7 0 7 8 0 8 9 0 9 10 0 10 11 1 11 12 0 12 13 0 13 14 0 14 15 0 15 16 0 16 17 0 17 18 0 18 19 0 19 20 0 20 21 0 21 22 0 22 23 1 23 24 0 24 25 0 25 26 0 26 27 0 27 28 0 28 29 0 29 30 0 30 31 0 31 32 0 32 33 0 33 34 0 34 35 1 35 36 0 36 37 0 37 38 0 38 39 0 39 40 0 40 41 0 41 42 0 42 43 0 43 44 0 44 45 0 45 46 0 46 47 1 47 48 0 48 49 0 49 50 0 50 51 0 51 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) Nikkei DJ_Indust 3.928e+02 3.901e-02 1.032e-01 Goudprijs Conjunct_Seizoenzuiver Cons_vertrouw -3.766e-03 -1.454e+01 2.614e+00 Alg_consumptie_index_BE Gem_rente_kasbon_1j M1 -9.801e+00 1.740e+01 -5.703e+01 M2 M3 M4 -2.429e+01 -6.885e+01 -1.780e+02 M5 M6 M7 -1.578e+02 -1.234e+02 -1.044e+02 M8 M9 M10 -6.778e+01 -7.326e+01 -8.093e+01 M11 t -3.056e+01 4.629e+01 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -110.087 -35.361 -6.725 41.704 172.844 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 3.928e+02 4.515e+02 0.870 0.390959 Nikkei 3.901e-02 2.568e-02 1.519 0.138907 DJ_Indust 1.032e-01 4.035e-02 2.558 0.015631 * Goudprijs -3.766e-03 2.993e-02 -0.126 0.900686 Conjunct_Seizoenzuiver -1.454e+01 3.735e+00 -3.893 0.000491 *** Cons_vertrouw 2.614e+00 4.160e+00 0.628 0.534300 Alg_consumptie_index_BE -9.801e+00 3.046e+01 -0.322 0.749772 Gem_rente_kasbon_1j 1.740e+01 5.610e+01 0.310 0.758536 M1 -5.703e+01 5.113e+01 -1.115 0.273217 M2 -2.429e+01 4.927e+01 -0.493 0.625449 M3 -6.885e+01 5.099e+01 -1.350 0.186713 M4 -1.780e+02 5.240e+01 -3.396 0.001890 ** M5 -1.578e+02 5.456e+01 -2.892 0.006933 ** M6 -1.234e+02 5.307e+01 -2.325 0.026808 * M7 -1.044e+02 5.358e+01 -1.948 0.060471 . M8 -6.778e+01 5.645e+01 -1.201 0.239017 M9 -7.326e+01 5.301e+01 -1.382 0.176845 M10 -8.093e+01 5.382e+01 -1.504 0.142769 M11 -3.056e+01 5.077e+01 -0.602 0.551647 t 4.629e+01 3.414e+00 13.561 1.41e-14 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 70.32 on 31 degrees of freedom Multiple R-squared: 0.9956, Adjusted R-squared: 0.993 F-statistic: 372.6 on 19 and 31 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.7812078 0.43758443 0.21879222 [2,] 0.8460758 0.30784835 0.15392418 [3,] 0.9214508 0.15709843 0.07854922 [4,] 0.9699134 0.06017322 0.03008661 [5,] 0.9855667 0.02886655 0.01443328 [6,] 0.9563868 0.08722638 0.04361319 > postscript(file="/var/www/html/rcomp/tmp/1ya0q1291647587.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/2ya0q1291647587.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/3rjhb1291647587.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/4rjhb1291647587.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/5rjhb1291647587.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 -38.242927 12.509124 69.501831 73.382404 11.270364 41.938864 7 8 9 10 11 12 -9.440061 -48.452538 -4.232008 -52.150777 -75.129815 -51.672176 13 14 15 16 17 18 -55.710616 -61.492921 -32.478314 4.838370 18.200974 -27.578192 19 20 21 22 23 24 41.935914 104.546352 88.046624 56.942793 41.471789 7.059343 25 26 27 28 29 30 31.196836 -11.282734 -70.890804 19.046228 -8.361998 -6.725146 31 32 33 34 35 36 -10.836047 -61.819474 -94.085511 -61.568194 -13.299540 67.930963 37 38 39 40 41 42 172.843741 54.979893 -9.648776 -97.267002 -21.109340 -7.635525 43 44 45 46 47 48 -21.659806 5.725659 10.270895 56.776178 46.957565 -23.318129 49 50 51 -110.087034 5.286637 43.516063 > postscript(file="/var/www/html/rcomp/tmp/61azw1291647587.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 -38.242927 NA 1 12.509124 -38.242927 2 69.501831 12.509124 3 73.382404 69.501831 4 11.270364 73.382404 5 41.938864 11.270364 6 -9.440061 41.938864 7 -48.452538 -9.440061 8 -4.232008 -48.452538 9 -52.150777 -4.232008 10 -75.129815 -52.150777 11 -51.672176 -75.129815 12 -55.710616 -51.672176 13 -61.492921 -55.710616 14 -32.478314 -61.492921 15 4.838370 -32.478314 16 18.200974 4.838370 17 -27.578192 18.200974 18 41.935914 -27.578192 19 104.546352 41.935914 20 88.046624 104.546352 21 56.942793 88.046624 22 41.471789 56.942793 23 7.059343 41.471789 24 31.196836 7.059343 25 -11.282734 31.196836 26 -70.890804 -11.282734 27 19.046228 -70.890804 28 -8.361998 19.046228 29 -6.725146 -8.361998 30 -10.836047 -6.725146 31 -61.819474 -10.836047 32 -94.085511 -61.819474 33 -61.568194 -94.085511 34 -13.299540 -61.568194 35 67.930963 -13.299540 36 172.843741 67.930963 37 54.979893 172.843741 38 -9.648776 54.979893 39 -97.267002 -9.648776 40 -21.109340 -97.267002 41 -7.635525 -21.109340 42 -21.659806 -7.635525 43 5.725659 -21.659806 44 10.270895 5.725659 45 56.776178 10.270895 46 46.957565 56.776178 47 -23.318129 46.957565 48 -110.087034 -23.318129 49 5.286637 -110.087034 50 43.516063 5.286637 51 NA 43.516063 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] 12.509124 -38.242927 [2,] 69.501831 12.509124 [3,] 73.382404 69.501831 [4,] 11.270364 73.382404 [5,] 41.938864 11.270364 [6,] -9.440061 41.938864 [7,] -48.452538 -9.440061 [8,] -4.232008 -48.452538 [9,] -52.150777 -4.232008 [10,] -75.129815 -52.150777 [11,] -51.672176 -75.129815 [12,] -55.710616 -51.672176 [13,] -61.492921 -55.710616 [14,] -32.478314 -61.492921 [15,] 4.838370 -32.478314 [16,] 18.200974 4.838370 [17,] -27.578192 18.200974 [18,] 41.935914 -27.578192 [19,] 104.546352 41.935914 [20,] 88.046624 104.546352 [21,] 56.942793 88.046624 [22,] 41.471789 56.942793 [23,] 7.059343 41.471789 [24,] 31.196836 7.059343 [25,] -11.282734 31.196836 [26,] -70.890804 -11.282734 [27,] 19.046228 -70.890804 [28,] -8.361998 19.046228 [29,] -6.725146 -8.361998 [30,] -10.836047 -6.725146 [31,] -61.819474 -10.836047 [32,] -94.085511 -61.819474 [33,] -61.568194 -94.085511 [34,] -13.299540 -61.568194 [35,] 67.930963 -13.299540 [36,] 172.843741 67.930963 [37,] 54.979893 172.843741 [38,] -9.648776 54.979893 [39,] -97.267002 -9.648776 [40,] -21.109340 -97.267002 [41,] -7.635525 -21.109340 [42,] -21.659806 -7.635525 [43,] 5.725659 -21.659806 [44,] 10.270895 5.725659 [45,] 56.776178 10.270895 [46,] 46.957565 56.776178 [47,] -23.318129 46.957565 [48,] -110.087034 -23.318129 [49,] 5.286637 -110.087034 [50,] 43.516063 5.286637 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 12.509124 -38.242927 2 69.501831 12.509124 3 73.382404 69.501831 4 11.270364 73.382404 5 41.938864 11.270364 6 -9.440061 41.938864 7 -48.452538 -9.440061 8 -4.232008 -48.452538 9 -52.150777 -4.232008 10 -75.129815 -52.150777 11 -51.672176 -75.129815 12 -55.710616 -51.672176 13 -61.492921 -55.710616 14 -32.478314 -61.492921 15 4.838370 -32.478314 16 18.200974 4.838370 17 -27.578192 18.200974 18 41.935914 -27.578192 19 104.546352 41.935914 20 88.046624 104.546352 21 56.942793 88.046624 22 41.471789 56.942793 23 7.059343 41.471789 24 31.196836 7.059343 25 -11.282734 31.196836 26 -70.890804 -11.282734 27 19.046228 -70.890804 28 -8.361998 19.046228 29 -6.725146 -8.361998 30 -10.836047 -6.725146 31 -61.819474 -10.836047 32 -94.085511 -61.819474 33 -61.568194 -94.085511 34 -13.299540 -61.568194 35 67.930963 -13.299540 36 172.843741 67.930963 37 54.979893 172.843741 38 -9.648776 54.979893 39 -97.267002 -9.648776 40 -21.109340 -97.267002 41 -7.635525 -21.109340 42 -21.659806 -7.635525 43 5.725659 -21.659806 44 10.270895 5.725659 45 56.776178 10.270895 46 46.957565 56.776178 47 -23.318129 46.957565 48 -110.087034 -23.318129 49 5.286637 -110.087034 50 43.516063 5.286637 > 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/7c1yz1291647587.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/8c1yz1291647587.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/9c1yz1291647587.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/10ntx21291647587.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/11qteq1291647587.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/12cucw1291647587.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/138ls51291647587.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/14t48s1291647587.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/15mvqd1291647587.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/160n541291647587.tab") + } > > try(system("convert tmp/1ya0q1291647587.ps tmp/1ya0q1291647587.png",intern=TRUE)) character(0) > try(system("convert tmp/2ya0q1291647587.ps tmp/2ya0q1291647587.png",intern=TRUE)) character(0) > try(system("convert tmp/3rjhb1291647587.ps tmp/3rjhb1291647587.png",intern=TRUE)) character(0) > try(system("convert tmp/4rjhb1291647587.ps tmp/4rjhb1291647587.png",intern=TRUE)) character(0) > try(system("convert tmp/5rjhb1291647587.ps tmp/5rjhb1291647587.png",intern=TRUE)) character(0) > try(system("convert tmp/61azw1291647587.ps tmp/61azw1291647587.png",intern=TRUE)) character(0) > try(system("convert tmp/7c1yz1291647587.ps tmp/7c1yz1291647587.png",intern=TRUE)) character(0) > try(system("convert tmp/8c1yz1291647587.ps tmp/8c1yz1291647587.png",intern=TRUE)) character(0) > try(system("convert tmp/9c1yz1291647587.ps tmp/9c1yz1291647587.png",intern=TRUE)) character(0) > try(system("convert tmp/10ntx21291647587.ps tmp/10ntx21291647587.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.316 1.579 5.632