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(100.6,71.7,104.3,77.5,120.4,89.8,107.5,80.3,102.9,78.7,125.6,93.8,107.5,57.6,108.8,60.6,128.4,91,121.1,85.3,119.5,77.4,128.7,77.3,108.7,68.3,105.5,69.9,119.8,81.7,111.3,75.1,110.6,69.9,120.1,84,97.5,54.3,107.7,60,127.3,89.9,117.2,77,119.8,85.3,116.2,77.6,111,69.2,112.4,75.5,130.6,85.7,109.1,72.2,118.8,79.9,123.9,85.3,101.6,52.2,112.8,61.2,128,82.4,129.6,85.4,125.8,78.2,119.5,70.2,115.7,70.2,113.6,69.3,129.7,77.5,112,66.1,116.8,69,127,79.2,112.1,56.2,114.2,63.3,121.1,77.8,131.6,92,125,78.1,120.4,65.1,117.7,71.1,117.5,70.9,120.6,72,127.5,81.9,112.3,70.6,124.5,72.5,115.2,65.1,104.7,54.9,130.9,80,129.2,77.4,113.5,59.6,125.6,57.4,107.6,50.8),dim=c(2,61),dimnames=list(c('Y','X'),1:61)) > y <- array(NA,dim=c(2,61),dimnames=list(c('Y','X'),1:61)) > for (i in 1:dim(x)[1]) + { + for (j in 1:dim(x)[2]) + { + y[i,j] <- as.numeric(x[i,j]) + } + } > par3 = 'No Linear Trend' > par2 = 'Include Monthly Dummies' > par1 = '1' > #'GNU S' R Code compiled by R2WASP v. 1.0.44 () > #Author: Prof. Dr. P. Wessa > #To cite this work: AUTHOR(S), (YEAR), YOUR SOFTWARE TITLE (vNUMBER) in Free Statistics Software (v$_version), Office for Research Development and Education, URL http://www.wessa.net/rwasp_YOURPAGE.wasp/ > #Source of accompanying publication: Office for Research, Development, and Education > #Technical description: Write here your technical program description (don't use hard returns!) > library(lattice) > library(lmtest) Loading required package: zoo Attaching package: 'zoo' The following object(s) are masked from package:base : as.Date.numeric > n25 <- 25 #minimum number of obs. for Goldfeld-Quandt test > par1 <- as.numeric(par1) > x <- t(y) > k <- length(x[1,]) > n <- length(x[,1]) > x1 <- cbind(x[,par1], x[,1:k!=par1]) > mycolnames <- c(colnames(x)[par1], colnames(x)[1:k!=par1]) > colnames(x1) <- mycolnames #colnames(x)[par1] > x <- x1 > if (par3 == 'First Differences'){ + x2 <- array(0, dim=c(n-1,k), dimnames=list(1:(n-1), paste('(1-B)',colnames(x),sep=''))) + for (i in 1:n-1) { + for (j in 1:k) { + x2[i,j] <- x[i+1,j] - x[i,j] + } + } + x <- x2 + } > if (par2 == 'Include Monthly Dummies'){ + x2 <- array(0, dim=c(n,11), dimnames=list(1:n, paste('M', seq(1:11), sep =''))) + for (i in 1:11){ + x2[seq(i,n,12),i] <- 1 + } + x <- cbind(x, x2) + } > if (par2 == 'Include Quarterly Dummies'){ + x2 <- array(0, dim=c(n,3), dimnames=list(1:n, paste('Q', seq(1:3), sep =''))) + for (i in 1:3){ + x2[seq(i,n,4),i] <- 1 + } + x <- cbind(x, x2) + } > k <- length(x[1,]) > if (par3 == 'Linear Trend'){ + x <- cbind(x, c(1:n)) + colnames(x)[k+1] <- 't' + } > x Y X M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 1 100.6 71.7 1 0 0 0 0 0 0 0 0 0 0 2 104.3 77.5 0 1 0 0 0 0 0 0 0 0 0 3 120.4 89.8 0 0 1 0 0 0 0 0 0 0 0 4 107.5 80.3 0 0 0 1 0 0 0 0 0 0 0 5 102.9 78.7 0 0 0 0 1 0 0 0 0 0 0 6 125.6 93.8 0 0 0 0 0 1 0 0 0 0 0 7 107.5 57.6 0 0 0 0 0 0 1 0 0 0 0 8 108.8 60.6 0 0 0 0 0 0 0 1 0 0 0 9 128.4 91.0 0 0 0 0 0 0 0 0 1 0 0 10 121.1 85.3 0 0 0 0 0 0 0 0 0 1 0 11 119.5 77.4 0 0 0 0 0 0 0 0 0 0 1 12 128.7 77.3 0 0 0 0 0 0 0 0 0 0 0 13 108.7 68.3 1 0 0 0 0 0 0 0 0 0 0 14 105.5 69.9 0 1 0 0 0 0 0 0 0 0 0 15 119.8 81.7 0 0 1 0 0 0 0 0 0 0 0 16 111.3 75.1 0 0 0 1 0 0 0 0 0 0 0 17 110.6 69.9 0 0 0 0 1 0 0 0 0 0 0 18 120.1 84.0 0 0 0 0 0 1 0 0 0 0 0 19 97.5 54.3 0 0 0 0 0 0 1 0 0 0 0 20 107.7 60.0 0 0 0 0 0 0 0 1 0 0 0 21 127.3 89.9 0 0 0 0 0 0 0 0 1 0 0 22 117.2 77.0 0 0 0 0 0 0 0 0 0 1 0 23 119.8 85.3 0 0 0 0 0 0 0 0 0 0 1 24 116.2 77.6 0 0 0 0 0 0 0 0 0 0 0 25 111.0 69.2 1 0 0 0 0 0 0 0 0 0 0 26 112.4 75.5 0 1 0 0 0 0 0 0 0 0 0 27 130.6 85.7 0 0 1 0 0 0 0 0 0 0 0 28 109.1 72.2 0 0 0 1 0 0 0 0 0 0 0 29 118.8 79.9 0 0 0 0 1 0 0 0 0 0 0 30 123.9 85.3 0 0 0 0 0 1 0 0 0 0 0 31 101.6 52.2 0 0 0 0 0 0 1 0 0 0 0 32 112.8 61.2 0 0 0 0 0 0 0 1 0 0 0 33 128.0 82.4 0 0 0 0 0 0 0 0 1 0 0 34 129.6 85.4 0 0 0 0 0 0 0 0 0 1 0 35 125.8 78.2 0 0 0 0 0 0 0 0 0 0 1 36 119.5 70.2 0 0 0 0 0 0 0 0 0 0 0 37 115.7 70.2 1 0 0 0 0 0 0 0 0 0 0 38 113.6 69.3 0 1 0 0 0 0 0 0 0 0 0 39 129.7 77.5 0 0 1 0 0 0 0 0 0 0 0 40 112.0 66.1 0 0 0 1 0 0 0 0 0 0 0 41 116.8 69.0 0 0 0 0 1 0 0 0 0 0 0 42 127.0 79.2 0 0 0 0 0 1 0 0 0 0 0 43 112.1 56.2 0 0 0 0 0 0 1 0 0 0 0 44 114.2 63.3 0 0 0 0 0 0 0 1 0 0 0 45 121.1 77.8 0 0 0 0 0 0 0 0 1 0 0 46 131.6 92.0 0 0 0 0 0 0 0 0 0 1 0 47 125.0 78.1 0 0 0 0 0 0 0 0 0 0 1 48 120.4 65.1 0 0 0 0 0 0 0 0 0 0 0 49 117.7 71.1 1 0 0 0 0 0 0 0 0 0 0 50 117.5 70.9 0 1 0 0 0 0 0 0 0 0 0 51 120.6 72.0 0 0 1 0 0 0 0 0 0 0 0 52 127.5 81.9 0 0 0 1 0 0 0 0 0 0 0 53 112.3 70.6 0 0 0 0 1 0 0 0 0 0 0 54 124.5 72.5 0 0 0 0 0 1 0 0 0 0 0 55 115.2 65.1 0 0 0 0 0 0 1 0 0 0 0 56 104.7 54.9 0 0 0 0 0 0 0 1 0 0 0 57 130.9 80.0 0 0 0 0 0 0 0 0 1 0 0 58 129.2 77.4 0 0 0 0 0 0 0 0 0 1 0 59 113.5 59.6 0 0 0 0 0 0 0 0 0 0 1 60 125.6 57.4 0 0 0 0 0 0 0 0 0 0 0 61 107.6 50.8 1 0 0 0 0 0 0 0 0 0 0 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) X M1 M2 M3 M4 107.6869 0.2070 -11.3174 -12.0618 -0.3072 -9.7594 M5 M6 M7 M8 M9 M10 -10.6488 -0.6426 -12.7245 -10.4690 2.0166 0.7822 M11 -2.6436 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -10.6139 -3.8826 -0.1437 4.0836 12.6163 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 107.6869 8.5702 12.565 < 2e-16 *** X 0.2070 0.1181 1.753 0.08590 . M1 -11.3174 3.3509 -3.377 0.00146 ** M2 -12.0618 3.5040 -3.442 0.00120 ** M3 -0.3072 3.7539 -0.082 0.93513 M4 -9.7594 3.5470 -2.751 0.00835 ** M5 -10.6488 3.5183 -3.027 0.00397 ** M6 -0.6426 3.8291 -0.168 0.86744 M7 -12.7245 3.7817 -3.365 0.00151 ** M8 -10.4690 3.6616 -2.859 0.00627 ** M9 2.0166 3.8931 0.518 0.60685 M10 0.7822 3.8519 0.203 0.83994 M11 -2.6436 3.5609 -0.742 0.46146 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 5.51 on 48 degrees of freedom Multiple R-squared: 0.6838, Adjusted R-squared: 0.6047 F-statistic: 8.649 on 12 and 48 DF, p-value: 1.951e-08 > 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.2876917 0.5753833 0.7123083 [2,] 0.2099956 0.4199913 0.7900044 [3,] 0.3508571 0.7017142 0.6491429 [4,] 0.5806119 0.8387762 0.4193881 [5,] 0.4619827 0.9239655 0.5380173 [6,] 0.3528525 0.7057050 0.6471475 [7,] 0.3657377 0.7314754 0.6342623 [8,] 0.3018249 0.6036497 0.6981751 [9,] 0.6635552 0.6728896 0.3364448 [10,] 0.6876201 0.6247598 0.3123799 [11,] 0.7394533 0.5210935 0.2605467 [12,] 0.8048431 0.3903138 0.1951569 [13,] 0.8434792 0.3130417 0.1565208 [14,] 0.8875023 0.2249953 0.1124977 [15,] 0.8855788 0.2288423 0.1144212 [16,] 0.8981124 0.2037751 0.1018876 [17,] 0.8664169 0.2671663 0.1335831 [18,] 0.8067876 0.3864249 0.1932124 [19,] 0.8066259 0.3867482 0.1933741 [20,] 0.7702647 0.4594705 0.2297353 [21,] 0.8160112 0.3679776 0.1839888 [22,] 0.7996029 0.4007941 0.2003971 [23,] 0.7622866 0.4754268 0.2377134 [24,] 0.7621104 0.4757793 0.2378896 [25,] 0.7811307 0.4377386 0.2188693 [26,] 0.7559429 0.4881142 0.2440571 [27,] 0.6459268 0.7081463 0.3540732 [28,] 0.5631212 0.8737576 0.4368788 [29,] 0.5055983 0.9888033 0.4944017 [30,] 0.6022785 0.7954430 0.3977215 > postscript(file="/var/www/html/rcomp/tmp/1mwrd1258729588.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/2bzq01258729588.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/3yx8w1258729588.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/46fh51258729588.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/5nur71258729588.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 = 61 Frequency = 1 1 2 3 4 5 6 -10.6138897 -7.3703353 -5.5715240 -7.0524461 -10.4317425 -0.8642695 7 8 9 10 11 12 0.6123413 -0.9642216 -0.1437036 -5.0292275 -1.5678204 5.0092605 13 14 15 16 17 18 -1.8099676 -4.5968623 -4.4945329 -2.1758593 -0.9098263 -4.3353174 19 20 21 22 23 24 -8.7044401 -1.9400000 -1.0159641 -7.2108293 -2.9034042 -7.5528503 25 26 27 28 29 30 0.3037001 1.1437365 5.4773233 -3.7754551 5.2198144 -0.8044641 31 32 33 34 35 36 -4.1696647 2.9115569 1.2368054 3.4500689 4.5665509 -2.7207844 37 38 39 40 41 42 4.7966642 3.6273593 6.2750180 0.3874641 5.4765060 3.5584551 43 44 45 46 47 48 5.5021916 3.8767814 -4.7108293 4.0836317 3.7872545 -0.7649012 49 50 51 52 53 54 6.6103318 7.1961018 -1.6862844 12.6162964 0.6452485 2.4455958 55 56 57 58 59 60 6.7595718 -3.8841168 4.6336916 4.7063563 -3.8825808 6.0292755 61 0.7131612 > postscript(file="/var/www/html/rcomp/tmp/6rpve1258729588.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 = 61 Frequency = 1 lag(myerror, k = 1) myerror 0 -10.6138897 NA 1 -7.3703353 -10.6138897 2 -5.5715240 -7.3703353 3 -7.0524461 -5.5715240 4 -10.4317425 -7.0524461 5 -0.8642695 -10.4317425 6 0.6123413 -0.8642695 7 -0.9642216 0.6123413 8 -0.1437036 -0.9642216 9 -5.0292275 -0.1437036 10 -1.5678204 -5.0292275 11 5.0092605 -1.5678204 12 -1.8099676 5.0092605 13 -4.5968623 -1.8099676 14 -4.4945329 -4.5968623 15 -2.1758593 -4.4945329 16 -0.9098263 -2.1758593 17 -4.3353174 -0.9098263 18 -8.7044401 -4.3353174 19 -1.9400000 -8.7044401 20 -1.0159641 -1.9400000 21 -7.2108293 -1.0159641 22 -2.9034042 -7.2108293 23 -7.5528503 -2.9034042 24 0.3037001 -7.5528503 25 1.1437365 0.3037001 26 5.4773233 1.1437365 27 -3.7754551 5.4773233 28 5.2198144 -3.7754551 29 -0.8044641 5.2198144 30 -4.1696647 -0.8044641 31 2.9115569 -4.1696647 32 1.2368054 2.9115569 33 3.4500689 1.2368054 34 4.5665509 3.4500689 35 -2.7207844 4.5665509 36 4.7966642 -2.7207844 37 3.6273593 4.7966642 38 6.2750180 3.6273593 39 0.3874641 6.2750180 40 5.4765060 0.3874641 41 3.5584551 5.4765060 42 5.5021916 3.5584551 43 3.8767814 5.5021916 44 -4.7108293 3.8767814 45 4.0836317 -4.7108293 46 3.7872545 4.0836317 47 -0.7649012 3.7872545 48 6.6103318 -0.7649012 49 7.1961018 6.6103318 50 -1.6862844 7.1961018 51 12.6162964 -1.6862844 52 0.6452485 12.6162964 53 2.4455958 0.6452485 54 6.7595718 2.4455958 55 -3.8841168 6.7595718 56 4.6336916 -3.8841168 57 4.7063563 4.6336916 58 -3.8825808 4.7063563 59 6.0292755 -3.8825808 60 0.7131612 6.0292755 61 NA 0.7131612 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -7.3703353 -10.6138897 [2,] -5.5715240 -7.3703353 [3,] -7.0524461 -5.5715240 [4,] -10.4317425 -7.0524461 [5,] -0.8642695 -10.4317425 [6,] 0.6123413 -0.8642695 [7,] -0.9642216 0.6123413 [8,] -0.1437036 -0.9642216 [9,] -5.0292275 -0.1437036 [10,] -1.5678204 -5.0292275 [11,] 5.0092605 -1.5678204 [12,] -1.8099676 5.0092605 [13,] -4.5968623 -1.8099676 [14,] -4.4945329 -4.5968623 [15,] -2.1758593 -4.4945329 [16,] -0.9098263 -2.1758593 [17,] -4.3353174 -0.9098263 [18,] -8.7044401 -4.3353174 [19,] -1.9400000 -8.7044401 [20,] -1.0159641 -1.9400000 [21,] -7.2108293 -1.0159641 [22,] -2.9034042 -7.2108293 [23,] -7.5528503 -2.9034042 [24,] 0.3037001 -7.5528503 [25,] 1.1437365 0.3037001 [26,] 5.4773233 1.1437365 [27,] -3.7754551 5.4773233 [28,] 5.2198144 -3.7754551 [29,] -0.8044641 5.2198144 [30,] -4.1696647 -0.8044641 [31,] 2.9115569 -4.1696647 [32,] 1.2368054 2.9115569 [33,] 3.4500689 1.2368054 [34,] 4.5665509 3.4500689 [35,] -2.7207844 4.5665509 [36,] 4.7966642 -2.7207844 [37,] 3.6273593 4.7966642 [38,] 6.2750180 3.6273593 [39,] 0.3874641 6.2750180 [40,] 5.4765060 0.3874641 [41,] 3.5584551 5.4765060 [42,] 5.5021916 3.5584551 [43,] 3.8767814 5.5021916 [44,] -4.7108293 3.8767814 [45,] 4.0836317 -4.7108293 [46,] 3.7872545 4.0836317 [47,] -0.7649012 3.7872545 [48,] 6.6103318 -0.7649012 [49,] 7.1961018 6.6103318 [50,] -1.6862844 7.1961018 [51,] 12.6162964 -1.6862844 [52,] 0.6452485 12.6162964 [53,] 2.4455958 0.6452485 [54,] 6.7595718 2.4455958 [55,] -3.8841168 6.7595718 [56,] 4.6336916 -3.8841168 [57,] 4.7063563 4.6336916 [58,] -3.8825808 4.7063563 [59,] 6.0292755 -3.8825808 [60,] 0.7131612 6.0292755 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -7.3703353 -10.6138897 2 -5.5715240 -7.3703353 3 -7.0524461 -5.5715240 4 -10.4317425 -7.0524461 5 -0.8642695 -10.4317425 6 0.6123413 -0.8642695 7 -0.9642216 0.6123413 8 -0.1437036 -0.9642216 9 -5.0292275 -0.1437036 10 -1.5678204 -5.0292275 11 5.0092605 -1.5678204 12 -1.8099676 5.0092605 13 -4.5968623 -1.8099676 14 -4.4945329 -4.5968623 15 -2.1758593 -4.4945329 16 -0.9098263 -2.1758593 17 -4.3353174 -0.9098263 18 -8.7044401 -4.3353174 19 -1.9400000 -8.7044401 20 -1.0159641 -1.9400000 21 -7.2108293 -1.0159641 22 -2.9034042 -7.2108293 23 -7.5528503 -2.9034042 24 0.3037001 -7.5528503 25 1.1437365 0.3037001 26 5.4773233 1.1437365 27 -3.7754551 5.4773233 28 5.2198144 -3.7754551 29 -0.8044641 5.2198144 30 -4.1696647 -0.8044641 31 2.9115569 -4.1696647 32 1.2368054 2.9115569 33 3.4500689 1.2368054 34 4.5665509 3.4500689 35 -2.7207844 4.5665509 36 4.7966642 -2.7207844 37 3.6273593 4.7966642 38 6.2750180 3.6273593 39 0.3874641 6.2750180 40 5.4765060 0.3874641 41 3.5584551 5.4765060 42 5.5021916 3.5584551 43 3.8767814 5.5021916 44 -4.7108293 3.8767814 45 4.0836317 -4.7108293 46 3.7872545 4.0836317 47 -0.7649012 3.7872545 48 6.6103318 -0.7649012 49 7.1961018 6.6103318 50 -1.6862844 7.1961018 51 12.6162964 -1.6862844 52 0.6452485 12.6162964 53 2.4455958 0.6452485 54 6.7595718 2.4455958 55 -3.8841168 6.7595718 56 4.6336916 -3.8841168 57 4.7063563 4.6336916 58 -3.8825808 4.7063563 59 6.0292755 -3.8825808 60 0.7131612 6.0292755 > 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/7oj931258729588.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/8q1qm1258729588.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/9f7ut1258729588.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/108c361258729588.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/111kg41258729588.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/1256bv1258729588.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/13puhb1258729588.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/148jdl1258729588.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/15x0lr1258729588.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/16ocx71258729588.tab") + } > system("convert tmp/1mwrd1258729588.ps tmp/1mwrd1258729588.png") > system("convert tmp/2bzq01258729588.ps tmp/2bzq01258729588.png") > system("convert tmp/3yx8w1258729588.ps tmp/3yx8w1258729588.png") > system("convert tmp/46fh51258729588.ps tmp/46fh51258729588.png") > system("convert tmp/5nur71258729588.ps tmp/5nur71258729588.png") > system("convert tmp/6rpve1258729588.ps tmp/6rpve1258729588.png") > system("convert tmp/7oj931258729588.ps tmp/7oj931258729588.png") > system("convert tmp/8q1qm1258729588.ps tmp/8q1qm1258729588.png") > system("convert tmp/9f7ut1258729588.ps tmp/9f7ut1258729588.png") > system("convert tmp/108c361258729588.ps tmp/108c361258729588.png") > > > proc.time() user system elapsed 2.453 1.578 2.907