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(10102 + ,8863 + ,8366 + ,8236 + ,12008 + ,8463 + ,10102 + ,8626 + ,8253 + ,9169 + ,9114 + ,8463 + ,8863 + ,7733 + ,8788 + ,8563 + ,9114 + ,10102 + ,8366 + ,8417 + ,8872 + ,8563 + ,8463 + ,8626 + ,8247 + ,8301 + ,8872 + ,9114 + ,8863 + ,8197 + ,8301 + ,8301 + ,8563 + ,10102 + ,8236 + ,8278 + ,8301 + ,8872 + ,8463 + ,8253 + ,7736 + ,8278 + ,8301 + ,9114 + ,7733 + ,7973 + ,7736 + ,8301 + ,8563 + ,8366 + ,8268 + ,7973 + ,8278 + ,8872 + ,8626 + ,9476 + ,8268 + ,7736 + ,8301 + ,8863 + ,11100 + ,9476 + ,7973 + ,8301 + ,10102 + ,8962 + ,11100 + ,8268 + ,8278 + ,8463 + ,9173 + ,8962 + ,9476 + ,7736 + ,9114 + ,8738 + ,9173 + ,11100 + ,7973 + ,8563 + ,8459 + ,8738 + ,8962 + ,8268 + ,8872 + ,8078 + ,8459 + ,9173 + ,9476 + ,8301 + ,8411 + ,8078 + ,8738 + ,11100 + ,8301 + ,8291 + ,8411 + ,8459 + ,8962 + ,8278 + ,7810 + ,8291 + ,8078 + ,9173 + ,7736 + ,8616 + ,7810 + ,8411 + ,8738 + ,7973 + ,8312 + ,8616 + ,8291 + ,8459 + ,8268 + ,9692 + ,8312 + ,7810 + ,8078 + ,9476 + ,9911 + ,9692 + ,8616 + ,8411 + ,11100 + ,8915 + ,9911 + ,8312 + ,8291 + ,8962 + ,9452 + ,8915 + ,9692 + ,7810 + ,9173 + ,9112 + ,9452 + ,9911 + ,8616 + ,8738 + ,8472 + ,9112 + ,8915 + ,8312 + ,8459 + ,8230 + ,8472 + ,9452 + ,9692 + ,8078 + ,8384 + ,8230 + ,9112 + ,9911 + ,8411 + ,8625 + ,8384 + ,8472 + ,8915 + ,8291 + ,8221 + ,8625 + ,8230 + ,9452 + ,7810 + ,8649 + ,8221 + ,8384 + ,9112 + ,8616 + ,8625 + ,8649 + ,8625 + ,8472 + ,8312 + ,10443 + ,8625 + ,8221 + ,8230 + ,9692 + ,10357 + ,10443 + ,8649 + ,8384 + ,9911 + ,8586 + ,10357 + ,8625 + ,8625 + ,8915 + ,8892 + ,8586 + ,10443 + ,8221 + ,9452 + ,8329 + ,8892 + ,10357 + ,8649 + ,9112 + ,8101 + ,8329 + ,8586 + ,8625 + ,8472 + ,7922 + ,8101 + ,8892 + ,10443 + ,8230 + ,8120 + ,7922 + ,8329 + ,10357 + ,8384 + ,7838 + ,8120 + ,8101 + ,8586 + ,8625 + ,7735 + ,7838 + ,7922 + ,8892 + ,8221 + ,8406 + ,7735 + ,8120 + ,8329 + ,8649 + ,8209 + ,8406 + ,7838 + ,8101 + ,8625 + ,9451 + ,8209 + ,7735 + ,7922 + ,10443 + ,10041 + ,9451 + ,8406 + ,8120 + ,10357 + ,9411 + ,10041 + ,8209 + ,7838 + ,8586 + ,10405 + ,9411 + ,9451 + ,7735 + ,8892 + ,8467 + ,10405 + ,10041 + ,8406 + ,8329 + ,8464 + ,8467 + ,9411 + ,8209 + ,8101 + ,8102 + ,8464 + ,10405 + ,9451 + ,7922 + ,7627 + ,8102 + ,8467 + ,10041 + ,8120 + ,7513 + ,7627 + ,8464 + ,9411 + ,7838 + ,7510 + ,7513 + ,8102 + ,10405 + ,7735 + ,8291 + ,7510 + ,7627 + ,8467 + ,8406 + ,8064 + ,8291 + ,7513 + ,8464 + ,8209 + ,9383 + ,8064 + ,7510 + ,8102 + ,9451 + ,9706 + ,9383 + ,8291 + ,7627 + ,10041 + ,8579 + ,9706 + ,8064 + ,7513 + ,9411 + ,9474 + ,8579 + ,9383 + ,7510 + ,10405 + ,8318 + ,9474 + ,9706 + ,8291 + ,8467 + ,8213 + ,8318 + ,8579 + ,8064 + ,8464 + ,8059 + ,8213 + ,9474 + ,9383 + ,8102 + ,9111 + ,8059 + ,8318 + ,9706 + ,7627 + ,7708 + ,9111 + ,8213 + ,8579 + ,7513 + ,7680 + ,7708 + ,8059 + ,9474 + ,7510 + ,8014 + ,7680 + ,9111 + ,8318 + ,8291 + ,8007 + ,8014 + ,7708 + ,8213 + ,8064 + ,8718 + ,8007 + ,7680 + ,8059 + ,9383 + ,9486 + ,8718 + ,8014 + ,9111 + ,9706 + ,9113 + ,9486 + ,8007 + ,7708 + ,8579 + ,9025 + ,9113 + ,8718 + ,7680 + ,9474 + ,8476 + ,9025 + ,9486 + ,8014 + ,8318 + ,7952 + ,8476 + ,9113 + ,8007 + ,8213 + ,7759 + ,7952 + ,9025 + ,8718 + ,8059 + ,7835 + ,7759 + ,8476 + ,9486 + ,9111 + ,7600 + ,7835 + ,7952 + ,9113 + ,7708 + ,7651 + ,7600 + ,7759 + ,9025 + ,7680 + ,8319 + ,7651 + ,7835 + ,8476 + ,8014 + ,8812 + ,8319 + ,7600 + ,7952 + ,8007 + ,8630 + ,8812 + ,7651 + ,7759 + ,8718) + ,dim=c(5 + ,84) + ,dimnames=list(c('Yt' + ,'Yt-1' + ,'Yt-3' + ,'Yt-6' + ,'Yt-12 ') + ,1:84)) > y <- array(NA,dim=c(5,84),dimnames=list(c('Yt','Yt-1','Yt-3','Yt-6','Yt-12 '),1:84)) > 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 = 'Do not include Seasonal 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-3 Yt-6 Yt-12\r 1 10102 8863 8366 8236 12008 2 8463 10102 8626 8253 9169 3 9114 8463 8863 7733 8788 4 8563 9114 10102 8366 8417 5 8872 8563 8463 8626 8247 6 8301 8872 9114 8863 8197 7 8301 8301 8563 10102 8236 8 8278 8301 8872 8463 8253 9 7736 8278 8301 9114 7733 10 7973 7736 8301 8563 8366 11 8268 7973 8278 8872 8626 12 9476 8268 7736 8301 8863 13 11100 9476 7973 8301 10102 14 8962 11100 8268 8278 8463 15 9173 8962 9476 7736 9114 16 8738 9173 11100 7973 8563 17 8459 8738 8962 8268 8872 18 8078 8459 9173 9476 8301 19 8411 8078 8738 11100 8301 20 8291 8411 8459 8962 8278 21 7810 8291 8078 9173 7736 22 8616 7810 8411 8738 7973 23 8312 8616 8291 8459 8268 24 9692 8312 7810 8078 9476 25 9911 9692 8616 8411 11100 26 8915 9911 8312 8291 8962 27 9452 8915 9692 7810 9173 28 9112 9452 9911 8616 8738 29 8472 9112 8915 8312 8459 30 8230 8472 9452 9692 8078 31 8384 8230 9112 9911 8411 32 8625 8384 8472 8915 8291 33 8221 8625 8230 9452 7810 34 8649 8221 8384 9112 8616 35 8625 8649 8625 8472 8312 36 10443 8625 8221 8230 9692 37 10357 10443 8649 8384 9911 38 8586 10357 8625 8625 8915 39 8892 8586 10443 8221 9452 40 8329 8892 10357 8649 9112 41 8101 8329 8586 8625 8472 42 7922 8101 8892 10443 8230 43 8120 7922 8329 10357 8384 44 7838 8120 8101 8586 8625 45 7735 7838 7922 8892 8221 46 8406 7735 8120 8329 8649 47 8209 8406 7838 8101 8625 48 9451 8209 7735 7922 10443 49 10041 9451 8406 8120 10357 50 9411 10041 8209 7838 8586 51 10405 9411 9451 7735 8892 52 8467 10405 10041 8406 8329 53 8464 8467 9411 8209 8101 54 8102 8464 10405 9451 7922 55 7627 8102 8467 10041 8120 56 7513 7627 8464 9411 7838 57 7510 7513 8102 10405 7735 58 8291 7510 7627 8467 8406 59 8064 8291 7513 8464 8209 60 9383 8064 7510 8102 9451 61 9706 9383 8291 7627 10041 62 8579 9706 8064 7513 9411 63 9474 8579 9383 7510 10405 64 8318 9474 9706 8291 8467 65 8213 8318 8579 8064 8464 66 8059 8213 9474 9383 8102 67 9111 8059 8318 9706 7627 68 7708 9111 8213 8579 7513 69 7680 7708 8059 9474 7510 70 8014 7680 9111 8318 8291 71 8007 8014 7708 8213 8064 72 8718 8007 7680 8059 9383 73 9486 8718 8014 9111 9706 74 9113 9486 8007 7708 8579 75 9025 9113 8718 7680 9474 76 8476 9025 9486 8014 8318 77 7952 8476 9113 8007 8213 78 7759 7952 9025 8718 8059 79 7835 7759 8476 9486 9111 80 7600 7835 7952 9113 7708 81 7651 7600 7759 9025 7680 82 8319 7651 7835 8476 8014 83 8812 8319 7600 7952 8007 84 8630 8812 7651 7759 8718 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) `Yt-1` `Yt-3` `Yt-6` `Yt-12\r` 3000.29080 0.24170 -0.06373 -0.10574 0.57620 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -881.56 -282.67 -72.13 196.69 1426.65 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 3000.29080 1347.53940 2.226 0.02883 * `Yt-1` 0.24170 0.07984 3.027 0.00333 ** `Yt-3` -0.06373 0.07025 -0.907 0.36710 `Yt-6` -0.10574 0.08020 -1.318 0.19116 `Yt-12\r` 0.57620 0.07139 8.071 6.34e-12 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 459.4 on 79 degrees of freedom Multiple R-squared: 0.6499, Adjusted R-squared: 0.6322 F-statistic: 36.67 on 4 and 79 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.2763355 0.55267103 0.72366449 [2,] 0.3278247 0.65564946 0.67217527 [3,] 0.4101144 0.82022888 0.58988556 [4,] 0.3002409 0.60048171 0.69975914 [5,] 0.5443385 0.91132293 0.45566146 [6,] 0.9673272 0.06534555 0.03267277 [7,] 0.9555496 0.08890083 0.04445042 [8,] 0.9333387 0.13332263 0.06666132 [9,] 0.9134854 0.17302924 0.08651462 [10,] 0.8976752 0.20464958 0.10232479 [11,] 0.8556732 0.28865360 0.14432680 [12,] 0.8531342 0.29373165 0.14686583 [13,] 0.8044184 0.39116325 0.19558162 [14,] 0.7621904 0.47561917 0.23780958 [15,] 0.7627814 0.47443727 0.23721863 [16,] 0.7103395 0.57932099 0.28966049 [17,] 0.7040720 0.59185596 0.29592798 [18,] 0.6721116 0.65577679 0.32788840 [19,] 0.6176541 0.76469188 0.38234594 [20,] 0.6099953 0.78000941 0.39000470 [21,] 0.5864282 0.82714364 0.41357182 [22,] 0.5274209 0.94515826 0.47257913 [23,] 0.4629923 0.92598457 0.53700772 [24,] 0.4008737 0.80174748 0.59912626 [25,] 0.3532377 0.70647548 0.64676226 [26,] 0.2954932 0.59098636 0.70450682 [27,] 0.2450278 0.49005558 0.75497221 [28,] 0.1998307 0.39966144 0.80016928 [29,] 0.4893610 0.97872192 0.51063904 [30,] 0.5512071 0.89758588 0.44879294 [31,] 0.5755324 0.84893521 0.42446760 [32,] 0.5179891 0.96402178 0.48201089 [33,] 0.5122313 0.97553742 0.48776871 [34,] 0.4986891 0.99737811 0.50131094 [35,] 0.4357656 0.87153113 0.56423443 [36,] 0.3745383 0.74907652 0.62546174 [37,] 0.4759290 0.95185802 0.52407099 [38,] 0.4859091 0.97181816 0.51409092 [39,] 0.4272283 0.85445661 0.57277170 [40,] 0.4242591 0.84851819 0.57574090 [41,] 0.3763670 0.75273394 0.62363303 [42,] 0.3302075 0.66041492 0.66979254 [43,] 0.3099000 0.61980001 0.69009999 [44,] 0.8605861 0.27882783 0.13941391 [45,] 0.8280845 0.34383096 0.17191548 [46,] 0.8025685 0.39486297 0.19743149 [47,] 0.7780245 0.44395096 0.22197548 [48,] 0.7626205 0.47475907 0.23737954 [49,] 0.7319353 0.53612939 0.26806469 [50,] 0.6966104 0.60677921 0.30338961 [51,] 0.6294907 0.74101865 0.37050932 [52,] 0.5959399 0.80812011 0.40406006 [53,] 0.5755017 0.84899661 0.42449831 [54,] 0.5283998 0.94320045 0.47160023 [55,] 0.6639294 0.67214111 0.33607055 [56,] 0.6441101 0.71177980 0.35588990 [57,] 0.5907984 0.81840315 0.40920158 [58,] 0.5154631 0.96907388 0.48453694 [59,] 0.4300113 0.86002254 0.56998873 [60,] 0.9543646 0.09127089 0.04563545 [61,] 0.9665525 0.06689509 0.03344754 [62,] 0.9423074 0.11538529 0.05769265 [63,] 0.9299748 0.14005043 0.07002522 [64,] 0.8980664 0.20386726 0.10193363 [65,] 0.8368288 0.32634236 0.16317118 [66,] 0.9460670 0.10786592 0.05393296 [67,] 0.9058215 0.18835690 0.09417845 [68,] 0.8198154 0.36036922 0.18018461 [69,] 0.8857691 0.22846178 0.11423089 > postscript(file="/var/www/html/rcomp/tmp/1g78r1292597060.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/2g78r1292597060.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/3g78r1292597060.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/4qy7c1292597060.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/5qy7c1292597060.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 = 84 Frequency = 1 1 2 3 4 5 -555.49458986 -839.77132163 387.03034315 38.34074669 501.51959443 6 7 8 9 10 -48.81102929 162.62985563 -23.78323593 -228.15091485 -283.14436599 11 12 13 14 15 -164.03157907 741.18965129 1374.40461962 -195.36552884 176.96048929 16 17 18 19 20 136.99725670 -319.95875535 -163.33328156 405.75797438 -25.32966370 21 22 23 24 25 -166.99375443 593.93003347 -112.01034519 574.48048760 -389.24255360 26 27 28 29 30 -238.32450323 454.91436477 334.94876939 -157.72839406 154.63625927 31 32 33 34 35 176.74491602 303.56437358 159.82647115 194.92057680 190.31965636 36 37 38 39 40 1167.63214245 559.58611466 -592.77950416 -95.00727869 -496.28446082 41 42 43 44 45 -334.83394696 -107.54897539 0.01021248 -670.50705090 -451.61264575 46 47 48 49 50 -49.24449388 -436.67830356 -220.08303008 182.97067207 388.44045877 51 52 53 54 55 1426.65278456 -318.65074412 217.16609568 153.70381058 -408.99992463 56 57 58 59 60 -312.51049731 -146.57028353 13.33058833 -296.51072689 323.24805658 61 62 63 64 65 -12.97330234 -881.55858249 -203.16326949 -355.64833553 -275.33219580 66 67 68 69 70 1.13682741 1324.54101354 -392.90540502 4.75746568 -159.68284224 71 72 73 74 75 -217.12445814 -282.50684109 260.05324478 202.00049951 -269.19367670 76 77 78 79 80 -46.57960964 -401.89329736 -309.93228746 -747.22091653 -265.01721321 81 82 83 84 -162.68751417 247.32680536 512.51860173 -215.47640328 > postscript(file="/var/www/html/rcomp/tmp/6qy7c1292597060.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 = 84 Frequency = 1 lag(myerror, k = 1) myerror 0 -555.49458986 NA 1 -839.77132163 -555.49458986 2 387.03034315 -839.77132163 3 38.34074669 387.03034315 4 501.51959443 38.34074669 5 -48.81102929 501.51959443 6 162.62985563 -48.81102929 7 -23.78323593 162.62985563 8 -228.15091485 -23.78323593 9 -283.14436599 -228.15091485 10 -164.03157907 -283.14436599 11 741.18965129 -164.03157907 12 1374.40461962 741.18965129 13 -195.36552884 1374.40461962 14 176.96048929 -195.36552884 15 136.99725670 176.96048929 16 -319.95875535 136.99725670 17 -163.33328156 -319.95875535 18 405.75797438 -163.33328156 19 -25.32966370 405.75797438 20 -166.99375443 -25.32966370 21 593.93003347 -166.99375443 22 -112.01034519 593.93003347 23 574.48048760 -112.01034519 24 -389.24255360 574.48048760 25 -238.32450323 -389.24255360 26 454.91436477 -238.32450323 27 334.94876939 454.91436477 28 -157.72839406 334.94876939 29 154.63625927 -157.72839406 30 176.74491602 154.63625927 31 303.56437358 176.74491602 32 159.82647115 303.56437358 33 194.92057680 159.82647115 34 190.31965636 194.92057680 35 1167.63214245 190.31965636 36 559.58611466 1167.63214245 37 -592.77950416 559.58611466 38 -95.00727869 -592.77950416 39 -496.28446082 -95.00727869 40 -334.83394696 -496.28446082 41 -107.54897539 -334.83394696 42 0.01021248 -107.54897539 43 -670.50705090 0.01021248 44 -451.61264575 -670.50705090 45 -49.24449388 -451.61264575 46 -436.67830356 -49.24449388 47 -220.08303008 -436.67830356 48 182.97067207 -220.08303008 49 388.44045877 182.97067207 50 1426.65278456 388.44045877 51 -318.65074412 1426.65278456 52 217.16609568 -318.65074412 53 153.70381058 217.16609568 54 -408.99992463 153.70381058 55 -312.51049731 -408.99992463 56 -146.57028353 -312.51049731 57 13.33058833 -146.57028353 58 -296.51072689 13.33058833 59 323.24805658 -296.51072689 60 -12.97330234 323.24805658 61 -881.55858249 -12.97330234 62 -203.16326949 -881.55858249 63 -355.64833553 -203.16326949 64 -275.33219580 -355.64833553 65 1.13682741 -275.33219580 66 1324.54101354 1.13682741 67 -392.90540502 1324.54101354 68 4.75746568 -392.90540502 69 -159.68284224 4.75746568 70 -217.12445814 -159.68284224 71 -282.50684109 -217.12445814 72 260.05324478 -282.50684109 73 202.00049951 260.05324478 74 -269.19367670 202.00049951 75 -46.57960964 -269.19367670 76 -401.89329736 -46.57960964 77 -309.93228746 -401.89329736 78 -747.22091653 -309.93228746 79 -265.01721321 -747.22091653 80 -162.68751417 -265.01721321 81 247.32680536 -162.68751417 82 512.51860173 247.32680536 83 -215.47640328 512.51860173 84 NA -215.47640328 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -839.77132163 -555.49458986 [2,] 387.03034315 -839.77132163 [3,] 38.34074669 387.03034315 [4,] 501.51959443 38.34074669 [5,] -48.81102929 501.51959443 [6,] 162.62985563 -48.81102929 [7,] -23.78323593 162.62985563 [8,] -228.15091485 -23.78323593 [9,] -283.14436599 -228.15091485 [10,] -164.03157907 -283.14436599 [11,] 741.18965129 -164.03157907 [12,] 1374.40461962 741.18965129 [13,] -195.36552884 1374.40461962 [14,] 176.96048929 -195.36552884 [15,] 136.99725670 176.96048929 [16,] -319.95875535 136.99725670 [17,] -163.33328156 -319.95875535 [18,] 405.75797438 -163.33328156 [19,] -25.32966370 405.75797438 [20,] -166.99375443 -25.32966370 [21,] 593.93003347 -166.99375443 [22,] -112.01034519 593.93003347 [23,] 574.48048760 -112.01034519 [24,] -389.24255360 574.48048760 [25,] -238.32450323 -389.24255360 [26,] 454.91436477 -238.32450323 [27,] 334.94876939 454.91436477 [28,] -157.72839406 334.94876939 [29,] 154.63625927 -157.72839406 [30,] 176.74491602 154.63625927 [31,] 303.56437358 176.74491602 [32,] 159.82647115 303.56437358 [33,] 194.92057680 159.82647115 [34,] 190.31965636 194.92057680 [35,] 1167.63214245 190.31965636 [36,] 559.58611466 1167.63214245 [37,] -592.77950416 559.58611466 [38,] -95.00727869 -592.77950416 [39,] -496.28446082 -95.00727869 [40,] -334.83394696 -496.28446082 [41,] -107.54897539 -334.83394696 [42,] 0.01021248 -107.54897539 [43,] -670.50705090 0.01021248 [44,] -451.61264575 -670.50705090 [45,] -49.24449388 -451.61264575 [46,] -436.67830356 -49.24449388 [47,] -220.08303008 -436.67830356 [48,] 182.97067207 -220.08303008 [49,] 388.44045877 182.97067207 [50,] 1426.65278456 388.44045877 [51,] -318.65074412 1426.65278456 [52,] 217.16609568 -318.65074412 [53,] 153.70381058 217.16609568 [54,] -408.99992463 153.70381058 [55,] -312.51049731 -408.99992463 [56,] -146.57028353 -312.51049731 [57,] 13.33058833 -146.57028353 [58,] -296.51072689 13.33058833 [59,] 323.24805658 -296.51072689 [60,] -12.97330234 323.24805658 [61,] -881.55858249 -12.97330234 [62,] -203.16326949 -881.55858249 [63,] -355.64833553 -203.16326949 [64,] -275.33219580 -355.64833553 [65,] 1.13682741 -275.33219580 [66,] 1324.54101354 1.13682741 [67,] -392.90540502 1324.54101354 [68,] 4.75746568 -392.90540502 [69,] -159.68284224 4.75746568 [70,] -217.12445814 -159.68284224 [71,] -282.50684109 -217.12445814 [72,] 260.05324478 -282.50684109 [73,] 202.00049951 260.05324478 [74,] -269.19367670 202.00049951 [75,] -46.57960964 -269.19367670 [76,] -401.89329736 -46.57960964 [77,] -309.93228746 -401.89329736 [78,] -747.22091653 -309.93228746 [79,] -265.01721321 -747.22091653 [80,] -162.68751417 -265.01721321 [81,] 247.32680536 -162.68751417 [82,] 512.51860173 247.32680536 [83,] -215.47640328 512.51860173 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -839.77132163 -555.49458986 2 387.03034315 -839.77132163 3 38.34074669 387.03034315 4 501.51959443 38.34074669 5 -48.81102929 501.51959443 6 162.62985563 -48.81102929 7 -23.78323593 162.62985563 8 -228.15091485 -23.78323593 9 -283.14436599 -228.15091485 10 -164.03157907 -283.14436599 11 741.18965129 -164.03157907 12 1374.40461962 741.18965129 13 -195.36552884 1374.40461962 14 176.96048929 -195.36552884 15 136.99725670 176.96048929 16 -319.95875535 136.99725670 17 -163.33328156 -319.95875535 18 405.75797438 -163.33328156 19 -25.32966370 405.75797438 20 -166.99375443 -25.32966370 21 593.93003347 -166.99375443 22 -112.01034519 593.93003347 23 574.48048760 -112.01034519 24 -389.24255360 574.48048760 25 -238.32450323 -389.24255360 26 454.91436477 -238.32450323 27 334.94876939 454.91436477 28 -157.72839406 334.94876939 29 154.63625927 -157.72839406 30 176.74491602 154.63625927 31 303.56437358 176.74491602 32 159.82647115 303.56437358 33 194.92057680 159.82647115 34 190.31965636 194.92057680 35 1167.63214245 190.31965636 36 559.58611466 1167.63214245 37 -592.77950416 559.58611466 38 -95.00727869 -592.77950416 39 -496.28446082 -95.00727869 40 -334.83394696 -496.28446082 41 -107.54897539 -334.83394696 42 0.01021248 -107.54897539 43 -670.50705090 0.01021248 44 -451.61264575 -670.50705090 45 -49.24449388 -451.61264575 46 -436.67830356 -49.24449388 47 -220.08303008 -436.67830356 48 182.97067207 -220.08303008 49 388.44045877 182.97067207 50 1426.65278456 388.44045877 51 -318.65074412 1426.65278456 52 217.16609568 -318.65074412 53 153.70381058 217.16609568 54 -408.99992463 153.70381058 55 -312.51049731 -408.99992463 56 -146.57028353 -312.51049731 57 13.33058833 -146.57028353 58 -296.51072689 13.33058833 59 323.24805658 -296.51072689 60 -12.97330234 323.24805658 61 -881.55858249 -12.97330234 62 -203.16326949 -881.55858249 63 -355.64833553 -203.16326949 64 -275.33219580 -355.64833553 65 1.13682741 -275.33219580 66 1324.54101354 1.13682741 67 -392.90540502 1324.54101354 68 4.75746568 -392.90540502 69 -159.68284224 4.75746568 70 -217.12445814 -159.68284224 71 -282.50684109 -217.12445814 72 260.05324478 -282.50684109 73 202.00049951 260.05324478 74 -269.19367670 202.00049951 75 -46.57960964 -269.19367670 76 -401.89329736 -46.57960964 77 -309.93228746 -401.89329736 78 -747.22091653 -309.93228746 79 -265.01721321 -747.22091653 80 -162.68751417 -265.01721321 81 247.32680536 -162.68751417 82 512.51860173 247.32680536 83 -215.47640328 512.51860173 > 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/7jqof1292597060.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/8ch501292597060.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/9ch501292597060.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/10ch501292597060.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/11fz461292597060.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/12ji2u1292597060.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/13fsil1292597060.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/14iah81292597060.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/15lbxw1292597060.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/16h2v51292597060.tab") + } > > try(system("convert tmp/1g78r1292597060.ps tmp/1g78r1292597060.png",intern=TRUE)) character(0) > try(system("convert tmp/2g78r1292597060.ps tmp/2g78r1292597060.png",intern=TRUE)) character(0) > try(system("convert tmp/3g78r1292597060.ps tmp/3g78r1292597060.png",intern=TRUE)) character(0) > try(system("convert tmp/4qy7c1292597060.ps tmp/4qy7c1292597060.png",intern=TRUE)) character(0) > try(system("convert tmp/5qy7c1292597060.ps tmp/5qy7c1292597060.png",intern=TRUE)) character(0) > try(system("convert tmp/6qy7c1292597060.ps tmp/6qy7c1292597060.png",intern=TRUE)) character(0) > try(system("convert tmp/7jqof1292597060.ps tmp/7jqof1292597060.png",intern=TRUE)) character(0) > try(system("convert tmp/8ch501292597060.ps tmp/8ch501292597060.png",intern=TRUE)) character(0) > try(system("convert tmp/9ch501292597060.ps tmp/9ch501292597060.png",intern=TRUE)) character(0) > try(system("convert tmp/10ch501292597060.ps tmp/10ch501292597060.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.806 1.657 7.276