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(13807 + ,0 + ,19169 + ,22782 + ,20366 + ,29743 + ,0 + ,13807 + ,19169 + ,22782 + ,25591 + ,0 + ,29743 + ,13807 + ,19169 + ,29096 + ,0 + ,25591 + ,29743 + ,13807 + ,26482 + ,0 + ,29096 + ,25591 + ,29743 + ,22405 + ,0 + ,26482 + ,29096 + ,25591 + ,27044 + ,0 + ,22405 + ,26482 + ,29096 + ,17970 + ,0 + ,27044 + ,22405 + ,26482 + ,18730 + ,0 + ,17970 + ,27044 + ,22405 + ,19684 + ,0 + ,18730 + ,17970 + ,27044 + ,19785 + ,0 + ,19684 + ,18730 + ,17970 + ,18479 + ,0 + ,19785 + ,19684 + ,18730 + ,10698 + ,0 + ,18479 + ,19785 + ,19684 + ,31956 + ,0 + ,10698 + ,18479 + ,19785 + ,29506 + ,0 + ,31956 + ,10698 + ,18479 + ,34506 + ,0 + ,29506 + ,31956 + ,10698 + ,27165 + ,0 + ,34506 + ,29506 + ,31956 + ,26736 + ,0 + ,27165 + ,34506 + ,29506 + ,23691 + ,0 + ,26736 + ,27165 + ,34506 + ,18157 + ,0 + ,23691 + ,26736 + ,27165 + ,17328 + ,0 + ,18157 + ,23691 + ,26736 + ,18205 + ,0 + ,17328 + ,18157 + ,23691 + ,20995 + ,0 + ,18205 + ,17328 + ,18157 + ,17382 + ,0 + ,20995 + ,18205 + ,17328 + ,9367 + ,0 + ,17382 + ,20995 + ,18205 + ,31124 + ,0 + ,9367 + ,17382 + ,20995 + ,26551 + ,0 + ,31124 + ,9367 + ,17382 + ,30651 + ,0 + ,26551 + ,31124 + ,9367 + ,25859 + ,0 + ,30651 + ,26551 + ,31124 + ,25100 + ,0 + ,25859 + ,30651 + ,26551 + ,25778 + ,0 + ,25100 + ,25859 + ,30651 + ,20418 + ,0 + ,25778 + ,25100 + ,25859 + ,18688 + ,0 + ,20418 + ,25778 + ,25100 + ,20424 + ,0 + ,18688 + ,20418 + ,25778 + ,24776 + ,0 + ,20424 + ,18688 + ,20418 + ,19814 + ,0 + ,24776 + ,20424 + ,18688 + ,12738 + ,0 + ,19814 + ,24776 + ,20424 + ,31566 + ,0 + ,12738 + ,19814 + ,24776 + ,30111 + ,0 + ,31566 + ,12738 + ,19814 + ,30019 + ,0 + ,30111 + ,31566 + ,12738 + ,31934 + ,1 + ,30019 + ,30111 + ,31566 + ,25826 + ,1 + ,31934 + ,30019 + ,30111 + ,26835 + ,1 + ,25826 + ,31934 + ,30019 + ,20205 + ,1 + ,26835 + ,25826 + ,31934 + ,17789 + ,1 + ,20205 + ,26835 + ,25826 + ,20520 + ,1 + ,17789 + ,20205 + ,26835 + ,22518 + ,1 + ,20520 + ,17789 + ,20205 + ,15572 + ,1 + ,22518 + ,20520 + ,17789 + ,11509 + ,1 + ,15572 + ,22518 + ,20520 + ,25447 + ,1 + ,11509 + ,15572 + ,22518 + ,24090 + ,1 + ,25447 + ,11509 + ,15572 + ,27786 + ,1 + ,24090 + ,25447 + ,11509 + ,26195 + ,1 + ,27786 + ,24090 + ,25447 + ,20516 + ,1 + ,26195 + ,27786 + ,24090 + ,22759 + ,1 + ,20516 + ,26195 + ,27786 + ,19028 + ,1 + ,22759 + ,20516 + ,26195 + ,16971 + ,1 + ,19028 + ,22759 + ,20516) + ,dim=c(5 + ,57) + ,dimnames=list(c('Y' + ,'X' + ,'Y1' + ,'Y2' + ,'Y3') + ,1:57)) > y <- array(NA,dim=c(5,57),dimnames=list(c('Y','X','Y1','Y2','Y3'),1:57)) > 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 M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t 1 13807 0 19169 22782 20366 1 0 0 0 0 0 0 0 0 0 0 1 2 29743 0 13807 19169 22782 0 1 0 0 0 0 0 0 0 0 0 2 3 25591 0 29743 13807 19169 0 0 1 0 0 0 0 0 0 0 0 3 4 29096 0 25591 29743 13807 0 0 0 1 0 0 0 0 0 0 0 4 5 26482 0 29096 25591 29743 0 0 0 0 1 0 0 0 0 0 0 5 6 22405 0 26482 29096 25591 0 0 0 0 0 1 0 0 0 0 0 6 7 27044 0 22405 26482 29096 0 0 0 0 0 0 1 0 0 0 0 7 8 17970 0 27044 22405 26482 0 0 0 0 0 0 0 1 0 0 0 8 9 18730 0 17970 27044 22405 0 0 0 0 0 0 0 0 1 0 0 9 10 19684 0 18730 17970 27044 0 0 0 0 0 0 0 0 0 1 0 10 11 19785 0 19684 18730 17970 0 0 0 0 0 0 0 0 0 0 1 11 12 18479 0 19785 19684 18730 0 0 0 0 0 0 0 0 0 0 0 12 13 10698 0 18479 19785 19684 1 0 0 0 0 0 0 0 0 0 0 13 14 31956 0 10698 18479 19785 0 1 0 0 0 0 0 0 0 0 0 14 15 29506 0 31956 10698 18479 0 0 1 0 0 0 0 0 0 0 0 15 16 34506 0 29506 31956 10698 0 0 0 1 0 0 0 0 0 0 0 16 17 27165 0 34506 29506 31956 0 0 0 0 1 0 0 0 0 0 0 17 18 26736 0 27165 34506 29506 0 0 0 0 0 1 0 0 0 0 0 18 19 23691 0 26736 27165 34506 0 0 0 0 0 0 1 0 0 0 0 19 20 18157 0 23691 26736 27165 0 0 0 0 0 0 0 1 0 0 0 20 21 17328 0 18157 23691 26736 0 0 0 0 0 0 0 0 1 0 0 21 22 18205 0 17328 18157 23691 0 0 0 0 0 0 0 0 0 1 0 22 23 20995 0 18205 17328 18157 0 0 0 0 0 0 0 0 0 0 1 23 24 17382 0 20995 18205 17328 0 0 0 0 0 0 0 0 0 0 0 24 25 9367 0 17382 20995 18205 1 0 0 0 0 0 0 0 0 0 0 25 26 31124 0 9367 17382 20995 0 1 0 0 0 0 0 0 0 0 0 26 27 26551 0 31124 9367 17382 0 0 1 0 0 0 0 0 0 0 0 27 28 30651 0 26551 31124 9367 0 0 0 1 0 0 0 0 0 0 0 28 29 25859 0 30651 26551 31124 0 0 0 0 1 0 0 0 0 0 0 29 30 25100 0 25859 30651 26551 0 0 0 0 0 1 0 0 0 0 0 30 31 25778 0 25100 25859 30651 0 0 0 0 0 0 1 0 0 0 0 31 32 20418 0 25778 25100 25859 0 0 0 0 0 0 0 1 0 0 0 32 33 18688 0 20418 25778 25100 0 0 0 0 0 0 0 0 1 0 0 33 34 20424 0 18688 20418 25778 0 0 0 0 0 0 0 0 0 1 0 34 35 24776 0 20424 18688 20418 0 0 0 0 0 0 0 0 0 0 1 35 36 19814 0 24776 20424 18688 0 0 0 0 0 0 0 0 0 0 0 36 37 12738 0 19814 24776 20424 1 0 0 0 0 0 0 0 0 0 0 37 38 31566 0 12738 19814 24776 0 1 0 0 0 0 0 0 0 0 0 38 39 30111 0 31566 12738 19814 0 0 1 0 0 0 0 0 0 0 0 39 40 30019 0 30111 31566 12738 0 0 0 1 0 0 0 0 0 0 0 40 41 31934 1 30019 30111 31566 0 0 0 0 1 0 0 0 0 0 0 41 42 25826 1 31934 30019 30111 0 0 0 0 0 1 0 0 0 0 0 42 43 26835 1 25826 31934 30019 0 0 0 0 0 0 1 0 0 0 0 43 44 20205 1 26835 25826 31934 0 0 0 0 0 0 0 1 0 0 0 44 45 17789 1 20205 26835 25826 0 0 0 0 0 0 0 0 1 0 0 45 46 20520 1 17789 20205 26835 0 0 0 0 0 0 0 0 0 1 0 46 47 22518 1 20520 17789 20205 0 0 0 0 0 0 0 0 0 0 1 47 48 15572 1 22518 20520 17789 0 0 0 0 0 0 0 0 0 0 0 48 49 11509 1 15572 22518 20520 1 0 0 0 0 0 0 0 0 0 0 49 50 25447 1 11509 15572 22518 0 1 0 0 0 0 0 0 0 0 0 50 51 24090 1 25447 11509 15572 0 0 1 0 0 0 0 0 0 0 0 51 52 27786 1 24090 25447 11509 0 0 0 1 0 0 0 0 0 0 0 52 53 26195 1 27786 24090 25447 0 0 0 0 1 0 0 0 0 0 0 53 54 20516 1 26195 27786 24090 0 0 0 0 0 1 0 0 0 0 0 54 55 22759 1 20516 26195 27786 0 0 0 0 0 0 1 0 0 0 0 55 56 19028 1 22759 20516 26195 0 0 0 0 0 0 0 1 0 0 0 56 57 16971 1 19028 22759 20516 0 0 0 0 0 0 0 0 1 0 0 57 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) X Y1 Y2 Y3 M1 4.707e+03 -8.896e+02 1.535e-01 4.366e-01 5.087e-02 -6.720e+03 M2 M3 M4 M5 M6 M7 1.427e+04 1.167e+04 7.645e+03 4.715e+03 4.603e+02 3.169e+03 M8 M9 M10 M11 t -1.445e+03 -2.091e+03 2.356e+03 5.209e+03 1.400e+01 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -3048.32 -928.23 53.19 843.24 3467.67 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 4.707e+03 3.579e+03 1.315 0.195926 X -8.896e+02 8.895e+02 -1.000 0.323284 Y1 1.535e-01 1.595e-01 0.963 0.341483 Y2 4.366e-01 1.436e-01 3.040 0.004160 ** Y3 5.087e-02 1.600e-01 0.318 0.752162 M1 -6.720e+03 1.491e+03 -4.507 5.62e-05 *** M2 1.427e+04 2.354e+03 6.060 3.89e-07 *** M3 1.167e+04 2.237e+03 5.216 5.94e-06 *** M4 7.645e+03 2.524e+03 3.029 0.004280 ** M5 4.715e+03 2.035e+03 2.317 0.025735 * M6 4.603e+02 1.984e+03 0.232 0.817678 M7 3.169e+03 2.205e+03 1.437 0.158401 M8 -1.445e+03 1.755e+03 -0.823 0.415339 M9 -2.091e+03 1.834e+03 -1.140 0.261068 M10 2.356e+03 2.052e+03 1.149 0.257576 M11 5.209e+03 1.360e+03 3.831 0.000441 *** t 1.400e+01 2.408e+01 0.581 0.564240 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 1786 on 40 degrees of freedom Multiple R-squared: 0.9341, Adjusted R-squared: 0.9077 F-statistic: 35.43 on 16 and 40 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.9091219 0.1817563 0.09087814 [2,] 0.8602758 0.2794485 0.13972424 [3,] 0.8712268 0.2575463 0.12877316 [4,] 0.8241657 0.3516686 0.17583432 [5,] 0.7584011 0.4831978 0.24159891 [6,] 0.7870890 0.4258219 0.21291097 [7,] 0.7725638 0.4548725 0.22743623 [8,] 0.6732450 0.6535100 0.32675499 [9,] 0.6245445 0.7509111 0.37545554 [10,] 0.8425172 0.3149655 0.15748276 [11,] 0.7802936 0.4394127 0.21970636 [12,] 0.6924074 0.6151851 0.30759257 [13,] 0.6390349 0.7219302 0.36096510 [14,] 0.5398169 0.9203661 0.46018306 [15,] 0.4526440 0.9052879 0.54735604 [16,] 0.4264832 0.8529664 0.57351681 [17,] 0.2918475 0.5836950 0.70815249 [18,] 0.2330853 0.4661707 0.76691467 > postscript(file="/var/www/html/rcomp/tmp/1dd0p1260972727.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/2n94s1260972727.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/3belu1260972727.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/4kma61260972727.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/5vdyc1260972727.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 = 57 Frequency = 1 1 2 3 4 5 6 1881.22502 -906.32803 -2394.55815 -928.23485 -162.14795 -916.29314 7 8 9 10 11 12 2588.73002 -684.83291 282.44117 383.97067 -2398.49765 1020.06735 13 14 15 16 17 18 53.18501 2069.63662 2405.00345 2904.69804 -2299.47170 580.89548 19 20 21 22 23 24 -2170.59473 -2076.55057 -72.81919 -958.89517 -526.91435 286.24662 25 26 27 28 29 30 -1730.42868 1691.31172 46.56797 -233.73165 -1849.29245 810.61460 31 32 33 34 35 36 765.78154 476.63877 -55.86490 -209.94293 2036.64333 931.81550 37 38 39 40 41 42 -664.34418 193.69602 1775.33323 -1944.75895 3467.67324 1420.30298 43 44 45 46 47 48 -187.06200 196.97183 -698.96914 784.86742 888.76866 -2238.12947 49 50 51 52 53 54 460.36284 -3048.31633 -1832.34650 202.02740 843.23887 -1895.51991 55 56 57 -996.85483 2087.77288 545.21206 > postscript(file="/var/www/html/rcomp/tmp/6m62x1260972727.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 = 57 Frequency = 1 lag(myerror, k = 1) myerror 0 1881.22502 NA 1 -906.32803 1881.22502 2 -2394.55815 -906.32803 3 -928.23485 -2394.55815 4 -162.14795 -928.23485 5 -916.29314 -162.14795 6 2588.73002 -916.29314 7 -684.83291 2588.73002 8 282.44117 -684.83291 9 383.97067 282.44117 10 -2398.49765 383.97067 11 1020.06735 -2398.49765 12 53.18501 1020.06735 13 2069.63662 53.18501 14 2405.00345 2069.63662 15 2904.69804 2405.00345 16 -2299.47170 2904.69804 17 580.89548 -2299.47170 18 -2170.59473 580.89548 19 -2076.55057 -2170.59473 20 -72.81919 -2076.55057 21 -958.89517 -72.81919 22 -526.91435 -958.89517 23 286.24662 -526.91435 24 -1730.42868 286.24662 25 1691.31172 -1730.42868 26 46.56797 1691.31172 27 -233.73165 46.56797 28 -1849.29245 -233.73165 29 810.61460 -1849.29245 30 765.78154 810.61460 31 476.63877 765.78154 32 -55.86490 476.63877 33 -209.94293 -55.86490 34 2036.64333 -209.94293 35 931.81550 2036.64333 36 -664.34418 931.81550 37 193.69602 -664.34418 38 1775.33323 193.69602 39 -1944.75895 1775.33323 40 3467.67324 -1944.75895 41 1420.30298 3467.67324 42 -187.06200 1420.30298 43 196.97183 -187.06200 44 -698.96914 196.97183 45 784.86742 -698.96914 46 888.76866 784.86742 47 -2238.12947 888.76866 48 460.36284 -2238.12947 49 -3048.31633 460.36284 50 -1832.34650 -3048.31633 51 202.02740 -1832.34650 52 843.23887 202.02740 53 -1895.51991 843.23887 54 -996.85483 -1895.51991 55 2087.77288 -996.85483 56 545.21206 2087.77288 57 NA 545.21206 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -906.32803 1881.22502 [2,] -2394.55815 -906.32803 [3,] -928.23485 -2394.55815 [4,] -162.14795 -928.23485 [5,] -916.29314 -162.14795 [6,] 2588.73002 -916.29314 [7,] -684.83291 2588.73002 [8,] 282.44117 -684.83291 [9,] 383.97067 282.44117 [10,] -2398.49765 383.97067 [11,] 1020.06735 -2398.49765 [12,] 53.18501 1020.06735 [13,] 2069.63662 53.18501 [14,] 2405.00345 2069.63662 [15,] 2904.69804 2405.00345 [16,] -2299.47170 2904.69804 [17,] 580.89548 -2299.47170 [18,] -2170.59473 580.89548 [19,] -2076.55057 -2170.59473 [20,] -72.81919 -2076.55057 [21,] -958.89517 -72.81919 [22,] -526.91435 -958.89517 [23,] 286.24662 -526.91435 [24,] -1730.42868 286.24662 [25,] 1691.31172 -1730.42868 [26,] 46.56797 1691.31172 [27,] -233.73165 46.56797 [28,] -1849.29245 -233.73165 [29,] 810.61460 -1849.29245 [30,] 765.78154 810.61460 [31,] 476.63877 765.78154 [32,] -55.86490 476.63877 [33,] -209.94293 -55.86490 [34,] 2036.64333 -209.94293 [35,] 931.81550 2036.64333 [36,] -664.34418 931.81550 [37,] 193.69602 -664.34418 [38,] 1775.33323 193.69602 [39,] -1944.75895 1775.33323 [40,] 3467.67324 -1944.75895 [41,] 1420.30298 3467.67324 [42,] -187.06200 1420.30298 [43,] 196.97183 -187.06200 [44,] -698.96914 196.97183 [45,] 784.86742 -698.96914 [46,] 888.76866 784.86742 [47,] -2238.12947 888.76866 [48,] 460.36284 -2238.12947 [49,] -3048.31633 460.36284 [50,] -1832.34650 -3048.31633 [51,] 202.02740 -1832.34650 [52,] 843.23887 202.02740 [53,] -1895.51991 843.23887 [54,] -996.85483 -1895.51991 [55,] 2087.77288 -996.85483 [56,] 545.21206 2087.77288 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -906.32803 1881.22502 2 -2394.55815 -906.32803 3 -928.23485 -2394.55815 4 -162.14795 -928.23485 5 -916.29314 -162.14795 6 2588.73002 -916.29314 7 -684.83291 2588.73002 8 282.44117 -684.83291 9 383.97067 282.44117 10 -2398.49765 383.97067 11 1020.06735 -2398.49765 12 53.18501 1020.06735 13 2069.63662 53.18501 14 2405.00345 2069.63662 15 2904.69804 2405.00345 16 -2299.47170 2904.69804 17 580.89548 -2299.47170 18 -2170.59473 580.89548 19 -2076.55057 -2170.59473 20 -72.81919 -2076.55057 21 -958.89517 -72.81919 22 -526.91435 -958.89517 23 286.24662 -526.91435 24 -1730.42868 286.24662 25 1691.31172 -1730.42868 26 46.56797 1691.31172 27 -233.73165 46.56797 28 -1849.29245 -233.73165 29 810.61460 -1849.29245 30 765.78154 810.61460 31 476.63877 765.78154 32 -55.86490 476.63877 33 -209.94293 -55.86490 34 2036.64333 -209.94293 35 931.81550 2036.64333 36 -664.34418 931.81550 37 193.69602 -664.34418 38 1775.33323 193.69602 39 -1944.75895 1775.33323 40 3467.67324 -1944.75895 41 1420.30298 3467.67324 42 -187.06200 1420.30298 43 196.97183 -187.06200 44 -698.96914 196.97183 45 784.86742 -698.96914 46 888.76866 784.86742 47 -2238.12947 888.76866 48 460.36284 -2238.12947 49 -3048.31633 460.36284 50 -1832.34650 -3048.31633 51 202.02740 -1832.34650 52 843.23887 202.02740 53 -1895.51991 843.23887 54 -996.85483 -1895.51991 55 2087.77288 -996.85483 56 545.21206 2087.77288 > 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/7h1hk1260972727.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/8sqr31260972727.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/9gzah1260972727.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/10jb8x1260972727.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/11pl9w1260972727.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/12u3ow1260972727.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/13nibq1260972727.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/14il3z1260972727.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/15r5161260972727.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/164dne1260972727.tab") + } > > try(system("convert tmp/1dd0p1260972727.ps tmp/1dd0p1260972727.png",intern=TRUE)) character(0) > try(system("convert tmp/2n94s1260972727.ps tmp/2n94s1260972727.png",intern=TRUE)) character(0) > try(system("convert tmp/3belu1260972727.ps tmp/3belu1260972727.png",intern=TRUE)) character(0) > try(system("convert tmp/4kma61260972727.ps tmp/4kma61260972727.png",intern=TRUE)) character(0) > try(system("convert tmp/5vdyc1260972727.ps tmp/5vdyc1260972727.png",intern=TRUE)) character(0) > try(system("convert tmp/6m62x1260972727.ps tmp/6m62x1260972727.png",intern=TRUE)) character(0) > try(system("convert tmp/7h1hk1260972727.ps tmp/7h1hk1260972727.png",intern=TRUE)) character(0) > try(system("convert tmp/8sqr31260972727.ps tmp/8sqr31260972727.png",intern=TRUE)) character(0) > try(system("convert tmp/9gzah1260972727.ps tmp/9gzah1260972727.png",intern=TRUE)) character(0) > try(system("convert tmp/10jb8x1260972727.ps tmp/10jb8x1260972727.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.348 1.613 8.787