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(12 + ,1221.53 + ,2617.2 + ,10168.52 + ,6957.61 + ,23448.78 + ,11 + ,1180.55 + ,2506.13 + ,9937.04 + ,6688.49 + ,23007.99 + ,10 + ,1183.26 + ,2679.07 + ,9202.45 + ,6601.37 + ,23096.32 + ,9 + ,1141.2 + ,2589.73 + ,9369.35 + ,6229.02 + ,22358.17 + ,8 + ,1049.33 + ,2457.46 + ,8824.06 + ,5925.22 + ,20536.49 + ,7 + ,1101.6 + ,2517.3 + ,9537.3 + ,6147.97 + ,21029.81 + ,6 + ,1030.71 + ,2386.53 + ,9382.64 + ,5965.52 + ,20128.99 + ,5 + ,1089.41 + ,2453.37 + ,9768.7 + ,5964.33 + ,19765.19 + ,4 + ,1186.69 + ,2529.66 + ,11057.4 + ,6135.7 + ,21108.59 + ,3 + ,1169.43 + ,2475.14 + ,11089.94 + ,6153.55 + ,21239.35 + ,2 + ,1104.49 + ,2525.93 + ,10126.03 + ,5598.46 + ,20608.7 + ,1 + ,1073.87 + ,2480.93 + ,10198.04 + ,5608.79 + ,20121.99 + ,12 + ,1115.1 + ,2229.85 + ,10546.44 + ,5957.43 + ,21872.5 + ,11 + ,1095.63 + ,2169.14 + ,9345.55 + ,5625.95 + ,21821.5 + ,10 + ,1036.19 + ,2030.98 + ,10034.74 + ,5414.96 + ,21752.87 + ,9 + ,1057.08 + ,2071.37 + ,10133.23 + ,5675.16 + ,20955.25 + ,8 + ,1020.62 + ,1953.35 + ,10492.53 + ,5458.04 + ,19724.19 + ,7 + ,987.48 + ,1748.74 + ,10356.83 + ,5332.14 + ,20573.33 + ,6 + ,919.32 + ,1696.58 + ,9958.44 + ,4808.64 + ,18378.73 + ,5 + ,919.14 + ,1900.09 + ,9522.5 + ,4940.82 + ,18171 + ,4 + ,872.81 + ,1908.64 + ,8828.26 + ,4769.45 + ,15520.99 + ,3 + ,797.87 + ,1881.46 + ,8109.53 + ,4084.76 + ,13576.02 + ,2 + ,735.09 + ,2100.18 + ,7568.42 + ,3843.74 + ,12811.57 + ,1 + ,825.88 + ,2672.2 + ,7994.05 + ,4338.35 + ,13278.21 + ,12 + ,903.25 + ,3136 + ,8859.56 + ,4810.2 + ,14387.48 + ,11 + ,896.24 + ,2994.38 + ,8512.27 + ,4669.44 + ,13888.24 + ,10 + ,968.75 + ,3168.22 + ,8576.98 + ,4987.97 + ,13968.67 + ,9 + ,1166.36 + ,3751.41 + ,11259.86 + ,5831.02 + ,18016.21 + ,8 + ,1282.83 + ,3925.43 + ,13072.87 + ,6422.3 + ,21261.89 + ,7 + ,1267.38 + ,3719.52 + ,13376.81 + ,6479.56 + ,22731.1 + ,6 + ,1280 + ,3757.12 + ,13481.38 + ,6418.32 + ,22102.01 + ,5 + ,1400.38 + ,3722.23 + ,14338.54 + ,7096.79 + ,24533.12 + ,4 + ,1385.59 + ,4127.47 + ,13849.99 + ,6948.82 + ,25755.35 + ,3 + ,1322.7 + ,4162.5 + ,12525.54 + ,6534.97 + ,22849.2 + ,2 + ,1330.63 + ,4441.82 + ,13603.02 + ,6748.13 + ,24331.67 + ,1 + ,1378.55 + ,4325.29 + ,13592.47 + ,6851.75 + ,23455.74 + ,12 + ,1468.36 + ,4350.83 + ,15307.78 + ,8067.32 + ,27812.65 + ,11 + ,1481.14 + ,4384.47 + ,15680.67 + ,7870.52 + ,28643.61 + ,10 + ,1549.38 + ,4639.4 + ,16737.63 + ,8019.22 + ,31352.58 + ,9 + ,1526.75 + ,4697.86 + ,16785.69 + ,7861.51 + ,27142.47 + ,8 + ,1473.99 + ,4614.76 + ,16569.09 + ,7638.17 + ,23984.14 + ,7 + ,1455.27 + ,4471.65 + ,17248.89 + ,7584.14 + ,23184.94 + ,6 + ,1503.35 + ,4305.23 + ,18138.36 + ,8007.32 + ,21772.73 + ,5 + ,1530.62 + ,4433.57 + ,17875.75 + ,7883.04 + ,20634.47 + ,4 + ,1482.37 + ,4388.53 + ,17400.41 + ,7408.87 + ,20318.98 + ,3 + ,1420.86 + ,4140.3 + ,17287.65 + ,6917.03 + ,19800.93 + ,2 + ,1406.82 + ,4144.38 + ,17604.12 + ,6715.44 + ,19651.51 + ,1 + ,1438.24 + ,4070.78 + ,17383.42 + ,6789.11 + ,20106.42 + ,12 + ,1418.3 + ,3906.01 + ,17225.83 + ,6596.92 + ,19964.72 + ,11 + ,1400.63 + ,3795.91 + ,16274.33 + ,6309.19 + ,18960.48 + ,10 + ,1377.94 + ,3703.32 + ,16399.39 + ,6268.92 + ,18324.35 + ,9 + ,1335.85 + ,3675.8 + ,16127.58 + ,6004.33 + ,17543.05 + ,8 + ,1303.82 + ,3911.06 + ,16140.76 + ,5859.57 + ,17392.27 + ,7 + ,1276.66 + ,3912.28 + ,15456.81 + ,5681.97 + ,16971.34 + ,6 + ,1270.2 + ,3839.25 + ,15505.18 + ,5683.31 + ,16267.62 + ,5 + ,1270.09 + ,3744.63 + ,15467.33 + ,5692.86 + ,15857.89 + ,4 + ,1310.61 + ,3549.25 + ,16906.23 + ,6009.89 + ,16661.3 + ,3 + ,1294.87 + ,3394.14 + ,17059.66 + ,5970.08 + ,15805.04 + ,2 + ,1280.66 + ,3264.26 + ,16205.43 + ,5796.04 + ,15918.48 + ,1 + ,1280.08 + ,3328.8 + ,16649.82 + ,5674.15 + ,15753.14 + ,12 + ,1248.29 + ,3223.98 + ,16111.43 + ,5408.26 + ,14876.43 + ,11 + ,1249.48 + ,3228.01 + ,14872.15 + ,5193.4 + ,14937.14 + ,10 + ,1207.01 + ,3112.83 + ,13606.5 + ,4929.07 + ,14386.37 + ,9 + ,1228.81 + ,3051.67 + ,13574.3 + ,5044.12 + ,15428.52 + ,8 + ,1220.33 + ,3039.71 + ,12413.6 + ,4829.69 + ,14903.55 + ,7 + ,1234.18 + ,3125.67 + ,11899.6 + ,4886.5 + ,14880.98 + ,6 + ,1191.33 + ,3106.54 + ,11584.01 + ,4586.28 + ,14201.06 + ,5 + ,1191.5 + ,11276.59 + ,4460.63 + ,13867.07 + ,4 + ,1156.85 + ,11008.9 + ,4184.84 + ,13908.97 + ,3 + ,1180.59 + ,11668.95 + ,4348.77 + ,13516.88 + ,2 + ,1203.6 + ,11740.6 + ,4350.49 + ,14195.35 + ,1 + ,1181.27 + ,11387.59 + ,4254.85 + ,13721.69) + ,dim=c(6 + ,72) + ,dimnames=list(c('month' + ,'S&P' + ,'Bel20' + ,'Nikkei225' + ,'DAX' + ,'HangSeng') + ,1:72)) > y <- array(NA,dim=c(6,72),dimnames=list(c('month','S&P','Bel20','Nikkei225','DAX','HangSeng'),1:72)) > 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 = 'Do not include Seasonal Dummies' > par1 = '2' > #'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 S&P month Bel20 Nikkei225 DAX HangSeng t 1 1221.53 12.00 2617.20 10168.52 6957.61 23448.78 1 2 1180.55 11.00 2506.13 9937.04 6688.49 23007.99 2 3 1183.26 10.00 2679.07 9202.45 6601.37 23096.32 3 4 1141.20 9.00 2589.73 9369.35 6229.02 22358.17 4 5 1049.33 8.00 2457.46 8824.06 5925.22 20536.49 5 6 1101.60 7.00 2517.30 9537.30 6147.97 21029.81 6 7 1030.71 6.00 2386.53 9382.64 5965.52 20128.99 7 8 1089.41 5.00 2453.37 9768.70 5964.33 19765.19 8 9 1186.69 4.00 2529.66 11057.40 6135.70 21108.59 9 10 1169.43 3.00 2475.14 11089.94 6153.55 21239.35 10 11 1104.49 2.00 2525.93 10126.03 5598.46 20608.70 11 12 1073.87 1.00 2480.93 10198.04 5608.79 20121.99 12 13 1115.10 12.00 2229.85 10546.44 5957.43 21872.50 13 14 1095.63 11.00 2169.14 9345.55 5625.95 21821.50 14 15 1036.19 10.00 2030.98 10034.74 5414.96 21752.87 15 16 1057.08 9.00 2071.37 10133.23 5675.16 20955.25 16 17 1020.62 8.00 1953.35 10492.53 5458.04 19724.19 17 18 987.48 7.00 1748.74 10356.83 5332.14 20573.33 18 19 919.32 6.00 1696.58 9958.44 4808.64 18378.73 19 20 919.14 5.00 1900.09 9522.50 4940.82 18171.00 20 21 872.81 4.00 1908.64 8828.26 4769.45 15520.99 21 22 797.87 3.00 1881.46 8109.53 4084.76 13576.02 22 23 735.09 2.00 2100.18 7568.42 3843.74 12811.57 23 24 825.88 1.00 2672.20 7994.05 4338.35 13278.21 24 25 903.25 12.00 3136.00 8859.56 4810.20 14387.48 25 26 896.24 11.00 2994.38 8512.27 4669.44 13888.24 26 27 968.75 10.00 3168.22 8576.98 4987.97 13968.67 27 28 1166.36 9.00 3751.41 11259.86 5831.02 18016.21 28 29 1282.83 8.00 3925.43 13072.87 6422.30 21261.89 29 30 1267.38 7.00 3719.52 13376.81 6479.56 22731.10 30 31 1280.00 6.00 3757.12 13481.38 6418.32 22102.01 31 32 1400.38 5.00 3722.23 14338.54 7096.79 24533.12 32 33 1385.59 4.00 4127.47 13849.99 6948.82 25755.35 33 34 1322.70 3.00 4162.50 12525.54 6534.97 22849.20 34 35 1330.63 2.00 4441.82 13603.02 6748.13 24331.67 35 36 1378.55 1.00 4325.29 13592.47 6851.75 23455.74 36 37 1468.36 12.00 4350.83 15307.78 8067.32 27812.65 37 38 1481.14 11.00 4384.47 15680.67 7870.52 28643.61 38 39 1549.38 10.00 4639.40 16737.63 8019.22 31352.58 39 40 1526.75 9.00 4697.86 16785.69 7861.51 27142.47 40 41 1473.99 8.00 4614.76 16569.09 7638.17 23984.14 41 42 1455.27 7.00 4471.65 17248.89 7584.14 23184.94 42 43 1503.35 6.00 4305.23 18138.36 8007.32 21772.73 43 44 1530.62 5.00 4433.57 17875.75 7883.04 20634.47 44 45 1482.37 4.00 4388.53 17400.41 7408.87 20318.98 45 46 1420.86 3.00 4140.30 17287.65 6917.03 19800.93 46 47 1406.82 2.00 4144.38 17604.12 6715.44 19651.51 47 48 1438.24 1.00 4070.78 17383.42 6789.11 20106.42 48 49 1418.30 12.00 3906.01 17225.83 6596.92 19964.72 49 50 1400.63 11.00 3795.91 16274.33 6309.19 18960.48 50 51 1377.94 10.00 3703.32 16399.39 6268.92 18324.35 51 52 1335.85 9.00 3675.80 16127.58 6004.33 17543.05 52 53 1303.82 8.00 3911.06 16140.76 5859.57 17392.27 53 54 1276.66 7.00 3912.28 15456.81 5681.97 16971.34 54 55 1270.20 6.00 3839.25 15505.18 5683.31 16267.62 55 56 1270.09 5.00 3744.63 15467.33 5692.86 15857.89 56 57 1310.61 4.00 3549.25 16906.23 6009.89 16661.30 57 58 1294.87 3.00 3394.14 17059.66 5970.08 15805.04 58 59 1280.66 2.00 3264.26 16205.43 5796.04 15918.48 59 60 1280.08 1.00 3328.80 16649.82 5674.15 15753.14 60 61 1248.29 12.00 3223.98 16111.43 5408.26 14876.43 61 62 1249.48 11.00 3228.01 14872.15 5193.40 14937.14 62 63 1207.01 10.00 3112.83 13606.50 4929.07 14386.37 63 64 1228.81 9.00 3051.67 13574.30 5044.12 15428.52 64 65 1220.33 8.00 3039.71 12413.60 4829.69 14903.55 65 66 1234.18 7.00 3125.67 11899.60 4886.50 14880.98 66 67 1191.33 6.00 3106.54 11584.01 4586.28 14201.06 67 68 1191.50 5.00 11276.59 4460.63 13867.07 4.00 68 69 11008.90 1156.85 4184.84 13908.97 3.00 1180.59 69 70 4348.77 11668.95 13516.88 2.00 1203.60 11740.60 70 71 14195.35 4350.49 1.00 1181.27 11387.59 4254.85 71 72 12.00 13721.69 1221.53 2617.20 10168.52 6957.61 72 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) month Bel20 Nikkei225 DAX HangSeng 3228.51499 -0.03587 -0.14334 -0.13485 0.00308 -0.04731 t 37.68554 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -4611.8 -724.9 69.3 439.8 8772.9 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 3228.51499 1240.66578 2.602 0.0115 * month -0.03587 0.15616 -0.230 0.8191 Bel20 -0.14334 0.13237 -1.083 0.2829 Nikkei225 -0.13485 0.11438 -1.179 0.2427 DAX 0.00308 0.12158 0.025 0.9799 HangSeng -0.04731 0.07396 -0.640 0.5246 t 37.68554 22.63263 1.665 0.1007 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 1777 on 65 degrees of freedom Multiple R-squared: 0.2391, Adjusted R-squared: 0.1689 F-statistic: 3.405 on 6 and 65 DF, p-value: 0.005541 > 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,] 4.874684e-07 9.749367e-07 0.9999995 [2,] 3.120919e-09 6.241838e-09 1.0000000 [3,] 2.999719e-11 5.999438e-11 1.0000000 [4,] 1.620942e-13 3.241883e-13 1.0000000 [5,] 5.756517e-14 1.151303e-13 1.0000000 [6,] 6.954817e-16 1.390963e-15 1.0000000 [7,] 6.277568e-18 1.255514e-17 1.0000000 [8,] 5.409602e-20 1.081920e-19 1.0000000 [9,] 4.285731e-22 8.571461e-22 1.0000000 [10,] 8.171548e-24 1.634310e-23 1.0000000 [11,] 7.236595e-26 1.447319e-25 1.0000000 [12,] 8.714936e-28 1.742987e-27 1.0000000 [13,] 1.248512e-29 2.497023e-29 1.0000000 [14,] 1.113175e-30 2.226350e-30 1.0000000 [15,] 1.041288e-31 2.082575e-31 1.0000000 [16,] 2.510485e-33 5.020970e-33 1.0000000 [17,] 4.028529e-35 8.057058e-35 1.0000000 [18,] 2.465622e-36 4.931245e-36 1.0000000 [19,] 6.473234e-38 1.294647e-37 1.0000000 [20,] 3.433851e-39 6.867702e-39 1.0000000 [21,] 3.573570e-40 7.147141e-40 1.0000000 [22,] 8.108527e-42 1.621705e-41 1.0000000 [23,] 1.355675e-43 2.711351e-43 1.0000000 [24,] 2.508521e-45 5.017043e-45 1.0000000 [25,] 2.295445e-46 4.590891e-46 1.0000000 [26,] 1.345323e-46 2.690647e-46 1.0000000 [27,] 1.427452e-45 2.854903e-45 1.0000000 [28,] 1.723606e-45 3.447213e-45 1.0000000 [29,] 1.229972e-46 2.459945e-46 1.0000000 [30,] 1.023291e-46 2.046582e-46 1.0000000 [31,] 4.663303e-48 9.326606e-48 1.0000000 [32,] 9.512671e-50 1.902534e-49 1.0000000 [33,] 2.096688e-51 4.193376e-51 1.0000000 [34,] 6.368216e-53 1.273643e-52 1.0000000 [35,] 5.328252e-54 1.065650e-53 1.0000000 [36,] 2.236562e-55 4.473124e-55 1.0000000 [37,] 6.636858e-57 1.327372e-56 1.0000000 [38,] 1.255931e-58 2.511862e-58 1.0000000 [39,] 1.217236e-59 2.434473e-59 1.0000000 [40,] 5.083653e-60 1.016731e-59 1.0000000 [41,] 1.488836e-59 2.977671e-59 1.0000000 [42,] 2.702427e-60 5.404854e-60 1.0000000 [43,] 3.150629e-61 6.301258e-61 1.0000000 [44,] 9.076030e-63 1.815206e-62 1.0000000 [45,] 2.747766e-63 5.495533e-63 1.0000000 [46,] 3.287567e-62 6.575134e-62 1.0000000 [47,] 1.995518e-52 3.991036e-52 1.0000000 [48,] 5.629345e-53 1.125869e-52 1.0000000 [49,] 2.349383e-54 4.698765e-54 1.0000000 [50,] 2.167746e-54 4.335492e-54 1.0000000 [51,] 2.096727e-52 4.193454e-52 1.0000000 [52,] 4.534817e-49 9.069634e-49 1.0000000 [53,] 7.501664e-46 1.500333e-45 1.0000000 > postscript(file="/var/www/html/rcomp/tmp/17lhk1291415549.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/27lhk1291415549.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/30cgn1291415549.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/40cgn1291415549.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/50cgn1291415549.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 = 72 Frequency = 1 1 2 3 4 5 6 790.09231 644.22979 539.39481 435.53824 128.20489 270.16501 7 8 9 10 11 12 79.89646 145.30800 452.61354 400.33681 146.84477 58.70512 13 14 15 16 17 18 155.38150 -73.84439 -100.46894 -136.76721 -236.98772 -314.91518 19 20 21 22 23 24 -584.21279 -661.96521 -963.25678 -1266.64505 -1444.18914 -1231.17807 25 26 27 28 29 30 -956.87699 -1091.92620 -1020.66937 -226.50289 273.41020 301.04413 31 32 33 34 35 36 265.85921 572.03402 570.00855 159.59706 384.62225 334.93462 37 38 39 40 41 42 824.81116 894.89581 1232.19348 988.00323 707.66556 684.73773 43 44 45 46 47 48 723.07080 642.13274 472.13983 299.12722 284.17840 258.86124 49 50 51 52 53 54 150.64931 -95.45931 -182.24998 -338.80899 -379.74909 -556.05423 55 56 57 58 59 60 -637.47881 -713.39114 -507.52786 -602.92033 -782.75874 -759.32994 61 62 63 64 65 66 -956.69695 -1156.23411 -1448.85204 -1428.93123 -1657.54432 -1739.65029 67 68 69 70 71 72 -1896.76431 -2424.09114 7752.89785 1390.29729 8772.86518 -4611.84942 > postscript(file="/var/www/html/rcomp/tmp/6t4yr1291415549.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 = 72 Frequency = 1 lag(myerror, k = 1) myerror 0 790.09231 NA 1 644.22979 790.09231 2 539.39481 644.22979 3 435.53824 539.39481 4 128.20489 435.53824 5 270.16501 128.20489 6 79.89646 270.16501 7 145.30800 79.89646 8 452.61354 145.30800 9 400.33681 452.61354 10 146.84477 400.33681 11 58.70512 146.84477 12 155.38150 58.70512 13 -73.84439 155.38150 14 -100.46894 -73.84439 15 -136.76721 -100.46894 16 -236.98772 -136.76721 17 -314.91518 -236.98772 18 -584.21279 -314.91518 19 -661.96521 -584.21279 20 -963.25678 -661.96521 21 -1266.64505 -963.25678 22 -1444.18914 -1266.64505 23 -1231.17807 -1444.18914 24 -956.87699 -1231.17807 25 -1091.92620 -956.87699 26 -1020.66937 -1091.92620 27 -226.50289 -1020.66937 28 273.41020 -226.50289 29 301.04413 273.41020 30 265.85921 301.04413 31 572.03402 265.85921 32 570.00855 572.03402 33 159.59706 570.00855 34 384.62225 159.59706 35 334.93462 384.62225 36 824.81116 334.93462 37 894.89581 824.81116 38 1232.19348 894.89581 39 988.00323 1232.19348 40 707.66556 988.00323 41 684.73773 707.66556 42 723.07080 684.73773 43 642.13274 723.07080 44 472.13983 642.13274 45 299.12722 472.13983 46 284.17840 299.12722 47 258.86124 284.17840 48 150.64931 258.86124 49 -95.45931 150.64931 50 -182.24998 -95.45931 51 -338.80899 -182.24998 52 -379.74909 -338.80899 53 -556.05423 -379.74909 54 -637.47881 -556.05423 55 -713.39114 -637.47881 56 -507.52786 -713.39114 57 -602.92033 -507.52786 58 -782.75874 -602.92033 59 -759.32994 -782.75874 60 -956.69695 -759.32994 61 -1156.23411 -956.69695 62 -1448.85204 -1156.23411 63 -1428.93123 -1448.85204 64 -1657.54432 -1428.93123 65 -1739.65029 -1657.54432 66 -1896.76431 -1739.65029 67 -2424.09114 -1896.76431 68 7752.89785 -2424.09114 69 1390.29729 7752.89785 70 8772.86518 1390.29729 71 -4611.84942 8772.86518 72 NA -4611.84942 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] 644.22979 790.09231 [2,] 539.39481 644.22979 [3,] 435.53824 539.39481 [4,] 128.20489 435.53824 [5,] 270.16501 128.20489 [6,] 79.89646 270.16501 [7,] 145.30800 79.89646 [8,] 452.61354 145.30800 [9,] 400.33681 452.61354 [10,] 146.84477 400.33681 [11,] 58.70512 146.84477 [12,] 155.38150 58.70512 [13,] -73.84439 155.38150 [14,] -100.46894 -73.84439 [15,] -136.76721 -100.46894 [16,] -236.98772 -136.76721 [17,] -314.91518 -236.98772 [18,] -584.21279 -314.91518 [19,] -661.96521 -584.21279 [20,] -963.25678 -661.96521 [21,] -1266.64505 -963.25678 [22,] -1444.18914 -1266.64505 [23,] -1231.17807 -1444.18914 [24,] -956.87699 -1231.17807 [25,] -1091.92620 -956.87699 [26,] -1020.66937 -1091.92620 [27,] -226.50289 -1020.66937 [28,] 273.41020 -226.50289 [29,] 301.04413 273.41020 [30,] 265.85921 301.04413 [31,] 572.03402 265.85921 [32,] 570.00855 572.03402 [33,] 159.59706 570.00855 [34,] 384.62225 159.59706 [35,] 334.93462 384.62225 [36,] 824.81116 334.93462 [37,] 894.89581 824.81116 [38,] 1232.19348 894.89581 [39,] 988.00323 1232.19348 [40,] 707.66556 988.00323 [41,] 684.73773 707.66556 [42,] 723.07080 684.73773 [43,] 642.13274 723.07080 [44,] 472.13983 642.13274 [45,] 299.12722 472.13983 [46,] 284.17840 299.12722 [47,] 258.86124 284.17840 [48,] 150.64931 258.86124 [49,] -95.45931 150.64931 [50,] -182.24998 -95.45931 [51,] -338.80899 -182.24998 [52,] -379.74909 -338.80899 [53,] -556.05423 -379.74909 [54,] -637.47881 -556.05423 [55,] -713.39114 -637.47881 [56,] -507.52786 -713.39114 [57,] -602.92033 -507.52786 [58,] -782.75874 -602.92033 [59,] -759.32994 -782.75874 [60,] -956.69695 -759.32994 [61,] -1156.23411 -956.69695 [62,] -1448.85204 -1156.23411 [63,] -1428.93123 -1448.85204 [64,] -1657.54432 -1428.93123 [65,] -1739.65029 -1657.54432 [66,] -1896.76431 -1739.65029 [67,] -2424.09114 -1896.76431 [68,] 7752.89785 -2424.09114 [69,] 1390.29729 7752.89785 [70,] 8772.86518 1390.29729 [71,] -4611.84942 8772.86518 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 644.22979 790.09231 2 539.39481 644.22979 3 435.53824 539.39481 4 128.20489 435.53824 5 270.16501 128.20489 6 79.89646 270.16501 7 145.30800 79.89646 8 452.61354 145.30800 9 400.33681 452.61354 10 146.84477 400.33681 11 58.70512 146.84477 12 155.38150 58.70512 13 -73.84439 155.38150 14 -100.46894 -73.84439 15 -136.76721 -100.46894 16 -236.98772 -136.76721 17 -314.91518 -236.98772 18 -584.21279 -314.91518 19 -661.96521 -584.21279 20 -963.25678 -661.96521 21 -1266.64505 -963.25678 22 -1444.18914 -1266.64505 23 -1231.17807 -1444.18914 24 -956.87699 -1231.17807 25 -1091.92620 -956.87699 26 -1020.66937 -1091.92620 27 -226.50289 -1020.66937 28 273.41020 -226.50289 29 301.04413 273.41020 30 265.85921 301.04413 31 572.03402 265.85921 32 570.00855 572.03402 33 159.59706 570.00855 34 384.62225 159.59706 35 334.93462 384.62225 36 824.81116 334.93462 37 894.89581 824.81116 38 1232.19348 894.89581 39 988.00323 1232.19348 40 707.66556 988.00323 41 684.73773 707.66556 42 723.07080 684.73773 43 642.13274 723.07080 44 472.13983 642.13274 45 299.12722 472.13983 46 284.17840 299.12722 47 258.86124 284.17840 48 150.64931 258.86124 49 -95.45931 150.64931 50 -182.24998 -95.45931 51 -338.80899 -182.24998 52 -379.74909 -338.80899 53 -556.05423 -379.74909 54 -637.47881 -556.05423 55 -713.39114 -637.47881 56 -507.52786 -713.39114 57 -602.92033 -507.52786 58 -782.75874 -602.92033 59 -759.32994 -782.75874 60 -956.69695 -759.32994 61 -1156.23411 -956.69695 62 -1448.85204 -1156.23411 63 -1428.93123 -1448.85204 64 -1657.54432 -1428.93123 65 -1739.65029 -1657.54432 66 -1896.76431 -1739.65029 67 -2424.09114 -1896.76431 68 7752.89785 -2424.09114 69 1390.29729 7752.89785 70 8772.86518 1390.29729 71 -4611.84942 8772.86518 > 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/7t4yr1291415549.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/8mdxb1291415549.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/9mdxb1291415549.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/10w4wx1291415549.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/11indk1291415549.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/12awun1291415549.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/13hxrh1291415549.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/143x751291415549.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/156yos1291415549.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/169g4y1291415549.tab") + } > > try(system("convert tmp/17lhk1291415549.ps tmp/17lhk1291415549.png",intern=TRUE)) character(0) > try(system("convert tmp/27lhk1291415549.ps tmp/27lhk1291415549.png",intern=TRUE)) character(0) > try(system("convert tmp/30cgn1291415549.ps tmp/30cgn1291415549.png",intern=TRUE)) character(0) > try(system("convert tmp/40cgn1291415549.ps tmp/40cgn1291415549.png",intern=TRUE)) character(0) > try(system("convert tmp/50cgn1291415549.ps tmp/50cgn1291415549.png",intern=TRUE)) character(0) > try(system("convert tmp/6t4yr1291415549.ps tmp/6t4yr1291415549.png",intern=TRUE)) character(0) > try(system("convert tmp/7t4yr1291415549.ps tmp/7t4yr1291415549.png",intern=TRUE)) character(0) > try(system("convert tmp/8mdxb1291415549.ps tmp/8mdxb1291415549.png",intern=TRUE)) character(0) > try(system("convert tmp/9mdxb1291415549.ps tmp/9mdxb1291415549.png",intern=TRUE)) character(0) > try(system("convert tmp/10w4wx1291415549.ps tmp/10w4wx1291415549.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.639 1.607 6.069