R version 2.12.0 (2010-10-15) Copyright (C) 2010 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(3484.74 + ,13830.14 + ,9349.44 + ,7977 + ,-5.6 + ,6 + ,1 + ,2.77 + ,3411.13 + ,14153.22 + ,9327.78 + ,8241 + ,-6.2 + ,3 + ,1 + ,2.76 + ,3288.18 + ,15418.03 + ,9753.63 + ,8444 + ,-7.1 + ,2 + ,1.2 + ,2.76 + ,3280.37 + ,16666.97 + ,10443.5 + ,8490 + ,-1.4 + ,2 + ,1.2 + ,2.46 + ,3173.95 + ,16505.21 + ,10853.87 + ,8388 + ,-0.1 + ,2 + ,0.8 + ,2.46 + ,3165.26 + ,17135.96 + ,10704.02 + ,8099 + ,-0.9 + ,-8 + ,0.7 + ,2.47 + ,3092.71 + ,18033.25 + ,11052.23 + ,7984 + ,0 + ,0 + ,0.7 + ,2.71 + ,3053.05 + ,17671 + ,10935.47 + ,7786 + ,0.1 + ,-2 + ,0.9 + ,2.8 + ,3181.96 + ,17544.22 + ,10714.03 + ,8086 + ,2.6 + ,3 + ,1.2 + ,2.89 + ,2999.93 + ,17677.9 + ,10394.48 + ,9315 + ,6 + ,5 + ,1.3 + ,3.36 + ,3249.57 + ,18470.97 + ,10817.9 + ,9113 + ,6.4 + ,8 + ,1.5 + ,3.31 + ,3210.52 + ,18409.96 + ,11251.2 + ,9023 + ,8.6 + ,8 + ,1.9 + ,3.5 + ,3030.29 + ,18941.6 + ,11281.26 + ,9026 + ,6.4 + ,9 + ,1.8 + ,3.51 + ,2803.47 + ,19685.53 + ,10539.68 + ,9787 + ,7.7 + ,11 + ,1.9 + ,3.71 + ,2767.63 + ,19834.71 + ,10483.39 + ,9536 + ,9.2 + ,13 + ,2.2 + ,3.71 + ,2882.6 + ,19598.93 + ,10947.43 + ,9490 + ,8.6 + ,12 + ,2.1 + ,3.71 + ,2863.36 + ,17039.97 + ,10580.27 + ,9736 + ,7.4 + ,13 + ,2.2 + ,4.21 + ,2897.06 + ,16969.28 + ,10582.92 + ,9694 + ,8.6 + ,15 + ,2.7 + ,4.21 + ,3012.61 + ,16973.38 + ,10654.41 + ,9647 + ,6.2 + ,13 + ,2.8 + ,4.21 + ,3142.95 + ,16329.89 + ,11014.51 + ,9753 + ,6 + ,16 + ,2.9 + ,4.5 + ,3032.93 + ,16153.34 + ,10967.87 + ,10070 + ,6.6 + ,10 + ,3.4 + ,4.51 + ,3045.78 + ,15311.7 + ,10433.56 + ,10137 + ,5.1 + ,14 + ,3 + ,4.51 + ,3110.52 + ,14760.87 + ,10665.78 + ,9984 + ,4.7 + ,14 + ,3.1 + ,4.51 + ,3013.24 + ,14452.93 + ,10666.71 + ,9732 + ,5 + ,15 + ,2.5 + ,4.32 + ,2987.1 + ,13720.95 + ,10682.74 + ,9103 + ,3.6 + ,13 + ,2.2 + ,4.02 + ,2995.55 + ,13266.27 + ,10777.22 + ,9155 + ,1.9 + ,8 + ,2.3 + ,4.02 + ,2833.18 + ,12708.47 + ,10052.6 + ,9308 + ,-0.1 + ,7 + ,2.1 + ,3.85 + ,2848.96 + ,13411.84 + ,10213.97 + ,9394 + ,-5.7 + ,3 + ,2.8 + ,3.84 + ,2794.83 + ,13975.55 + ,10546.82 + ,9948 + ,-5.6 + ,3 + ,3.1 + ,4.02 + ,2845.26 + ,12974.89 + ,10767.2 + ,10177 + ,-6.4 + ,4 + ,2.9 + ,3.82 + ,2915.02 + ,12151.11 + ,10444.5 + ,10002 + ,-7.7 + ,4 + ,2.6 + ,3.75 + ,2892.63 + ,11576.21 + ,10314.68 + ,9728 + ,-8 + ,0 + ,2.7 + ,3.74 + ,2604.42 + ,9996.83 + ,9042.56 + ,10002 + ,-11.9 + ,-4 + ,2.3 + ,3.14 + ,2641.65 + ,10438.9 + ,9220.75 + ,10063 + ,-15.4 + ,-14 + ,2.3 + ,2.91 + ,2659.81 + ,10511.22 + ,9721.84 + ,10018 + ,-15.5 + ,-18 + ,2.1 + ,2.84 + ,2638.53 + ,10496.2 + ,9978.53 + ,9960 + ,-13.4 + ,-8 + ,2.2 + ,2.85 + ,2720.25 + ,10300.79 + ,9923.81 + ,10236 + ,-10.9 + ,-1 + ,2.9 + ,2.85 + ,2745.88 + ,9981.65 + ,9892.56 + ,10893 + ,-10.8 + ,1 + ,2.6 + ,3.08 + ,2735.7 + ,11448.79 + ,10500.98 + ,10756 + ,-7.3 + ,2 + ,2.7 + ,3.3 + ,2811.7 + ,11384.49 + ,10179.35 + ,10940 + ,-6.5 + ,0 + ,1.8 + ,3.29 + ,2799.43 + ,11717.46 + ,10080.48 + ,10997 + ,-5.1 + ,1 + ,1.3 + ,3.26 + ,2555.28 + ,10965.88 + ,9492.44 + ,10827 + ,-5.3 + ,0 + ,0.9 + ,3.26 + ,2304.98 + ,10352.27 + ,8616.49 + ,10166 + ,-6.8 + ,-1 + ,1.3 + ,3.11 + ,2214.95 + ,9751.2 + ,8685.4 + ,10186 + ,-8.4 + ,-3 + ,1.3 + ,2.84 + ,2065.81 + ,9354.01 + ,8160.67 + ,10457 + ,-8.4 + ,-3 + ,1.3 + ,2.71 + ,1940.49 + ,8792.5 + ,8048.1 + ,10368 + ,-9.7 + ,-3 + ,1.3 + ,2.69 + ,2042 + ,8721.14 + ,8641.21 + ,10244 + ,-8.8 + ,-4 + ,1.1 + ,2.65 + ,1995.37 + ,8692.94 + ,8526.63 + ,10511 + ,-9.6 + ,-8 + ,1.4 + ,2.57 + ,1946.81 + ,8570.73 + ,8474.21 + ,10812 + ,-11.5 + ,-9 + ,1.2 + ,2.32 + ,1765.9 + ,8538.47 + ,7916.13 + ,10738 + ,-11 + ,-13 + ,1.7 + ,2.12 + ,1635.25 + ,8169.75 + ,7977.64 + ,10171 + ,-14.9 + ,-18 + ,1.8 + ,2.05) + ,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 > 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 3484.74 13830.14 9349.44 7977 -5.6 6 2 3411.13 14153.22 9327.78 8241 -6.2 3 3 3288.18 15418.03 9753.63 8444 -7.1 2 4 3280.37 16666.97 10443.50 8490 -1.4 2 5 3173.95 16505.21 10853.87 8388 -0.1 2 6 3165.26 17135.96 10704.02 8099 -0.9 -8 7 3092.71 18033.25 11052.23 7984 0.0 0 8 3053.05 17671.00 10935.47 7786 0.1 -2 9 3181.96 17544.22 10714.03 8086 2.6 3 10 2999.93 17677.90 10394.48 9315 6.0 5 11 3249.57 18470.97 10817.90 9113 6.4 8 12 3210.52 18409.96 11251.20 9023 8.6 8 13 3030.29 18941.60 11281.26 9026 6.4 9 14 2803.47 19685.53 10539.68 9787 7.7 11 15 2767.63 19834.71 10483.39 9536 9.2 13 16 2882.60 19598.93 10947.43 9490 8.6 12 17 2863.36 17039.97 10580.27 9736 7.4 13 18 2897.06 16969.28 10582.92 9694 8.6 15 19 3012.61 16973.38 10654.41 9647 6.2 13 20 3142.95 16329.89 11014.51 9753 6.0 16 21 3032.93 16153.34 10967.87 10070 6.6 10 22 3045.78 15311.70 10433.56 10137 5.1 14 23 3110.52 14760.87 10665.78 9984 4.7 14 24 3013.24 14452.93 10666.71 9732 5.0 15 25 2987.10 13720.95 10682.74 9103 3.6 13 26 2995.55 13266.27 10777.22 9155 1.9 8 27 2833.18 12708.47 10052.60 9308 -0.1 7 28 2848.96 13411.84 10213.97 9394 -5.7 3 29 2794.83 13975.55 10546.82 9948 -5.6 3 30 2845.26 12974.89 10767.20 10177 -6.4 4 31 2915.02 12151.11 10444.50 10002 -7.7 4 32 2892.63 11576.21 10314.68 9728 -8.0 0 33 2604.42 9996.83 9042.56 10002 -11.9 -4 34 2641.65 10438.90 9220.75 10063 -15.4 -14 35 2659.81 10511.22 9721.84 10018 -15.5 -18 36 2638.53 10496.20 9978.53 9960 -13.4 -8 37 2720.25 10300.79 9923.81 10236 -10.9 -1 38 2745.88 9981.65 9892.56 10893 -10.8 1 39 2735.70 11448.79 10500.98 10756 -7.3 2 40 2811.70 11384.49 10179.35 10940 -6.5 0 41 2799.43 11717.46 10080.48 10997 -5.1 1 42 2555.28 10965.88 9492.44 10827 -5.3 0 43 2304.98 10352.27 8616.49 10166 -6.8 -1 44 2214.95 9751.20 8685.40 10186 -8.4 -3 45 2065.81 9354.01 8160.67 10457 -8.4 -3 46 1940.49 8792.50 8048.10 10368 -9.7 -3 47 2042.00 8721.14 8641.21 10244 -8.8 -4 48 1995.37 8692.94 8526.63 10511 -9.6 -8 49 1946.81 8570.73 8474.21 10812 -11.5 -9 50 1765.90 8538.47 7916.13 10738 -11.0 -13 51 1635.25 8169.75 7977.64 10171 -14.9 -18 Alg_consumptie_index_BE Gem_rente_kasbon_1j M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 1 1.0 2.77 1 0 0 0 0 0 0 0 0 0 2 1.0 2.76 0 1 0 0 0 0 0 0 0 0 3 1.2 2.76 0 0 1 0 0 0 0 0 0 0 4 1.2 2.46 0 0 0 1 0 0 0 0 0 0 5 0.8 2.46 0 0 0 0 1 0 0 0 0 0 6 0.7 2.47 0 0 0 0 0 1 0 0 0 0 7 0.7 2.71 0 0 0 0 0 0 1 0 0 0 8 0.9 2.80 0 0 0 0 0 0 0 1 0 0 9 1.2 2.89 0 0 0 0 0 0 0 0 1 0 10 1.3 3.36 0 0 0 0 0 0 0 0 0 1 11 1.5 3.31 0 0 0 0 0 0 0 0 0 0 12 1.9 3.50 0 0 0 0 0 0 0 0 0 0 13 1.8 3.51 1 0 0 0 0 0 0 0 0 0 14 1.9 3.71 0 1 0 0 0 0 0 0 0 0 15 2.2 3.71 0 0 1 0 0 0 0 0 0 0 16 2.1 3.71 0 0 0 1 0 0 0 0 0 0 17 2.2 4.21 0 0 0 0 1 0 0 0 0 0 18 2.7 4.21 0 0 0 0 0 1 0 0 0 0 19 2.8 4.21 0 0 0 0 0 0 1 0 0 0 20 2.9 4.50 0 0 0 0 0 0 0 1 0 0 21 3.4 4.51 0 0 0 0 0 0 0 0 1 0 22 3.0 4.51 0 0 0 0 0 0 0 0 0 1 23 3.1 4.51 0 0 0 0 0 0 0 0 0 0 24 2.5 4.32 0 0 0 0 0 0 0 0 0 0 25 2.2 4.02 1 0 0 0 0 0 0 0 0 0 26 2.3 4.02 0 1 0 0 0 0 0 0 0 0 27 2.1 3.85 0 0 1 0 0 0 0 0 0 0 28 2.8 3.84 0 0 0 1 0 0 0 0 0 0 29 3.1 4.02 0 0 0 0 1 0 0 0 0 0 30 2.9 3.82 0 0 0 0 0 1 0 0 0 0 31 2.6 3.75 0 0 0 0 0 0 1 0 0 0 32 2.7 3.74 0 0 0 0 0 0 0 1 0 0 33 2.3 3.14 0 0 0 0 0 0 0 0 1 0 34 2.3 2.91 0 0 0 0 0 0 0 0 0 1 35 2.1 2.84 0 0 0 0 0 0 0 0 0 0 36 2.2 2.85 0 0 0 0 0 0 0 0 0 0 37 2.9 2.85 1 0 0 0 0 0 0 0 0 0 38 2.6 3.08 0 1 0 0 0 0 0 0 0 0 39 2.7 3.30 0 0 1 0 0 0 0 0 0 0 40 1.8 3.29 0 0 0 1 0 0 0 0 0 0 41 1.3 3.26 0 0 0 0 1 0 0 0 0 0 42 0.9 3.26 0 0 0 0 0 1 0 0 0 0 43 1.3 3.11 0 0 0 0 0 0 1 0 0 0 44 1.3 2.84 0 0 0 0 0 0 0 1 0 0 45 1.3 2.71 0 0 0 0 0 0 0 0 1 0 46 1.3 2.69 0 0 0 0 0 0 0 0 0 1 47 1.1 2.65 0 0 0 0 0 0 0 0 0 0 48 1.4 2.57 0 0 0 0 0 0 0 0 0 0 49 1.2 2.32 1 0 0 0 0 0 0 0 0 0 50 1.7 2.12 0 1 0 0 0 0 0 0 0 0 51 1.8 2.05 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 305.04884 -0.08794 0.27326 Goudprijs Conjunct_Seizoenzuiver Cons_vertrouw 0.16609 -12.15814 4.00557 Alg_consumptie_index_BE Gem_rente_kasbon_1j M1 -120.44520 176.26212 23.09845 M2 M3 M4 -0.34417 -3.60817 58.26220 M5 M6 M7 -80.49088 -53.38570 22.65211 M8 M9 M10 18.20958 39.15621 -25.20268 M11 t 39.83616 -40.48872 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -123.29 -48.07 -5.36 40.44 200.20 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 305.04884 498.91067 0.611 0.545373 Nikkei -0.08794 0.02164 -4.065 0.000305 *** DJ_Indust 0.27326 0.03430 7.968 5.38e-09 *** Goudprijs 0.16609 0.04921 3.375 0.002000 ** Conjunct_Seizoenzuiver -12.15814 8.73718 -1.392 0.173967 Cons_vertrouw 4.00557 5.91425 0.677 0.503255 Alg_consumptie_index_BE -120.44520 41.61713 -2.894 0.006903 ** Gem_rente_kasbon_1j 176.26212 72.13287 2.444 0.020433 * M1 23.09845 66.46141 0.348 0.730529 M2 -0.34417 65.87617 -0.005 0.995865 M3 -3.60817 66.96787 -0.054 0.957377 M4 58.26220 70.59571 0.825 0.415511 M5 -80.49088 70.24190 -1.146 0.260602 M6 -53.38570 69.22554 -0.771 0.446436 M7 22.65211 72.08573 0.314 0.755445 M8 18.20958 70.31967 0.259 0.797382 M9 39.15621 68.59894 0.571 0.572251 M10 -25.20268 72.76848 -0.346 0.731427 M11 39.83616 67.90693 0.587 0.561701 t -40.48872 4.71398 -8.589 1.06e-09 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 93.73 on 31 degrees of freedom Multiple R-squared: 0.9707, Adjusted R-squared: 0.9528 F-statistic: 54.08 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.7548723 0.4902554 0.2451277 [2,] 0.5906977 0.8186046 0.4093023 [3,] 0.4744955 0.9489909 0.5255045 [4,] 0.3140796 0.6281592 0.6859204 [5,] 0.2597794 0.5195589 0.7402206 [6,] 0.1316839 0.2633677 0.8683161 > postscript(file="/var/www/rcomp/tmp/1xjn61291647019.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/rcomp/tmp/2xjn61291647019.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/rcomp/tmp/3lpy21291647019.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/rcomp/tmp/4lpy21291647019.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/rcomp/tmp/5lpy21291647019.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 73.6546952 60.9434470 -39.9562040 -33.2882659 -102.2616398 63.3728114 7 8 9 10 11 12 -105.2733380 -49.6145199 129.0090492 -90.6960748 147.7332343 121.6228240 13 14 15 16 17 18 -47.7362326 -84.3659607 40.0967719 -21.5480370 -121.7976253 -7.8777965 19 20 21 22 23 24 51.6306709 0.7844602 -55.3377718 40.7846397 1.6696104 -39.9008472 25 26 27 28 29 30 -5.1962232 4.1483283 -5.3595809 26.5257349 23.8634162 -101.1490337 31 32 33 34 35 36 -61.7364677 17.4127648 -61.8525149 98.3202546 -28.1087315 -35.1367538 37 38 39 40 41 42 102.5679978 -19.9891425 10.9190896 28.3105679 200.1958489 45.6540187 43 44 45 46 47 48 115.3791347 31.4172949 -11.8187625 -48.4088195 -121.2941133 -46.5852230 49 50 51 -123.2902372 39.2633278 -5.7000766 > postscript(file="/var/www/rcomp/tmp/6vgx51291647019.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 73.6546952 NA 1 60.9434470 73.6546952 2 -39.9562040 60.9434470 3 -33.2882659 -39.9562040 4 -102.2616398 -33.2882659 5 63.3728114 -102.2616398 6 -105.2733380 63.3728114 7 -49.6145199 -105.2733380 8 129.0090492 -49.6145199 9 -90.6960748 129.0090492 10 147.7332343 -90.6960748 11 121.6228240 147.7332343 12 -47.7362326 121.6228240 13 -84.3659607 -47.7362326 14 40.0967719 -84.3659607 15 -21.5480370 40.0967719 16 -121.7976253 -21.5480370 17 -7.8777965 -121.7976253 18 51.6306709 -7.8777965 19 0.7844602 51.6306709 20 -55.3377718 0.7844602 21 40.7846397 -55.3377718 22 1.6696104 40.7846397 23 -39.9008472 1.6696104 24 -5.1962232 -39.9008472 25 4.1483283 -5.1962232 26 -5.3595809 4.1483283 27 26.5257349 -5.3595809 28 23.8634162 26.5257349 29 -101.1490337 23.8634162 30 -61.7364677 -101.1490337 31 17.4127648 -61.7364677 32 -61.8525149 17.4127648 33 98.3202546 -61.8525149 34 -28.1087315 98.3202546 35 -35.1367538 -28.1087315 36 102.5679978 -35.1367538 37 -19.9891425 102.5679978 38 10.9190896 -19.9891425 39 28.3105679 10.9190896 40 200.1958489 28.3105679 41 45.6540187 200.1958489 42 115.3791347 45.6540187 43 31.4172949 115.3791347 44 -11.8187625 31.4172949 45 -48.4088195 -11.8187625 46 -121.2941133 -48.4088195 47 -46.5852230 -121.2941133 48 -123.2902372 -46.5852230 49 39.2633278 -123.2902372 50 -5.7000766 39.2633278 51 NA -5.7000766 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] 60.9434470 73.6546952 [2,] -39.9562040 60.9434470 [3,] -33.2882659 -39.9562040 [4,] -102.2616398 -33.2882659 [5,] 63.3728114 -102.2616398 [6,] -105.2733380 63.3728114 [7,] -49.6145199 -105.2733380 [8,] 129.0090492 -49.6145199 [9,] -90.6960748 129.0090492 [10,] 147.7332343 -90.6960748 [11,] 121.6228240 147.7332343 [12,] -47.7362326 121.6228240 [13,] -84.3659607 -47.7362326 [14,] 40.0967719 -84.3659607 [15,] -21.5480370 40.0967719 [16,] -121.7976253 -21.5480370 [17,] -7.8777965 -121.7976253 [18,] 51.6306709 -7.8777965 [19,] 0.7844602 51.6306709 [20,] -55.3377718 0.7844602 [21,] 40.7846397 -55.3377718 [22,] 1.6696104 40.7846397 [23,] -39.9008472 1.6696104 [24,] -5.1962232 -39.9008472 [25,] 4.1483283 -5.1962232 [26,] -5.3595809 4.1483283 [27,] 26.5257349 -5.3595809 [28,] 23.8634162 26.5257349 [29,] -101.1490337 23.8634162 [30,] -61.7364677 -101.1490337 [31,] 17.4127648 -61.7364677 [32,] -61.8525149 17.4127648 [33,] 98.3202546 -61.8525149 [34,] -28.1087315 98.3202546 [35,] -35.1367538 -28.1087315 [36,] 102.5679978 -35.1367538 [37,] -19.9891425 102.5679978 [38,] 10.9190896 -19.9891425 [39,] 28.3105679 10.9190896 [40,] 200.1958489 28.3105679 [41,] 45.6540187 200.1958489 [42,] 115.3791347 45.6540187 [43,] 31.4172949 115.3791347 [44,] -11.8187625 31.4172949 [45,] -48.4088195 -11.8187625 [46,] -121.2941133 -48.4088195 [47,] -46.5852230 -121.2941133 [48,] -123.2902372 -46.5852230 [49,] 39.2633278 -123.2902372 [50,] -5.7000766 39.2633278 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 60.9434470 73.6546952 2 -39.9562040 60.9434470 3 -33.2882659 -39.9562040 4 -102.2616398 -33.2882659 5 63.3728114 -102.2616398 6 -105.2733380 63.3728114 7 -49.6145199 -105.2733380 8 129.0090492 -49.6145199 9 -90.6960748 129.0090492 10 147.7332343 -90.6960748 11 121.6228240 147.7332343 12 -47.7362326 121.6228240 13 -84.3659607 -47.7362326 14 40.0967719 -84.3659607 15 -21.5480370 40.0967719 16 -121.7976253 -21.5480370 17 -7.8777965 -121.7976253 18 51.6306709 -7.8777965 19 0.7844602 51.6306709 20 -55.3377718 0.7844602 21 40.7846397 -55.3377718 22 1.6696104 40.7846397 23 -39.9008472 1.6696104 24 -5.1962232 -39.9008472 25 4.1483283 -5.1962232 26 -5.3595809 4.1483283 27 26.5257349 -5.3595809 28 23.8634162 26.5257349 29 -101.1490337 23.8634162 30 -61.7364677 -101.1490337 31 17.4127648 -61.7364677 32 -61.8525149 17.4127648 33 98.3202546 -61.8525149 34 -28.1087315 98.3202546 35 -35.1367538 -28.1087315 36 102.5679978 -35.1367538 37 -19.9891425 102.5679978 38 10.9190896 -19.9891425 39 28.3105679 10.9190896 40 200.1958489 28.3105679 41 45.6540187 200.1958489 42 115.3791347 45.6540187 43 31.4172949 115.3791347 44 -11.8187625 31.4172949 45 -48.4088195 -11.8187625 46 -121.2941133 -48.4088195 47 -46.5852230 -121.2941133 48 -123.2902372 -46.5852230 49 39.2633278 -123.2902372 50 -5.7000766 39.2633278 > 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/rcomp/tmp/76pwq1291647019.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/rcomp/tmp/86pwq1291647019.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/rcomp/tmp/9zhdb1291647019.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/rcomp/tmp/10zhdb1291647019.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/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/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/rcomp/tmp/11kzch1291647019.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/rcomp/tmp/12n0sn1291647019.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/rcomp/tmp/132rqe1291647019.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/rcomp/tmp/145ap21291647019.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/rcomp/tmp/15qbnq1291647019.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/rcomp/tmp/16m2ly1291647019.tab") + } > > try(system("convert tmp/1xjn61291647019.ps tmp/1xjn61291647019.png",intern=TRUE)) character(0) > try(system("convert tmp/2xjn61291647019.ps tmp/2xjn61291647019.png",intern=TRUE)) character(0) > try(system("convert tmp/3lpy21291647019.ps tmp/3lpy21291647019.png",intern=TRUE)) character(0) > try(system("convert tmp/4lpy21291647019.ps tmp/4lpy21291647019.png",intern=TRUE)) character(0) > try(system("convert tmp/5lpy21291647019.ps tmp/5lpy21291647019.png",intern=TRUE)) character(0) > try(system("convert tmp/6vgx51291647019.ps tmp/6vgx51291647019.png",intern=TRUE)) character(0) > try(system("convert tmp/76pwq1291647019.ps tmp/76pwq1291647019.png",intern=TRUE)) character(0) > try(system("convert tmp/86pwq1291647019.ps tmp/86pwq1291647019.png",intern=TRUE)) character(0) > try(system("convert tmp/9zhdb1291647019.ps tmp/9zhdb1291647019.png",intern=TRUE)) character(0) > try(system("convert tmp/10zhdb1291647019.ps tmp/10zhdb1291647019.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.97 1.66 4.64