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(26105 + ,29462 + ,27071 + ,31514 + ,22397 + ,26105 + ,29462 + ,27071 + ,23843 + ,22397 + ,26105 + ,29462 + ,21705 + ,23843 + ,22397 + ,26105 + ,18089 + ,21705 + ,23843 + ,22397 + ,20764 + ,18089 + ,21705 + ,23843 + ,25316 + ,20764 + ,18089 + ,21705 + ,17704 + ,25316 + ,20764 + ,18089 + ,15548 + ,17704 + ,25316 + ,20764 + ,28029 + ,15548 + ,17704 + ,25316 + ,29383 + ,28029 + ,15548 + ,17704 + ,36438 + ,29383 + ,28029 + ,15548 + ,32034 + ,36438 + ,29383 + ,28029 + ,22679 + ,32034 + ,36438 + ,29383 + ,24319 + ,22679 + ,32034 + ,36438 + ,18004 + ,24319 + ,22679 + ,32034 + ,17537 + ,18004 + ,24319 + ,22679 + ,20366 + ,17537 + ,18004 + ,24319 + ,22782 + ,20366 + ,17537 + ,18004 + ,19169 + ,22782 + ,20366 + ,17537 + ,13807 + ,19169 + ,22782 + ,20366 + ,29743 + ,13807 + ,19169 + ,22782 + ,25591 + ,29743 + ,13807 + ,19169 + ,29096 + ,25591 + ,29743 + ,13807 + ,26482 + ,29096 + ,25591 + ,29743 + ,22405 + ,26482 + ,29096 + ,25591 + ,27044 + ,22405 + ,26482 + ,29096 + ,17970 + ,27044 + ,22405 + ,26482 + ,18730 + ,17970 + ,27044 + ,22405 + ,19684 + ,18730 + ,17970 + ,27044 + ,19785 + ,19684 + ,18730 + ,17970 + ,18479 + ,19785 + ,19684 + ,18730 + ,10698 + ,18479 + ,19785 + ,19684 + ,31956 + ,10698 + ,18479 + ,19785 + ,29506 + ,31956 + ,10698 + ,18479 + ,34506 + ,29506 + ,31956 + ,10698 + ,27165 + ,34506 + ,29506 + ,31956 + ,26736 + ,27165 + ,34506 + ,29506 + ,23691 + ,26736 + ,27165 + ,34506 + ,18157 + ,23691 + ,26736 + ,27165 + ,17328 + ,18157 + ,23691 + ,26736 + ,18205 + ,17328 + ,18157 + ,23691 + ,20995 + ,18205 + ,17328 + ,18157 + ,17382 + ,20995 + ,18205 + ,17328 + ,9367 + ,17382 + ,20995 + ,18205 + ,31124 + ,9367 + ,17382 + ,20995 + ,26551 + ,31124 + ,9367 + ,17382 + ,30651 + ,26551 + ,31124 + ,9367 + ,25859 + ,30651 + ,26551 + ,31124 + ,25100 + ,25859 + ,30651 + ,26551 + ,25778 + ,25100 + ,25859 + ,30651 + ,20418 + ,25778 + ,25100 + ,25859 + ,18688 + ,20418 + ,25778 + ,25100 + ,20424 + ,18688 + ,20418 + ,25778 + ,24776 + ,20424 + ,18688 + ,20418 + ,19814 + ,24776 + ,20424 + ,18688 + ,12738 + ,19814 + ,24776 + ,20424 + ,31566 + ,12738 + ,19814 + ,24776 + ,30111 + ,31566 + ,12738 + ,19814 + ,30019 + ,30111 + ,31566 + ,12738 + ,31934 + ,30019 + ,30111 + ,31566 + ,25826 + ,31934 + ,30019 + ,30111 + ,26835 + ,25826 + ,31934 + ,30019 + ,20205 + ,26835 + ,25826 + ,31934 + ,17789 + ,20205 + ,26835 + ,25826 + ,20520 + ,17789 + ,20205 + ,26835 + ,22518 + ,20520 + ,17789 + ,20205 + ,15572 + ,22518 + ,20520 + ,17789 + ,11509 + ,15572 + ,22518 + ,20520 + ,25447 + ,11509 + ,15572 + ,22518 + ,24090 + ,25447 + ,11509 + ,15572 + ,27786 + ,24090 + ,25447 + ,11509 + ,26195 + ,27786 + ,24090 + ,25447 + ,20516 + ,26195 + ,27786 + ,24090 + ,22759 + ,20516 + ,26195 + ,27786 + ,19028 + ,22759 + ,20516 + ,26195 + ,16971 + ,19028 + ,22759 + ,20516 + ,20036 + ,16971 + ,19028 + ,22759 + ,22485 + ,20036 + ,16971 + ,19028 + ,18730 + ,22485 + ,20036 + ,16971 + ,14538 + ,18730 + ,22485 + ,20036 + ,27561 + ,14538 + ,18730 + ,22485 + ,25985 + ,27561 + ,14538 + ,18730 + ,34670 + ,25985 + ,27561 + ,14538 + ,32066 + ,34670 + ,25985 + ,27561 + ,27186 + ,32066 + ,34670 + ,25985 + ,29586 + ,27186 + ,32066 + ,34670 + ,21359 + ,29586 + ,27186 + ,32066 + ,21553 + ,21359 + ,29586 + ,27186 + ,19573 + ,21553 + ,21359 + ,29586 + ,24256 + ,19573 + ,21553 + ,21359) + ,dim=c(4 + ,91) + ,dimnames=list(c('X' + ,'Y_1' + ,'Y_2' + ,'Y_3') + ,1:91)) > y <- array(NA,dim=c(4,91),dimnames=list(c('X','Y_1','Y_2','Y_3'),1:91)) > for (i in 1:dim(x)[1]) + { + for (j in 1:dim(x)[2]) + { + y[i,j] <- as.numeric(x[i,j]) + } + } > par3 = 'No 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 X Y_1 Y_2 Y_3 M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 1 26105 29462 27071 31514 1 0 0 0 0 0 0 0 0 0 0 2 22397 26105 29462 27071 0 1 0 0 0 0 0 0 0 0 0 3 23843 22397 26105 29462 0 0 1 0 0 0 0 0 0 0 0 4 21705 23843 22397 26105 0 0 0 1 0 0 0 0 0 0 0 5 18089 21705 23843 22397 0 0 0 0 1 0 0 0 0 0 0 6 20764 18089 21705 23843 0 0 0 0 0 1 0 0 0 0 0 7 25316 20764 18089 21705 0 0 0 0 0 0 1 0 0 0 0 8 17704 25316 20764 18089 0 0 0 0 0 0 0 1 0 0 0 9 15548 17704 25316 20764 0 0 0 0 0 0 0 0 1 0 0 10 28029 15548 17704 25316 0 0 0 0 0 0 0 0 0 1 0 11 29383 28029 15548 17704 0 0 0 0 0 0 0 0 0 0 1 12 36438 29383 28029 15548 0 0 0 0 0 0 0 0 0 0 0 13 32034 36438 29383 28029 1 0 0 0 0 0 0 0 0 0 0 14 22679 32034 36438 29383 0 1 0 0 0 0 0 0 0 0 0 15 24319 22679 32034 36438 0 0 1 0 0 0 0 0 0 0 0 16 18004 24319 22679 32034 0 0 0 1 0 0 0 0 0 0 0 17 17537 18004 24319 22679 0 0 0 0 1 0 0 0 0 0 0 18 20366 17537 18004 24319 0 0 0 0 0 1 0 0 0 0 0 19 22782 20366 17537 18004 0 0 0 0 0 0 1 0 0 0 0 20 19169 22782 20366 17537 0 0 0 0 0 0 0 1 0 0 0 21 13807 19169 22782 20366 0 0 0 0 0 0 0 0 1 0 0 22 29743 13807 19169 22782 0 0 0 0 0 0 0 0 0 1 0 23 25591 29743 13807 19169 0 0 0 0 0 0 0 0 0 0 1 24 29096 25591 29743 13807 0 0 0 0 0 0 0 0 0 0 0 25 26482 29096 25591 29743 1 0 0 0 0 0 0 0 0 0 0 26 22405 26482 29096 25591 0 1 0 0 0 0 0 0 0 0 0 27 27044 22405 26482 29096 0 0 1 0 0 0 0 0 0 0 0 28 17970 27044 22405 26482 0 0 0 1 0 0 0 0 0 0 0 29 18730 17970 27044 22405 0 0 0 0 1 0 0 0 0 0 0 30 19684 18730 17970 27044 0 0 0 0 0 1 0 0 0 0 0 31 19785 19684 18730 17970 0 0 0 0 0 0 1 0 0 0 0 32 18479 19785 19684 18730 0 0 0 0 0 0 0 1 0 0 0 33 10698 18479 19785 19684 0 0 0 0 0 0 0 0 1 0 0 34 31956 10698 18479 19785 0 0 0 0 0 0 0 0 0 1 0 35 29506 31956 10698 18479 0 0 0 0 0 0 0 0 0 0 1 36 34506 29506 31956 10698 0 0 0 0 0 0 0 0 0 0 0 37 27165 34506 29506 31956 1 0 0 0 0 0 0 0 0 0 0 38 26736 27165 34506 29506 0 1 0 0 0 0 0 0 0 0 0 39 23691 26736 27165 34506 0 0 1 0 0 0 0 0 0 0 0 40 18157 23691 26736 27165 0 0 0 1 0 0 0 0 0 0 0 41 17328 18157 23691 26736 0 0 0 0 1 0 0 0 0 0 0 42 18205 17328 18157 23691 0 0 0 0 0 1 0 0 0 0 0 43 20995 18205 17328 18157 0 0 0 0 0 0 1 0 0 0 0 44 17382 20995 18205 17328 0 0 0 0 0 0 0 1 0 0 0 45 9367 17382 20995 18205 0 0 0 0 0 0 0 0 1 0 0 46 31124 9367 17382 20995 0 0 0 0 0 0 0 0 0 1 0 47 26551 31124 9367 17382 0 0 0 0 0 0 0 0 0 0 1 48 30651 26551 31124 9367 0 0 0 0 0 0 0 0 0 0 0 49 25859 30651 26551 31124 1 0 0 0 0 0 0 0 0 0 0 50 25100 25859 30651 26551 0 1 0 0 0 0 0 0 0 0 0 51 25778 25100 25859 30651 0 0 1 0 0 0 0 0 0 0 0 52 20418 25778 25100 25859 0 0 0 1 0 0 0 0 0 0 0 53 18688 20418 25778 25100 0 0 0 0 1 0 0 0 0 0 0 54 20424 18688 20418 25778 0 0 0 0 0 1 0 0 0 0 0 55 24776 20424 18688 20418 0 0 0 0 0 0 1 0 0 0 0 56 19814 24776 20424 18688 0 0 0 0 0 0 0 1 0 0 0 57 12738 19814 24776 20424 0 0 0 0 0 0 0 0 1 0 0 58 31566 12738 19814 24776 0 0 0 0 0 0 0 0 0 1 0 59 30111 31566 12738 19814 0 0 0 0 0 0 0 0 0 0 1 60 30019 30111 31566 12738 0 0 0 0 0 0 0 0 0 0 0 61 31934 30019 30111 31566 1 0 0 0 0 0 0 0 0 0 0 62 25826 31934 30019 30111 0 1 0 0 0 0 0 0 0 0 0 63 26835 25826 31934 30019 0 0 1 0 0 0 0 0 0 0 0 64 20205 26835 25826 31934 0 0 0 1 0 0 0 0 0 0 0 65 17789 20205 26835 25826 0 0 0 0 1 0 0 0 0 0 0 66 20520 17789 20205 26835 0 0 0 0 0 1 0 0 0 0 0 67 22518 20520 17789 20205 0 0 0 0 0 0 1 0 0 0 0 68 15572 22518 20520 17789 0 0 0 0 0 0 0 1 0 0 0 69 11509 15572 22518 20520 0 0 0 0 0 0 0 0 1 0 0 70 25447 11509 15572 22518 0 0 0 0 0 0 0 0 0 1 0 71 24090 25447 11509 15572 0 0 0 0 0 0 0 0 0 0 1 72 27786 24090 25447 11509 0 0 0 0 0 0 0 0 0 0 0 73 26195 27786 24090 25447 1 0 0 0 0 0 0 0 0 0 0 74 20516 26195 27786 24090 0 1 0 0 0 0 0 0 0 0 0 75 22759 20516 26195 27786 0 0 1 0 0 0 0 0 0 0 0 76 19028 22759 20516 26195 0 0 0 1 0 0 0 0 0 0 0 77 16971 19028 22759 20516 0 0 0 0 1 0 0 0 0 0 0 78 20036 16971 19028 22759 0 0 0 0 0 1 0 0 0 0 0 79 22485 20036 16971 19028 0 0 0 0 0 0 1 0 0 0 0 80 18730 22485 20036 16971 0 0 0 0 0 0 0 1 0 0 0 81 14538 18730 22485 20036 0 0 0 0 0 0 0 0 1 0 0 82 27561 14538 18730 22485 0 0 0 0 0 0 0 0 0 1 0 83 25985 27561 14538 18730 0 0 0 0 0 0 0 0 0 0 1 84 34670 25985 27561 14538 0 0 0 0 0 0 0 0 0 0 0 85 32066 34670 25985 27561 1 0 0 0 0 0 0 0 0 0 0 86 27186 32066 34670 25985 0 1 0 0 0 0 0 0 0 0 0 87 29586 27186 32066 34670 0 0 1 0 0 0 0 0 0 0 0 88 21359 29586 27186 32066 0 0 0 1 0 0 0 0 0 0 0 89 21553 21359 29586 27186 0 0 0 0 1 0 0 0 0 0 0 90 19573 21553 21359 29586 0 0 0 0 0 1 0 0 0 0 0 91 24256 19573 21553 21359 0 0 0 0 0 0 1 0 0 0 0 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) Y_1 Y_2 Y_3 M1 M2 1.553e+04 2.832e-01 2.990e-01 -1.238e-02 -3.781e+03 -8.590e+03 M3 M4 M5 M6 M7 M8 -4.996e+03 -9.992e+03 -1.006e+04 -6.320e+03 -3.551e+03 -9.583e+03 M9 M10 M11 -1.459e+04 5.113e+03 -6.432e+01 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -3859.83 -1395.78 -29.41 1240.82 4402.42 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 1.553e+04 3.489e+03 4.450 2.89e-05 *** Y_1 2.832e-01 1.133e-01 2.500 0.0146 * Y_2 2.989e-01 1.145e-01 2.611 0.0109 * Y_3 -1.238e-02 1.148e-01 -0.108 0.9144 M1 -3.781e+03 2.226e+03 -1.699 0.0934 . M2 -8.590e+03 1.880e+03 -4.569 1.86e-05 *** M3 -4.996e+03 2.535e+03 -1.971 0.0524 . M4 -9.992e+03 2.349e+03 -4.254 5.92e-05 *** M5 -1.006e+04 2.109e+03 -4.773 8.62e-06 *** M6 -6.320e+03 2.569e+03 -2.460 0.0162 * M7 -3.551e+03 2.072e+03 -1.714 0.0906 . M8 -9.583e+03 1.758e+03 -5.450 6.00e-07 *** M9 -1.459e+04 1.965e+03 -7.425 1.38e-10 *** M10 5.113e+03 2.740e+03 1.866 0.0659 . M11 -6.432e+01 2.471e+03 -0.026 0.9793 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 1936 on 76 degrees of freedom Multiple R-squared: 0.9018, Adjusted R-squared: 0.8837 F-statistic: 49.83 on 14 and 76 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.4413964 0.8827928 0.5586036 [2,] 0.6003181 0.7993639 0.3996819 [3,] 0.5370868 0.9258264 0.4629132 [4,] 0.4480980 0.8961960 0.5519020 [5,] 0.3320484 0.6640969 0.6679516 [6,] 0.3439633 0.6879266 0.6560367 [7,] 0.8405881 0.3188238 0.1594119 [8,] 0.7796710 0.4406579 0.2203290 [9,] 0.7118240 0.5763520 0.2881760 [10,] 0.7021037 0.5957926 0.2978963 [11,] 0.7626908 0.4746184 0.2373092 [12,] 0.7024697 0.5950606 0.2975303 [13,] 0.6252950 0.7494100 0.3747050 [14,] 0.7611307 0.4777385 0.2388693 [15,] 0.7222378 0.5555245 0.2777622 [16,] 0.7433744 0.5132512 0.2566256 [17,] 0.7753996 0.4492009 0.2246004 [18,] 0.7706304 0.4587393 0.2293696 [19,] 0.7315575 0.5368849 0.2684425 [20,] 0.7652935 0.4694129 0.2347065 [21,] 0.8227942 0.3544116 0.1772058 [22,] 0.8215281 0.3569438 0.1784719 [23,] 0.8062816 0.3874369 0.1937184 [24,] 0.7548370 0.4903260 0.2451630 [25,] 0.7190788 0.5618425 0.2809212 [26,] 0.6748340 0.6503320 0.3251660 [27,] 0.6108535 0.7782929 0.3891465 [28,] 0.6654629 0.6690742 0.3345371 [29,] 0.7526801 0.4946399 0.2473199 [30,] 0.6965991 0.6068018 0.3034009 [31,] 0.6880488 0.6239025 0.3119512 [32,] 0.7964047 0.4071906 0.2035953 [33,] 0.7896682 0.4206637 0.2103318 [34,] 0.7363062 0.5273877 0.2636938 [35,] 0.6943882 0.6112236 0.3056118 [36,] 0.6268383 0.7463234 0.3731617 [37,] 0.5565618 0.8868764 0.4434382 [38,] 0.5349614 0.9300771 0.4650386 [39,] 0.4825849 0.9651697 0.5174151 [40,] 0.4300286 0.8600573 0.5699714 [41,] 0.5206752 0.9586495 0.4793248 [42,] 0.5368038 0.9263923 0.4631962 [43,] 0.7499182 0.5001637 0.2500818 [44,] 0.7674375 0.4651250 0.2325625 [45,] 0.7325663 0.5348674 0.2674337 [46,] 0.7089307 0.5821386 0.2910693 [47,] 0.6304946 0.7390108 0.3695054 [48,] 0.5653643 0.8692714 0.4346357 [49,] 0.5081880 0.9836240 0.4918120 [50,] 0.4092119 0.8184238 0.5907881 [51,] 0.4551295 0.9102590 0.5448705 [52,] 0.3667685 0.7335369 0.6332315 [53,] 0.3188322 0.6376643 0.6811678 [54,] 0.2324797 0.4649594 0.7675203 [55,] 0.5454498 0.9091004 0.4545502 [56,] 0.5034923 0.9930155 0.4965077 > postscript(file="/var/www/html/rcomp/tmp/1e29o1292181853.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/2e29o1292181853.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/3e29o1292181853.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/47c8r1292181853.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/57c8r1292181853.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 = 91 Frequency = 1 1 2 3 4 5 6 -1687.897175 -406.010034 -471.230881 3044.725238 -372.291630 239.459959 7 8 9 10 11 12 2320.108445 -1393.850152 2282.511419 -1994.547239 1553.114053 4402.418995 13 14 15 16 17 18 1531.330555 -3859.827227 -1761.190905 -801.940696 -15.071546 1110.098960 19 20 21 22 23 24 17.998222 900.862259 879.282267 -256.892025 -2185.623484 -2399.752701 25 26 27 28 29 30 -786.736057 -413.679279 2610.264907 -1594.439813 369.511418 134.184924 31 32 33 34 35 36 -3142.950581 1278.199506 -1146.806498 3005.659410 2023.615139 1201.526365 37 38 39 40 41 42 -2778.711369 2155.054682 -2106.348521 -1744.268471 -29.407926 -1045.235333 43 44 45 46 47 48 -1092.684598 263.348233 -2547.216271 2893.504170 -311.461061 -1584.446194 49 50 51 52 53 54 -2119.965723 2004.753671 786.616205 398.660795 46.153617 138.557841 55 56 57 58 59 60 1681.374569 978.127430 -967.762781 1700.691705 2145.719705 -3314.936726 61 62 63 64 65 66 3075.196257 1243.496591 -185.945673 -255.457371 -1099.533756 565.900250 67 68 69 70 71 72 -337.687955 -2664.297601 -319.306643 -2830.085981 -1827.655417 -2028.858687 73 74 75 76 77 78 -307.251927 -1848.367324 -1070.242208 1238.135122 -431.461939 614.925754 79 80 81 82 83 84 -3.663534 637.610326 1819.298505 -2518.330039 -1397.708934 3724.048947 85 86 87 88 89 90 3074.035438 1124.578919 2198.077076 -285.414802 1532.101762 -1757.892355 91 557.505432 > postscript(file="/var/www/html/rcomp/tmp/67c8r1292181853.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 = 91 Frequency = 1 lag(myerror, k = 1) myerror 0 -1687.897175 NA 1 -406.010034 -1687.897175 2 -471.230881 -406.010034 3 3044.725238 -471.230881 4 -372.291630 3044.725238 5 239.459959 -372.291630 6 2320.108445 239.459959 7 -1393.850152 2320.108445 8 2282.511419 -1393.850152 9 -1994.547239 2282.511419 10 1553.114053 -1994.547239 11 4402.418995 1553.114053 12 1531.330555 4402.418995 13 -3859.827227 1531.330555 14 -1761.190905 -3859.827227 15 -801.940696 -1761.190905 16 -15.071546 -801.940696 17 1110.098960 -15.071546 18 17.998222 1110.098960 19 900.862259 17.998222 20 879.282267 900.862259 21 -256.892025 879.282267 22 -2185.623484 -256.892025 23 -2399.752701 -2185.623484 24 -786.736057 -2399.752701 25 -413.679279 -786.736057 26 2610.264907 -413.679279 27 -1594.439813 2610.264907 28 369.511418 -1594.439813 29 134.184924 369.511418 30 -3142.950581 134.184924 31 1278.199506 -3142.950581 32 -1146.806498 1278.199506 33 3005.659410 -1146.806498 34 2023.615139 3005.659410 35 1201.526365 2023.615139 36 -2778.711369 1201.526365 37 2155.054682 -2778.711369 38 -2106.348521 2155.054682 39 -1744.268471 -2106.348521 40 -29.407926 -1744.268471 41 -1045.235333 -29.407926 42 -1092.684598 -1045.235333 43 263.348233 -1092.684598 44 -2547.216271 263.348233 45 2893.504170 -2547.216271 46 -311.461061 2893.504170 47 -1584.446194 -311.461061 48 -2119.965723 -1584.446194 49 2004.753671 -2119.965723 50 786.616205 2004.753671 51 398.660795 786.616205 52 46.153617 398.660795 53 138.557841 46.153617 54 1681.374569 138.557841 55 978.127430 1681.374569 56 -967.762781 978.127430 57 1700.691705 -967.762781 58 2145.719705 1700.691705 59 -3314.936726 2145.719705 60 3075.196257 -3314.936726 61 1243.496591 3075.196257 62 -185.945673 1243.496591 63 -255.457371 -185.945673 64 -1099.533756 -255.457371 65 565.900250 -1099.533756 66 -337.687955 565.900250 67 -2664.297601 -337.687955 68 -319.306643 -2664.297601 69 -2830.085981 -319.306643 70 -1827.655417 -2830.085981 71 -2028.858687 -1827.655417 72 -307.251927 -2028.858687 73 -1848.367324 -307.251927 74 -1070.242208 -1848.367324 75 1238.135122 -1070.242208 76 -431.461939 1238.135122 77 614.925754 -431.461939 78 -3.663534 614.925754 79 637.610326 -3.663534 80 1819.298505 637.610326 81 -2518.330039 1819.298505 82 -1397.708934 -2518.330039 83 3724.048947 -1397.708934 84 3074.035438 3724.048947 85 1124.578919 3074.035438 86 2198.077076 1124.578919 87 -285.414802 2198.077076 88 1532.101762 -285.414802 89 -1757.892355 1532.101762 90 557.505432 -1757.892355 91 NA 557.505432 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -406.010034 -1687.897175 [2,] -471.230881 -406.010034 [3,] 3044.725238 -471.230881 [4,] -372.291630 3044.725238 [5,] 239.459959 -372.291630 [6,] 2320.108445 239.459959 [7,] -1393.850152 2320.108445 [8,] 2282.511419 -1393.850152 [9,] -1994.547239 2282.511419 [10,] 1553.114053 -1994.547239 [11,] 4402.418995 1553.114053 [12,] 1531.330555 4402.418995 [13,] -3859.827227 1531.330555 [14,] -1761.190905 -3859.827227 [15,] -801.940696 -1761.190905 [16,] -15.071546 -801.940696 [17,] 1110.098960 -15.071546 [18,] 17.998222 1110.098960 [19,] 900.862259 17.998222 [20,] 879.282267 900.862259 [21,] -256.892025 879.282267 [22,] -2185.623484 -256.892025 [23,] -2399.752701 -2185.623484 [24,] -786.736057 -2399.752701 [25,] -413.679279 -786.736057 [26,] 2610.264907 -413.679279 [27,] -1594.439813 2610.264907 [28,] 369.511418 -1594.439813 [29,] 134.184924 369.511418 [30,] -3142.950581 134.184924 [31,] 1278.199506 -3142.950581 [32,] -1146.806498 1278.199506 [33,] 3005.659410 -1146.806498 [34,] 2023.615139 3005.659410 [35,] 1201.526365 2023.615139 [36,] -2778.711369 1201.526365 [37,] 2155.054682 -2778.711369 [38,] -2106.348521 2155.054682 [39,] -1744.268471 -2106.348521 [40,] -29.407926 -1744.268471 [41,] -1045.235333 -29.407926 [42,] -1092.684598 -1045.235333 [43,] 263.348233 -1092.684598 [44,] -2547.216271 263.348233 [45,] 2893.504170 -2547.216271 [46,] -311.461061 2893.504170 [47,] -1584.446194 -311.461061 [48,] -2119.965723 -1584.446194 [49,] 2004.753671 -2119.965723 [50,] 786.616205 2004.753671 [51,] 398.660795 786.616205 [52,] 46.153617 398.660795 [53,] 138.557841 46.153617 [54,] 1681.374569 138.557841 [55,] 978.127430 1681.374569 [56,] -967.762781 978.127430 [57,] 1700.691705 -967.762781 [58,] 2145.719705 1700.691705 [59,] -3314.936726 2145.719705 [60,] 3075.196257 -3314.936726 [61,] 1243.496591 3075.196257 [62,] -185.945673 1243.496591 [63,] -255.457371 -185.945673 [64,] -1099.533756 -255.457371 [65,] 565.900250 -1099.533756 [66,] -337.687955 565.900250 [67,] -2664.297601 -337.687955 [68,] -319.306643 -2664.297601 [69,] -2830.085981 -319.306643 [70,] -1827.655417 -2830.085981 [71,] -2028.858687 -1827.655417 [72,] -307.251927 -2028.858687 [73,] -1848.367324 -307.251927 [74,] -1070.242208 -1848.367324 [75,] 1238.135122 -1070.242208 [76,] -431.461939 1238.135122 [77,] 614.925754 -431.461939 [78,] -3.663534 614.925754 [79,] 637.610326 -3.663534 [80,] 1819.298505 637.610326 [81,] -2518.330039 1819.298505 [82,] -1397.708934 -2518.330039 [83,] 3724.048947 -1397.708934 [84,] 3074.035438 3724.048947 [85,] 1124.578919 3074.035438 [86,] 2198.077076 1124.578919 [87,] -285.414802 2198.077076 [88,] 1532.101762 -285.414802 [89,] -1757.892355 1532.101762 [90,] 557.505432 -1757.892355 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -406.010034 -1687.897175 2 -471.230881 -406.010034 3 3044.725238 -471.230881 4 -372.291630 3044.725238 5 239.459959 -372.291630 6 2320.108445 239.459959 7 -1393.850152 2320.108445 8 2282.511419 -1393.850152 9 -1994.547239 2282.511419 10 1553.114053 -1994.547239 11 4402.418995 1553.114053 12 1531.330555 4402.418995 13 -3859.827227 1531.330555 14 -1761.190905 -3859.827227 15 -801.940696 -1761.190905 16 -15.071546 -801.940696 17 1110.098960 -15.071546 18 17.998222 1110.098960 19 900.862259 17.998222 20 879.282267 900.862259 21 -256.892025 879.282267 22 -2185.623484 -256.892025 23 -2399.752701 -2185.623484 24 -786.736057 -2399.752701 25 -413.679279 -786.736057 26 2610.264907 -413.679279 27 -1594.439813 2610.264907 28 369.511418 -1594.439813 29 134.184924 369.511418 30 -3142.950581 134.184924 31 1278.199506 -3142.950581 32 -1146.806498 1278.199506 33 3005.659410 -1146.806498 34 2023.615139 3005.659410 35 1201.526365 2023.615139 36 -2778.711369 1201.526365 37 2155.054682 -2778.711369 38 -2106.348521 2155.054682 39 -1744.268471 -2106.348521 40 -29.407926 -1744.268471 41 -1045.235333 -29.407926 42 -1092.684598 -1045.235333 43 263.348233 -1092.684598 44 -2547.216271 263.348233 45 2893.504170 -2547.216271 46 -311.461061 2893.504170 47 -1584.446194 -311.461061 48 -2119.965723 -1584.446194 49 2004.753671 -2119.965723 50 786.616205 2004.753671 51 398.660795 786.616205 52 46.153617 398.660795 53 138.557841 46.153617 54 1681.374569 138.557841 55 978.127430 1681.374569 56 -967.762781 978.127430 57 1700.691705 -967.762781 58 2145.719705 1700.691705 59 -3314.936726 2145.719705 60 3075.196257 -3314.936726 61 1243.496591 3075.196257 62 -185.945673 1243.496591 63 -255.457371 -185.945673 64 -1099.533756 -255.457371 65 565.900250 -1099.533756 66 -337.687955 565.900250 67 -2664.297601 -337.687955 68 -319.306643 -2664.297601 69 -2830.085981 -319.306643 70 -1827.655417 -2830.085981 71 -2028.858687 -1827.655417 72 -307.251927 -2028.858687 73 -1848.367324 -307.251927 74 -1070.242208 -1848.367324 75 1238.135122 -1070.242208 76 -431.461939 1238.135122 77 614.925754 -431.461939 78 -3.663534 614.925754 79 637.610326 -3.663534 80 1819.298505 637.610326 81 -2518.330039 1819.298505 82 -1397.708934 -2518.330039 83 3724.048947 -1397.708934 84 3074.035438 3724.048947 85 1124.578919 3074.035438 86 2198.077076 1124.578919 87 -285.414802 2198.077076 88 1532.101762 -285.414802 89 -1757.892355 1532.101762 90 557.505432 -1757.892355 > 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/7z37u1292181853.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/8ad7f1292181853.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/9ad7f1292181853.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/10ad7f1292181853.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/11ommn1292181853.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/12zv381292181853.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/135wjk1292181853.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/14goi51292181853.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/15ug1o1292181854.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/16qqzf1292181854.tab") + } > > try(system("convert tmp/1e29o1292181853.ps tmp/1e29o1292181853.png",intern=TRUE)) character(0) > try(system("convert tmp/2e29o1292181853.ps tmp/2e29o1292181853.png",intern=TRUE)) character(0) > try(system("convert tmp/3e29o1292181853.ps tmp/3e29o1292181853.png",intern=TRUE)) character(0) > try(system("convert tmp/47c8r1292181853.ps tmp/47c8r1292181853.png",intern=TRUE)) character(0) > try(system("convert tmp/57c8r1292181853.ps tmp/57c8r1292181853.png",intern=TRUE)) character(0) > try(system("convert tmp/67c8r1292181853.ps tmp/67c8r1292181853.png",intern=TRUE)) character(0) > try(system("convert tmp/7z37u1292181853.ps tmp/7z37u1292181853.png",intern=TRUE)) character(0) > try(system("convert tmp/8ad7f1292181853.ps tmp/8ad7f1292181853.png",intern=TRUE)) character(0) > try(system("convert tmp/9ad7f1292181853.ps tmp/9ad7f1292181853.png",intern=TRUE)) character(0) > try(system("convert tmp/10ad7f1292181853.ps tmp/10ad7f1292181853.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.978 1.689 7.054