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(9563 + ,9731 + ,8587 + ,9743 + ,9084 + ,9081 + ,9700 + ,9998 + ,9563 + ,9731 + ,8587 + ,9743 + ,9084 + ,9081 + ,9437 + ,9998 + ,9563 + ,9731 + ,8587 + ,9743 + ,9084 + ,10038 + ,9437 + ,9998 + ,9563 + ,9731 + ,8587 + ,9743 + ,9918 + ,10038 + ,9437 + ,9998 + ,9563 + ,9731 + ,8587 + ,9252 + ,9918 + ,10038 + ,9437 + ,9998 + ,9563 + ,9731 + ,9737 + ,9252 + ,9918 + ,10038 + ,9437 + ,9998 + ,9563 + ,9035 + ,9737 + ,9252 + ,9918 + ,10038 + ,9437 + ,9998 + ,9133 + ,9035 + ,9737 + ,9252 + ,9918 + ,10038 + ,9437 + ,9487 + ,9133 + ,9035 + ,9737 + ,9252 + ,9918 + ,10038 + ,8700 + ,9487 + ,9133 + ,9035 + ,9737 + ,9252 + ,9918 + ,9627 + ,8700 + ,9487 + ,9133 + ,9035 + ,9737 + ,9252 + ,8947 + ,9627 + ,8700 + ,9487 + ,9133 + ,9035 + ,9737 + ,9283 + ,8947 + ,9627 + ,8700 + ,9487 + ,9133 + ,9035 + ,8829 + ,9283 + ,8947 + ,9627 + ,8700 + ,9487 + ,9133 + ,9947 + ,8829 + ,9283 + ,8947 + ,9627 + ,8700 + ,9487 + ,9628 + ,9947 + ,8829 + ,9283 + ,8947 + ,9627 + ,8700 + ,9318 + ,9628 + ,9947 + ,8829 + ,9283 + ,8947 + ,9627 + ,9605 + ,9318 + ,9628 + ,9947 + ,8829 + ,9283 + ,8947 + ,8640 + ,9605 + ,9318 + ,9628 + ,9947 + ,8829 + ,9283 + ,9214 + ,8640 + ,9605 + ,9318 + ,9628 + ,9947 + ,8829 + ,9567 + ,9214 + ,8640 + ,9605 + ,9318 + ,9628 + ,9947 + ,8547 + ,9567 + ,9214 + ,8640 + ,9605 + ,9318 + ,9628 + ,9185 + ,8547 + ,9567 + ,9214 + ,8640 + ,9605 + ,9318 + ,9470 + ,9185 + ,8547 + ,9567 + ,9214 + ,8640 + ,9605 + ,9123 + ,9470 + ,9185 + ,8547 + ,9567 + ,9214 + ,8640 + ,9278 + ,9123 + ,9470 + ,9185 + ,8547 + ,9567 + ,9214 + ,10170 + ,9278 + ,9123 + ,9470 + ,9185 + ,8547 + ,9567 + ,9434 + ,10170 + ,9278 + ,9123 + ,9470 + ,9185 + ,8547 + ,9655 + ,9434 + ,10170 + ,9278 + ,9123 + ,9470 + ,9185 + ,9429 + ,9655 + ,9434 + ,10170 + ,9278 + ,9123 + ,9470 + ,8739 + ,9429 + ,9655 + ,9434 + ,10170 + ,9278 + ,9123 + ,9552 + ,8739 + ,9429 + ,9655 + ,9434 + ,10170 + ,9278 + ,9687 + ,9552 + ,8739 + ,9429 + ,9655 + ,9434 + ,10170 + ,9019 + ,9687 + ,9552 + ,8739 + ,9429 + ,9655 + ,9434 + ,9672 + ,9019 + ,9687 + ,9552 + ,8739 + ,9429 + ,9655 + ,9206 + ,9672 + ,9019 + ,9687 + ,9552 + ,8739 + ,9429 + ,9069 + ,9206 + ,9672 + ,9019 + ,9687 + ,9552 + ,8739 + ,9788 + ,9069 + ,9206 + ,9672 + ,9019 + ,9687 + ,9552 + ,10312 + ,9788 + ,9069 + ,9206 + ,9672 + ,9019 + ,9687 + ,10105 + ,10312 + ,9788 + ,9069 + ,9206 + ,9672 + ,9019 + ,9863 + ,10105 + ,10312 + ,9788 + ,9069 + ,9206 + ,9672 + ,9656 + ,9863 + ,10105 + ,10312 + ,9788 + ,9069 + ,9206 + ,9295 + ,9656 + ,9863 + ,10105 + ,10312 + ,9788 + ,9069 + ,9946 + ,9295 + ,9656 + ,9863 + ,10105 + ,10312 + ,9788 + ,9701 + ,9946 + ,9295 + ,9656 + ,9863 + ,10105 + ,10312 + ,9049 + ,9701 + ,9946 + ,9295 + ,9656 + ,9863 + ,10105 + ,10190 + ,9049 + ,9701 + ,9946 + ,9295 + ,9656 + ,9863 + ,9706 + ,10190 + ,9049 + ,9701 + ,9946 + ,9295 + ,9656 + ,9765 + ,9706 + ,10190 + ,9049 + ,9701 + ,9946 + ,9295 + ,9893 + ,9765 + ,9706 + ,10190 + ,9049 + ,9701 + ,9946 + ,9994 + ,9893 + ,9765 + ,9706 + ,10190 + ,9049 + ,9701 + ,10433 + ,9994 + ,9893 + ,9765 + ,9706 + ,10190 + ,9049 + ,10073 + ,10433 + ,9994 + ,9893 + ,9765 + ,9706 + ,10190 + ,10112 + ,10073 + ,10433 + ,9994 + ,9893 + ,9765 + ,9706 + ,9266 + ,10112 + ,10073 + ,10433 + ,9994 + ,9893 + ,9765 + ,9820 + ,9266 + ,10112 + ,10073 + ,10433 + ,9994 + ,9893 + ,10097 + ,9820 + ,9266 + ,10112 + ,10073 + ,10433 + ,9994 + ,9115 + ,10097 + ,9820 + ,9266 + ,10112 + ,10073 + ,10433 + ,10411 + ,9115 + ,10097 + ,9820 + ,9266 + ,10112 + ,10073 + ,9678 + ,10411 + ,9115 + ,10097 + ,9820 + ,9266 + ,10112 + ,10408 + ,9678 + ,10411 + ,9115 + ,10097 + ,9820 + ,9266 + ,10153 + ,10408 + ,9678 + ,10411 + ,9115 + ,10097 + ,9820 + ,10368 + ,10153 + ,10408 + ,9678 + ,10411 + ,9115 + ,10097 + ,10581 + ,10368 + ,10153 + ,10408 + ,9678 + ,10411 + ,9115 + ,10597 + ,10581 + ,10368 + ,10153 + ,10408 + ,9678 + ,10411 + ,10680 + ,10597 + ,10581 + ,10368 + ,10153 + ,10408 + ,9678 + ,9738 + ,10680 + ,10597 + ,10581 + ,10368 + ,10153 + ,10408 + ,9556 + ,9738 + ,10680 + ,10597 + ,10581 + ,10368 + ,10153) + ,dim=c(7 + ,69) + ,dimnames=list(c('Yt' + ,'Yt-1' + ,'Yt-2' + ,'Yt-3' + ,'Yt-4' + ,'Yt-5' + ,'Yt-6') + ,1:69)) > y <- array(NA,dim=c(7,69),dimnames=list(c('Yt','Yt-1','Yt-2','Yt-3','Yt-4','Yt-5','Yt-6'),1:69)) > 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 Yt Yt-1 Yt-2 Yt-3 Yt-4 Yt-5 Yt-6 M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 1 9563 9731 8587 9743 9084 9081 9700 1 0 0 0 0 0 0 0 0 0 0 2 9998 9563 9731 8587 9743 9084 9081 0 1 0 0 0 0 0 0 0 0 0 3 9437 9998 9563 9731 8587 9743 9084 0 0 1 0 0 0 0 0 0 0 0 4 10038 9437 9998 9563 9731 8587 9743 0 0 0 1 0 0 0 0 0 0 0 5 9918 10038 9437 9998 9563 9731 8587 0 0 0 0 1 0 0 0 0 0 0 6 9252 9918 10038 9437 9998 9563 9731 0 0 0 0 0 1 0 0 0 0 0 7 9737 9252 9918 10038 9437 9998 9563 0 0 0 0 0 0 1 0 0 0 0 8 9035 9737 9252 9918 10038 9437 9998 0 0 0 0 0 0 0 1 0 0 0 9 9133 9035 9737 9252 9918 10038 9437 0 0 0 0 0 0 0 0 1 0 0 10 9487 9133 9035 9737 9252 9918 10038 0 0 0 0 0 0 0 0 0 1 0 11 8700 9487 9133 9035 9737 9252 9918 0 0 0 0 0 0 0 0 0 0 1 12 9627 8700 9487 9133 9035 9737 9252 0 0 0 0 0 0 0 0 0 0 0 13 8947 9627 8700 9487 9133 9035 9737 1 0 0 0 0 0 0 0 0 0 0 14 9283 8947 9627 8700 9487 9133 9035 0 1 0 0 0 0 0 0 0 0 0 15 8829 9283 8947 9627 8700 9487 9133 0 0 1 0 0 0 0 0 0 0 0 16 9947 8829 9283 8947 9627 8700 9487 0 0 0 1 0 0 0 0 0 0 0 17 9628 9947 8829 9283 8947 9627 8700 0 0 0 0 1 0 0 0 0 0 0 18 9318 9628 9947 8829 9283 8947 9627 0 0 0 0 0 1 0 0 0 0 0 19 9605 9318 9628 9947 8829 9283 8947 0 0 0 0 0 0 1 0 0 0 0 20 8640 9605 9318 9628 9947 8829 9283 0 0 0 0 0 0 0 1 0 0 0 21 9214 8640 9605 9318 9628 9947 8829 0 0 0 0 0 0 0 0 1 0 0 22 9567 9214 8640 9605 9318 9628 9947 0 0 0 0 0 0 0 0 0 1 0 23 8547 9567 9214 8640 9605 9318 9628 0 0 0 0 0 0 0 0 0 0 1 24 9185 8547 9567 9214 8640 9605 9318 0 0 0 0 0 0 0 0 0 0 0 25 9470 9185 8547 9567 9214 8640 9605 1 0 0 0 0 0 0 0 0 0 0 26 9123 9470 9185 8547 9567 9214 8640 0 1 0 0 0 0 0 0 0 0 0 27 9278 9123 9470 9185 8547 9567 9214 0 0 1 0 0 0 0 0 0 0 0 28 10170 9278 9123 9470 9185 8547 9567 0 0 0 1 0 0 0 0 0 0 0 29 9434 10170 9278 9123 9470 9185 8547 0 0 0 0 1 0 0 0 0 0 0 30 9655 9434 10170 9278 9123 9470 9185 0 0 0 0 0 1 0 0 0 0 0 31 9429 9655 9434 10170 9278 9123 9470 0 0 0 0 0 0 1 0 0 0 0 32 8739 9429 9655 9434 10170 9278 9123 0 0 0 0 0 0 0 1 0 0 0 33 9552 8739 9429 9655 9434 10170 9278 0 0 0 0 0 0 0 0 1 0 0 34 9687 9552 8739 9429 9655 9434 10170 0 0 0 0 0 0 0 0 0 1 0 35 9019 9687 9552 8739 9429 9655 9434 0 0 0 0 0 0 0 0 0 0 1 36 9672 9019 9687 9552 8739 9429 9655 0 0 0 0 0 0 0 0 0 0 0 37 9206 9672 9019 9687 9552 8739 9429 1 0 0 0 0 0 0 0 0 0 0 38 9069 9206 9672 9019 9687 9552 8739 0 1 0 0 0 0 0 0 0 0 0 39 9788 9069 9206 9672 9019 9687 9552 0 0 1 0 0 0 0 0 0 0 0 40 10312 9788 9069 9206 9672 9019 9687 0 0 0 1 0 0 0 0 0 0 0 41 10105 10312 9788 9069 9206 9672 9019 0 0 0 0 1 0 0 0 0 0 0 42 9863 10105 10312 9788 9069 9206 9672 0 0 0 0 0 1 0 0 0 0 0 43 9656 9863 10105 10312 9788 9069 9206 0 0 0 0 0 0 1 0 0 0 0 44 9295 9656 9863 10105 10312 9788 9069 0 0 0 0 0 0 0 1 0 0 0 45 9946 9295 9656 9863 10105 10312 9788 0 0 0 0 0 0 0 0 1 0 0 46 9701 9946 9295 9656 9863 10105 10312 0 0 0 0 0 0 0 0 0 1 0 47 9049 9701 9946 9295 9656 9863 10105 0 0 0 0 0 0 0 0 0 0 1 48 10190 9049 9701 9946 9295 9656 9863 0 0 0 0 0 0 0 0 0 0 0 49 9706 10190 9049 9701 9946 9295 9656 1 0 0 0 0 0 0 0 0 0 0 50 9765 9706 10190 9049 9701 9946 9295 0 1 0 0 0 0 0 0 0 0 0 51 9893 9765 9706 10190 9049 9701 9946 0 0 1 0 0 0 0 0 0 0 0 52 9994 9893 9765 9706 10190 9049 9701 0 0 0 1 0 0 0 0 0 0 0 53 10433 9994 9893 9765 9706 10190 9049 0 0 0 0 1 0 0 0 0 0 0 54 10073 10433 9994 9893 9765 9706 10190 0 0 0 0 0 1 0 0 0 0 0 55 10112 10073 10433 9994 9893 9765 9706 0 0 0 0 0 0 1 0 0 0 0 56 9266 10112 10073 10433 9994 9893 9765 0 0 0 0 0 0 0 1 0 0 0 57 9820 9266 10112 10073 10433 9994 9893 0 0 0 0 0 0 0 0 1 0 0 58 10097 9820 9266 10112 10073 10433 9994 0 0 0 0 0 0 0 0 0 1 0 59 9115 10097 9820 9266 10112 10073 10433 0 0 0 0 0 0 0 0 0 0 1 60 10411 9115 10097 9820 9266 10112 10073 0 0 0 0 0 0 0 0 0 0 0 61 9678 10411 9115 10097 9820 9266 10112 1 0 0 0 0 0 0 0 0 0 0 62 10408 9678 10411 9115 10097 9820 9266 0 1 0 0 0 0 0 0 0 0 0 63 10153 10408 9678 10411 9115 10097 9820 0 0 1 0 0 0 0 0 0 0 0 64 10368 10153 10408 9678 10411 9115 10097 0 0 0 1 0 0 0 0 0 0 0 65 10581 10368 10153 10408 9678 10411 9115 0 0 0 0 1 0 0 0 0 0 0 66 10597 10581 10368 10153 10408 9678 10411 0 0 0 0 0 1 0 0 0 0 0 67 10680 10597 10581 10368 10153 10408 9678 0 0 0 0 0 0 1 0 0 0 0 68 9738 10680 10597 10581 10368 10153 10408 0 0 0 0 0 0 0 1 0 0 0 69 9556 9738 10680 10597 10581 10368 10153 0 0 0 0 0 0 0 0 1 0 0 t 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 37 38 38 39 39 40 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 48 49 49 50 50 51 51 52 52 53 53 54 54 55 55 56 56 57 57 58 58 59 59 60 60 61 61 62 62 63 63 64 64 65 65 66 66 67 67 68 68 69 69 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) `Yt-1` `Yt-2` `Yt-3` `Yt-4` `Yt-5` 2260.17635 0.03399 0.03501 0.11248 -0.01184 0.31608 `Yt-6` M1 M2 M3 M4 M5 0.28026 -179.02684 129.39808 -238.93757 585.73988 356.88104 M6 M7 M8 M9 M10 M11 -33.05508 33.60608 -732.85993 -442.64035 -299.09219 -930.99474 t 5.03344 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -531.51 -118.67 30.95 115.36 665.82 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 2260.17635 1654.97621 1.366 0.178150 `Yt-1` 0.03399 0.14260 0.238 0.812569 `Yt-2` 0.03501 0.13827 0.253 0.801134 `Yt-3` 0.11248 0.14127 0.796 0.429709 `Yt-4` -0.01184 0.14192 -0.083 0.933838 `Yt-5` 0.31608 0.13890 2.276 0.027186 * `Yt-6` 0.28026 0.14637 1.915 0.061267 . M1 -179.02684 259.76784 -0.689 0.493896 M2 129.39808 243.25459 0.532 0.597120 M3 -238.93757 204.95797 -1.166 0.249231 M4 585.73988 240.23346 2.438 0.018356 * M5 356.88104 288.87126 1.235 0.222443 M6 -33.05508 227.53212 -0.145 0.885077 M7 33.60608 226.52930 0.148 0.882662 M8 -732.85993 247.11497 -2.966 0.004620 ** M9 -442.64035 212.50857 -2.083 0.042392 * M10 -299.09219 234.46333 -1.276 0.207976 M11 -930.99474 233.06605 -3.995 0.000213 *** t 5.03344 2.59457 1.940 0.058032 . --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 257 on 50 degrees of freedom Multiple R-squared: 0.8063, Adjusted R-squared: 0.7366 F-statistic: 11.56 on 18 and 50 DF, p-value: 4.022e-12 > 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.7568580 0.4862841 0.24314203 [2,] 0.6189425 0.7621150 0.38105751 [3,] 0.5080270 0.9839461 0.49197304 [4,] 0.8677056 0.2645889 0.13229443 [5,] 0.8070170 0.3859661 0.19298304 [6,] 0.8069416 0.3861168 0.19305842 [7,] 0.9110557 0.1778887 0.08894435 [8,] 0.8942545 0.2114909 0.10574546 [9,] 0.8889947 0.2220105 0.11100525 [10,] 0.8312890 0.3374221 0.16871103 [11,] 0.8172376 0.3655247 0.18276237 [12,] 0.7814450 0.4371100 0.21855502 [13,] 0.7853047 0.4293906 0.21469529 [14,] 0.7325406 0.5349188 0.26745939 [15,] 0.6484406 0.7031188 0.35155938 [16,] 0.5588275 0.8823450 0.44117252 [17,] 0.7980045 0.4039910 0.20199549 [18,] 0.8348351 0.3303298 0.16516490 [19,] 0.8096260 0.3807481 0.19037404 [20,] 0.7275894 0.5448211 0.27241055 [21,] 0.6626386 0.6747228 0.33736139 [22,] 0.5434588 0.9130823 0.45654117 [23,] 0.4798176 0.9596353 0.52018235 [24,] 0.6984466 0.6031068 0.30155339 [25,] 0.5640389 0.8719222 0.43596108 [26,] 0.7027705 0.5944590 0.29722951 > postscript(file="/var/www/html/rcomp/tmp/1z04d1290883230.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/2z04d1290883230.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/3s93g1290883230.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/4s93g1290883230.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/5s93g1290883230.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 = 69 Frequency = 1 1 2 3 4 5 6 268.269105 665.823343 107.721702 95.994445 110.494636 -386.828446 7 8 9 10 11 12 -111.336565 30.952163 -118.673445 -84.949050 68.298548 87.643611 13 14 15 16 17 18 -375.009203 -103.335099 -434.588102 94.375394 -141.196739 -84.413471 19 20 21 22 23 24 105.845771 1.829561 108.276118 78.521728 -47.380224 -402.919620 25 26 27 28 29 30 261.778435 -222.783983 -58.946974 209.195519 -212.121643 97.138154 31 32 33 34 35 36 -250.985013 -38.007605 152.148443 145.773896 282.936261 -72.226884 37 38 39 40 41 42 -87.164227 -531.511257 219.886979 127.987112 92.528062 105.915594 43 44 45 46 47 48 -33.825856 222.734471 255.635567 -208.443950 -75.381790 216.085845 49 50 51 52 53 54 97.506588 -214.612692 50.568035 -341.861779 122.758757 -51.284474 55 56 57 58 59 60 20.038851 -158.424528 105.605993 69.097376 -228.472795 171.417049 61 62 63 64 65 66 -165.380698 406.419688 115.358360 -185.690691 27.536926 319.472642 67 68 69 270.262811 -59.084062 -502.992676 > postscript(file="/var/www/html/rcomp/tmp/63j2j1290883230.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 = 69 Frequency = 1 lag(myerror, k = 1) myerror 0 268.269105 NA 1 665.823343 268.269105 2 107.721702 665.823343 3 95.994445 107.721702 4 110.494636 95.994445 5 -386.828446 110.494636 6 -111.336565 -386.828446 7 30.952163 -111.336565 8 -118.673445 30.952163 9 -84.949050 -118.673445 10 68.298548 -84.949050 11 87.643611 68.298548 12 -375.009203 87.643611 13 -103.335099 -375.009203 14 -434.588102 -103.335099 15 94.375394 -434.588102 16 -141.196739 94.375394 17 -84.413471 -141.196739 18 105.845771 -84.413471 19 1.829561 105.845771 20 108.276118 1.829561 21 78.521728 108.276118 22 -47.380224 78.521728 23 -402.919620 -47.380224 24 261.778435 -402.919620 25 -222.783983 261.778435 26 -58.946974 -222.783983 27 209.195519 -58.946974 28 -212.121643 209.195519 29 97.138154 -212.121643 30 -250.985013 97.138154 31 -38.007605 -250.985013 32 152.148443 -38.007605 33 145.773896 152.148443 34 282.936261 145.773896 35 -72.226884 282.936261 36 -87.164227 -72.226884 37 -531.511257 -87.164227 38 219.886979 -531.511257 39 127.987112 219.886979 40 92.528062 127.987112 41 105.915594 92.528062 42 -33.825856 105.915594 43 222.734471 -33.825856 44 255.635567 222.734471 45 -208.443950 255.635567 46 -75.381790 -208.443950 47 216.085845 -75.381790 48 97.506588 216.085845 49 -214.612692 97.506588 50 50.568035 -214.612692 51 -341.861779 50.568035 52 122.758757 -341.861779 53 -51.284474 122.758757 54 20.038851 -51.284474 55 -158.424528 20.038851 56 105.605993 -158.424528 57 69.097376 105.605993 58 -228.472795 69.097376 59 171.417049 -228.472795 60 -165.380698 171.417049 61 406.419688 -165.380698 62 115.358360 406.419688 63 -185.690691 115.358360 64 27.536926 -185.690691 65 319.472642 27.536926 66 270.262811 319.472642 67 -59.084062 270.262811 68 -502.992676 -59.084062 69 NA -502.992676 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] 665.823343 268.269105 [2,] 107.721702 665.823343 [3,] 95.994445 107.721702 [4,] 110.494636 95.994445 [5,] -386.828446 110.494636 [6,] -111.336565 -386.828446 [7,] 30.952163 -111.336565 [8,] -118.673445 30.952163 [9,] -84.949050 -118.673445 [10,] 68.298548 -84.949050 [11,] 87.643611 68.298548 [12,] -375.009203 87.643611 [13,] -103.335099 -375.009203 [14,] -434.588102 -103.335099 [15,] 94.375394 -434.588102 [16,] -141.196739 94.375394 [17,] -84.413471 -141.196739 [18,] 105.845771 -84.413471 [19,] 1.829561 105.845771 [20,] 108.276118 1.829561 [21,] 78.521728 108.276118 [22,] -47.380224 78.521728 [23,] -402.919620 -47.380224 [24,] 261.778435 -402.919620 [25,] -222.783983 261.778435 [26,] -58.946974 -222.783983 [27,] 209.195519 -58.946974 [28,] -212.121643 209.195519 [29,] 97.138154 -212.121643 [30,] -250.985013 97.138154 [31,] -38.007605 -250.985013 [32,] 152.148443 -38.007605 [33,] 145.773896 152.148443 [34,] 282.936261 145.773896 [35,] -72.226884 282.936261 [36,] -87.164227 -72.226884 [37,] -531.511257 -87.164227 [38,] 219.886979 -531.511257 [39,] 127.987112 219.886979 [40,] 92.528062 127.987112 [41,] 105.915594 92.528062 [42,] -33.825856 105.915594 [43,] 222.734471 -33.825856 [44,] 255.635567 222.734471 [45,] -208.443950 255.635567 [46,] -75.381790 -208.443950 [47,] 216.085845 -75.381790 [48,] 97.506588 216.085845 [49,] -214.612692 97.506588 [50,] 50.568035 -214.612692 [51,] -341.861779 50.568035 [52,] 122.758757 -341.861779 [53,] -51.284474 122.758757 [54,] 20.038851 -51.284474 [55,] -158.424528 20.038851 [56,] 105.605993 -158.424528 [57,] 69.097376 105.605993 [58,] -228.472795 69.097376 [59,] 171.417049 -228.472795 [60,] -165.380698 171.417049 [61,] 406.419688 -165.380698 [62,] 115.358360 406.419688 [63,] -185.690691 115.358360 [64,] 27.536926 -185.690691 [65,] 319.472642 27.536926 [66,] 270.262811 319.472642 [67,] -59.084062 270.262811 [68,] -502.992676 -59.084062 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 665.823343 268.269105 2 107.721702 665.823343 3 95.994445 107.721702 4 110.494636 95.994445 5 -386.828446 110.494636 6 -111.336565 -386.828446 7 30.952163 -111.336565 8 -118.673445 30.952163 9 -84.949050 -118.673445 10 68.298548 -84.949050 11 87.643611 68.298548 12 -375.009203 87.643611 13 -103.335099 -375.009203 14 -434.588102 -103.335099 15 94.375394 -434.588102 16 -141.196739 94.375394 17 -84.413471 -141.196739 18 105.845771 -84.413471 19 1.829561 105.845771 20 108.276118 1.829561 21 78.521728 108.276118 22 -47.380224 78.521728 23 -402.919620 -47.380224 24 261.778435 -402.919620 25 -222.783983 261.778435 26 -58.946974 -222.783983 27 209.195519 -58.946974 28 -212.121643 209.195519 29 97.138154 -212.121643 30 -250.985013 97.138154 31 -38.007605 -250.985013 32 152.148443 -38.007605 33 145.773896 152.148443 34 282.936261 145.773896 35 -72.226884 282.936261 36 -87.164227 -72.226884 37 -531.511257 -87.164227 38 219.886979 -531.511257 39 127.987112 219.886979 40 92.528062 127.987112 41 105.915594 92.528062 42 -33.825856 105.915594 43 222.734471 -33.825856 44 255.635567 222.734471 45 -208.443950 255.635567 46 -75.381790 -208.443950 47 216.085845 -75.381790 48 97.506588 216.085845 49 -214.612692 97.506588 50 50.568035 -214.612692 51 -341.861779 50.568035 52 122.758757 -341.861779 53 -51.284474 122.758757 54 20.038851 -51.284474 55 -158.424528 20.038851 56 105.605993 -158.424528 57 69.097376 105.605993 58 -228.472795 69.097376 59 171.417049 -228.472795 60 -165.380698 171.417049 61 406.419688 -165.380698 62 115.358360 406.419688 63 -185.690691 115.358360 64 27.536926 -185.690691 65 319.472642 27.536926 66 270.262811 319.472642 67 -59.084062 270.262811 68 -502.992676 -59.084062 > 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/7wsk41290883230.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/8wsk41290883230.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/9wsk41290883230.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/10o1171290883230.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/11s2zv1290883230.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/12d2g01290883230.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/132lvc1290883230.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/14ducx1290883230.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/15gvs31290883230.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/16u58t1290883230.tab") + } > > try(system("convert tmp/1z04d1290883230.ps tmp/1z04d1290883230.png",intern=TRUE)) character(0) > try(system("convert tmp/2z04d1290883230.ps tmp/2z04d1290883230.png",intern=TRUE)) character(0) > try(system("convert tmp/3s93g1290883230.ps tmp/3s93g1290883230.png",intern=TRUE)) character(0) > try(system("convert tmp/4s93g1290883230.ps tmp/4s93g1290883230.png",intern=TRUE)) character(0) > try(system("convert tmp/5s93g1290883230.ps tmp/5s93g1290883230.png",intern=TRUE)) character(0) > try(system("convert tmp/63j2j1290883230.ps tmp/63j2j1290883230.png",intern=TRUE)) character(0) > try(system("convert tmp/7wsk41290883230.ps tmp/7wsk41290883230.png",intern=TRUE)) character(0) > try(system("convert tmp/8wsk41290883230.ps tmp/8wsk41290883230.png",intern=TRUE)) character(0) > try(system("convert tmp/9wsk41290883230.ps tmp/9wsk41290883230.png",intern=TRUE)) character(0) > try(system("convert tmp/10o1171290883230.ps tmp/10o1171290883230.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 3.034 1.978 6.901