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(96.96,89.1,93.11,83.3,95.62,97.7,98.30,100.9,96.38,108.3,100.82,113.2,99.06,105,94.03,104,102.07,109.8,99.31,98.6,98.64,93.5,101.82,98.2,99.14,88,97.63,85.3,100.06,96.8,101.32,98.8,101.49,110.3,105.43,111.6,105.09,111.2,99.48,106.9,108.53,117.6,104.34,97,106.10,97.3,107.35,98.4,103.00,87.6,104.50,87.4,105.17,94.7,104.84,101.5,106.18,110.4,108.86,108.4,107.77,109.7,102.74,105.2,112.63,111.1,106.26,96.2,108.86,97.3,111.38,98.9,106.85,91.7,107.86,90.9,107.94,98.8,111.38,111.5,111.29,119,113.72,115.3,111.88,116.3,109.87,113.6,113.72,115.1,111.71,109.7,114.81,97.6,112.05,100.8,111.54,94,110.87,87.2,110.87,102.9,115.48,111.3,111.63,106.6,116.24,108.9,113.56,108.3,106.01,100.5,110.45,104,107.77,89.9,108.61,86.8,108.19,91.2),dim=c(2,60),dimnames=list(c('BESTC','INDUSTR'),1:60)) > y <- array(NA,dim=c(2,60),dimnames=list(c('BESTC','INDUSTR'),1:60)) > 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 BESTC INDUSTR M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t 1 96.96 89.1 1 0 0 0 0 0 0 0 0 0 0 1 2 93.11 83.3 0 1 0 0 0 0 0 0 0 0 0 2 3 95.62 97.7 0 0 1 0 0 0 0 0 0 0 0 3 4 98.30 100.9 0 0 0 1 0 0 0 0 0 0 0 4 5 96.38 108.3 0 0 0 0 1 0 0 0 0 0 0 5 6 100.82 113.2 0 0 0 0 0 1 0 0 0 0 0 6 7 99.06 105.0 0 0 0 0 0 0 1 0 0 0 0 7 8 94.03 104.0 0 0 0 0 0 0 0 1 0 0 0 8 9 102.07 109.8 0 0 0 0 0 0 0 0 1 0 0 9 10 99.31 98.6 0 0 0 0 0 0 0 0 0 1 0 10 11 98.64 93.5 0 0 0 0 0 0 0 0 0 0 1 11 12 101.82 98.2 0 0 0 0 0 0 0 0 0 0 0 12 13 99.14 88.0 1 0 0 0 0 0 0 0 0 0 0 13 14 97.63 85.3 0 1 0 0 0 0 0 0 0 0 0 14 15 100.06 96.8 0 0 1 0 0 0 0 0 0 0 0 15 16 101.32 98.8 0 0 0 1 0 0 0 0 0 0 0 16 17 101.49 110.3 0 0 0 0 1 0 0 0 0 0 0 17 18 105.43 111.6 0 0 0 0 0 1 0 0 0 0 0 18 19 105.09 111.2 0 0 0 0 0 0 1 0 0 0 0 19 20 99.48 106.9 0 0 0 0 0 0 0 1 0 0 0 20 21 108.53 117.6 0 0 0 0 0 0 0 0 1 0 0 21 22 104.34 97.0 0 0 0 0 0 0 0 0 0 1 0 22 23 106.10 97.3 0 0 0 0 0 0 0 0 0 0 1 23 24 107.35 98.4 0 0 0 0 0 0 0 0 0 0 0 24 25 103.00 87.6 1 0 0 0 0 0 0 0 0 0 0 25 26 104.50 87.4 0 1 0 0 0 0 0 0 0 0 0 26 27 105.17 94.7 0 0 1 0 0 0 0 0 0 0 0 27 28 104.84 101.5 0 0 0 1 0 0 0 0 0 0 0 28 29 106.18 110.4 0 0 0 0 1 0 0 0 0 0 0 29 30 108.86 108.4 0 0 0 0 0 1 0 0 0 0 0 30 31 107.77 109.7 0 0 0 0 0 0 1 0 0 0 0 31 32 102.74 105.2 0 0 0 0 0 0 0 1 0 0 0 32 33 112.63 111.1 0 0 0 0 0 0 0 0 1 0 0 33 34 106.26 96.2 0 0 0 0 0 0 0 0 0 1 0 34 35 108.86 97.3 0 0 0 0 0 0 0 0 0 0 1 35 36 111.38 98.9 0 0 0 0 0 0 0 0 0 0 0 36 37 106.85 91.7 1 0 0 0 0 0 0 0 0 0 0 37 38 107.86 90.9 0 1 0 0 0 0 0 0 0 0 0 38 39 107.94 98.8 0 0 1 0 0 0 0 0 0 0 0 39 40 111.38 111.5 0 0 0 1 0 0 0 0 0 0 0 40 41 111.29 119.0 0 0 0 0 1 0 0 0 0 0 0 41 42 113.72 115.3 0 0 0 0 0 1 0 0 0 0 0 42 43 111.88 116.3 0 0 0 0 0 0 1 0 0 0 0 43 44 109.87 113.6 0 0 0 0 0 0 0 1 0 0 0 44 45 113.72 115.1 0 0 0 0 0 0 0 0 1 0 0 45 46 111.71 109.7 0 0 0 0 0 0 0 0 0 1 0 46 47 114.81 97.6 0 0 0 0 0 0 0 0 0 0 1 47 48 112.05 100.8 0 0 0 0 0 0 0 0 0 0 0 48 49 111.54 94.0 1 0 0 0 0 0 0 0 0 0 0 49 50 110.87 87.2 0 1 0 0 0 0 0 0 0 0 0 50 51 110.87 102.9 0 0 1 0 0 0 0 0 0 0 0 51 52 115.48 111.3 0 0 0 1 0 0 0 0 0 0 0 52 53 111.63 106.6 0 0 0 0 1 0 0 0 0 0 0 53 54 116.24 108.9 0 0 0 0 0 1 0 0 0 0 0 54 55 113.56 108.3 0 0 0 0 0 0 1 0 0 0 0 55 56 106.01 100.5 0 0 0 0 0 0 0 1 0 0 0 56 57 110.45 104.0 0 0 0 0 0 0 0 0 1 0 0 57 58 107.77 89.9 0 0 0 0 0 0 0 0 0 1 0 58 59 108.61 86.8 0 0 0 0 0 0 0 0 0 0 1 59 60 108.19 91.2 0 0 0 0 0 0 0 0 0 0 0 60 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) INDUSTR M1 M2 M3 M4 56.7056 0.4278 1.4913 1.9113 -2.0810 -2.8516 M5 M6 M7 M8 M9 M10 -6.6103 -3.5005 -4.7228 -8.3027 -3.8636 -2.0724 M11 t 0.8000 0.2707 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -3.76859 -0.85573 -0.06316 0.77715 3.32967 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 56.70557 5.02610 11.282 7.65e-15 *** INDUSTR 0.42778 0.05136 8.329 9.74e-11 *** M1 1.49133 1.08712 1.372 0.176777 M2 1.91125 1.15349 1.657 0.104339 M3 -2.08103 1.02224 -2.036 0.047558 * M4 -2.85161 1.09071 -2.614 0.012041 * M5 -6.61031 1.23582 -5.349 2.70e-06 *** M6 -3.50052 1.25070 -2.799 0.007469 ** M7 -4.72283 1.20941 -3.905 0.000306 *** M8 -8.30267 1.10930 -7.485 1.72e-09 *** M9 -3.86358 1.24773 -3.096 0.003331 ** M10 -2.07237 1.01638 -2.039 0.047223 * M11 0.80000 1.02666 0.779 0.439833 t 0.27065 0.01230 22.007 < 2e-16 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 1.605 on 46 degrees of freedom Multiple R-squared: 0.9407, Adjusted R-squared: 0.924 F-statistic: 56.17 on 13 and 46 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.086903041 0.173806081 0.9130970 [2,] 0.078342666 0.156685331 0.9216573 [3,] 0.031030371 0.062060742 0.9689696 [4,] 0.013648370 0.027296740 0.9863516 [5,] 0.005539477 0.011078953 0.9944605 [6,] 0.005746332 0.011492663 0.9942537 [7,] 0.012607541 0.025215083 0.9873925 [8,] 0.007827692 0.015655384 0.9921723 [9,] 0.007361787 0.014723574 0.9926382 [10,] 0.007601227 0.015202454 0.9923988 [11,] 0.007858276 0.015716553 0.9921417 [12,] 0.016710546 0.033421091 0.9832895 [13,] 0.008930794 0.017861588 0.9910692 [14,] 0.005049867 0.010099734 0.9949501 [15,] 0.004273206 0.008546411 0.9957268 [16,] 0.002672300 0.005344600 0.9973277 [17,] 0.004009076 0.008018152 0.9959909 [18,] 0.004022634 0.008045269 0.9959774 [19,] 0.002439666 0.004879331 0.9975603 [20,] 0.005903043 0.011806087 0.9940970 [21,] 0.008667942 0.017335885 0.9913321 [22,] 0.005646584 0.011293168 0.9943534 [23,] 0.004575505 0.009151010 0.9954245 [24,] 0.002410138 0.004820276 0.9975899 [25,] 0.002992131 0.005984261 0.9970079 [26,] 0.007738856 0.015477712 0.9922611 [27,] 0.437290348 0.874580697 0.5627097 > postscript(file="/var/www/html/rcomp/tmp/1e4571258650780.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/2dziu1258650780.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/3fjwe1258650780.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/405711258650780.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/5bda61258650780.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 = 60 Frequency = 1 1 2 3 4 5 6 0.37686308 -1.68256444 -1.61102914 0.19999365 -1.39757044 -2.43415492 7 8 9 10 11 12 0.26533498 -1.02768541 -0.17857643 -0.20925670 -1.84058123 -0.14181479 13 14 15 16 17 18 -0.22039120 -1.26595048 -0.03384031 0.87052382 -0.39095648 -0.38751697 19 20 21 22 23 24 0.39525427 -0.06607746 -0.30311225 2.25738125 0.74602072 2.05481116 25 26 27 28 29 30 0.56290542 1.45788502 2.72668986 -0.01231134 1.00844791 1.16357609 31 32 33 34 35 36 0.46911378 0.67333893 3.32966947 1.27179164 0.25820356 2.62310178 37 38 39 40 41 42 -0.58882796 0.07282231 0.49495648 -0.99797293 -0.80831546 -0.17595374 43 44 45 46 47 48 -1.49208071 0.96213245 -0.53928547 -2.30111551 2.83205106 -0.76750582 49 50 51 52 53 54 -0.13054934 1.41780759 -1.57677690 -0.06023321 1.58839447 1.83404954 55 56 57 58 59 60 0.36237768 -0.54170851 -2.30869531 -1.01880069 -1.99569411 -3.76859233 > postscript(file="/var/www/html/rcomp/tmp/6k8bf1258650780.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 = 60 Frequency = 1 lag(myerror, k = 1) myerror 0 0.37686308 NA 1 -1.68256444 0.37686308 2 -1.61102914 -1.68256444 3 0.19999365 -1.61102914 4 -1.39757044 0.19999365 5 -2.43415492 -1.39757044 6 0.26533498 -2.43415492 7 -1.02768541 0.26533498 8 -0.17857643 -1.02768541 9 -0.20925670 -0.17857643 10 -1.84058123 -0.20925670 11 -0.14181479 -1.84058123 12 -0.22039120 -0.14181479 13 -1.26595048 -0.22039120 14 -0.03384031 -1.26595048 15 0.87052382 -0.03384031 16 -0.39095648 0.87052382 17 -0.38751697 -0.39095648 18 0.39525427 -0.38751697 19 -0.06607746 0.39525427 20 -0.30311225 -0.06607746 21 2.25738125 -0.30311225 22 0.74602072 2.25738125 23 2.05481116 0.74602072 24 0.56290542 2.05481116 25 1.45788502 0.56290542 26 2.72668986 1.45788502 27 -0.01231134 2.72668986 28 1.00844791 -0.01231134 29 1.16357609 1.00844791 30 0.46911378 1.16357609 31 0.67333893 0.46911378 32 3.32966947 0.67333893 33 1.27179164 3.32966947 34 0.25820356 1.27179164 35 2.62310178 0.25820356 36 -0.58882796 2.62310178 37 0.07282231 -0.58882796 38 0.49495648 0.07282231 39 -0.99797293 0.49495648 40 -0.80831546 -0.99797293 41 -0.17595374 -0.80831546 42 -1.49208071 -0.17595374 43 0.96213245 -1.49208071 44 -0.53928547 0.96213245 45 -2.30111551 -0.53928547 46 2.83205106 -2.30111551 47 -0.76750582 2.83205106 48 -0.13054934 -0.76750582 49 1.41780759 -0.13054934 50 -1.57677690 1.41780759 51 -0.06023321 -1.57677690 52 1.58839447 -0.06023321 53 1.83404954 1.58839447 54 0.36237768 1.83404954 55 -0.54170851 0.36237768 56 -2.30869531 -0.54170851 57 -1.01880069 -2.30869531 58 -1.99569411 -1.01880069 59 -3.76859233 -1.99569411 60 NA -3.76859233 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -1.68256444 0.37686308 [2,] -1.61102914 -1.68256444 [3,] 0.19999365 -1.61102914 [4,] -1.39757044 0.19999365 [5,] -2.43415492 -1.39757044 [6,] 0.26533498 -2.43415492 [7,] -1.02768541 0.26533498 [8,] -0.17857643 -1.02768541 [9,] -0.20925670 -0.17857643 [10,] -1.84058123 -0.20925670 [11,] -0.14181479 -1.84058123 [12,] -0.22039120 -0.14181479 [13,] -1.26595048 -0.22039120 [14,] -0.03384031 -1.26595048 [15,] 0.87052382 -0.03384031 [16,] -0.39095648 0.87052382 [17,] -0.38751697 -0.39095648 [18,] 0.39525427 -0.38751697 [19,] -0.06607746 0.39525427 [20,] -0.30311225 -0.06607746 [21,] 2.25738125 -0.30311225 [22,] 0.74602072 2.25738125 [23,] 2.05481116 0.74602072 [24,] 0.56290542 2.05481116 [25,] 1.45788502 0.56290542 [26,] 2.72668986 1.45788502 [27,] -0.01231134 2.72668986 [28,] 1.00844791 -0.01231134 [29,] 1.16357609 1.00844791 [30,] 0.46911378 1.16357609 [31,] 0.67333893 0.46911378 [32,] 3.32966947 0.67333893 [33,] 1.27179164 3.32966947 [34,] 0.25820356 1.27179164 [35,] 2.62310178 0.25820356 [36,] -0.58882796 2.62310178 [37,] 0.07282231 -0.58882796 [38,] 0.49495648 0.07282231 [39,] -0.99797293 0.49495648 [40,] -0.80831546 -0.99797293 [41,] -0.17595374 -0.80831546 [42,] -1.49208071 -0.17595374 [43,] 0.96213245 -1.49208071 [44,] -0.53928547 0.96213245 [45,] -2.30111551 -0.53928547 [46,] 2.83205106 -2.30111551 [47,] -0.76750582 2.83205106 [48,] -0.13054934 -0.76750582 [49,] 1.41780759 -0.13054934 [50,] -1.57677690 1.41780759 [51,] -0.06023321 -1.57677690 [52,] 1.58839447 -0.06023321 [53,] 1.83404954 1.58839447 [54,] 0.36237768 1.83404954 [55,] -0.54170851 0.36237768 [56,] -2.30869531 -0.54170851 [57,] -1.01880069 -2.30869531 [58,] -1.99569411 -1.01880069 [59,] -3.76859233 -1.99569411 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -1.68256444 0.37686308 2 -1.61102914 -1.68256444 3 0.19999365 -1.61102914 4 -1.39757044 0.19999365 5 -2.43415492 -1.39757044 6 0.26533498 -2.43415492 7 -1.02768541 0.26533498 8 -0.17857643 -1.02768541 9 -0.20925670 -0.17857643 10 -1.84058123 -0.20925670 11 -0.14181479 -1.84058123 12 -0.22039120 -0.14181479 13 -1.26595048 -0.22039120 14 -0.03384031 -1.26595048 15 0.87052382 -0.03384031 16 -0.39095648 0.87052382 17 -0.38751697 -0.39095648 18 0.39525427 -0.38751697 19 -0.06607746 0.39525427 20 -0.30311225 -0.06607746 21 2.25738125 -0.30311225 22 0.74602072 2.25738125 23 2.05481116 0.74602072 24 0.56290542 2.05481116 25 1.45788502 0.56290542 26 2.72668986 1.45788502 27 -0.01231134 2.72668986 28 1.00844791 -0.01231134 29 1.16357609 1.00844791 30 0.46911378 1.16357609 31 0.67333893 0.46911378 32 3.32966947 0.67333893 33 1.27179164 3.32966947 34 0.25820356 1.27179164 35 2.62310178 0.25820356 36 -0.58882796 2.62310178 37 0.07282231 -0.58882796 38 0.49495648 0.07282231 39 -0.99797293 0.49495648 40 -0.80831546 -0.99797293 41 -0.17595374 -0.80831546 42 -1.49208071 -0.17595374 43 0.96213245 -1.49208071 44 -0.53928547 0.96213245 45 -2.30111551 -0.53928547 46 2.83205106 -2.30111551 47 -0.76750582 2.83205106 48 -0.13054934 -0.76750582 49 1.41780759 -0.13054934 50 -1.57677690 1.41780759 51 -0.06023321 -1.57677690 52 1.58839447 -0.06023321 53 1.83404954 1.58839447 54 0.36237768 1.83404954 55 -0.54170851 0.36237768 56 -2.30869531 -0.54170851 57 -1.01880069 -2.30869531 58 -1.99569411 -1.01880069 59 -3.76859233 -1.99569411 > 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/7aja21258650780.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/8cwv71258650780.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/9byhj1258650780.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/107d061258650780.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/11bohn1258650780.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/1226761258650780.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/131lbb1258650780.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/143gnn1258650781.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/156yxe1258650781.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/16ysxa1258650781.tab") + } > system("convert tmp/1e4571258650780.ps tmp/1e4571258650780.png") > system("convert tmp/2dziu1258650780.ps tmp/2dziu1258650780.png") > system("convert tmp/3fjwe1258650780.ps tmp/3fjwe1258650780.png") > system("convert tmp/405711258650780.ps tmp/405711258650780.png") > system("convert tmp/5bda61258650780.ps tmp/5bda61258650780.png") > system("convert tmp/6k8bf1258650780.ps tmp/6k8bf1258650780.png") > system("convert tmp/7aja21258650780.ps tmp/7aja21258650780.png") > system("convert tmp/8cwv71258650780.ps tmp/8cwv71258650780.png") > system("convert tmp/9byhj1258650780.ps tmp/9byhj1258650780.png") > system("convert tmp/107d061258650780.ps tmp/107d061258650780.png") > > > proc.time() user system elapsed 2.422 1.587 2.885