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(9283 + ,4359 + ,8947 + ,9627 + ,8700 + ,9487 + ,8829 + ,5382 + ,9283 + ,8947 + ,9627 + ,8700 + ,9947 + ,4459 + ,8829 + ,9283 + ,8947 + ,9627 + ,9628 + ,6398 + ,9947 + ,8829 + ,9283 + ,8947 + ,9318 + ,4596 + ,9628 + ,9947 + ,8829 + ,9283 + ,9605 + ,3024 + ,9318 + ,9628 + ,9947 + ,8829 + ,8640 + ,1887 + ,9605 + ,9318 + ,9628 + ,9947 + ,9214 + ,2070 + ,8640 + ,9605 + ,9318 + ,9628 + ,9567 + ,1351 + ,9214 + ,8640 + ,9605 + ,9318 + ,8547 + ,2218 + ,9567 + ,9214 + ,8640 + ,9605 + ,9185 + ,2461 + ,8547 + ,9567 + ,9214 + ,8640 + ,9470 + ,3028 + ,9185 + ,8547 + ,9567 + ,9214 + ,9123 + ,4784 + ,9470 + ,9185 + ,8547 + ,9567 + ,9278 + ,4975 + ,9123 + ,9470 + ,9185 + ,8547 + ,10170 + ,4607 + ,9278 + ,9123 + ,9470 + ,9185 + ,9434 + ,6249 + ,10170 + ,9278 + ,9123 + ,9470 + ,9655 + ,4809 + ,9434 + ,10170 + ,9278 + ,9123 + ,9429 + ,3157 + ,9655 + ,9434 + ,10170 + ,9278 + ,8739 + ,1910 + ,9429 + ,9655 + ,9434 + ,10170 + ,9552 + ,2228 + ,8739 + ,9429 + ,9655 + ,9434 + ,9784 + ,1594 + ,9552 + ,8739 + ,9429 + ,9655 + ,9089 + ,2467 + ,9784 + ,9552 + ,8739 + ,9429 + ,9763 + ,2222 + ,9089 + ,9784 + ,9552 + ,8739 + ,9330 + ,3607 + ,9763 + ,9089 + ,9784 + ,9552 + ,9144 + ,4685 + ,9330 + ,9763 + ,9089 + ,9784 + ,9895 + ,4962 + ,9144 + ,9330 + ,9763 + ,9089 + ,10404 + ,5770 + ,9895 + ,9144 + ,9330 + ,9763 + ,10195 + ,5480 + ,10404 + ,9895 + ,9144 + ,9330 + ,9987 + ,5000 + ,10195 + ,10404 + ,9895 + ,9144 + ,9789 + ,3228 + ,9987 + ,10195 + ,10404 + ,9895 + ,9437 + ,1993 + ,9789 + ,9987 + ,10195 + ,10404 + ,10096 + ,2288 + ,9437 + ,9789 + ,9987 + ,10195 + ,9776 + ,1580 + ,10096 + ,9437 + ,9789 + ,9987 + ,9106 + ,2111 + ,9776 + ,10096 + ,9437 + ,9789 + ,10258 + ,2192 + ,9106 + ,9776 + ,10096 + ,9437 + ,9766 + ,3601 + ,10258 + ,9106 + ,9776 + ,10096 + ,9826 + ,4665 + ,9766 + ,10258 + ,9106 + ,9776 + ,9957 + ,4876 + ,9826 + ,9766 + ,10258 + ,9106 + ,10036 + ,5813 + ,9957 + ,9826 + ,9766 + ,10258 + ,10508 + ,5589 + ,10036 + ,9957 + ,9826 + ,9766 + ,10146 + ,5331 + ,10508 + ,10036 + ,9957 + ,9826 + ,10166 + ,3075 + ,10146 + ,10508 + ,10036 + ,9957 + ,9365 + ,2002 + ,10166 + ,10146 + ,10508 + ,10036 + ,9968 + ,2306 + ,9365 + ,10166 + ,10146 + ,10508 + ,10123 + ,1507 + ,9968 + ,9365 + ,10166 + ,10146 + ,9144 + ,1992 + ,10123 + ,9968 + ,9365 + ,10166 + ,10447 + ,2487 + ,9144 + ,10123 + ,9968 + ,9365 + ,9699 + ,3490 + ,10447 + ,9144 + ,10123 + ,9968 + ,10451 + ,4647 + ,9699 + ,10447 + ,9144 + ,10123 + ,10192 + ,5594 + ,10451 + ,9699 + ,10447 + ,9144 + ,10404 + ,5611 + ,10192 + ,10451 + ,9699 + ,10447 + ,10597 + ,5788 + ,10404 + ,10192 + ,10451 + ,9699 + ,10633 + ,6204 + ,10597 + ,10404 + ,10192 + ,10451 + ,10727 + ,3013 + ,10633 + ,10597 + ,10404 + ,10192 + ,9784 + ,1931 + ,10727 + ,10633 + ,10597 + ,10404 + ,9667 + ,2549 + ,9784 + ,10727 + ,10633 + ,10597 + ,10297 + ,1504 + ,9667 + ,9784 + ,10727 + ,10633 + ,9426 + ,2090 + ,10297 + ,9667 + ,9784 + ,10727 + ,10274 + ,2702 + ,9426 + ,10297 + ,9667 + ,9784 + ,9598 + ,2939 + ,10274 + ,9426 + ,10297 + ,9667 + ,10400 + ,4500 + ,9598 + ,10274 + ,9426 + ,10297 + ,9985 + ,6208 + ,10400 + ,9598 + ,10274 + ,9426 + ,10761 + ,6415 + ,9985 + ,10400 + ,9598 + ,10274 + ,11081 + ,5657 + ,10761 + ,9985 + ,10400 + ,9598 + ,10297 + ,5964 + ,11081 + ,10761 + ,9985 + ,10400 + ,10751 + ,3163 + ,10297 + ,11081 + ,10761 + ,9985 + ,9760 + ,1997 + ,10751 + ,10297 + ,11081 + ,10761 + ,10133 + ,2422 + ,9760 + ,10751 + ,10297 + ,11081 + ,10806 + ,1376 + ,10133 + ,9760 + ,10751 + ,10297 + ,9734 + ,2202 + ,10806 + ,10133 + ,9760 + ,10751 + ,10083 + ,2683 + ,9734 + ,10806 + ,10133 + ,9760 + ,10691 + ,3303 + ,10083 + ,9734 + ,10806 + ,10133 + ,10446 + ,5202 + ,10691 + ,10083 + ,9734 + ,10806 + ,10517 + ,5231 + ,10446 + ,10691 + ,10083 + ,9734 + ,11353 + ,4880 + ,10517 + ,10446 + ,10691 + ,10083 + ,10436 + ,7998 + ,11353 + ,10517 + ,10446 + ,10691 + ,10721 + ,4977 + ,10436 + ,11353 + ,10517 + ,10446 + ,10701 + ,3531 + ,10721 + ,10436 + ,11353 + ,10517 + ,9793 + ,2025 + ,10701 + ,10721 + ,10436 + ,11353 + ,10142 + ,2205 + ,9793 + ,10701 + ,10721 + ,10436) + ,dim=c(6 + ,80) + ,dimnames=list(c('Y' + ,'X' + ,'Y1' + ,'Y2' + ,'Y3' + ,'Y4') + ,1:80)) > y <- array(NA,dim=c(6,80),dimnames=list(c('Y','X','Y1','Y2','Y3','Y4'),1:80)) > 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 9283 4359 8947 9627 8700 9487 1 0 0 0 0 0 0 0 0 0 0 1 2 8829 5382 9283 8947 9627 8700 0 1 0 0 0 0 0 0 0 0 0 2 3 9947 4459 8829 9283 8947 9627 0 0 1 0 0 0 0 0 0 0 0 3 4 9628 6398 9947 8829 9283 8947 0 0 0 1 0 0 0 0 0 0 0 4 5 9318 4596 9628 9947 8829 9283 0 0 0 0 1 0 0 0 0 0 0 5 6 9605 3024 9318 9628 9947 8829 0 0 0 0 0 1 0 0 0 0 0 6 7 8640 1887 9605 9318 9628 9947 0 0 0 0 0 0 1 0 0 0 0 7 8 9214 2070 8640 9605 9318 9628 0 0 0 0 0 0 0 1 0 0 0 8 9 9567 1351 9214 8640 9605 9318 0 0 0 0 0 0 0 0 1 0 0 9 10 8547 2218 9567 9214 8640 9605 0 0 0 0 0 0 0 0 0 1 0 10 11 9185 2461 8547 9567 9214 8640 0 0 0 0 0 0 0 0 0 0 1 11 12 9470 3028 9185 8547 9567 9214 0 0 0 0 0 0 0 0 0 0 0 12 13 9123 4784 9470 9185 8547 9567 1 0 0 0 0 0 0 0 0 0 0 13 14 9278 4975 9123 9470 9185 8547 0 1 0 0 0 0 0 0 0 0 0 14 15 10170 4607 9278 9123 9470 9185 0 0 1 0 0 0 0 0 0 0 0 15 16 9434 6249 10170 9278 9123 9470 0 0 0 1 0 0 0 0 0 0 0 16 17 9655 4809 9434 10170 9278 9123 0 0 0 0 1 0 0 0 0 0 0 17 18 9429 3157 9655 9434 10170 9278 0 0 0 0 0 1 0 0 0 0 0 18 19 8739 1910 9429 9655 9434 10170 0 0 0 0 0 0 1 0 0 0 0 19 20 9552 2228 8739 9429 9655 9434 0 0 0 0 0 0 0 1 0 0 0 20 21 9784 1594 9552 8739 9429 9655 0 0 0 0 0 0 0 0 1 0 0 21 22 9089 2467 9784 9552 8739 9429 0 0 0 0 0 0 0 0 0 1 0 22 23 9763 2222 9089 9784 9552 8739 0 0 0 0 0 0 0 0 0 0 1 23 24 9330 3607 9763 9089 9784 9552 0 0 0 0 0 0 0 0 0 0 0 24 25 9144 4685 9330 9763 9089 9784 1 0 0 0 0 0 0 0 0 0 0 25 26 9895 4962 9144 9330 9763 9089 0 1 0 0 0 0 0 0 0 0 0 26 27 10404 5770 9895 9144 9330 9763 0 0 1 0 0 0 0 0 0 0 0 27 28 10195 5480 10404 9895 9144 9330 0 0 0 1 0 0 0 0 0 0 0 28 29 9987 5000 10195 10404 9895 9144 0 0 0 0 1 0 0 0 0 0 0 29 30 9789 3228 9987 10195 10404 9895 0 0 0 0 0 1 0 0 0 0 0 30 31 9437 1993 9789 9987 10195 10404 0 0 0 0 0 0 1 0 0 0 0 31 32 10096 2288 9437 9789 9987 10195 0 0 0 0 0 0 0 1 0 0 0 32 33 9776 1580 10096 9437 9789 9987 0 0 0 0 0 0 0 0 1 0 0 33 34 9106 2111 9776 10096 9437 9789 0 0 0 0 0 0 0 0 0 1 0 34 35 10258 2192 9106 9776 10096 9437 0 0 0 0 0 0 0 0 0 0 1 35 36 9766 3601 10258 9106 9776 10096 0 0 0 0 0 0 0 0 0 0 0 36 37 9826 4665 9766 10258 9106 9776 1 0 0 0 0 0 0 0 0 0 0 37 38 9957 4876 9826 9766 10258 9106 0 1 0 0 0 0 0 0 0 0 0 38 39 10036 5813 9957 9826 9766 10258 0 0 1 0 0 0 0 0 0 0 0 39 40 10508 5589 10036 9957 9826 9766 0 0 0 1 0 0 0 0 0 0 0 40 41 10146 5331 10508 10036 9957 9826 0 0 0 0 1 0 0 0 0 0 0 41 42 10166 3075 10146 10508 10036 9957 0 0 0 0 0 1 0 0 0 0 0 42 43 9365 2002 10166 10146 10508 10036 0 0 0 0 0 0 1 0 0 0 0 43 44 9968 2306 9365 10166 10146 10508 0 0 0 0 0 0 0 1 0 0 0 44 45 10123 1507 9968 9365 10166 10146 0 0 0 0 0 0 0 0 1 0 0 45 46 9144 1992 10123 9968 9365 10166 0 0 0 0 0 0 0 0 0 1 0 46 47 10447 2487 9144 10123 9968 9365 0 0 0 0 0 0 0 0 0 0 1 47 48 9699 3490 10447 9144 10123 9968 0 0 0 0 0 0 0 0 0 0 0 48 49 10451 4647 9699 10447 9144 10123 1 0 0 0 0 0 0 0 0 0 0 49 50 10192 5594 10451 9699 10447 9144 0 1 0 0 0 0 0 0 0 0 0 50 51 10404 5611 10192 10451 9699 10447 0 0 1 0 0 0 0 0 0 0 0 51 52 10597 5788 10404 10192 10451 9699 0 0 0 1 0 0 0 0 0 0 0 52 53 10633 6204 10597 10404 10192 10451 0 0 0 0 1 0 0 0 0 0 0 53 54 10727 3013 10633 10597 10404 10192 0 0 0 0 0 1 0 0 0 0 0 54 55 9784 1931 10727 10633 10597 10404 0 0 0 0 0 0 1 0 0 0 0 55 56 9667 2549 9784 10727 10633 10597 0 0 0 0 0 0 0 1 0 0 0 56 57 10297 1504 9667 9784 10727 10633 0 0 0 0 0 0 0 0 1 0 0 57 58 9426 2090 10297 9667 9784 10727 0 0 0 0 0 0 0 0 0 1 0 58 59 10274 2702 9426 10297 9667 9784 0 0 0 0 0 0 0 0 0 0 1 59 60 9598 2939 10274 9426 10297 9667 0 0 0 0 0 0 0 0 0 0 0 60 61 10400 4500 9598 10274 9426 10297 1 0 0 0 0 0 0 0 0 0 0 61 62 9985 6208 10400 9598 10274 9426 0 1 0 0 0 0 0 0 0 0 0 62 63 10761 6415 9985 10400 9598 10274 0 0 1 0 0 0 0 0 0 0 0 63 64 11081 5657 10761 9985 10400 9598 0 0 0 1 0 0 0 0 0 0 0 64 65 10297 5964 11081 10761 9985 10400 0 0 0 0 1 0 0 0 0 0 0 65 66 10751 3163 10297 11081 10761 9985 0 0 0 0 0 1 0 0 0 0 0 66 67 9760 1997 10751 10297 11081 10761 0 0 0 0 0 0 1 0 0 0 0 67 68 10133 2422 9760 10751 10297 11081 0 0 0 0 0 0 0 1 0 0 0 68 69 10806 1376 10133 9760 10751 10297 0 0 0 0 0 0 0 0 1 0 0 69 70 9734 2202 10806 10133 9760 10751 0 0 0 0 0 0 0 0 0 1 0 70 71 10083 2683 9734 10806 10133 9760 0 0 0 0 0 0 0 0 0 0 1 71 72 10691 3303 10083 9734 10806 10133 0 0 0 0 0 0 0 0 0 0 0 72 73 10446 5202 10691 10083 9734 10806 1 0 0 0 0 0 0 0 0 0 0 73 74 10517 5231 10446 10691 10083 9734 0 1 0 0 0 0 0 0 0 0 0 74 75 11353 4880 10517 10446 10691 10083 0 0 1 0 0 0 0 0 0 0 0 75 76 10436 7998 11353 10517 10446 10691 0 0 0 1 0 0 0 0 0 0 0 76 77 10721 4977 10436 11353 10517 10446 0 0 0 0 1 0 0 0 0 0 0 77 78 10701 3531 10721 10436 11353 10517 0 0 0 0 0 1 0 0 0 0 0 78 79 9793 2025 10701 10721 10436 11353 0 0 0 0 0 0 1 0 0 0 0 79 80 10142 2205 9793 10701 10721 10436 0 0 0 0 0 0 0 1 0 0 0 80 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) X Y1 Y2 Y3 Y4 9650.17771 -0.20165 -0.03892 -0.06494 0.13012 -0.03483 M1 M2 M3 M4 M5 M6 588.59607 539.99454 1241.94351 1205.54424 886.02316 402.96891 M7 M8 M9 M10 M11 t -630.32969 -130.21647 -10.75694 -626.18320 131.90526 18.96414 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -588.49 -133.21 13.58 124.31 489.18 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 9650.17771 2414.05101 3.998 0.000173 *** X -0.20165 0.08552 -2.358 0.021553 * Y1 -0.03892 0.13250 -0.294 0.769917 Y2 -0.06494 0.12421 -0.523 0.602944 Y3 0.13012 0.12146 1.071 0.288182 Y4 -0.03483 0.12615 -0.276 0.783398 M1 588.59607 229.69113 2.563 0.012833 * M2 539.99454 268.72669 2.009 0.048847 * M3 1241.94351 245.01512 5.069 3.87e-06 *** M4 1205.54424 293.60386 4.106 0.000120 *** M5 886.02316 276.02008 3.210 0.002104 ** M6 402.96891 203.63390 1.979 0.052274 . M7 -630.32969 235.27795 -2.679 0.009441 ** M8 -130.21647 205.54088 -0.634 0.528717 M9 -10.75694 213.22249 -0.050 0.959926 M10 -626.18320 208.91713 -2.997 0.003915 ** M11 131.90526 196.31134 0.672 0.504132 t 18.96414 4.91601 3.858 0.000275 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 241.6 on 62 degrees of freedom Multiple R-squared: 0.8653, Adjusted R-squared: 0.8284 F-statistic: 23.44 on 17 and 62 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.17731164 0.3546233 0.8226884 [2,] 0.09518844 0.1903769 0.9048116 [3,] 0.14730297 0.2946059 0.8526970 [4,] 0.12485347 0.2497069 0.8751465 [5,] 0.16055482 0.3211096 0.8394452 [6,] 0.46515065 0.9303013 0.5348494 [7,] 0.60791531 0.7841694 0.3920847 [8,] 0.51504779 0.9699044 0.4849522 [9,] 0.41928002 0.8385600 0.5807200 [10,] 0.37913157 0.7582631 0.6208684 [11,] 0.36470243 0.7294049 0.6352976 [12,] 0.46400324 0.9280065 0.5359968 [13,] 0.43200383 0.8640077 0.5679962 [14,] 0.39745971 0.7949194 0.6025403 [15,] 0.36043164 0.7208633 0.6395684 [16,] 0.31545205 0.6309041 0.6845480 [17,] 0.26686703 0.5337341 0.7331330 [18,] 0.21300899 0.4260180 0.7869910 [19,] 0.28305603 0.5661121 0.7169440 [20,] 0.21637474 0.4327495 0.7836253 [21,] 0.16807706 0.3361541 0.8319229 [22,] 0.13769892 0.2753978 0.8623011 [23,] 0.11769459 0.2353892 0.8823054 [24,] 0.09623404 0.1924681 0.9037660 [25,] 0.07102668 0.1420534 0.9289733 [26,] 0.09159339 0.1831868 0.9084066 [27,] 0.09839950 0.1967990 0.9016005 [28,] 0.08901819 0.1780364 0.9109818 [29,] 0.10781606 0.2156321 0.8921839 [30,] 0.07705981 0.1541196 0.9229402 [31,] 0.07899066 0.1579813 0.9210093 [32,] 0.06156936 0.1231387 0.9384306 [33,] 0.12976369 0.2595274 0.8702363 [34,] 0.11344313 0.2268863 0.8865569 [35,] 0.10563012 0.2112602 0.8943699 [36,] 0.09539821 0.1907964 0.9046018 [37,] 0.09855473 0.1971095 0.9014453 [38,] 0.09754666 0.1950933 0.9024533 [39,] 0.07068232 0.1413646 0.9293177 > postscript(file="/var/www/html/rcomp/tmp/1exdu1261231862.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/2mvfy1261231862.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/3buyu1261231862.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/40izk1261231862.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/585951261231862.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 = 80 Frequency = 1 1 2 3 4 5 6 76.074550 -321.117270 14.767276 50.824564 -191.021429 49.009427 7 8 9 10 11 12 -59.442341 42.685861 23.808681 -38.322499 -253.451336 191.476147 13 14 15 16 17 18 -211.447800 -101.836542 -36.320327 -323.916523 -95.705686 -340.600807 19 20 21 22 23 24 -135.328742 126.792752 116.463413 337.702840 43.441614 -18.106968 25 26 27 28 29 30 -468.860068 220.366584 268.353910 96.015326 12.503701 -140.468087 31 32 33 34 35 36 296.540479 489.175202 -90.705237 12.078967 258.490937 229.472883 37 38 39 40 41 42 28.163357 28.498254 -311.332564 119.572273 14.650305 54.669319 43 44 45 46 47 48 -29.759529 149.128664 -39.170262 -173.793490 317.568839 -127.265187 49 50 51 52 53 54 438.771740 177.418207 -146.598474 -32.942934 468.672414 360.633844 55 56 57 58 59 60 202.053173 -337.967887 -133.884899 -147.357124 36.389433 -588.487326 61 62 63 64 65 66 84.760400 -109.551249 140.703940 200.642382 -76.111185 152.002593 67 68 69 70 71 72 -107.637702 -63.944331 123.488303 9.691306 -402.439487 312.910451 73 74 75 76 77 78 52.537821 106.222015 70.426238 -110.195088 -132.988119 -135.246290 79 80 -166.425339 -405.870262 > postscript(file="/var/www/html/rcomp/tmp/6kppt1261231862.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 = 80 Frequency = 1 lag(myerror, k = 1) myerror 0 76.074550 NA 1 -321.117270 76.074550 2 14.767276 -321.117270 3 50.824564 14.767276 4 -191.021429 50.824564 5 49.009427 -191.021429 6 -59.442341 49.009427 7 42.685861 -59.442341 8 23.808681 42.685861 9 -38.322499 23.808681 10 -253.451336 -38.322499 11 191.476147 -253.451336 12 -211.447800 191.476147 13 -101.836542 -211.447800 14 -36.320327 -101.836542 15 -323.916523 -36.320327 16 -95.705686 -323.916523 17 -340.600807 -95.705686 18 -135.328742 -340.600807 19 126.792752 -135.328742 20 116.463413 126.792752 21 337.702840 116.463413 22 43.441614 337.702840 23 -18.106968 43.441614 24 -468.860068 -18.106968 25 220.366584 -468.860068 26 268.353910 220.366584 27 96.015326 268.353910 28 12.503701 96.015326 29 -140.468087 12.503701 30 296.540479 -140.468087 31 489.175202 296.540479 32 -90.705237 489.175202 33 12.078967 -90.705237 34 258.490937 12.078967 35 229.472883 258.490937 36 28.163357 229.472883 37 28.498254 28.163357 38 -311.332564 28.498254 39 119.572273 -311.332564 40 14.650305 119.572273 41 54.669319 14.650305 42 -29.759529 54.669319 43 149.128664 -29.759529 44 -39.170262 149.128664 45 -173.793490 -39.170262 46 317.568839 -173.793490 47 -127.265187 317.568839 48 438.771740 -127.265187 49 177.418207 438.771740 50 -146.598474 177.418207 51 -32.942934 -146.598474 52 468.672414 -32.942934 53 360.633844 468.672414 54 202.053173 360.633844 55 -337.967887 202.053173 56 -133.884899 -337.967887 57 -147.357124 -133.884899 58 36.389433 -147.357124 59 -588.487326 36.389433 60 84.760400 -588.487326 61 -109.551249 84.760400 62 140.703940 -109.551249 63 200.642382 140.703940 64 -76.111185 200.642382 65 152.002593 -76.111185 66 -107.637702 152.002593 67 -63.944331 -107.637702 68 123.488303 -63.944331 69 9.691306 123.488303 70 -402.439487 9.691306 71 312.910451 -402.439487 72 52.537821 312.910451 73 106.222015 52.537821 74 70.426238 106.222015 75 -110.195088 70.426238 76 -132.988119 -110.195088 77 -135.246290 -132.988119 78 -166.425339 -135.246290 79 -405.870262 -166.425339 80 NA -405.870262 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -321.117270 76.074550 [2,] 14.767276 -321.117270 [3,] 50.824564 14.767276 [4,] -191.021429 50.824564 [5,] 49.009427 -191.021429 [6,] -59.442341 49.009427 [7,] 42.685861 -59.442341 [8,] 23.808681 42.685861 [9,] -38.322499 23.808681 [10,] -253.451336 -38.322499 [11,] 191.476147 -253.451336 [12,] -211.447800 191.476147 [13,] -101.836542 -211.447800 [14,] -36.320327 -101.836542 [15,] -323.916523 -36.320327 [16,] -95.705686 -323.916523 [17,] -340.600807 -95.705686 [18,] -135.328742 -340.600807 [19,] 126.792752 -135.328742 [20,] 116.463413 126.792752 [21,] 337.702840 116.463413 [22,] 43.441614 337.702840 [23,] -18.106968 43.441614 [24,] -468.860068 -18.106968 [25,] 220.366584 -468.860068 [26,] 268.353910 220.366584 [27,] 96.015326 268.353910 [28,] 12.503701 96.015326 [29,] -140.468087 12.503701 [30,] 296.540479 -140.468087 [31,] 489.175202 296.540479 [32,] -90.705237 489.175202 [33,] 12.078967 -90.705237 [34,] 258.490937 12.078967 [35,] 229.472883 258.490937 [36,] 28.163357 229.472883 [37,] 28.498254 28.163357 [38,] -311.332564 28.498254 [39,] 119.572273 -311.332564 [40,] 14.650305 119.572273 [41,] 54.669319 14.650305 [42,] -29.759529 54.669319 [43,] 149.128664 -29.759529 [44,] -39.170262 149.128664 [45,] -173.793490 -39.170262 [46,] 317.568839 -173.793490 [47,] -127.265187 317.568839 [48,] 438.771740 -127.265187 [49,] 177.418207 438.771740 [50,] -146.598474 177.418207 [51,] -32.942934 -146.598474 [52,] 468.672414 -32.942934 [53,] 360.633844 468.672414 [54,] 202.053173 360.633844 [55,] -337.967887 202.053173 [56,] -133.884899 -337.967887 [57,] -147.357124 -133.884899 [58,] 36.389433 -147.357124 [59,] -588.487326 36.389433 [60,] 84.760400 -588.487326 [61,] -109.551249 84.760400 [62,] 140.703940 -109.551249 [63,] 200.642382 140.703940 [64,] -76.111185 200.642382 [65,] 152.002593 -76.111185 [66,] -107.637702 152.002593 [67,] -63.944331 -107.637702 [68,] 123.488303 -63.944331 [69,] 9.691306 123.488303 [70,] -402.439487 9.691306 [71,] 312.910451 -402.439487 [72,] 52.537821 312.910451 [73,] 106.222015 52.537821 [74,] 70.426238 106.222015 [75,] -110.195088 70.426238 [76,] -132.988119 -110.195088 [77,] -135.246290 -132.988119 [78,] -166.425339 -135.246290 [79,] -405.870262 -166.425339 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -321.117270 76.074550 2 14.767276 -321.117270 3 50.824564 14.767276 4 -191.021429 50.824564 5 49.009427 -191.021429 6 -59.442341 49.009427 7 42.685861 -59.442341 8 23.808681 42.685861 9 -38.322499 23.808681 10 -253.451336 -38.322499 11 191.476147 -253.451336 12 -211.447800 191.476147 13 -101.836542 -211.447800 14 -36.320327 -101.836542 15 -323.916523 -36.320327 16 -95.705686 -323.916523 17 -340.600807 -95.705686 18 -135.328742 -340.600807 19 126.792752 -135.328742 20 116.463413 126.792752 21 337.702840 116.463413 22 43.441614 337.702840 23 -18.106968 43.441614 24 -468.860068 -18.106968 25 220.366584 -468.860068 26 268.353910 220.366584 27 96.015326 268.353910 28 12.503701 96.015326 29 -140.468087 12.503701 30 296.540479 -140.468087 31 489.175202 296.540479 32 -90.705237 489.175202 33 12.078967 -90.705237 34 258.490937 12.078967 35 229.472883 258.490937 36 28.163357 229.472883 37 28.498254 28.163357 38 -311.332564 28.498254 39 119.572273 -311.332564 40 14.650305 119.572273 41 54.669319 14.650305 42 -29.759529 54.669319 43 149.128664 -29.759529 44 -39.170262 149.128664 45 -173.793490 -39.170262 46 317.568839 -173.793490 47 -127.265187 317.568839 48 438.771740 -127.265187 49 177.418207 438.771740 50 -146.598474 177.418207 51 -32.942934 -146.598474 52 468.672414 -32.942934 53 360.633844 468.672414 54 202.053173 360.633844 55 -337.967887 202.053173 56 -133.884899 -337.967887 57 -147.357124 -133.884899 58 36.389433 -147.357124 59 -588.487326 36.389433 60 84.760400 -588.487326 61 -109.551249 84.760400 62 140.703940 -109.551249 63 200.642382 140.703940 64 -76.111185 200.642382 65 152.002593 -76.111185 66 -107.637702 152.002593 67 -63.944331 -107.637702 68 123.488303 -63.944331 69 9.691306 123.488303 70 -402.439487 9.691306 71 312.910451 -402.439487 72 52.537821 312.910451 73 106.222015 52.537821 74 70.426238 106.222015 75 -110.195088 70.426238 76 -132.988119 -110.195088 77 -135.246290 -132.988119 78 -166.425339 -135.246290 79 -405.870262 -166.425339 > 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/7nzcc1261231862.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/8y6521261231862.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/9gmgz1261231862.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/10n30w1261231862.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/11tnpl1261231862.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/126in51261231862.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/138ih41261231862.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/147tnt1261231862.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/15upzf1261231862.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/16ioz01261231862.tab") + } > > try(system("convert tmp/1exdu1261231862.ps tmp/1exdu1261231862.png",intern=TRUE)) character(0) > try(system("convert tmp/2mvfy1261231862.ps tmp/2mvfy1261231862.png",intern=TRUE)) character(0) > try(system("convert tmp/3buyu1261231862.ps tmp/3buyu1261231862.png",intern=TRUE)) character(0) > try(system("convert tmp/40izk1261231862.ps tmp/40izk1261231862.png",intern=TRUE)) character(0) > try(system("convert tmp/585951261231862.ps tmp/585951261231862.png",intern=TRUE)) character(0) > try(system("convert tmp/6kppt1261231862.ps tmp/6kppt1261231862.png",intern=TRUE)) character(0) > try(system("convert tmp/7nzcc1261231862.ps tmp/7nzcc1261231862.png",intern=TRUE)) character(0) > try(system("convert tmp/8y6521261231862.ps tmp/8y6521261231862.png",intern=TRUE)) character(0) > try(system("convert tmp/9gmgz1261231862.ps tmp/9gmgz1261231862.png",intern=TRUE)) character(0) > try(system("convert tmp/10n30w1261231862.ps tmp/10n30w1261231862.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.724 1.630 3.539