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(3.7 + ,0 + ,3.7 + ,3.93 + ,4.15 + ,4.24 + ,3.65 + ,0 + ,3.7 + ,3.7 + ,3.93 + ,4.15 + ,3.55 + ,0 + ,3.65 + ,3.7 + ,3.7 + ,3.93 + ,3.43 + ,0 + ,3.55 + ,3.65 + ,3.7 + ,3.7 + ,3.47 + ,0 + ,3.43 + ,3.55 + ,3.65 + ,3.7 + ,3.58 + ,0 + ,3.47 + ,3.43 + ,3.55 + ,3.65 + ,3.67 + ,0 + ,3.58 + ,3.47 + ,3.43 + ,3.55 + ,3.72 + ,0 + ,3.67 + ,3.58 + ,3.47 + ,3.43 + ,3.8 + ,0 + ,3.72 + ,3.67 + ,3.58 + ,3.47 + ,3.76 + ,0 + ,3.8 + ,3.72 + ,3.67 + ,3.58 + ,3.63 + ,0 + ,3.76 + ,3.8 + ,3.72 + ,3.67 + ,3.48 + ,0 + ,3.63 + ,3.76 + ,3.8 + ,3.72 + ,3.41 + ,0 + ,3.48 + ,3.63 + ,3.76 + ,3.8 + ,3.43 + ,0 + ,3.41 + ,3.48 + ,3.63 + ,3.76 + ,3.5 + ,0 + ,3.43 + ,3.41 + ,3.48 + ,3.63 + ,3.62 + ,0 + ,3.5 + ,3.43 + ,3.41 + ,3.48 + ,3.58 + ,0 + ,3.62 + ,3.5 + ,3.43 + ,3.41 + ,3.52 + ,0 + ,3.58 + ,3.62 + ,3.5 + ,3.43 + ,3.45 + ,0 + ,3.52 + ,3.58 + ,3.62 + ,3.5 + ,3.36 + ,0 + ,3.45 + ,3.52 + ,3.58 + ,3.62 + ,3.27 + ,0 + ,3.36 + ,3.45 + ,3.52 + ,3.58 + ,3.21 + ,0 + ,3.27 + ,3.36 + ,3.45 + ,3.52 + ,3.19 + ,0 + ,3.21 + ,3.27 + ,3.36 + ,3.45 + ,3.16 + ,0 + ,3.19 + ,3.21 + ,3.27 + ,3.36 + ,3.12 + ,0 + ,3.16 + ,3.19 + ,3.21 + ,3.27 + ,3.06 + ,0 + ,3.12 + ,3.16 + ,3.19 + ,3.21 + ,3.01 + ,0 + ,3.06 + ,3.12 + ,3.16 + ,3.19 + ,2.98 + ,0 + ,3.01 + ,3.06 + ,3.12 + ,3.16 + ,2.97 + ,0 + ,2.98 + ,3.01 + ,3.06 + ,3.12 + ,3.02 + ,0 + ,2.97 + ,2.98 + ,3.01 + ,3.06 + ,3.07 + ,0 + ,3.02 + ,2.97 + ,2.98 + ,3.01 + ,3.18 + ,0 + ,3.07 + ,3.02 + ,2.97 + ,2.98 + ,3.29 + ,1 + ,3.18 + ,3.07 + ,3.02 + ,2.97 + ,3.43 + ,1 + ,3.29 + ,3.18 + ,3.07 + ,3.02 + ,3.61 + ,1 + ,3.43 + ,3.29 + ,3.18 + ,3.07 + ,3.74 + ,1 + ,3.61 + ,3.43 + ,3.29 + ,3.18 + ,3.87 + ,1 + ,3.74 + ,3.61 + ,3.43 + ,3.29 + ,3.88 + ,1 + ,3.87 + ,3.74 + ,3.61 + ,3.43 + ,4.09 + ,1 + ,3.88 + ,3.87 + ,3.74 + ,3.61 + ,4.19 + ,1 + ,4.09 + ,3.88 + ,3.87 + ,3.74 + ,4.2 + ,1 + ,4.19 + ,4.09 + ,3.88 + ,3.87 + ,4.29 + ,1 + ,4.2 + ,4.19 + ,4.09 + ,3.88 + ,4.37 + ,1 + ,4.29 + ,4.2 + ,4.19 + ,4.09 + ,4.47 + ,1 + ,4.37 + ,4.29 + ,4.2 + ,4.19 + ,4.61 + ,1 + ,4.47 + ,4.37 + ,4.29 + ,4.2 + ,4.65 + ,1 + ,4.61 + ,4.47 + ,4.37 + ,4.29 + ,4.69 + ,1 + ,4.65 + ,4.61 + ,4.47 + ,4.37 + ,4.82 + ,1 + ,4.69 + ,4.65 + ,4.61 + ,4.47 + ,4.86 + ,1 + ,4.82 + ,4.69 + ,4.65 + ,4.61 + ,4.87 + ,1 + ,4.86 + ,4.82 + ,4.69 + ,4.65 + ,5.01 + ,1 + ,4.87 + ,4.86 + ,4.82 + ,4.69 + ,5.03 + ,1 + ,5.01 + ,4.87 + ,4.86 + ,4.82 + ,5.13 + ,1 + ,5.03 + ,5.01 + ,4.87 + ,4.86 + ,5.18 + ,1 + ,5.13 + ,5.03 + ,5.01 + ,4.87 + ,5.21 + ,1 + ,5.18 + ,5.13 + ,5.03 + ,5.01 + ,5.26 + ,1 + ,5.21 + ,5.18 + ,5.13 + ,5.03 + ,5.25 + ,1 + ,5.26 + ,5.21 + ,5.18 + ,5.13 + ,5.2 + ,1 + ,5.25 + ,5.26 + ,5.21 + ,5.18 + ,5.16 + ,1 + ,5.2 + ,5.25 + ,5.26 + ,5.21 + ,5.19 + ,1 + ,5.16 + ,5.2 + ,5.25 + ,5.26 + ,5.39 + ,1 + ,5.19 + ,5.16 + ,5.2 + ,5.25 + ,5.58 + ,1 + ,5.39 + ,5.19 + ,5.16 + ,5.2 + ,5.76 + ,1 + ,5.58 + ,5.39 + ,5.19 + ,5.16 + ,5.89 + ,1 + ,5.76 + ,5.58 + ,5.39 + ,5.19 + ,5.98 + ,1 + ,5.89 + ,5.76 + ,5.58 + ,5.39 + ,6.02 + ,1 + ,5.98 + ,5.89 + ,5.76 + ,5.58 + ,5.62 + ,1 + ,6.02 + ,5.98 + ,5.89 + ,5.76 + ,4.87 + ,1 + ,5.62 + ,6.02 + ,5.98 + ,5.89) + ,dim=c(6 + ,68) + ,dimnames=list(c('Y' + ,'X' + ,'Y1' + ,'Y2' + ,'Y3' + ,'Y4') + ,1:68)) > y <- array(NA,dim=c(6,68),dimnames=list(c('Y','X','Y1','Y2','Y3','Y4'),1:68)) > 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 M10 M11 t 1 3.70 0 3.70 3.93 4.15 4.24 1 0 0 0 0 0 0 0 0 0 0 1 2 3.65 0 3.70 3.70 3.93 4.15 0 1 0 0 0 0 0 0 0 0 0 2 3 3.55 0 3.65 3.70 3.70 3.93 0 0 1 0 0 0 0 0 0 0 0 3 4 3.43 0 3.55 3.65 3.70 3.70 0 0 0 1 0 0 0 0 0 0 0 4 5 3.47 0 3.43 3.55 3.65 3.70 0 0 0 0 1 0 0 0 0 0 0 5 6 3.58 0 3.47 3.43 3.55 3.65 0 0 0 0 0 1 0 0 0 0 0 6 7 3.67 0 3.58 3.47 3.43 3.55 0 0 0 0 0 0 1 0 0 0 0 7 8 3.72 0 3.67 3.58 3.47 3.43 0 0 0 0 0 0 0 1 0 0 0 8 9 3.80 0 3.72 3.67 3.58 3.47 0 0 0 0 0 0 0 0 1 0 0 9 10 3.76 0 3.80 3.72 3.67 3.58 0 0 0 0 0 0 0 0 0 1 0 10 11 3.63 0 3.76 3.80 3.72 3.67 0 0 0 0 0 0 0 0 0 0 1 11 12 3.48 0 3.63 3.76 3.80 3.72 0 0 0 0 0 0 0 0 0 0 0 12 13 3.41 0 3.48 3.63 3.76 3.80 1 0 0 0 0 0 0 0 0 0 0 13 14 3.43 0 3.41 3.48 3.63 3.76 0 1 0 0 0 0 0 0 0 0 0 14 15 3.50 0 3.43 3.41 3.48 3.63 0 0 1 0 0 0 0 0 0 0 0 15 16 3.62 0 3.50 3.43 3.41 3.48 0 0 0 1 0 0 0 0 0 0 0 16 17 3.58 0 3.62 3.50 3.43 3.41 0 0 0 0 1 0 0 0 0 0 0 17 18 3.52 0 3.58 3.62 3.50 3.43 0 0 0 0 0 1 0 0 0 0 0 18 19 3.45 0 3.52 3.58 3.62 3.50 0 0 0 0 0 0 1 0 0 0 0 19 20 3.36 0 3.45 3.52 3.58 3.62 0 0 0 0 0 0 0 1 0 0 0 20 21 3.27 0 3.36 3.45 3.52 3.58 0 0 0 0 0 0 0 0 1 0 0 21 22 3.21 0 3.27 3.36 3.45 3.52 0 0 0 0 0 0 0 0 0 1 0 22 23 3.19 0 3.21 3.27 3.36 3.45 0 0 0 0 0 0 0 0 0 0 1 23 24 3.16 0 3.19 3.21 3.27 3.36 0 0 0 0 0 0 0 0 0 0 0 24 25 3.12 0 3.16 3.19 3.21 3.27 1 0 0 0 0 0 0 0 0 0 0 25 26 3.06 0 3.12 3.16 3.19 3.21 0 1 0 0 0 0 0 0 0 0 0 26 27 3.01 0 3.06 3.12 3.16 3.19 0 0 1 0 0 0 0 0 0 0 0 27 28 2.98 0 3.01 3.06 3.12 3.16 0 0 0 1 0 0 0 0 0 0 0 28 29 2.97 0 2.98 3.01 3.06 3.12 0 0 0 0 1 0 0 0 0 0 0 29 30 3.02 0 2.97 2.98 3.01 3.06 0 0 0 0 0 1 0 0 0 0 0 30 31 3.07 0 3.02 2.97 2.98 3.01 0 0 0 0 0 0 1 0 0 0 0 31 32 3.18 0 3.07 3.02 2.97 2.98 0 0 0 0 0 0 0 1 0 0 0 32 33 3.29 1 3.18 3.07 3.02 2.97 0 0 0 0 0 0 0 0 1 0 0 33 34 3.43 1 3.29 3.18 3.07 3.02 0 0 0 0 0 0 0 0 0 1 0 34 35 3.61 1 3.43 3.29 3.18 3.07 0 0 0 0 0 0 0 0 0 0 1 35 36 3.74 1 3.61 3.43 3.29 3.18 0 0 0 0 0 0 0 0 0 0 0 36 37 3.87 1 3.74 3.61 3.43 3.29 1 0 0 0 0 0 0 0 0 0 0 37 38 3.88 1 3.87 3.74 3.61 3.43 0 1 0 0 0 0 0 0 0 0 0 38 39 4.09 1 3.88 3.87 3.74 3.61 0 0 1 0 0 0 0 0 0 0 0 39 40 4.19 1 4.09 3.88 3.87 3.74 0 0 0 1 0 0 0 0 0 0 0 40 41 4.20 1 4.19 4.09 3.88 3.87 0 0 0 0 1 0 0 0 0 0 0 41 42 4.29 1 4.20 4.19 4.09 3.88 0 0 0 0 0 1 0 0 0 0 0 42 43 4.37 1 4.29 4.20 4.19 4.09 0 0 0 0 0 0 1 0 0 0 0 43 44 4.47 1 4.37 4.29 4.20 4.19 0 0 0 0 0 0 0 1 0 0 0 44 45 4.61 1 4.47 4.37 4.29 4.20 0 0 0 0 0 0 0 0 1 0 0 45 46 4.65 1 4.61 4.47 4.37 4.29 0 0 0 0 0 0 0 0 0 1 0 46 47 4.69 1 4.65 4.61 4.47 4.37 0 0 0 0 0 0 0 0 0 0 1 47 48 4.82 1 4.69 4.65 4.61 4.47 0 0 0 0 0 0 0 0 0 0 0 48 49 4.86 1 4.82 4.69 4.65 4.61 1 0 0 0 0 0 0 0 0 0 0 49 50 4.87 1 4.86 4.82 4.69 4.65 0 1 0 0 0 0 0 0 0 0 0 50 51 5.01 1 4.87 4.86 4.82 4.69 0 0 1 0 0 0 0 0 0 0 0 51 52 5.03 1 5.01 4.87 4.86 4.82 0 0 0 1 0 0 0 0 0 0 0 52 53 5.13 1 5.03 5.01 4.87 4.86 0 0 0 0 1 0 0 0 0 0 0 53 54 5.18 1 5.13 5.03 5.01 4.87 0 0 0 0 0 1 0 0 0 0 0 54 55 5.21 1 5.18 5.13 5.03 5.01 0 0 0 0 0 0 1 0 0 0 0 55 56 5.26 1 5.21 5.18 5.13 5.03 0 0 0 0 0 0 0 1 0 0 0 56 57 5.25 1 5.26 5.21 5.18 5.13 0 0 0 0 0 0 0 0 1 0 0 57 58 5.20 1 5.25 5.26 5.21 5.18 0 0 0 0 0 0 0 0 0 1 0 58 59 5.16 1 5.20 5.25 5.26 5.21 0 0 0 0 0 0 0 0 0 0 1 59 60 5.19 1 5.16 5.20 5.25 5.26 0 0 0 0 0 0 0 0 0 0 0 60 61 5.39 1 5.19 5.16 5.20 5.25 1 0 0 0 0 0 0 0 0 0 0 61 62 5.58 1 5.39 5.19 5.16 5.20 0 1 0 0 0 0 0 0 0 0 0 62 63 5.76 1 5.58 5.39 5.19 5.16 0 0 1 0 0 0 0 0 0 0 0 63 64 5.89 1 5.76 5.58 5.39 5.19 0 0 0 1 0 0 0 0 0 0 0 64 65 5.98 1 5.89 5.76 5.58 5.39 0 0 0 0 1 0 0 0 0 0 0 65 66 6.02 1 5.98 5.89 5.76 5.58 0 0 0 0 0 1 0 0 0 0 0 66 67 5.62 1 6.02 5.98 5.89 5.76 0 0 0 0 0 0 1 0 0 0 0 67 68 4.87 1 5.62 6.02 5.98 5.89 0 0 0 0 0 0 0 1 0 0 0 68 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) X Y1 Y2 Y3 Y4 0.1614445 0.0791593 2.0606456 -1.5124844 0.3994992 0.0095502 M1 M2 M3 M4 M5 M6 0.0378650 -0.0484576 0.0596382 -0.0446391 0.0169784 0.0241710 M7 M8 M9 M10 M11 t -0.0756530 -0.0303723 -0.0095478 -0.0461532 -0.0003892 -0.0004754 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -0.28159 -0.04843 0.01404 0.05533 0.13770 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 0.1614445 0.0832036 1.940 0.058 . X 0.0791593 0.0568823 1.392 0.170 Y1 2.0606456 0.1635501 12.599 < 2e-16 *** Y2 -1.5124844 0.3335304 -4.535 3.62e-05 *** Y3 0.3994992 0.3711067 1.077 0.287 Y4 0.0095502 0.1991501 0.048 0.962 M1 0.0378650 0.0583309 0.649 0.519 M2 -0.0484576 0.0593709 -0.816 0.418 M3 0.0596382 0.0605241 0.985 0.329 M4 -0.0446391 0.0591251 -0.755 0.454 M5 0.0169784 0.0606204 0.280 0.781 M6 0.0241710 0.0587947 0.411 0.683 M7 -0.0756530 0.0589395 -1.284 0.205 M8 -0.0303723 0.0599551 -0.507 0.615 M9 -0.0095478 0.0606229 -0.157 0.875 M10 -0.0461532 0.0608884 -0.758 0.452 M11 -0.0003892 0.0609417 -0.006 0.995 t -0.0004754 0.0014293 -0.333 0.741 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 0.09522 on 50 degrees of freedom Multiple R-squared: 0.9916, Adjusted R-squared: 0.9887 F-statistic: 345.3 on 17 and 50 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.7416642938 0.516671412 0.2583357 [2,] 0.5960348914 0.807930217 0.4039651 [3,] 0.4440571051 0.888114210 0.5559429 [4,] 0.3205676377 0.641135275 0.6794324 [5,] 0.3104978709 0.620995742 0.6895021 [6,] 0.2101151021 0.420230204 0.7898849 [7,] 0.1640278794 0.328055759 0.8359721 [8,] 0.1049880316 0.209976063 0.8950120 [9,] 0.0673906417 0.134781283 0.9326094 [10,] 0.0416630941 0.083326188 0.9583369 [11,] 0.0222568890 0.044513778 0.9777431 [12,] 0.0176115951 0.035223190 0.9823884 [13,] 0.0092342053 0.018468411 0.9907658 [14,] 0.0070902134 0.014180427 0.9929098 [15,] 0.0047942124 0.009588425 0.9952058 [16,] 0.0039826896 0.007965379 0.9960173 [17,] 0.0019296501 0.003859300 0.9980703 [18,] 0.0012938496 0.002587699 0.9987062 [19,] 0.0045137117 0.009027423 0.9954863 [20,] 0.0054343667 0.010868733 0.9945656 [21,] 0.0108542905 0.021708581 0.9891457 [22,] 0.0056801989 0.011360398 0.9943198 [23,] 0.0025247135 0.005049427 0.9974753 [24,] 0.0011539380 0.002307876 0.9988461 [25,] 0.0006462639 0.001292528 0.9993537 [26,] 0.0010145078 0.002029016 0.9989855 [27,] 0.0006017256 0.001203451 0.9993983 > postscript(file="/var/www/html/rcomp/tmp/180ls1293570695.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/280ls1293570695.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/3ia3v1293570695.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/4ia3v1293570695.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/5ia3v1293570695.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 = 68 Frequency = 1 1 2 3 4 5 6 0.122426385 -0.099897664 -0.110500016 0.006889562 0.101751387 -0.018462341 7 8 9 10 11 12 0.054560300 0.025836246 0.074251519 -0.054900592 -0.047599135 -0.022565892 13 14 15 16 17 18 -0.002265752 0.074221702 -0.049319196 0.090835464 -0.159031729 0.010019061 19 20 21 22 23 24 0.054849364 -0.011625861 -0.018038834 0.036914393 -0.004235663 -0.046871231 25 26 27 28 29 30 -0.067861758 0.004550549 -0.077754597 0.025547781 -0.035047275 0.004015411 31 32 33 34 35 36 0.048620132 0.090688278 -0.069746376 0.026584188 -0.005243966 -0.079321650 37 38 39 40 41 42 -0.039328470 -0.087038286 0.137703811 -0.128330643 -0.073152168 0.056782278 43 44 45 46 47 48 0.024792916 0.046309558 0.044844198 -0.048136433 0.035182986 0.086457772 49 50 51 52 53 54 -0.135633450 0.058999739 0.078955274 -0.086879067 0.118136668 -0.070420794 55 56 57 58 59 60 0.098767707 0.077626345 -0.031310508 0.039538445 0.021895778 0.062301001 61 62 63 64 65 66 0.122663044 0.049163960 0.020914724 0.091936903 0.047343117 0.018066384 67 68 -0.281590419 -0.228834566 > postscript(file="/var/www/html/rcomp/tmp/6b1ky1293570695.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 = 68 Frequency = 1 lag(myerror, k = 1) myerror 0 0.122426385 NA 1 -0.099897664 0.122426385 2 -0.110500016 -0.099897664 3 0.006889562 -0.110500016 4 0.101751387 0.006889562 5 -0.018462341 0.101751387 6 0.054560300 -0.018462341 7 0.025836246 0.054560300 8 0.074251519 0.025836246 9 -0.054900592 0.074251519 10 -0.047599135 -0.054900592 11 -0.022565892 -0.047599135 12 -0.002265752 -0.022565892 13 0.074221702 -0.002265752 14 -0.049319196 0.074221702 15 0.090835464 -0.049319196 16 -0.159031729 0.090835464 17 0.010019061 -0.159031729 18 0.054849364 0.010019061 19 -0.011625861 0.054849364 20 -0.018038834 -0.011625861 21 0.036914393 -0.018038834 22 -0.004235663 0.036914393 23 -0.046871231 -0.004235663 24 -0.067861758 -0.046871231 25 0.004550549 -0.067861758 26 -0.077754597 0.004550549 27 0.025547781 -0.077754597 28 -0.035047275 0.025547781 29 0.004015411 -0.035047275 30 0.048620132 0.004015411 31 0.090688278 0.048620132 32 -0.069746376 0.090688278 33 0.026584188 -0.069746376 34 -0.005243966 0.026584188 35 -0.079321650 -0.005243966 36 -0.039328470 -0.079321650 37 -0.087038286 -0.039328470 38 0.137703811 -0.087038286 39 -0.128330643 0.137703811 40 -0.073152168 -0.128330643 41 0.056782278 -0.073152168 42 0.024792916 0.056782278 43 0.046309558 0.024792916 44 0.044844198 0.046309558 45 -0.048136433 0.044844198 46 0.035182986 -0.048136433 47 0.086457772 0.035182986 48 -0.135633450 0.086457772 49 0.058999739 -0.135633450 50 0.078955274 0.058999739 51 -0.086879067 0.078955274 52 0.118136668 -0.086879067 53 -0.070420794 0.118136668 54 0.098767707 -0.070420794 55 0.077626345 0.098767707 56 -0.031310508 0.077626345 57 0.039538445 -0.031310508 58 0.021895778 0.039538445 59 0.062301001 0.021895778 60 0.122663044 0.062301001 61 0.049163960 0.122663044 62 0.020914724 0.049163960 63 0.091936903 0.020914724 64 0.047343117 0.091936903 65 0.018066384 0.047343117 66 -0.281590419 0.018066384 67 -0.228834566 -0.281590419 68 NA -0.228834566 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -0.099897664 0.122426385 [2,] -0.110500016 -0.099897664 [3,] 0.006889562 -0.110500016 [4,] 0.101751387 0.006889562 [5,] -0.018462341 0.101751387 [6,] 0.054560300 -0.018462341 [7,] 0.025836246 0.054560300 [8,] 0.074251519 0.025836246 [9,] -0.054900592 0.074251519 [10,] -0.047599135 -0.054900592 [11,] -0.022565892 -0.047599135 [12,] -0.002265752 -0.022565892 [13,] 0.074221702 -0.002265752 [14,] -0.049319196 0.074221702 [15,] 0.090835464 -0.049319196 [16,] -0.159031729 0.090835464 [17,] 0.010019061 -0.159031729 [18,] 0.054849364 0.010019061 [19,] -0.011625861 0.054849364 [20,] -0.018038834 -0.011625861 [21,] 0.036914393 -0.018038834 [22,] -0.004235663 0.036914393 [23,] -0.046871231 -0.004235663 [24,] -0.067861758 -0.046871231 [25,] 0.004550549 -0.067861758 [26,] -0.077754597 0.004550549 [27,] 0.025547781 -0.077754597 [28,] -0.035047275 0.025547781 [29,] 0.004015411 -0.035047275 [30,] 0.048620132 0.004015411 [31,] 0.090688278 0.048620132 [32,] -0.069746376 0.090688278 [33,] 0.026584188 -0.069746376 [34,] -0.005243966 0.026584188 [35,] -0.079321650 -0.005243966 [36,] -0.039328470 -0.079321650 [37,] -0.087038286 -0.039328470 [38,] 0.137703811 -0.087038286 [39,] -0.128330643 0.137703811 [40,] -0.073152168 -0.128330643 [41,] 0.056782278 -0.073152168 [42,] 0.024792916 0.056782278 [43,] 0.046309558 0.024792916 [44,] 0.044844198 0.046309558 [45,] -0.048136433 0.044844198 [46,] 0.035182986 -0.048136433 [47,] 0.086457772 0.035182986 [48,] -0.135633450 0.086457772 [49,] 0.058999739 -0.135633450 [50,] 0.078955274 0.058999739 [51,] -0.086879067 0.078955274 [52,] 0.118136668 -0.086879067 [53,] -0.070420794 0.118136668 [54,] 0.098767707 -0.070420794 [55,] 0.077626345 0.098767707 [56,] -0.031310508 0.077626345 [57,] 0.039538445 -0.031310508 [58,] 0.021895778 0.039538445 [59,] 0.062301001 0.021895778 [60,] 0.122663044 0.062301001 [61,] 0.049163960 0.122663044 [62,] 0.020914724 0.049163960 [63,] 0.091936903 0.020914724 [64,] 0.047343117 0.091936903 [65,] 0.018066384 0.047343117 [66,] -0.281590419 0.018066384 [67,] -0.228834566 -0.281590419 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -0.099897664 0.122426385 2 -0.110500016 -0.099897664 3 0.006889562 -0.110500016 4 0.101751387 0.006889562 5 -0.018462341 0.101751387 6 0.054560300 -0.018462341 7 0.025836246 0.054560300 8 0.074251519 0.025836246 9 -0.054900592 0.074251519 10 -0.047599135 -0.054900592 11 -0.022565892 -0.047599135 12 -0.002265752 -0.022565892 13 0.074221702 -0.002265752 14 -0.049319196 0.074221702 15 0.090835464 -0.049319196 16 -0.159031729 0.090835464 17 0.010019061 -0.159031729 18 0.054849364 0.010019061 19 -0.011625861 0.054849364 20 -0.018038834 -0.011625861 21 0.036914393 -0.018038834 22 -0.004235663 0.036914393 23 -0.046871231 -0.004235663 24 -0.067861758 -0.046871231 25 0.004550549 -0.067861758 26 -0.077754597 0.004550549 27 0.025547781 -0.077754597 28 -0.035047275 0.025547781 29 0.004015411 -0.035047275 30 0.048620132 0.004015411 31 0.090688278 0.048620132 32 -0.069746376 0.090688278 33 0.026584188 -0.069746376 34 -0.005243966 0.026584188 35 -0.079321650 -0.005243966 36 -0.039328470 -0.079321650 37 -0.087038286 -0.039328470 38 0.137703811 -0.087038286 39 -0.128330643 0.137703811 40 -0.073152168 -0.128330643 41 0.056782278 -0.073152168 42 0.024792916 0.056782278 43 0.046309558 0.024792916 44 0.044844198 0.046309558 45 -0.048136433 0.044844198 46 0.035182986 -0.048136433 47 0.086457772 0.035182986 48 -0.135633450 0.086457772 49 0.058999739 -0.135633450 50 0.078955274 0.058999739 51 -0.086879067 0.078955274 52 0.118136668 -0.086879067 53 -0.070420794 0.118136668 54 0.098767707 -0.070420794 55 0.077626345 0.098767707 56 -0.031310508 0.077626345 57 0.039538445 -0.031310508 58 0.021895778 0.039538445 59 0.062301001 0.021895778 60 0.122663044 0.062301001 61 0.049163960 0.122663044 62 0.020914724 0.049163960 63 0.091936903 0.020914724 64 0.047343117 0.091936903 65 0.018066384 0.047343117 66 -0.281590419 0.018066384 67 -0.228834566 -0.281590419 > 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/7ma111293570695.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/8ma111293570695.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/9ma111293570695.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/10e1141293570695.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/11au251293570696.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/123l1q1293570696.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/13a4y11293570696.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/14kvfm1293570696.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/15owea1293570696.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/1626bj1293570696.tab") + } > > try(system("convert tmp/180ls1293570695.ps tmp/180ls1293570695.png",intern=TRUE)) character(0) > try(system("convert tmp/280ls1293570695.ps tmp/280ls1293570695.png",intern=TRUE)) character(0) > try(system("convert tmp/3ia3v1293570695.ps tmp/3ia3v1293570695.png",intern=TRUE)) character(0) > try(system("convert tmp/4ia3v1293570695.ps tmp/4ia3v1293570695.png",intern=TRUE)) character(0) > try(system("convert tmp/5ia3v1293570695.ps tmp/5ia3v1293570695.png",intern=TRUE)) character(0) > try(system("convert tmp/6b1ky1293570695.ps tmp/6b1ky1293570695.png",intern=TRUE)) character(0) > try(system("convert tmp/7ma111293570695.ps tmp/7ma111293570695.png",intern=TRUE)) character(0) > try(system("convert tmp/8ma111293570695.ps tmp/8ma111293570695.png",intern=TRUE)) character(0) > try(system("convert tmp/9ma111293570695.ps tmp/9ma111293570695.png",intern=TRUE)) character(0) > try(system("convert tmp/10e1141293570695.ps tmp/10e1141293570695.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.526 1.640 8.229