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(1.8 + ,0.8 + ,2.9 + ,1.8 + ,2.3 + ,0.8 + ,2.6 + ,1.7 + ,-0.1 + ,2.9 + ,1.7 + ,2.2 + ,1 + ,2.2 + ,1.4 + ,-1.5 + ,2.9 + ,1.6 + ,2.1 + ,0.6 + ,2.3 + ,1.2 + ,-4.4 + ,1.4 + ,1.8 + ,2.4 + ,0.9 + ,2.4 + ,1 + ,-4.2 + ,1.1 + ,1.6 + ,2.5 + ,0.6 + ,2.1 + ,1.7 + ,3.5 + ,1.9 + ,1.5 + ,2.4 + ,0.6 + ,1.9 + ,2.4 + ,10 + ,2.8 + ,1.5 + ,2.3 + ,0.4 + ,2.2 + ,2 + ,8.6 + ,1.4 + ,1.3 + ,2.1 + ,0.3 + ,1.9 + ,2.1 + ,9.5 + ,0.7 + ,1.4 + ,2.3 + ,0 + ,2.3 + ,2 + ,9.9 + ,-0.8 + ,1.4 + ,2.2 + ,0.3 + ,2.1 + ,1.8 + ,10.4 + ,-3.1 + ,1.3 + ,2.1 + ,0.1 + ,2.2 + ,2.7 + ,16 + ,0.1 + ,1.3 + ,2 + ,0 + ,2.3 + ,2.3 + ,12.7 + ,1 + ,1.2 + ,2.1 + ,0 + ,1.9 + ,1.9 + ,10.2 + ,1.9 + ,1.1 + ,2.1 + ,0 + ,1.7 + ,2 + ,8.9 + ,-0.5 + ,1.4 + ,2.5 + ,-0.2 + ,2.5 + ,2.3 + ,12.6 + ,1.5 + ,1.2 + ,2.2 + ,-0.3 + ,2.1 + ,2.8 + ,13.6 + ,3.9 + ,1.5 +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1 + ,7 + ,1.5 + ,3.2 + ,3.2 + ,6.5 + ,1.6 + ,2.9 + ,5.8 + ,1.5 + ,3.2) + ,dim=c(7 + ,61) + ,dimnames=list(c('HCPI' + ,'ED' + ,'NBL' + ,'IT' + ,'BL' + ,'NEI' + ,'D') + ,1:61)) > y <- array(NA,dim=c(7,61),dimnames=list(c('HCPI','ED','NBL','IT','BL','NEI','D'),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 = 'Do not include Seasonal Dummies' > par1 = '1' > #'GNU S' R Code compiled by R2WASP v. 1.0.44 () > #Author: Prof. Dr. P. Wessa > #To cite this work: AUTHOR(S), (YEAR), YOUR SOFTWARE TITLE (vNUMBER) in Free Statistics Software (v$_version), Office for Research Development and Education, URL http://www.wessa.net/rwasp_YOURPAGE.wasp/ > #Source of accompanying publication: Office for Research, Development, and Education > #Technical description: Write here your technical program description (don't use hard returns!) > library(lattice) > library(lmtest) Loading required package: zoo Attaching package: 'zoo' The following object(s) are masked from package:base : as.Date.numeric > n25 <- 25 #minimum number of obs. for Goldfeld-Quandt test > par1 <- as.numeric(par1) > x <- t(y) > k <- length(x[1,]) > n <- length(x[,1]) > x1 <- cbind(x[,par1], x[,1:k!=par1]) > mycolnames <- c(colnames(x)[par1], colnames(x)[1:k!=par1]) > colnames(x1) <- mycolnames #colnames(x)[par1] > x <- x1 > if (par3 == 'First Differences'){ + x2 <- array(0, dim=c(n-1,k), dimnames=list(1:(n-1), paste('(1-B)',colnames(x),sep=''))) + for (i in 1:n-1) { + for (j in 1:k) { + x2[i,j] <- x[i+1,j] - x[i,j] + } + } + x <- x2 + } > if (par2 == 'Include Monthly Dummies'){ + x2 <- array(0, dim=c(n,11), dimnames=list(1:n, paste('M', seq(1:11), sep =''))) + for (i in 1:11){ + x2[seq(i,n,12),i] <- 1 + } + x <- cbind(x, x2) + } > if (par2 == 'Include Quarterly Dummies'){ + x2 <- array(0, dim=c(n,3), dimnames=list(1:n, paste('Q', seq(1:3), sep =''))) + for (i in 1:3){ + x2[seq(i,n,4),i] <- 1 + } + x <- cbind(x, x2) + } > k <- length(x[1,]) > if (par3 == 'Linear Trend'){ + x <- cbind(x, c(1:n)) + colnames(x)[k+1] <- 't' + } > x HCPI ED NBL IT BL NEI D 1 1.8 0.8 2.9 1.8 2.3 0.8 2.6 2 1.7 -0.1 2.9 1.7 2.2 1.0 2.2 3 1.4 -1.5 2.9 1.6 2.1 0.6 2.3 4 1.2 -4.4 1.4 1.8 2.4 0.9 2.4 5 1.0 -4.2 1.1 1.6 2.5 0.6 2.1 6 1.7 3.5 1.9 1.5 2.4 0.6 1.9 7 2.4 10.0 2.8 1.5 2.3 0.4 2.2 8 2.0 8.6 1.4 1.3 2.1 0.3 1.9 9 2.1 9.5 0.7 1.4 2.3 0.0 2.3 10 2.0 9.9 -0.8 1.4 2.2 0.3 2.1 11 1.8 10.4 -3.1 1.3 2.1 0.1 2.2 12 2.7 16.0 0.1 1.3 2.0 0.0 2.3 13 2.3 12.7 1.0 1.2 2.1 0.0 1.9 14 1.9 10.2 1.9 1.1 2.1 0.0 1.7 15 2.0 8.9 -0.5 1.4 2.5 -0.2 2.5 16 2.3 12.6 1.5 1.2 2.2 -0.3 2.1 17 2.8 13.6 3.9 1.5 2.3 0.1 2.4 18 2.4 14.8 1.9 1.1 2.3 0.1 1.5 19 2.3 9.5 2.6 1.3 2.2 0.4 1.9 20 2.7 13.7 1.7 1.5 2.2 0.4 2.1 21 2.7 17.0 1.4 1.1 1.6 -0.5 2.2 22 2.9 14.7 2.8 1.4 1.8 0.5 2.0 23 3.0 17.4 0.5 1.3 1.7 0.4 2.0 24 2.2 9.0 1.0 1.5 1.9 0.7 2.2 25 2.3 9.1 1.5 1.6 1.8 0.8 2.3 26 2.8 12.2 1.8 1.7 1.9 0.8 2.3 27 2.8 15.9 2.7 1.1 1.5 0.0 2.0 28 2.8 12.9 3.0 1.6 1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> df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) ED NBL IT BL NEI -0.09996 0.10277 0.07992 0.29950 0.07595 0.25417 D 0.25891 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -0.129235 -0.027321 -0.003326 0.033107 0.133829 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) -0.0999629 0.0409914 -2.439 0.01806 * ED 0.1027719 0.0009024 113.886 < 2e-16 *** NBL 0.0799172 0.0042116 18.976 < 2e-16 *** IT 0.2994971 0.2008637 1.491 0.14177 BL 0.0759468 0.0305164 2.489 0.01594 * NEI 0.2541713 0.0784725 3.239 0.00205 ** D 0.2589101 0.0935186 2.769 0.00770 ** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 0.05281 on 54 degrees of freedom Multiple R-squared: 0.9982, Adjusted R-squared: 0.998 F-statistic: 4878 on 6 and 54 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.1885609 3.771218e-01 8.114391e-01 [2,] 0.1008301 2.016601e-01 8.991699e-01 [3,] 0.4147265 8.294530e-01 5.852735e-01 [4,] 0.3130561 6.261121e-01 6.869439e-01 [5,] 0.5786849 8.426303e-01 4.213151e-01 [6,] 0.6261176 7.477647e-01 3.738824e-01 [7,] 0.5368465 9.263069e-01 4.631535e-01 [8,] 0.6594874 6.810253e-01 3.405126e-01 [9,] 0.7794129 4.411742e-01 2.205871e-01 [10,] 0.8711724 2.576552e-01 1.288276e-01 [11,] 0.8852139 2.295723e-01 1.147861e-01 [12,] 0.9398180 1.203640e-01 6.018199e-02 [13,] 0.9359496 1.281007e-01 6.405037e-02 [14,] 0.9807584 3.848311e-02 1.924156e-02 [15,] 0.9925346 1.493079e-02 7.465397e-03 [16,] 0.9991850 1.630092e-03 8.150458e-04 [17,] 0.9986095 2.780907e-03 1.390453e-03 [18,] 0.9979618 4.076326e-03 2.038163e-03 [19,] 0.9997439 5.122863e-04 2.561431e-04 [20,] 0.9994524 1.095204e-03 5.476019e-04 [21,] 0.9996584 6.831113e-04 3.415557e-04 [22,] 0.9992708 1.458354e-03 7.291769e-04 [23,] 0.9986260 2.747935e-03 1.373967e-03 [24,] 0.9976278 4.744335e-03 2.372167e-03 [25,] 0.9990399 1.920278e-03 9.601391e-04 [26,] 0.9996894 6.212368e-04 3.106184e-04 [27,] 0.9999841 3.178065e-05 1.589033e-05 [28,] 0.9999752 4.956041e-05 2.478020e-05 [29,] 0.9999641 7.174288e-05 3.587144e-05 [30,] 0.9999041 1.917159e-04 9.585796e-05 [31,] 0.9997683 4.634101e-04 2.317050e-04 [32,] 0.9994773 1.045415e-03 5.227073e-04 [33,] 0.9989695 2.061076e-03 1.030538e-03 [34,] 0.9978777 4.244609e-03 2.122305e-03 [35,] 0.9950641 9.871844e-03 4.935922e-03 [36,] 0.9883803 2.323943e-02 1.161971e-02 [37,] 0.9769321 4.613574e-02 2.306787e-02 [38,] 0.9950311 9.937891e-03 4.968946e-03 [39,] 0.9883814 2.323718e-02 1.161859e-02 [40,] 0.9742883 5.142332e-02 2.571166e-02 [41,] 0.9329924 1.340151e-01 6.700755e-02 [42,] 0.9218786 1.562429e-01 7.812143e-02 > postscript(file="/var/www/html/rcomp/tmp/1crf71293346154.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > plot(x[,1], type='l', main='Actuals and Interpolation', ylab='value of Actuals and Interpolation (dots)', xlab='time or index') > points(x[,1]-mysum$resid) > grid() > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/2crf71293346154.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > plot(mysum$resid, type='b', pch=19, main='Residuals', ylab='value of Residuals', xlab='time or index') > grid() > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/3crf71293346154.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > hist(mysum$resid, main='Residual Histogram', xlab='values of Residuals') > grid() > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/44jxa1293346154.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > densityplot(~mysum$resid,col='black',main='Residual Density Plot', xlab='values of Residuals') > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/54jxa1293346154.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > qqnorm(mysum$resid, main='Residual Normal Q-Q Plot') > qqline(mysum$resid) > grid() > dev.off() null device 1 > (myerror <- as.ts(mysum$resid)) Time Series: Start = 1 End = 61 Frequency = 1 1 2 3 4 5 6 -0.004290124 0.078478734 0.035681262 0.068769622 0.078419584 0.012468811 7 8 9 10 11 12 -0.046717939 -0.012774309 -0.021778678 -0.059886342 -0.064975108 0.010888189 13 14 15 16 17 18 0.004028989 -0.129235059 0.019647960 -0.008777721 -0.080136221 -0.090810141 19 20 21 22 23 24 0.065818569 -0.005579278 0.047478770 0.064542234 0.133829225 -0.045967820 25 26 27 28 29 30 -0.069866780 0.050020868 0.088926524 -0.069878662 0.032937593 0.054903909 31 32 33 34 35 36 -0.009374127 -0.027850868 -0.066218914 -0.056763287 -0.079259735 -0.054738016 37 38 39 40 41 42 0.033107202 0.054781406 0.029345933 0.029371422 -0.009710320 0.010851764 43 44 45 46 47 48 -0.014420320 0.020674337 -0.007728173 0.002732893 -0.023160474 -0.002505801 49 50 51 52 53 54 0.041262539 -0.003325905 -0.017282310 -0.040366145 -0.017209793 0.040242046 55 56 57 58 59 60 -0.027320586 0.014890486 0.046880014 -0.012289790 0.006788128 0.017153665 61 -0.014723935 > postscript(file="/var/www/html/rcomp/tmp/6fawd1293346154.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > dum <- cbind(lag(myerror,k=1),myerror) > dum Time Series: Start = 0 End = 61 Frequency = 1 lag(myerror, k = 1) myerror 0 -0.004290124 NA 1 0.078478734 -0.004290124 2 0.035681262 0.078478734 3 0.068769622 0.035681262 4 0.078419584 0.068769622 5 0.012468811 0.078419584 6 -0.046717939 0.012468811 7 -0.012774309 -0.046717939 8 -0.021778678 -0.012774309 9 -0.059886342 -0.021778678 10 -0.064975108 -0.059886342 11 0.010888189 -0.064975108 12 0.004028989 0.010888189 13 -0.129235059 0.004028989 14 0.019647960 -0.129235059 15 -0.008777721 0.019647960 16 -0.080136221 -0.008777721 17 -0.090810141 -0.080136221 18 0.065818569 -0.090810141 19 -0.005579278 0.065818569 20 0.047478770 -0.005579278 21 0.064542234 0.047478770 22 0.133829225 0.064542234 23 -0.045967820 0.133829225 24 -0.069866780 -0.045967820 25 0.050020868 -0.069866780 26 0.088926524 0.050020868 27 -0.069878662 0.088926524 28 0.032937593 -0.069878662 29 0.054903909 0.032937593 30 -0.009374127 0.054903909 31 -0.027850868 -0.009374127 32 -0.066218914 -0.027850868 33 -0.056763287 -0.066218914 34 -0.079259735 -0.056763287 35 -0.054738016 -0.079259735 36 0.033107202 -0.054738016 37 0.054781406 0.033107202 38 0.029345933 0.054781406 39 0.029371422 0.029345933 40 -0.009710320 0.029371422 41 0.010851764 -0.009710320 42 -0.014420320 0.010851764 43 0.020674337 -0.014420320 44 -0.007728173 0.020674337 45 0.002732893 -0.007728173 46 -0.023160474 0.002732893 47 -0.002505801 -0.023160474 48 0.041262539 -0.002505801 49 -0.003325905 0.041262539 50 -0.017282310 -0.003325905 51 -0.040366145 -0.017282310 52 -0.017209793 -0.040366145 53 0.040242046 -0.017209793 54 -0.027320586 0.040242046 55 0.014890486 -0.027320586 56 0.046880014 0.014890486 57 -0.012289790 0.046880014 58 0.006788128 -0.012289790 59 0.017153665 0.006788128 60 -0.014723935 0.017153665 61 NA -0.014723935 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] 0.078478734 -0.004290124 [2,] 0.035681262 0.078478734 [3,] 0.068769622 0.035681262 [4,] 0.078419584 0.068769622 [5,] 0.012468811 0.078419584 [6,] -0.046717939 0.012468811 [7,] -0.012774309 -0.046717939 [8,] -0.021778678 -0.012774309 [9,] -0.059886342 -0.021778678 [10,] -0.064975108 -0.059886342 [11,] 0.010888189 -0.064975108 [12,] 0.004028989 0.010888189 [13,] -0.129235059 0.004028989 [14,] 0.019647960 -0.129235059 [15,] -0.008777721 0.019647960 [16,] -0.080136221 -0.008777721 [17,] -0.090810141 -0.080136221 [18,] 0.065818569 -0.090810141 [19,] -0.005579278 0.065818569 [20,] 0.047478770 -0.005579278 [21,] 0.064542234 0.047478770 [22,] 0.133829225 0.064542234 [23,] -0.045967820 0.133829225 [24,] -0.069866780 -0.045967820 [25,] 0.050020868 -0.069866780 [26,] 0.088926524 0.050020868 [27,] -0.069878662 0.088926524 [28,] 0.032937593 -0.069878662 [29,] 0.054903909 0.032937593 [30,] -0.009374127 0.054903909 [31,] -0.027850868 -0.009374127 [32,] -0.066218914 -0.027850868 [33,] -0.056763287 -0.066218914 [34,] -0.079259735 -0.056763287 [35,] -0.054738016 -0.079259735 [36,] 0.033107202 -0.054738016 [37,] 0.054781406 0.033107202 [38,] 0.029345933 0.054781406 [39,] 0.029371422 0.029345933 [40,] -0.009710320 0.029371422 [41,] 0.010851764 -0.009710320 [42,] -0.014420320 0.010851764 [43,] 0.020674337 -0.014420320 [44,] -0.007728173 0.020674337 [45,] 0.002732893 -0.007728173 [46,] -0.023160474 0.002732893 [47,] -0.002505801 -0.023160474 [48,] 0.041262539 -0.002505801 [49,] -0.003325905 0.041262539 [50,] -0.017282310 -0.003325905 [51,] -0.040366145 -0.017282310 [52,] -0.017209793 -0.040366145 [53,] 0.040242046 -0.017209793 [54,] -0.027320586 0.040242046 [55,] 0.014890486 -0.027320586 [56,] 0.046880014 0.014890486 [57,] -0.012289790 0.046880014 [58,] 0.006788128 -0.012289790 [59,] 0.017153665 0.006788128 [60,] -0.014723935 0.017153665 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 0.078478734 -0.004290124 2 0.035681262 0.078478734 3 0.068769622 0.035681262 4 0.078419584 0.068769622 5 0.012468811 0.078419584 6 -0.046717939 0.012468811 7 -0.012774309 -0.046717939 8 -0.021778678 -0.012774309 9 -0.059886342 -0.021778678 10 -0.064975108 -0.059886342 11 0.010888189 -0.064975108 12 0.004028989 0.010888189 13 -0.129235059 0.004028989 14 0.019647960 -0.129235059 15 -0.008777721 0.019647960 16 -0.080136221 -0.008777721 17 -0.090810141 -0.080136221 18 0.065818569 -0.090810141 19 -0.005579278 0.065818569 20 0.047478770 -0.005579278 21 0.064542234 0.047478770 22 0.133829225 0.064542234 23 -0.045967820 0.133829225 24 -0.069866780 -0.045967820 25 0.050020868 -0.069866780 26 0.088926524 0.050020868 27 -0.069878662 0.088926524 28 0.032937593 -0.069878662 29 0.054903909 0.032937593 30 -0.009374127 0.054903909 31 -0.027850868 -0.009374127 32 -0.066218914 -0.027850868 33 -0.056763287 -0.066218914 34 -0.079259735 -0.056763287 35 -0.054738016 -0.079259735 36 0.033107202 -0.054738016 37 0.054781406 0.033107202 38 0.029345933 0.054781406 39 0.029371422 0.029345933 40 -0.009710320 0.029371422 41 0.010851764 -0.009710320 42 -0.014420320 0.010851764 43 0.020674337 -0.014420320 44 -0.007728173 0.020674337 45 0.002732893 -0.007728173 46 -0.023160474 0.002732893 47 -0.002505801 -0.023160474 48 0.041262539 -0.002505801 49 -0.003325905 0.041262539 50 -0.017282310 -0.003325905 51 -0.040366145 -0.017282310 52 -0.017209793 -0.040366145 53 0.040242046 -0.017209793 54 -0.027320586 0.040242046 55 0.014890486 -0.027320586 56 0.046880014 0.014890486 57 -0.012289790 0.046880014 58 0.006788128 -0.012289790 59 0.017153665 0.006788128 60 -0.014723935 0.017153665 > 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/7fawd1293346154.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > acf(mysum$resid, lag.max=length(mysum$resid)/2, main='Residual Autocorrelation Function') > grid() > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/8q1vg1293346154.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > pacf(mysum$resid, lag.max=length(mysum$resid)/2, main='Residual Partial Autocorrelation Function') > grid() > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/9q1vg1293346154.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > opar <- par(mfrow = c(2,2), oma = c(0, 0, 1.1, 0)) > plot(mylm, las = 1, sub='Residual Diagnostics') > par(opar) > dev.off() null device 1 > if (n > n25) { + postscript(file="/var/www/html/rcomp/tmp/105vkq1293346154.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) + plot(kp3:nmkm3,gqarr[,2], main='Goldfeld-Quandt test',ylab='2-sided p-value',xlab='breakpoint') + grid() + dev.off() + } null device 1 > > #Note: the /var/www/html/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/html/rcomp/createtable") > > a<-table.start() > a<-table.row.start(a) > a<-table.element(a, 'Multiple Linear Regression - Estimated Regression Equation', 1, TRUE) > a<-table.row.end(a) > myeq <- colnames(x)[1] > myeq <- paste(myeq, '[t] = ', sep='') > for (i in 1:k){ + if (mysum$coefficients[i,1] > 0) myeq <- paste(myeq, '+', '') + myeq <- paste(myeq, mysum$coefficients[i,1], sep=' ') + if (rownames(mysum$coefficients)[i] != '(Intercept)') { + myeq <- paste(myeq, rownames(mysum$coefficients)[i], sep='') + if (rownames(mysum$coefficients)[i] != 't') myeq <- paste(myeq, '[t]', sep='') + } + } > myeq <- paste(myeq, ' + e[t]') > a<-table.row.start(a) > a<-table.element(a, myeq) > a<-table.row.end(a) > a<-table.end(a) > table.save(a,file="/var/www/html/rcomp/tmp/114tb71293346154.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/12ptrv1293346154.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/133l7m1293346154.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/1474oa1293346154.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/15a44x1293346154.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/16wn3l1293346154.tab") + } > > try(system("convert tmp/1crf71293346154.ps tmp/1crf71293346154.png",intern=TRUE)) character(0) > try(system("convert tmp/2crf71293346154.ps tmp/2crf71293346154.png",intern=TRUE)) character(0) > try(system("convert tmp/3crf71293346154.ps tmp/3crf71293346154.png",intern=TRUE)) character(0) > try(system("convert tmp/44jxa1293346154.ps tmp/44jxa1293346154.png",intern=TRUE)) character(0) > try(system("convert tmp/54jxa1293346154.ps tmp/54jxa1293346154.png",intern=TRUE)) character(0) > try(system("convert tmp/6fawd1293346154.ps tmp/6fawd1293346154.png",intern=TRUE)) character(0) > try(system("convert tmp/7fawd1293346154.ps tmp/7fawd1293346154.png",intern=TRUE)) character(0) > try(system("convert tmp/8q1vg1293346154.ps tmp/8q1vg1293346154.png",intern=TRUE)) character(0) > try(system("convert tmp/9q1vg1293346154.ps tmp/9q1vg1293346154.png",intern=TRUE)) character(0) > try(system("convert tmp/105vkq1293346154.ps tmp/105vkq1293346154.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.537 1.619 5.962