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(6802.96 + ,0 + ,6349.71 + ,6303.79 + ,6158.17 + ,6091.43 + ,7132.68 + ,0 + ,6802.96 + ,6349.71 + ,6303.79 + ,6158.17 + ,7073.29 + ,0 + ,7132.68 + ,6802.96 + ,6349.71 + ,6303.79 + ,7264.5 + ,0 + ,7073.29 + ,7132.68 + ,6802.96 + ,6349.71 + ,7105.33 + ,0 + ,7264.5 + ,7073.29 + ,7132.68 + ,6802.96 + ,7218.71 + ,0 + ,7105.33 + ,7264.5 + ,7073.29 + ,7132.68 + ,7225.72 + ,0 + ,7218.71 + ,7105.33 + ,7264.5 + ,7073.29 + ,7354.25 + ,0 + ,7225.72 + ,7218.71 + ,7105.33 + ,7264.5 + ,7745.46 + ,0 + ,7354.25 + ,7225.72 + ,7218.71 + ,7105.33 + ,8070.26 + ,0 + ,7745.46 + ,7354.25 + ,7225.72 + ,7218.71 + ,8366.33 + ,0 + ,8070.26 + ,7745.46 + ,7354.25 + ,7225.72 + ,8667.51 + ,0 + ,8366.33 + ,8070.26 + ,7745.46 + ,7354.25 + ,8854.34 + ,0 + ,8667.51 + ,8366.33 + ,8070.26 + ,7745.46 + ,9218.1 + ,0 + ,8854.34 + ,8667.51 + ,8366.33 + ,8070.26 + ,9332.9 + ,0 + ,9218.1 + ,8854.34 + ,8667.51 + ,8366.33 + ,9358.31 + ,0 + ,9332.9 + ,9218.1 + ,8854.34 + ,8667.51 + ,9248.66 + ,0 + ,9358.31 + ,9332.9 + ,9218.1 + ,8854.34 + ,9401.2 + ,0 + ,9248.66 + ,9358.31 + ,9332.9 + ,9218.1 + ,9652.04 + ,0 + ,9401.2 + ,9248.66 + ,9358.31 + ,9332.9 + ,9957.38 + ,0 + ,9652.04 + ,9401.2 + ,9248.66 + ,9358.31 + ,10110.63 + ,0 + ,9957.38 + ,9652.04 + ,9401.2 + ,9248.66 + ,10169.26 + ,0 + ,10110.63 + ,9957.38 + ,9652.04 + ,9401.2 + ,10343.78 + ,0 + ,10169.26 + ,10110.63 + ,9957.38 + ,9652.04 + ,10750.21 + ,0 + ,10343.78 + ,10169.26 + ,10110.63 + ,9957.38 + ,11337.5 + ,0 + ,10750.21 + ,10343.78 + ,10169.26 + ,10110.63 + ,11786.96 + ,0 + ,11337.5 + ,10750.21 + ,10343.78 + ,10169.26 + ,12083.04 + ,0 + ,11786.96 + ,11337.5 + ,10750.21 + ,10343.78 + ,12007.74 + ,0 + ,12083.04 + ,11786.96 + ,11337.5 + ,10750.21 + ,11745.93 + ,0 + ,12007.74 + ,12083.04 + ,11786.96 + ,11337.5 + ,11051.51 + ,0 + ,11745.93 + ,12007.74 + ,12083.04 + ,11786.96 + ,11445.9 + ,0 + ,11051.51 + ,11745.93 + ,12007.74 + ,12083.04 + ,11924.88 + ,0 + ,11445.9 + ,11051.51 + ,11745.93 + ,12007.74 + ,12247.63 + ,0 + ,11924.88 + ,11445.9 + ,11051.51 + ,11745.93 + ,12690.91 + ,0 + ,12247.63 + ,11924.88 + ,11445.9 + ,11051.51 + ,12910.7 + ,0 + ,12690.91 + ,12247.63 + ,11924.88 + ,11445.9 + ,13202.12 + ,0 + ,12910.7 + ,12690.91 + ,12247.63 + ,11924.88 + ,13654.67 + ,0 + ,13202.12 + ,12910.7 + ,12690.91 + ,12247.63 + ,13862.82 + ,0 + ,13654.67 + ,13202.12 + ,12910.7 + ,12690.91 + ,13523.93 + ,0 + ,13862.82 + ,13654.67 + ,13202.12 + ,12910.7 + ,14211.17 + ,0 + ,13523.93 + ,13862.82 + ,13654.67 + ,13202.12 + ,14510.35 + ,0 + ,14211.17 + ,13523.93 + ,13862.82 + ,13654.67 + ,14289.23 + ,0 + ,14510.35 + ,14211.17 + ,13523.93 + ,13862.82 + ,14111.82 + ,0 + ,14289.23 + ,14510.35 + ,14211.17 + ,13523.93 + ,13086.59 + ,0 + ,14111.82 + ,14289.23 + ,14510.35 + ,14211.17 + ,13351.54 + ,0 + ,13086.59 + ,14111.82 + ,14289.23 + ,14510.35 + ,13747.69 + ,0 + ,13351.54 + ,13086.59 + ,14111.82 + ,14289.23 + ,12855.61 + ,0 + ,13747.69 + ,13351.54 + ,13086.59 + ,14111.82 + ,12926.93 + ,0 + ,12855.61 + ,13747.69 + ,13351.54 + ,13086.59 + ,12121.95 + ,1 + ,12926.93 + ,12855.61 + ,13747.69 + ,13351.54 + ,11731.65 + ,1 + ,12121.95 + ,12926.93 + ,12855.61 + ,13747.69 + ,11639.51 + ,1 + ,11731.65 + ,12121.95 + ,12926.93 + ,12855.61 + ,12163.78 + ,1 + ,11639.51 + ,11731.65 + ,12121.95 + ,12926.93 + ,12029.53 + ,1 + ,12163.78 + ,11639.51 + ,11731.65 + ,12121.95 + ,11234.18 + ,1 + ,12029.53 + ,12163.78 + ,11639.51 + ,11731.65 + ,9852.13 + ,1 + ,11234.18 + ,12029.53 + ,12163.78 + ,11639.51 + ,9709.04 + ,1 + ,9852.13 + ,11234.18 + ,12029.53 + ,12163.78 + ,9332.75 + ,1 + ,9709.04 + ,9852.13 + ,11234.18 + ,12029.53 + ,7108.6 + ,1 + ,9332.75 + ,9709.04 + ,9852.13 + ,11234.18 + ,6691.49 + ,1 + ,7108.6 + ,9332.75 + ,9709.04 + ,9852.13 + ,6143.05 + ,1 + ,6691.49 + ,7108.6 + ,9332.75 + ,9709.04) + ,dim=c(6 + ,60) + ,dimnames=list(c('Y' + ,'X' + ,'Y1' + ,'Y2' + ,'Y3' + ,'Y4') + ,1:60)) > y <- array(NA,dim=c(6,60),dimnames=list(c('Y','X','Y1','Y2','Y3','Y4'),1:60)) > 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 Y X Y1 Y2 Y3 Y4 M1 M2 M3 M4 M5 M6 M7 M8 M9 1 6802.96 0 6349.71 6303.79 6158.17 6091.43 1 0 0 0 0 0 0 0 0 2 7132.68 0 6802.96 6349.71 6303.79 6158.17 0 1 0 0 0 0 0 0 0 3 7073.29 0 7132.68 6802.96 6349.71 6303.79 0 0 1 0 0 0 0 0 0 4 7264.50 0 7073.29 7132.68 6802.96 6349.71 0 0 0 1 0 0 0 0 0 5 7105.33 0 7264.50 7073.29 7132.68 6802.96 0 0 0 0 1 0 0 0 0 6 7218.71 0 7105.33 7264.50 7073.29 7132.68 0 0 0 0 0 1 0 0 0 7 7225.72 0 7218.71 7105.33 7264.50 7073.29 0 0 0 0 0 0 1 0 0 8 7354.25 0 7225.72 7218.71 7105.33 7264.50 0 0 0 0 0 0 0 1 0 9 7745.46 0 7354.25 7225.72 7218.71 7105.33 0 0 0 0 0 0 0 0 1 10 8070.26 0 7745.46 7354.25 7225.72 7218.71 0 0 0 0 0 0 0 0 0 11 8366.33 0 8070.26 7745.46 7354.25 7225.72 0 0 0 0 0 0 0 0 0 12 8667.51 0 8366.33 8070.26 7745.46 7354.25 0 0 0 0 0 0 0 0 0 13 8854.34 0 8667.51 8366.33 8070.26 7745.46 1 0 0 0 0 0 0 0 0 14 9218.10 0 8854.34 8667.51 8366.33 8070.26 0 1 0 0 0 0 0 0 0 15 9332.90 0 9218.10 8854.34 8667.51 8366.33 0 0 1 0 0 0 0 0 0 16 9358.31 0 9332.90 9218.10 8854.34 8667.51 0 0 0 1 0 0 0 0 0 17 9248.66 0 9358.31 9332.90 9218.10 8854.34 0 0 0 0 1 0 0 0 0 18 9401.20 0 9248.66 9358.31 9332.90 9218.10 0 0 0 0 0 1 0 0 0 19 9652.04 0 9401.20 9248.66 9358.31 9332.90 0 0 0 0 0 0 1 0 0 20 9957.38 0 9652.04 9401.20 9248.66 9358.31 0 0 0 0 0 0 0 1 0 21 10110.63 0 9957.38 9652.04 9401.20 9248.66 0 0 0 0 0 0 0 0 1 22 10169.26 0 10110.63 9957.38 9652.04 9401.20 0 0 0 0 0 0 0 0 0 23 10343.78 0 10169.26 10110.63 9957.38 9652.04 0 0 0 0 0 0 0 0 0 24 10750.21 0 10343.78 10169.26 10110.63 9957.38 0 0 0 0 0 0 0 0 0 25 11337.50 0 10750.21 10343.78 10169.26 10110.63 1 0 0 0 0 0 0 0 0 26 11786.96 0 11337.50 10750.21 10343.78 10169.26 0 1 0 0 0 0 0 0 0 27 12083.04 0 11786.96 11337.50 10750.21 10343.78 0 0 1 0 0 0 0 0 0 28 12007.74 0 12083.04 11786.96 11337.50 10750.21 0 0 0 1 0 0 0 0 0 29 11745.93 0 12007.74 12083.04 11786.96 11337.50 0 0 0 0 1 0 0 0 0 30 11051.51 0 11745.93 12007.74 12083.04 11786.96 0 0 0 0 0 1 0 0 0 31 11445.90 0 11051.51 11745.93 12007.74 12083.04 0 0 0 0 0 0 1 0 0 32 11924.88 0 11445.90 11051.51 11745.93 12007.74 0 0 0 0 0 0 0 1 0 33 12247.63 0 11924.88 11445.90 11051.51 11745.93 0 0 0 0 0 0 0 0 1 34 12690.91 0 12247.63 11924.88 11445.90 11051.51 0 0 0 0 0 0 0 0 0 35 12910.70 0 12690.91 12247.63 11924.88 11445.90 0 0 0 0 0 0 0 0 0 36 13202.12 0 12910.70 12690.91 12247.63 11924.88 0 0 0 0 0 0 0 0 0 37 13654.67 0 13202.12 12910.70 12690.91 12247.63 1 0 0 0 0 0 0 0 0 38 13862.82 0 13654.67 13202.12 12910.70 12690.91 0 1 0 0 0 0 0 0 0 39 13523.93 0 13862.82 13654.67 13202.12 12910.70 0 0 1 0 0 0 0 0 0 40 14211.17 0 13523.93 13862.82 13654.67 13202.12 0 0 0 1 0 0 0 0 0 41 14510.35 0 14211.17 13523.93 13862.82 13654.67 0 0 0 0 1 0 0 0 0 42 14289.23 0 14510.35 14211.17 13523.93 13862.82 0 0 0 0 0 1 0 0 0 43 14111.82 0 14289.23 14510.35 14211.17 13523.93 0 0 0 0 0 0 1 0 0 44 13086.59 0 14111.82 14289.23 14510.35 14211.17 0 0 0 0 0 0 0 1 0 45 13351.54 0 13086.59 14111.82 14289.23 14510.35 0 0 0 0 0 0 0 0 1 46 13747.69 0 13351.54 13086.59 14111.82 14289.23 0 0 0 0 0 0 0 0 0 47 12855.61 0 13747.69 13351.54 13086.59 14111.82 0 0 0 0 0 0 0 0 0 48 12926.93 0 12855.61 13747.69 13351.54 13086.59 0 0 0 0 0 0 0 0 0 49 12121.95 1 12926.93 12855.61 13747.69 13351.54 1 0 0 0 0 0 0 0 0 50 11731.65 1 12121.95 12926.93 12855.61 13747.69 0 1 0 0 0 0 0 0 0 51 11639.51 1 11731.65 12121.95 12926.93 12855.61 0 0 1 0 0 0 0 0 0 52 12163.78 1 11639.51 11731.65 12121.95 12926.93 0 0 0 1 0 0 0 0 0 53 12029.53 1 12163.78 11639.51 11731.65 12121.95 0 0 0 0 1 0 0 0 0 54 11234.18 1 12029.53 12163.78 11639.51 11731.65 0 0 0 0 0 1 0 0 0 55 9852.13 1 11234.18 12029.53 12163.78 11639.51 0 0 0 0 0 0 1 0 0 56 9709.04 1 9852.13 11234.18 12029.53 12163.78 0 0 0 0 0 0 0 1 0 57 9332.75 1 9709.04 9852.13 11234.18 12029.53 0 0 0 0 0 0 0 0 1 58 7108.60 1 9332.75 9709.04 9852.13 11234.18 0 0 0 0 0 0 0 0 0 59 6691.49 1 7108.60 9332.75 9709.04 9852.13 0 0 0 0 0 0 0 0 0 60 6143.05 1 6691.49 7108.60 9332.75 9709.04 0 0 0 0 0 0 0 0 0 M10 M11 t 1 0 0 1 2 0 0 2 3 0 0 3 4 0 0 4 5 0 0 5 6 0 0 6 7 0 0 7 8 0 0 8 9 0 0 9 10 1 0 10 11 0 1 11 12 0 0 12 13 0 0 13 14 0 0 14 15 0 0 15 16 0 0 16 17 0 0 17 18 0 0 18 19 0 0 19 20 0 0 20 21 0 0 21 22 1 0 22 23 0 1 23 24 0 0 24 25 0 0 25 26 0 0 26 27 0 0 27 28 0 0 28 29 0 0 29 30 0 0 30 31 0 0 31 32 0 0 32 33 0 0 33 34 1 0 34 35 0 1 35 36 0 0 36 37 0 0 37 38 0 0 38 39 0 0 39 40 0 0 40 41 0 0 41 42 0 0 42 43 0 0 43 44 0 0 44 45 0 0 45 46 1 0 46 47 0 1 47 48 0 0 48 49 0 0 49 50 0 0 50 51 0 0 51 52 0 0 52 53 0 0 53 54 0 0 54 55 0 0 55 56 0 0 56 57 0 0 57 58 1 0 58 59 0 1 59 60 0 0 60 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) X Y1 Y2 Y3 Y4 -8.26383 -293.37416 1.02470 -0.21100 0.31681 -0.04904 M1 M2 M3 M4 M5 M6 -99.37526 -2.92769 -229.80564 73.40714 -312.34395 -434.54794 M7 M8 M9 M10 M11 t -401.50195 -270.91887 2.58703 -299.75662 -158.83668 -20.29065 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -1198.13 -155.70 35.66 258.95 789.09 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) -8.26383 458.15971 -0.018 0.986 X -293.37416 402.16121 -0.729 0.470 Y1 1.02470 0.15192 6.745 3.37e-08 *** Y2 -0.21100 0.21810 -0.967 0.339 Y3 0.31681 0.25122 1.261 0.214 Y4 -0.04904 0.19642 -0.250 0.804 M1 -99.37526 319.65128 -0.311 0.757 M2 -2.92769 323.52299 -0.009 0.993 M3 -229.80564 316.48137 -0.726 0.472 M4 73.40714 316.18102 0.232 0.818 M5 -312.34395 313.75873 -0.995 0.325 M6 -434.54794 318.30452 -1.365 0.179 M7 -401.50195 308.73162 -1.300 0.201 M8 -270.91887 309.46373 -0.875 0.386 M9 2.58703 306.97533 0.008 0.993 M10 -299.75662 296.03272 -1.013 0.317 M11 -158.83668 293.55402 -0.541 0.591 t -20.29065 16.46742 -1.232 0.225 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 449.9 on 42 degrees of freedom Multiple R-squared: 0.9749, Adjusted R-squared: 0.9647 F-statistic: 95.79 on 17 and 42 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,] 2.655529e-02 5.311058e-02 0.9734447 [2,] 9.086187e-03 1.817237e-02 0.9909138 [3,] 2.932079e-03 5.864158e-03 0.9970679 [4,] 6.587986e-04 1.317597e-03 0.9993412 [5,] 1.622364e-04 3.244727e-04 0.9998378 [6,] 3.607281e-05 7.214562e-05 0.9999639 [7,] 5.740455e-05 1.148091e-04 0.9999426 [8,] 2.447942e-05 4.895884e-05 0.9999755 [9,] 1.137247e-05 2.274494e-05 0.9999886 [10,] 6.483215e-04 1.296643e-03 0.9993517 [11,] 2.960904e-04 5.921807e-04 0.9997039 [12,] 1.116665e-04 2.233330e-04 0.9998883 [13,] 6.976818e-05 1.395364e-04 0.9999302 [14,] 2.299281e-05 4.598563e-05 0.9999770 [15,] 5.750274e-06 1.150055e-05 0.9999942 [16,] 1.302429e-06 2.604858e-06 0.9999987 [17,] 7.307996e-06 1.461599e-05 0.9999927 [18,] 6.578443e-06 1.315689e-05 0.9999934 [19,] 5.192880e-05 1.038576e-04 0.9999481 > postscript(file="/var/www/html/rcomp/tmp/1veja1258678474.ps",horizontal=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/2eqim1258678474.ps",horizontal=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/3taz01258678474.ps",horizontal=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/45kh21258678474.ps",horizontal=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/5zqk51258678474.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > qqnorm(mysum$resid, main='Residual Normal Q-Q Plot') > qqline(mysum$resid) > grid() > dev.off() null device 1 > (myerror <- as.ts(mysum$resid)) Time Series: Start = 1 End = 60 Frequency = 1 1 2 3 4 5 6 102.202315 -141.850563 -203.705114 -306.332671 -350.157653 144.148168 7 8 9 10 11 12 -74.852788 19.928938 -16.027150 260.994922 145.784236 -44.067764 13 14 15 16 17 18 -67.435136 14.402326 -37.850137 -380.664058 -192.169001 202.053184 19 20 21 22 23 24 258.273621 264.457319 -149.164654 67.503220 9.217071 77.063811 25 26 27 28 29 30 393.316874 198.168562 284.572414 -448.335395 -278.065660 -649.365085 31 32 33 34 35 36 426.972034 324.257648 193.363449 570.621640 151.248902 93.674852 37 38 39 40 41 42 289.040027 -29.097622 -320.168066 346.246141 231.996524 109.384054 43 44 45 46 47 48 -25.418214 -1086.889242 22.686144 299.013648 -747.617237 48.641162 49 50 51 52 53 54 -717.124080 -41.622703 277.150903 789.085982 588.395789 193.779679 55 56 57 58 59 60 -584.974653 478.245337 -50.857789 -1198.133431 441.367028 -175.312062 > postscript(file="/var/www/html/rcomp/tmp/6eyxb1258678474.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > dum <- cbind(lag(myerror,k=1),myerror) > dum Time Series: Start = 0 End = 60 Frequency = 1 lag(myerror, k = 1) myerror 0 102.202315 NA 1 -141.850563 102.202315 2 -203.705114 -141.850563 3 -306.332671 -203.705114 4 -350.157653 -306.332671 5 144.148168 -350.157653 6 -74.852788 144.148168 7 19.928938 -74.852788 8 -16.027150 19.928938 9 260.994922 -16.027150 10 145.784236 260.994922 11 -44.067764 145.784236 12 -67.435136 -44.067764 13 14.402326 -67.435136 14 -37.850137 14.402326 15 -380.664058 -37.850137 16 -192.169001 -380.664058 17 202.053184 -192.169001 18 258.273621 202.053184 19 264.457319 258.273621 20 -149.164654 264.457319 21 67.503220 -149.164654 22 9.217071 67.503220 23 77.063811 9.217071 24 393.316874 77.063811 25 198.168562 393.316874 26 284.572414 198.168562 27 -448.335395 284.572414 28 -278.065660 -448.335395 29 -649.365085 -278.065660 30 426.972034 -649.365085 31 324.257648 426.972034 32 193.363449 324.257648 33 570.621640 193.363449 34 151.248902 570.621640 35 93.674852 151.248902 36 289.040027 93.674852 37 -29.097622 289.040027 38 -320.168066 -29.097622 39 346.246141 -320.168066 40 231.996524 346.246141 41 109.384054 231.996524 42 -25.418214 109.384054 43 -1086.889242 -25.418214 44 22.686144 -1086.889242 45 299.013648 22.686144 46 -747.617237 299.013648 47 48.641162 -747.617237 48 -717.124080 48.641162 49 -41.622703 -717.124080 50 277.150903 -41.622703 51 789.085982 277.150903 52 588.395789 789.085982 53 193.779679 588.395789 54 -584.974653 193.779679 55 478.245337 -584.974653 56 -50.857789 478.245337 57 -1198.133431 -50.857789 58 441.367028 -1198.133431 59 -175.312062 441.367028 60 NA -175.312062 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -141.850563 102.202315 [2,] -203.705114 -141.850563 [3,] -306.332671 -203.705114 [4,] -350.157653 -306.332671 [5,] 144.148168 -350.157653 [6,] -74.852788 144.148168 [7,] 19.928938 -74.852788 [8,] -16.027150 19.928938 [9,] 260.994922 -16.027150 [10,] 145.784236 260.994922 [11,] -44.067764 145.784236 [12,] -67.435136 -44.067764 [13,] 14.402326 -67.435136 [14,] -37.850137 14.402326 [15,] -380.664058 -37.850137 [16,] -192.169001 -380.664058 [17,] 202.053184 -192.169001 [18,] 258.273621 202.053184 [19,] 264.457319 258.273621 [20,] -149.164654 264.457319 [21,] 67.503220 -149.164654 [22,] 9.217071 67.503220 [23,] 77.063811 9.217071 [24,] 393.316874 77.063811 [25,] 198.168562 393.316874 [26,] 284.572414 198.168562 [27,] -448.335395 284.572414 [28,] -278.065660 -448.335395 [29,] -649.365085 -278.065660 [30,] 426.972034 -649.365085 [31,] 324.257648 426.972034 [32,] 193.363449 324.257648 [33,] 570.621640 193.363449 [34,] 151.248902 570.621640 [35,] 93.674852 151.248902 [36,] 289.040027 93.674852 [37,] -29.097622 289.040027 [38,] -320.168066 -29.097622 [39,] 346.246141 -320.168066 [40,] 231.996524 346.246141 [41,] 109.384054 231.996524 [42,] -25.418214 109.384054 [43,] -1086.889242 -25.418214 [44,] 22.686144 -1086.889242 [45,] 299.013648 22.686144 [46,] -747.617237 299.013648 [47,] 48.641162 -747.617237 [48,] -717.124080 48.641162 [49,] -41.622703 -717.124080 [50,] 277.150903 -41.622703 [51,] 789.085982 277.150903 [52,] 588.395789 789.085982 [53,] 193.779679 588.395789 [54,] -584.974653 193.779679 [55,] 478.245337 -584.974653 [56,] -50.857789 478.245337 [57,] -1198.133431 -50.857789 [58,] 441.367028 -1198.133431 [59,] -175.312062 441.367028 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -141.850563 102.202315 2 -203.705114 -141.850563 3 -306.332671 -203.705114 4 -350.157653 -306.332671 5 144.148168 -350.157653 6 -74.852788 144.148168 7 19.928938 -74.852788 8 -16.027150 19.928938 9 260.994922 -16.027150 10 145.784236 260.994922 11 -44.067764 145.784236 12 -67.435136 -44.067764 13 14.402326 -67.435136 14 -37.850137 14.402326 15 -380.664058 -37.850137 16 -192.169001 -380.664058 17 202.053184 -192.169001 18 258.273621 202.053184 19 264.457319 258.273621 20 -149.164654 264.457319 21 67.503220 -149.164654 22 9.217071 67.503220 23 77.063811 9.217071 24 393.316874 77.063811 25 198.168562 393.316874 26 284.572414 198.168562 27 -448.335395 284.572414 28 -278.065660 -448.335395 29 -649.365085 -278.065660 30 426.972034 -649.365085 31 324.257648 426.972034 32 193.363449 324.257648 33 570.621640 193.363449 34 151.248902 570.621640 35 93.674852 151.248902 36 289.040027 93.674852 37 -29.097622 289.040027 38 -320.168066 -29.097622 39 346.246141 -320.168066 40 231.996524 346.246141 41 109.384054 231.996524 42 -25.418214 109.384054 43 -1086.889242 -25.418214 44 22.686144 -1086.889242 45 299.013648 22.686144 46 -747.617237 299.013648 47 48.641162 -747.617237 48 -717.124080 48.641162 49 -41.622703 -717.124080 50 277.150903 -41.622703 51 789.085982 277.150903 52 588.395789 789.085982 53 193.779679 588.395789 54 -584.974653 193.779679 55 478.245337 -584.974653 56 -50.857789 478.245337 57 -1198.133431 -50.857789 58 441.367028 -1198.133431 59 -175.312062 441.367028 > 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/7v1q81258678474.ps",horizontal=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/85ckc1258678474.ps",horizontal=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/991ve1258678474.ps",horizontal=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/101foc1258678474.ps",horizontal=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/119pnj1258678474.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/12pod81258678474.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/13vaf01258678474.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/14noyt1258678474.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/159w0k1258678475.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/167s8j1258678475.tab") + } > > system("convert tmp/1veja1258678474.ps tmp/1veja1258678474.png") > system("convert tmp/2eqim1258678474.ps tmp/2eqim1258678474.png") > system("convert tmp/3taz01258678474.ps tmp/3taz01258678474.png") > system("convert tmp/45kh21258678474.ps tmp/45kh21258678474.png") > system("convert tmp/5zqk51258678474.ps tmp/5zqk51258678474.png") > system("convert tmp/6eyxb1258678474.ps tmp/6eyxb1258678474.png") > system("convert tmp/7v1q81258678474.ps tmp/7v1q81258678474.png") > system("convert tmp/85ckc1258678474.ps tmp/85ckc1258678474.png") > system("convert tmp/991ve1258678474.ps tmp/991ve1258678474.png") > system("convert tmp/101foc1258678474.ps tmp/101foc1258678474.png") > > > proc.time() user system elapsed 2.377 1.549 2.998