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(95.1,136,97,133,112.7,126,102.9,120,97.4,114,111.4,116,87.4,153,96.8,162,114.1,161,110.3,149,103.9,139,101.6,135,94.6,130,95.9,127,104.7,122,102.8,117,98.1,112,113.9,113,80.9,149,95.7,157,113.2,157,105.9,147,108.8,137,102.3,132,99,125,100.7,123,115.5,117,100.7,114,109.9,111,114.6,112,85.4,144,100.5,150,114.8,149,116.5,134,112.9,123,102,116,106,117,105.3,111,118.8,105,106.1,102,109.3,95,117.2,93,92.5,124,104.2,130,112.5,124,122.4,115,113.3,106,100,105,110.7,105,112.8,101,109.8,95,117.3,93,109.1,84,115.9,87,96,116,99.8,120,116.8,117,115.7,109,99.4,105,94.3,107,91,109),dim=c(2,61),dimnames=list(c('tip','wrk'),1:61)) > y <- array(NA,dim=c(2,61),dimnames=list(c('tip','wrk'),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 = '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 tip wrk M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t 1 95.1 136 1 0 0 0 0 0 0 0 0 0 0 1 2 97.0 133 0 1 0 0 0 0 0 0 0 0 0 2 3 112.7 126 0 0 1 0 0 0 0 0 0 0 0 3 4 102.9 120 0 0 0 1 0 0 0 0 0 0 0 4 5 97.4 114 0 0 0 0 1 0 0 0 0 0 0 5 6 111.4 116 0 0 0 0 0 1 0 0 0 0 0 6 7 87.4 153 0 0 0 0 0 0 1 0 0 0 0 7 8 96.8 162 0 0 0 0 0 0 0 1 0 0 0 8 9 114.1 161 0 0 0 0 0 0 0 0 1 0 0 9 10 110.3 149 0 0 0 0 0 0 0 0 0 1 0 10 11 103.9 139 0 0 0 0 0 0 0 0 0 0 1 11 12 101.6 135 0 0 0 0 0 0 0 0 0 0 0 12 13 94.6 130 1 0 0 0 0 0 0 0 0 0 0 13 14 95.9 127 0 1 0 0 0 0 0 0 0 0 0 14 15 104.7 122 0 0 1 0 0 0 0 0 0 0 0 15 16 102.8 117 0 0 0 1 0 0 0 0 0 0 0 16 17 98.1 112 0 0 0 0 1 0 0 0 0 0 0 17 18 113.9 113 0 0 0 0 0 1 0 0 0 0 0 18 19 80.9 149 0 0 0 0 0 0 1 0 0 0 0 19 20 95.7 157 0 0 0 0 0 0 0 1 0 0 0 20 21 113.2 157 0 0 0 0 0 0 0 0 1 0 0 21 22 105.9 147 0 0 0 0 0 0 0 0 0 1 0 22 23 108.8 137 0 0 0 0 0 0 0 0 0 0 1 23 24 102.3 132 0 0 0 0 0 0 0 0 0 0 0 24 25 99.0 125 1 0 0 0 0 0 0 0 0 0 0 25 26 100.7 123 0 1 0 0 0 0 0 0 0 0 0 26 27 115.5 117 0 0 1 0 0 0 0 0 0 0 0 27 28 100.7 114 0 0 0 1 0 0 0 0 0 0 0 28 29 109.9 111 0 0 0 0 1 0 0 0 0 0 0 29 30 114.6 112 0 0 0 0 0 1 0 0 0 0 0 30 31 85.4 144 0 0 0 0 0 0 1 0 0 0 0 31 32 100.5 150 0 0 0 0 0 0 0 1 0 0 0 32 33 114.8 149 0 0 0 0 0 0 0 0 1 0 0 33 34 116.5 134 0 0 0 0 0 0 0 0 0 1 0 34 35 112.9 123 0 0 0 0 0 0 0 0 0 0 1 35 36 102.0 116 0 0 0 0 0 0 0 0 0 0 0 36 37 106.0 117 1 0 0 0 0 0 0 0 0 0 0 37 38 105.3 111 0 1 0 0 0 0 0 0 0 0 0 38 39 118.8 105 0 0 1 0 0 0 0 0 0 0 0 39 40 106.1 102 0 0 0 1 0 0 0 0 0 0 0 40 41 109.3 95 0 0 0 0 1 0 0 0 0 0 0 41 42 117.2 93 0 0 0 0 0 1 0 0 0 0 0 42 43 92.5 124 0 0 0 0 0 0 1 0 0 0 0 43 44 104.2 130 0 0 0 0 0 0 0 1 0 0 0 44 45 112.5 124 0 0 0 0 0 0 0 0 1 0 0 45 46 122.4 115 0 0 0 0 0 0 0 0 0 1 0 46 47 113.3 106 0 0 0 0 0 0 0 0 0 0 1 47 48 100.0 105 0 0 0 0 0 0 0 0 0 0 0 48 49 110.7 105 1 0 0 0 0 0 0 0 0 0 0 49 50 112.8 101 0 1 0 0 0 0 0 0 0 0 0 50 51 109.8 95 0 0 1 0 0 0 0 0 0 0 0 51 52 117.3 93 0 0 0 1 0 0 0 0 0 0 0 52 53 109.1 84 0 0 0 0 1 0 0 0 0 0 0 53 54 115.9 87 0 0 0 0 0 1 0 0 0 0 0 54 55 96.0 116 0 0 0 0 0 0 1 0 0 0 0 55 56 99.8 120 0 0 0 0 0 0 0 1 0 0 0 56 57 116.8 117 0 0 0 0 0 0 0 0 1 0 0 57 58 115.7 109 0 0 0 0 0 0 0 0 0 1 0 58 59 99.4 105 0 0 0 0 0 0 0 0 0 0 1 59 60 94.3 107 0 0 0 0 0 0 0 0 0 0 0 60 61 91.0 109 1 0 0 0 0 0 0 0 0 0 0 61 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) wrk M1 M2 M3 M4 122.259778 -0.185269 -0.416978 2.251994 11.105183 4.065963 M5 M6 M7 M8 M9 M10 1.759153 11.789222 -8.252116 3.935457 18.412667 16.296567 M11 t 8.171005 -0.004801 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -11.2944 -2.5762 0.5826 2.9329 8.5456 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 122.259778 20.152348 6.067 2.13e-07 *** wrk -0.185269 0.137589 -1.347 0.18459 M1 -0.416978 3.000392 -0.139 0.89006 M2 2.251994 3.288569 0.685 0.49684 M3 11.105183 3.573807 3.107 0.00320 ** M4 4.065963 3.793315 1.072 0.28925 M5 1.759153 4.244522 0.414 0.68043 M6 11.789222 4.084826 2.886 0.00587 ** M7 -8.252116 3.703298 -2.228 0.03068 * M8 3.935457 4.331012 0.909 0.36816 M9 18.412667 4.191855 4.392 6.34e-05 *** M10 16.296567 3.420990 4.764 1.86e-05 *** M11 8.171005 3.126150 2.614 0.01199 * t -0.004801 0.106805 -0.045 0.96434 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 4.918 on 47 degrees of freedom Multiple R-squared: 0.7719, Adjusted R-squared: 0.7088 F-statistic: 12.23 on 13 and 47 DF, p-value: 5.178e-11 > 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.19987690 0.39975380 0.8001231 [2,] 0.13044564 0.26089128 0.8695544 [3,] 0.13723469 0.27446938 0.8627653 [4,] 0.07405376 0.14810752 0.9259462 [5,] 0.03570707 0.07141414 0.9642929 [6,] 0.02857464 0.05714929 0.9714254 [7,] 0.03576152 0.07152304 0.9642385 [8,] 0.01999257 0.03998515 0.9800074 [9,] 0.03786960 0.07573920 0.9621304 [10,] 0.04551883 0.09103767 0.9544812 [11,] 0.05271390 0.10542779 0.9472861 [12,] 0.07963222 0.15926444 0.9203678 [13,] 0.20795746 0.41591492 0.7920425 [14,] 0.14729261 0.29458523 0.8527074 [15,] 0.12234859 0.24469718 0.8776514 [16,] 0.09313612 0.18627223 0.9068639 [17,] 0.08574133 0.17148265 0.9142587 [18,] 0.08562277 0.17124554 0.9143772 [19,] 0.12646568 0.25293137 0.8735343 [20,] 0.09805722 0.19611443 0.9019428 [21,] 0.08632693 0.17265386 0.9136731 [22,] 0.07268286 0.14536573 0.9273171 [23,] 0.13539398 0.27078796 0.8646060 [24,] 0.25945182 0.51890364 0.7405482 [25,] 0.18874256 0.37748513 0.8112574 [26,] 0.12468861 0.24937722 0.8753114 [27,] 0.10095911 0.20191821 0.8990409 [28,] 0.08884825 0.17769650 0.9111517 > postscript(file="/var/www/html/rcomp/tmp/1a40t1260974340.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/2q4tj1260974340.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/3jl9a1260974340.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/4y5d81260974340.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/55ovf1260974340.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 -1.5414783 -2.8614555 2.6932760 -1.1743148 -5.4743148 -1.1290462 7 8 9 10 11 12 1.7720279 0.6566724 3.2989946 -0.6033276 -0.7256499 4.4090816 13 14 15 16 17 18 -3.0954820 -5.0154592 -5.9901907 -1.7725129 -5.0872444 0.8727556 19 20 21 22 23 24 -5.4114388 -1.3120628 1.7155279 -5.3162572 3.8614205 4.6108835 25 26 27 28 29 30 0.4357828 -0.8989259 3.9410741 -4.3707110 6.5850945 1.4450945 31 32 33 34 35 36 -1.7801740 2.2486649 1.8909871 2.9328593 5.4252685 1.4041944 37 38 39 40 41 42 6.0112420 1.5354592 5.0754592 -1.1363260 3.0784055 0.5825999 43 44 45 46 47 48 1.6720628 2.3009017 -4.9831187 5.3703647 2.7333109 -2.5761520 49 50 51 52 53 54 8.5456270 7.2403813 -5.7196187 8.4538647 0.8980591 -1.7714038 55 56 57 58 59 60 3.7475220 -3.8941762 -1.9223910 -2.3836391 -11.2943501 -7.8480075 61 -10.3556914 > postscript(file="/var/www/html/rcomp/tmp/6tjy51260974340.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 -1.5414783 NA 1 -2.8614555 -1.5414783 2 2.6932760 -2.8614555 3 -1.1743148 2.6932760 4 -5.4743148 -1.1743148 5 -1.1290462 -5.4743148 6 1.7720279 -1.1290462 7 0.6566724 1.7720279 8 3.2989946 0.6566724 9 -0.6033276 3.2989946 10 -0.7256499 -0.6033276 11 4.4090816 -0.7256499 12 -3.0954820 4.4090816 13 -5.0154592 -3.0954820 14 -5.9901907 -5.0154592 15 -1.7725129 -5.9901907 16 -5.0872444 -1.7725129 17 0.8727556 -5.0872444 18 -5.4114388 0.8727556 19 -1.3120628 -5.4114388 20 1.7155279 -1.3120628 21 -5.3162572 1.7155279 22 3.8614205 -5.3162572 23 4.6108835 3.8614205 24 0.4357828 4.6108835 25 -0.8989259 0.4357828 26 3.9410741 -0.8989259 27 -4.3707110 3.9410741 28 6.5850945 -4.3707110 29 1.4450945 6.5850945 30 -1.7801740 1.4450945 31 2.2486649 -1.7801740 32 1.8909871 2.2486649 33 2.9328593 1.8909871 34 5.4252685 2.9328593 35 1.4041944 5.4252685 36 6.0112420 1.4041944 37 1.5354592 6.0112420 38 5.0754592 1.5354592 39 -1.1363260 5.0754592 40 3.0784055 -1.1363260 41 0.5825999 3.0784055 42 1.6720628 0.5825999 43 2.3009017 1.6720628 44 -4.9831187 2.3009017 45 5.3703647 -4.9831187 46 2.7333109 5.3703647 47 -2.5761520 2.7333109 48 8.5456270 -2.5761520 49 7.2403813 8.5456270 50 -5.7196187 7.2403813 51 8.4538647 -5.7196187 52 0.8980591 8.4538647 53 -1.7714038 0.8980591 54 3.7475220 -1.7714038 55 -3.8941762 3.7475220 56 -1.9223910 -3.8941762 57 -2.3836391 -1.9223910 58 -11.2943501 -2.3836391 59 -7.8480075 -11.2943501 60 -10.3556914 -7.8480075 61 NA -10.3556914 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -2.8614555 -1.5414783 [2,] 2.6932760 -2.8614555 [3,] -1.1743148 2.6932760 [4,] -5.4743148 -1.1743148 [5,] -1.1290462 -5.4743148 [6,] 1.7720279 -1.1290462 [7,] 0.6566724 1.7720279 [8,] 3.2989946 0.6566724 [9,] -0.6033276 3.2989946 [10,] -0.7256499 -0.6033276 [11,] 4.4090816 -0.7256499 [12,] -3.0954820 4.4090816 [13,] -5.0154592 -3.0954820 [14,] -5.9901907 -5.0154592 [15,] -1.7725129 -5.9901907 [16,] -5.0872444 -1.7725129 [17,] 0.8727556 -5.0872444 [18,] -5.4114388 0.8727556 [19,] -1.3120628 -5.4114388 [20,] 1.7155279 -1.3120628 [21,] -5.3162572 1.7155279 [22,] 3.8614205 -5.3162572 [23,] 4.6108835 3.8614205 [24,] 0.4357828 4.6108835 [25,] -0.8989259 0.4357828 [26,] 3.9410741 -0.8989259 [27,] -4.3707110 3.9410741 [28,] 6.5850945 -4.3707110 [29,] 1.4450945 6.5850945 [30,] -1.7801740 1.4450945 [31,] 2.2486649 -1.7801740 [32,] 1.8909871 2.2486649 [33,] 2.9328593 1.8909871 [34,] 5.4252685 2.9328593 [35,] 1.4041944 5.4252685 [36,] 6.0112420 1.4041944 [37,] 1.5354592 6.0112420 [38,] 5.0754592 1.5354592 [39,] -1.1363260 5.0754592 [40,] 3.0784055 -1.1363260 [41,] 0.5825999 3.0784055 [42,] 1.6720628 0.5825999 [43,] 2.3009017 1.6720628 [44,] -4.9831187 2.3009017 [45,] 5.3703647 -4.9831187 [46,] 2.7333109 5.3703647 [47,] -2.5761520 2.7333109 [48,] 8.5456270 -2.5761520 [49,] 7.2403813 8.5456270 [50,] -5.7196187 7.2403813 [51,] 8.4538647 -5.7196187 [52,] 0.8980591 8.4538647 [53,] -1.7714038 0.8980591 [54,] 3.7475220 -1.7714038 [55,] -3.8941762 3.7475220 [56,] -1.9223910 -3.8941762 [57,] -2.3836391 -1.9223910 [58,] -11.2943501 -2.3836391 [59,] -7.8480075 -11.2943501 [60,] -10.3556914 -7.8480075 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -2.8614555 -1.5414783 2 2.6932760 -2.8614555 3 -1.1743148 2.6932760 4 -5.4743148 -1.1743148 5 -1.1290462 -5.4743148 6 1.7720279 -1.1290462 7 0.6566724 1.7720279 8 3.2989946 0.6566724 9 -0.6033276 3.2989946 10 -0.7256499 -0.6033276 11 4.4090816 -0.7256499 12 -3.0954820 4.4090816 13 -5.0154592 -3.0954820 14 -5.9901907 -5.0154592 15 -1.7725129 -5.9901907 16 -5.0872444 -1.7725129 17 0.8727556 -5.0872444 18 -5.4114388 0.8727556 19 -1.3120628 -5.4114388 20 1.7155279 -1.3120628 21 -5.3162572 1.7155279 22 3.8614205 -5.3162572 23 4.6108835 3.8614205 24 0.4357828 4.6108835 25 -0.8989259 0.4357828 26 3.9410741 -0.8989259 27 -4.3707110 3.9410741 28 6.5850945 -4.3707110 29 1.4450945 6.5850945 30 -1.7801740 1.4450945 31 2.2486649 -1.7801740 32 1.8909871 2.2486649 33 2.9328593 1.8909871 34 5.4252685 2.9328593 35 1.4041944 5.4252685 36 6.0112420 1.4041944 37 1.5354592 6.0112420 38 5.0754592 1.5354592 39 -1.1363260 5.0754592 40 3.0784055 -1.1363260 41 0.5825999 3.0784055 42 1.6720628 0.5825999 43 2.3009017 1.6720628 44 -4.9831187 2.3009017 45 5.3703647 -4.9831187 46 2.7333109 5.3703647 47 -2.5761520 2.7333109 48 8.5456270 -2.5761520 49 7.2403813 8.5456270 50 -5.7196187 7.2403813 51 8.4538647 -5.7196187 52 0.8980591 8.4538647 53 -1.7714038 0.8980591 54 3.7475220 -1.7714038 55 -3.8941762 3.7475220 56 -1.9223910 -3.8941762 57 -2.3836391 -1.9223910 58 -11.2943501 -2.3836391 59 -7.8480075 -11.2943501 60 -10.3556914 -7.8480075 > 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/7ekm71260974340.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/8ze891260974340.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/9jxjk1260974340.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/10lloe1260974340.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/11no9i1260974340.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/127bsc1260974340.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/133dht1260974340.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/14dolp1260974340.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/151i711260974340.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/16d7uu1260974340.tab") + } > try(system("convert tmp/1a40t1260974340.ps tmp/1a40t1260974340.png",intern=TRUE)) character(0) > try(system("convert tmp/2q4tj1260974340.ps tmp/2q4tj1260974340.png",intern=TRUE)) character(0) > try(system("convert tmp/3jl9a1260974340.ps tmp/3jl9a1260974340.png",intern=TRUE)) character(0) > try(system("convert tmp/4y5d81260974340.ps tmp/4y5d81260974340.png",intern=TRUE)) character(0) > try(system("convert tmp/55ovf1260974340.ps tmp/55ovf1260974340.png",intern=TRUE)) character(0) > try(system("convert tmp/6tjy51260974340.ps tmp/6tjy51260974340.png",intern=TRUE)) character(0) > try(system("convert tmp/7ekm71260974340.ps tmp/7ekm71260974340.png",intern=TRUE)) character(0) > try(system("convert tmp/8ze891260974340.ps tmp/8ze891260974340.png",intern=TRUE)) character(0) > try(system("convert tmp/9jxjk1260974340.ps tmp/9jxjk1260974340.png",intern=TRUE)) character(0) > try(system("convert tmp/10lloe1260974340.ps tmp/10lloe1260974340.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.432 1.609 5.676