R version 2.8.0 (2008-10-20) Copyright (C) 2008 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(127.96,0,127.47,0,126.47,0,125.75,0,125.42,0,125.14,0,125.15,0,125.51,0,125.63,0,126.22,0,126.88,0,127.96,0,128.74,0,129.6,0,131.2,0,132.72,0,134.67,0,135.94,0,136.39,0,136.74,0,137.2,0,137.36,0,138.63,0,141.07,0,143.32,0,147.91,0,152.56,0,151.61,0,156.56,0,157.45,0,158.13,0,159.18,0,159.47,0,159.79,0,161.65,0,162.77,0,163.48,0,166.16,0,163.86,0,162.12,0,149.08,0,145.32,0,141.21,0,134.68,0,133.65,0,139.17,0,138.61,0,144.96,1,157.99,1,167.18,1,174.48,1,182.77,1,190.00,1,189.70,1,188.90,1,198.28,1,201.18,1,204.14,1,221.02,1,221.12,1,220.68,1),dim=c(2,61),dimnames=list(c('Gasindex','dumivariable'),1:61)) > y <- array(NA,dim=c(2,61),dimnames=list(c('Gasindex','dumivariable'),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 Gasindex dumivariable M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 1 127.96 0 1 0 0 0 0 0 0 0 0 0 0 2 127.47 0 0 1 0 0 0 0 0 0 0 0 0 3 126.47 0 0 0 1 0 0 0 0 0 0 0 0 4 125.75 0 0 0 0 1 0 0 0 0 0 0 0 5 125.42 0 0 0 0 0 1 0 0 0 0 0 0 6 125.14 0 0 0 0 0 0 1 0 0 0 0 0 7 125.15 0 0 0 0 0 0 0 1 0 0 0 0 8 125.51 0 0 0 0 0 0 0 0 1 0 0 0 9 125.63 0 0 0 0 0 0 0 0 0 1 0 0 10 126.22 0 0 0 0 0 0 0 0 0 0 1 0 11 126.88 0 0 0 0 0 0 0 0 0 0 0 1 12 127.96 0 0 0 0 0 0 0 0 0 0 0 0 13 128.74 0 1 0 0 0 0 0 0 0 0 0 0 14 129.60 0 0 1 0 0 0 0 0 0 0 0 0 15 131.20 0 0 0 1 0 0 0 0 0 0 0 0 16 132.72 0 0 0 0 1 0 0 0 0 0 0 0 17 134.67 0 0 0 0 0 1 0 0 0 0 0 0 18 135.94 0 0 0 0 0 0 1 0 0 0 0 0 19 136.39 0 0 0 0 0 0 0 1 0 0 0 0 20 136.74 0 0 0 0 0 0 0 0 1 0 0 0 21 137.20 0 0 0 0 0 0 0 0 0 1 0 0 22 137.36 0 0 0 0 0 0 0 0 0 0 1 0 23 138.63 0 0 0 0 0 0 0 0 0 0 0 1 24 141.07 0 0 0 0 0 0 0 0 0 0 0 0 25 143.32 0 1 0 0 0 0 0 0 0 0 0 0 26 147.91 0 0 1 0 0 0 0 0 0 0 0 0 27 152.56 0 0 0 1 0 0 0 0 0 0 0 0 28 151.61 0 0 0 0 1 0 0 0 0 0 0 0 29 156.56 0 0 0 0 0 1 0 0 0 0 0 0 30 157.45 0 0 0 0 0 0 1 0 0 0 0 0 31 158.13 0 0 0 0 0 0 0 1 0 0 0 0 32 159.18 0 0 0 0 0 0 0 0 1 0 0 0 33 159.47 0 0 0 0 0 0 0 0 0 1 0 0 34 159.79 0 0 0 0 0 0 0 0 0 0 1 0 35 161.65 0 0 0 0 0 0 0 0 0 0 0 1 36 162.77 0 0 0 0 0 0 0 0 0 0 0 0 37 163.48 0 1 0 0 0 0 0 0 0 0 0 0 38 166.16 0 0 1 0 0 0 0 0 0 0 0 0 39 163.86 0 0 0 1 0 0 0 0 0 0 0 0 40 162.12 0 0 0 0 1 0 0 0 0 0 0 0 41 149.08 0 0 0 0 0 1 0 0 0 0 0 0 42 145.32 0 0 0 0 0 0 1 0 0 0 0 0 43 141.21 0 0 0 0 0 0 0 1 0 0 0 0 44 134.68 0 0 0 0 0 0 0 0 1 0 0 0 45 133.65 0 0 0 0 0 0 0 0 0 1 0 0 46 139.17 0 0 0 0 0 0 0 0 0 0 1 0 47 138.61 0 0 0 0 0 0 0 0 0 0 0 1 48 144.96 1 0 0 0 0 0 0 0 0 0 0 0 49 157.99 1 1 0 0 0 0 0 0 0 0 0 0 50 167.18 1 0 1 0 0 0 0 0 0 0 0 0 51 174.48 1 0 0 1 0 0 0 0 0 0 0 0 52 182.77 1 0 0 0 1 0 0 0 0 0 0 0 53 190.00 1 0 0 0 0 1 0 0 0 0 0 0 54 189.70 1 0 0 0 0 0 1 0 0 0 0 0 55 188.90 1 0 0 0 0 0 0 1 0 0 0 0 56 198.28 1 0 0 0 0 0 0 0 1 0 0 0 57 201.18 1 0 0 0 0 0 0 0 0 1 0 0 58 204.14 1 0 0 0 0 0 0 0 0 0 1 0 59 221.02 1 0 0 0 0 0 0 0 0 0 0 1 60 221.12 1 0 0 0 0 0 0 0 0 0 0 0 61 220.68 1 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) dumivariable M1 M2 M3 139.98071 48.98823 0.71822 -2.11435 -0.06435 M4 M5 M6 M7 M8 1.21565 1.36765 0.93165 0.17765 1.09965 M9 M10 M11 1.64765 3.55765 7.57965 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -44.01 -11.96 -4.34 12.64 32.15 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 139.98071 8.29111 16.883 < 2e-16 *** dumivariable 48.98823 5.50705 8.896 1.01e-11 *** M1 0.71822 10.82897 0.066 0.947 M2 -2.11435 11.35752 -0.186 0.853 M3 -0.06435 11.35752 -0.006 0.996 M4 1.21565 11.35752 0.107 0.915 M5 1.36765 11.35752 0.120 0.905 M6 0.93165 11.35752 0.082 0.935 M7 0.17765 11.35752 0.016 0.988 M8 1.09965 11.35752 0.097 0.923 M9 1.64765 11.35752 0.145 0.885 M10 3.55765 11.35752 0.313 0.755 M11 7.57965 11.35752 0.667 0.508 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 17.87 on 48 degrees of freedom Multiple R-squared: 0.6292, Adjusted R-squared: 0.5365 F-statistic: 6.787 on 12 and 48 DF, p-value: 6.044e-07 > 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.0103125236 0.020625047 0.9896875 [2,] 0.0071748149 0.014349630 0.9928252 [3,] 0.0054882541 0.010976508 0.9945117 [4,] 0.0039110109 0.007822022 0.9960890 [5,] 0.0026214083 0.005242817 0.9973786 [6,] 0.0017797317 0.003559463 0.9982203 [7,] 0.0011558295 0.002311659 0.9988442 [8,] 0.0008551027 0.001710205 0.9991449 [9,] 0.0006314159 0.001262832 0.9993686 [10,] 0.0007397983 0.001479597 0.9992602 [11,] 0.0012835691 0.002567138 0.9987164 [12,] 0.0028810496 0.005762099 0.9971190 [13,] 0.0040574829 0.008114966 0.9959425 [14,] 0.0069353083 0.013870617 0.9930647 [15,] 0.0100274723 0.020054945 0.9899725 [16,] 0.0132140225 0.026428045 0.9867860 [17,] 0.0161576769 0.032315354 0.9838423 [18,] 0.0179928656 0.035985731 0.9820071 [19,] 0.0181107969 0.036221594 0.9818892 [20,] 0.0173250818 0.034650164 0.9826749 [21,] 0.0181459658 0.036291932 0.9818540 [22,] 0.0193979803 0.038795961 0.9806020 [23,] 0.0342220102 0.068444020 0.9657780 [24,] 0.0463614485 0.092722897 0.9536386 [25,] 0.0527061263 0.105412253 0.9472939 [26,] 0.0346824346 0.069364869 0.9653176 [27,] 0.0208472493 0.041694499 0.9791528 [28,] 0.0115739208 0.023147842 0.9884261 [29,] 0.0049423913 0.009884783 0.9950576 [30,] 0.0017767130 0.003553426 0.9982233 > postscript(file="/var/www/html/freestat/rcomp/tmp/1i5k31229945909.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/freestat/rcomp/tmp/2egfm1229945909.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/freestat/rcomp/tmp/3aafy1229945909.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/freestat/rcomp/tmp/4b9bg1229945909.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/freestat/rcomp/tmp/5v3c61229945909.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 -12.7389241 -10.3963544 -13.4463544 -15.4463544 -15.9283544 -15.7723544 7 8 9 10 11 12 -15.0083544 -15.5703544 -15.9983544 -17.3183544 -20.6803544 -12.0207089 13 14 15 16 17 18 -11.9589241 -8.2663544 -8.7163544 -8.4763544 -6.6783544 -4.9723544 19 20 21 22 23 24 -3.7683544 -4.3403544 -4.4283544 -6.1783544 -8.9303544 1.0892911 25 26 27 28 29 30 2.6210759 10.0436456 12.6436456 10.4136456 15.2116456 16.5376456 31 32 33 34 35 36 17.9716456 18.0996456 17.8416456 16.2516456 14.0896456 22.7892911 37 38 39 40 41 42 22.7810759 28.2936456 23.9436456 20.9236456 7.7316456 4.4076456 43 44 45 46 47 48 1.0516456 -6.4003544 -7.9783544 -4.3683544 -8.9503544 -44.0089367 49 50 51 52 53 54 -31.6971519 -19.6745823 -14.4245823 -7.4145823 -0.3365823 -0.2005823 55 56 57 58 59 60 -0.2465823 8.2114177 10.5634177 11.6134177 24.4714177 32.1510633 61 30.9928481 > postscript(file="/var/www/html/freestat/rcomp/tmp/6ftsh1229945909.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 -12.7389241 NA 1 -10.3963544 -12.7389241 2 -13.4463544 -10.3963544 3 -15.4463544 -13.4463544 4 -15.9283544 -15.4463544 5 -15.7723544 -15.9283544 6 -15.0083544 -15.7723544 7 -15.5703544 -15.0083544 8 -15.9983544 -15.5703544 9 -17.3183544 -15.9983544 10 -20.6803544 -17.3183544 11 -12.0207089 -20.6803544 12 -11.9589241 -12.0207089 13 -8.2663544 -11.9589241 14 -8.7163544 -8.2663544 15 -8.4763544 -8.7163544 16 -6.6783544 -8.4763544 17 -4.9723544 -6.6783544 18 -3.7683544 -4.9723544 19 -4.3403544 -3.7683544 20 -4.4283544 -4.3403544 21 -6.1783544 -4.4283544 22 -8.9303544 -6.1783544 23 1.0892911 -8.9303544 24 2.6210759 1.0892911 25 10.0436456 2.6210759 26 12.6436456 10.0436456 27 10.4136456 12.6436456 28 15.2116456 10.4136456 29 16.5376456 15.2116456 30 17.9716456 16.5376456 31 18.0996456 17.9716456 32 17.8416456 18.0996456 33 16.2516456 17.8416456 34 14.0896456 16.2516456 35 22.7892911 14.0896456 36 22.7810759 22.7892911 37 28.2936456 22.7810759 38 23.9436456 28.2936456 39 20.9236456 23.9436456 40 7.7316456 20.9236456 41 4.4076456 7.7316456 42 1.0516456 4.4076456 43 -6.4003544 1.0516456 44 -7.9783544 -6.4003544 45 -4.3683544 -7.9783544 46 -8.9503544 -4.3683544 47 -44.0089367 -8.9503544 48 -31.6971519 -44.0089367 49 -19.6745823 -31.6971519 50 -14.4245823 -19.6745823 51 -7.4145823 -14.4245823 52 -0.3365823 -7.4145823 53 -0.2005823 -0.3365823 54 -0.2465823 -0.2005823 55 8.2114177 -0.2465823 56 10.5634177 8.2114177 57 11.6134177 10.5634177 58 24.4714177 11.6134177 59 32.1510633 24.4714177 60 30.9928481 32.1510633 61 NA 30.9928481 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -10.3963544 -12.7389241 [2,] -13.4463544 -10.3963544 [3,] -15.4463544 -13.4463544 [4,] -15.9283544 -15.4463544 [5,] -15.7723544 -15.9283544 [6,] -15.0083544 -15.7723544 [7,] -15.5703544 -15.0083544 [8,] -15.9983544 -15.5703544 [9,] -17.3183544 -15.9983544 [10,] -20.6803544 -17.3183544 [11,] -12.0207089 -20.6803544 [12,] -11.9589241 -12.0207089 [13,] -8.2663544 -11.9589241 [14,] -8.7163544 -8.2663544 [15,] -8.4763544 -8.7163544 [16,] -6.6783544 -8.4763544 [17,] -4.9723544 -6.6783544 [18,] -3.7683544 -4.9723544 [19,] -4.3403544 -3.7683544 [20,] -4.4283544 -4.3403544 [21,] -6.1783544 -4.4283544 [22,] -8.9303544 -6.1783544 [23,] 1.0892911 -8.9303544 [24,] 2.6210759 1.0892911 [25,] 10.0436456 2.6210759 [26,] 12.6436456 10.0436456 [27,] 10.4136456 12.6436456 [28,] 15.2116456 10.4136456 [29,] 16.5376456 15.2116456 [30,] 17.9716456 16.5376456 [31,] 18.0996456 17.9716456 [32,] 17.8416456 18.0996456 [33,] 16.2516456 17.8416456 [34,] 14.0896456 16.2516456 [35,] 22.7892911 14.0896456 [36,] 22.7810759 22.7892911 [37,] 28.2936456 22.7810759 [38,] 23.9436456 28.2936456 [39,] 20.9236456 23.9436456 [40,] 7.7316456 20.9236456 [41,] 4.4076456 7.7316456 [42,] 1.0516456 4.4076456 [43,] -6.4003544 1.0516456 [44,] -7.9783544 -6.4003544 [45,] -4.3683544 -7.9783544 [46,] -8.9503544 -4.3683544 [47,] -44.0089367 -8.9503544 [48,] -31.6971519 -44.0089367 [49,] -19.6745823 -31.6971519 [50,] -14.4245823 -19.6745823 [51,] -7.4145823 -14.4245823 [52,] -0.3365823 -7.4145823 [53,] -0.2005823 -0.3365823 [54,] -0.2465823 -0.2005823 [55,] 8.2114177 -0.2465823 [56,] 10.5634177 8.2114177 [57,] 11.6134177 10.5634177 [58,] 24.4714177 11.6134177 [59,] 32.1510633 24.4714177 [60,] 30.9928481 32.1510633 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -10.3963544 -12.7389241 2 -13.4463544 -10.3963544 3 -15.4463544 -13.4463544 4 -15.9283544 -15.4463544 5 -15.7723544 -15.9283544 6 -15.0083544 -15.7723544 7 -15.5703544 -15.0083544 8 -15.9983544 -15.5703544 9 -17.3183544 -15.9983544 10 -20.6803544 -17.3183544 11 -12.0207089 -20.6803544 12 -11.9589241 -12.0207089 13 -8.2663544 -11.9589241 14 -8.7163544 -8.2663544 15 -8.4763544 -8.7163544 16 -6.6783544 -8.4763544 17 -4.9723544 -6.6783544 18 -3.7683544 -4.9723544 19 -4.3403544 -3.7683544 20 -4.4283544 -4.3403544 21 -6.1783544 -4.4283544 22 -8.9303544 -6.1783544 23 1.0892911 -8.9303544 24 2.6210759 1.0892911 25 10.0436456 2.6210759 26 12.6436456 10.0436456 27 10.4136456 12.6436456 28 15.2116456 10.4136456 29 16.5376456 15.2116456 30 17.9716456 16.5376456 31 18.0996456 17.9716456 32 17.8416456 18.0996456 33 16.2516456 17.8416456 34 14.0896456 16.2516456 35 22.7892911 14.0896456 36 22.7810759 22.7892911 37 28.2936456 22.7810759 38 23.9436456 28.2936456 39 20.9236456 23.9436456 40 7.7316456 20.9236456 41 4.4076456 7.7316456 42 1.0516456 4.4076456 43 -6.4003544 1.0516456 44 -7.9783544 -6.4003544 45 -4.3683544 -7.9783544 46 -8.9503544 -4.3683544 47 -44.0089367 -8.9503544 48 -31.6971519 -44.0089367 49 -19.6745823 -31.6971519 50 -14.4245823 -19.6745823 51 -7.4145823 -14.4245823 52 -0.3365823 -7.4145823 53 -0.2005823 -0.3365823 54 -0.2465823 -0.2005823 55 8.2114177 -0.2465823 56 10.5634177 8.2114177 57 11.6134177 10.5634177 58 24.4714177 11.6134177 59 32.1510633 24.4714177 60 30.9928481 32.1510633 > 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/freestat/rcomp/tmp/7jdxg1229945909.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/freestat/rcomp/tmp/8h3qo1229945909.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/freestat/rcomp/tmp/96o0w1229945909.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/freestat/rcomp/tmp/100f791229945909.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/freestat/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/html/freestat/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/freestat/rcomp/tmp/111ai81229945909.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/freestat/rcomp/tmp/12g8sj1229945909.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/freestat/rcomp/tmp/1388011229945909.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/freestat/rcomp/tmp/14i69k1229945909.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/freestat/rcomp/tmp/15ugj21229945909.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/freestat/rcomp/tmp/16iu3g1229945909.tab") + } > > system("convert tmp/1i5k31229945909.ps tmp/1i5k31229945909.png") > system("convert tmp/2egfm1229945909.ps tmp/2egfm1229945909.png") > system("convert tmp/3aafy1229945909.ps tmp/3aafy1229945909.png") > system("convert tmp/4b9bg1229945909.ps tmp/4b9bg1229945909.png") > system("convert tmp/5v3c61229945909.ps tmp/5v3c61229945909.png") > system("convert tmp/6ftsh1229945909.ps tmp/6ftsh1229945909.png") > system("convert tmp/7jdxg1229945909.ps tmp/7jdxg1229945909.png") > system("convert tmp/8h3qo1229945909.ps tmp/8h3qo1229945909.png") > system("convert tmp/96o0w1229945909.ps tmp/96o0w1229945909.png") > system("convert tmp/100f791229945909.ps tmp/100f791229945909.png") > > > proc.time() user system elapsed 3.660 2.456 4.723