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(111.4,0,87.4,0,96.8,0,114.1,0,110.3,0,103.9,0,101.6,0,94.6,0,95.9,0,104.7,0,102.8,0,98.1,0,113.9,0,80.9,0,95.7,0,113.2,0,105.9,0,108.8,0,102.3,0,99,0,100.7,0,115.5,0,100.7,0,109.9,0,114.6,0,85.4,0,100.5,0,114.8,0,116.5,0,112.9,0,102,0,106,0,105.3,0,118.8,0,106.1,0,109.3,0,117.2,0,92.5,0,104.2,0,112.5,0,122.4,0,113.3,0,100,0,110.7,0,112.8,0,109.8,0,117.3,0,109.1,0,115.9,0,96,0,99.8,0,116.8,1,115.7,1,99.4,1,94.3,1,91,1,93.2,1,103.1,1,94.1,1,91.8,1,102.7,1),dim=c(2,61),dimnames=list(c('Y','X'),1:61)) > y <- array(NA,dim=c(2,61),dimnames=list(c('Y','X'),1:61)) > for (i in 1:dim(x)[1]) + { + for (j in 1:dim(x)[2]) + { + y[i,j] <- as.numeric(x[i,j]) + } + } > par3 = 'No Linear Trend' > par2 = 'Include Monthly Dummies' > par1 = '1' > #'GNU S' R Code compiled by R2WASP v. 1.0.44 () > #Author: Prof. Dr. P. Wessa > #To cite this work: AUTHOR(S), (YEAR), YOUR SOFTWARE TITLE (vNUMBER) in Free Statistics Software (v$_version), Office for Research Development and Education, URL http://www.wessa.net/rwasp_YOURPAGE.wasp/ > #Source of accompanying publication: Office for Research, Development, and Education > #Technical description: Write here your technical program description (don't use hard returns!) > library(lattice) > library(lmtest) Loading required package: zoo Attaching package: 'zoo' The following object(s) are masked from package:base : as.Date.numeric > n25 <- 25 #minimum number of obs. for Goldfeld-Quandt test > par1 <- as.numeric(par1) > x <- t(y) > k <- length(x[1,]) > n <- length(x[,1]) > x1 <- cbind(x[,par1], x[,1:k!=par1]) > mycolnames <- c(colnames(x)[par1], colnames(x)[1:k!=par1]) > colnames(x1) <- mycolnames #colnames(x)[par1] > x <- x1 > if (par3 == 'First Differences'){ + x2 <- array(0, dim=c(n-1,k), dimnames=list(1:(n-1), paste('(1-B)',colnames(x),sep=''))) + for (i in 1:n-1) { + for (j in 1:k) { + x2[i,j] <- x[i+1,j] - x[i,j] + } + } + x <- x2 + } > if (par2 == 'Include Monthly Dummies'){ + x2 <- array(0, dim=c(n,11), dimnames=list(1:n, paste('M', seq(1:11), sep =''))) + for (i in 1:11){ + x2[seq(i,n,12),i] <- 1 + } + x <- cbind(x, x2) + } > if (par2 == 'Include Quarterly Dummies'){ + x2 <- array(0, dim=c(n,3), dimnames=list(1:n, paste('Q', seq(1:3), sep =''))) + for (i in 1:3){ + x2[seq(i,n,4),i] <- 1 + } + x <- cbind(x, x2) + } > k <- length(x[1,]) > if (par3 == 'Linear Trend'){ + x <- cbind(x, c(1:n)) + colnames(x)[k+1] <- 't' + } > x Y X M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 1 111.4 0 1 0 0 0 0 0 0 0 0 0 0 2 87.4 0 0 1 0 0 0 0 0 0 0 0 0 3 96.8 0 0 0 1 0 0 0 0 0 0 0 0 4 114.1 0 0 0 0 1 0 0 0 0 0 0 0 5 110.3 0 0 0 0 0 1 0 0 0 0 0 0 6 103.9 0 0 0 0 0 0 1 0 0 0 0 0 7 101.6 0 0 0 0 0 0 0 1 0 0 0 0 8 94.6 0 0 0 0 0 0 0 0 1 0 0 0 9 95.9 0 0 0 0 0 0 0 0 0 1 0 0 10 104.7 0 0 0 0 0 0 0 0 0 0 1 0 11 102.8 0 0 0 0 0 0 0 0 0 0 0 1 12 98.1 0 0 0 0 0 0 0 0 0 0 0 0 13 113.9 0 1 0 0 0 0 0 0 0 0 0 0 14 80.9 0 0 1 0 0 0 0 0 0 0 0 0 15 95.7 0 0 0 1 0 0 0 0 0 0 0 0 16 113.2 0 0 0 0 1 0 0 0 0 0 0 0 17 105.9 0 0 0 0 0 1 0 0 0 0 0 0 18 108.8 0 0 0 0 0 0 1 0 0 0 0 0 19 102.3 0 0 0 0 0 0 0 1 0 0 0 0 20 99.0 0 0 0 0 0 0 0 0 1 0 0 0 21 100.7 0 0 0 0 0 0 0 0 0 1 0 0 22 115.5 0 0 0 0 0 0 0 0 0 0 1 0 23 100.7 0 0 0 0 0 0 0 0 0 0 0 1 24 109.9 0 0 0 0 0 0 0 0 0 0 0 0 25 114.6 0 1 0 0 0 0 0 0 0 0 0 0 26 85.4 0 0 1 0 0 0 0 0 0 0 0 0 27 100.5 0 0 0 1 0 0 0 0 0 0 0 0 28 114.8 0 0 0 0 1 0 0 0 0 0 0 0 29 116.5 0 0 0 0 0 1 0 0 0 0 0 0 30 112.9 0 0 0 0 0 0 1 0 0 0 0 0 31 102.0 0 0 0 0 0 0 0 1 0 0 0 0 32 106.0 0 0 0 0 0 0 0 0 1 0 0 0 33 105.3 0 0 0 0 0 0 0 0 0 1 0 0 34 118.8 0 0 0 0 0 0 0 0 0 0 1 0 35 106.1 0 0 0 0 0 0 0 0 0 0 0 1 36 109.3 0 0 0 0 0 0 0 0 0 0 0 0 37 117.2 0 1 0 0 0 0 0 0 0 0 0 0 38 92.5 0 0 1 0 0 0 0 0 0 0 0 0 39 104.2 0 0 0 1 0 0 0 0 0 0 0 0 40 112.5 0 0 0 0 1 0 0 0 0 0 0 0 41 122.4 0 0 0 0 0 1 0 0 0 0 0 0 42 113.3 0 0 0 0 0 0 1 0 0 0 0 0 43 100.0 0 0 0 0 0 0 0 1 0 0 0 0 44 110.7 0 0 0 0 0 0 0 0 1 0 0 0 45 112.8 0 0 0 0 0 0 0 0 0 1 0 0 46 109.8 0 0 0 0 0 0 0 0 0 0 1 0 47 117.3 0 0 0 0 0 0 0 0 0 0 0 1 48 109.1 0 0 0 0 0 0 0 0 0 0 0 0 49 115.9 0 1 0 0 0 0 0 0 0 0 0 0 50 96.0 0 0 1 0 0 0 0 0 0 0 0 0 51 99.8 0 0 0 1 0 0 0 0 0 0 0 0 52 116.8 1 0 0 0 1 0 0 0 0 0 0 0 53 115.7 1 0 0 0 0 1 0 0 0 0 0 0 54 99.4 1 0 0 0 0 0 1 0 0 0 0 0 55 94.3 1 0 0 0 0 0 0 1 0 0 0 0 56 91.0 1 0 0 0 0 0 0 0 1 0 0 0 57 93.2 1 0 0 0 0 0 0 0 0 1 0 0 58 103.1 1 0 0 0 0 0 0 0 0 0 1 0 59 94.1 1 0 0 0 0 0 0 0 0 0 0 1 60 91.8 1 0 0 0 0 0 0 0 0 0 0 0 61 102.7 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) X M1 M2 M3 M4 105.301 -8.305 8.700 -16.861 -5.901 10.640 M5 M6 M7 M8 M9 M10 10.520 4.020 -3.600 -3.380 -2.060 6.740 M11 0.560 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -9.921 -2.996 -0.521 3.579 11.439 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 105.301 2.424 43.436 < 2e-16 *** X -8.305 1.889 -4.396 6.08e-05 *** M1 8.700 3.243 2.683 0.00999 ** M2 -16.861 3.408 -4.948 9.62e-06 *** M3 -5.901 3.408 -1.732 0.08975 . M4 10.640 3.387 3.142 0.00287 ** M5 10.520 3.387 3.106 0.00318 ** M6 4.020 3.387 1.187 0.24105 M7 -3.600 3.387 -1.063 0.29309 M8 -3.380 3.387 -0.998 0.32326 M9 -2.060 3.387 -0.608 0.54587 M10 6.740 3.387 1.990 0.05228 . M11 0.560 3.387 0.165 0.86936 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 5.355 on 48 degrees of freedom Multiple R-squared: 0.7323, Adjusted R-squared: 0.6654 F-statistic: 10.94 on 12 and 48 DF, p-value: 4.934e-10 > 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.18500641 0.3700128 0.8149936 [2,] 0.19509246 0.3901849 0.8049075 [3,] 0.17203816 0.3440763 0.8279618 [4,] 0.09221686 0.1844337 0.9077831 [5,] 0.08454759 0.1690952 0.9154524 [6,] 0.08400939 0.1680188 0.9159906 [7,] 0.23144661 0.4628932 0.7685534 [8,] 0.20757583 0.4151517 0.7924242 [9,] 0.38286888 0.7657378 0.6171311 [10,] 0.29578877 0.5915775 0.7042112 [11,] 0.27859936 0.5571987 0.7214006 [12,] 0.23439245 0.4687849 0.7656075 [13,] 0.18983805 0.3796761 0.8101620 [14,] 0.30779433 0.6155887 0.6922057 [15,] 0.29589324 0.5917865 0.7041068 [16,] 0.21874803 0.4374961 0.7812520 [17,] 0.25671844 0.5134369 0.7432816 [18,] 0.25421154 0.5084231 0.7457885 [19,] 0.30427204 0.6085441 0.6957280 [20,] 0.28229820 0.5645964 0.7177018 [21,] 0.23666026 0.4733205 0.7633397 [22,] 0.18084886 0.3616977 0.8191511 [23,] 0.17137042 0.3427408 0.8286296 [24,] 0.14855790 0.2971158 0.8514421 [25,] 0.44366201 0.8873240 0.5563380 [26,] 0.56113527 0.8777295 0.4388647 [27,] 0.45067667 0.9013533 0.5493233 [28,] 0.58044528 0.8391094 0.4195547 [29,] 0.52309044 0.9538191 0.4769096 [30,] 0.45960342 0.9192068 0.5403966 > postscript(file="/var/www/html/rcomp/tmp/16jlm1258734706.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/2hm6y1258734706.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/3rxxa1258734706.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/4f99k1258734706.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/5m6aq1258734706.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 7 -2.6008299 -1.0400000 -2.6000000 -1.8409959 -5.5209959 -5.4209959 -0.1009959 8 9 10 11 12 13 14 -7.3209959 -7.3409959 -7.3409959 -3.0609959 -7.2009959 -0.1008299 -7.5400000 15 16 17 18 19 20 21 -3.7000000 -2.7409959 -9.9209959 -0.5209959 0.5990041 -2.9209959 -2.5409959 22 23 24 25 26 27 28 3.4590041 -5.1609959 4.5990041 0.5991701 -3.0400000 1.1000000 -1.1409959 29 30 31 32 33 34 35 0.6790041 3.5790041 0.2990041 4.0790041 2.0590041 6.7590041 0.2390041 36 37 38 39 40 41 42 3.9990041 3.1991701 4.0600000 4.8000000 -3.4409959 6.5790041 3.9790041 43 44 45 46 47 48 49 -1.7009959 8.7790041 9.5590041 -2.2409959 11.4390041 3.7990041 1.8991701 50 51 52 53 54 55 56 7.5600000 0.4000000 9.1639834 8.1839834 -1.6160166 0.9039834 -2.6160166 57 58 59 60 61 -1.7360166 -0.6360166 -3.4560166 -5.1960166 -2.9958506 > postscript(file="/var/www/html/rcomp/tmp/6g30a1258734706.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 -2.6008299 NA 1 -1.0400000 -2.6008299 2 -2.6000000 -1.0400000 3 -1.8409959 -2.6000000 4 -5.5209959 -1.8409959 5 -5.4209959 -5.5209959 6 -0.1009959 -5.4209959 7 -7.3209959 -0.1009959 8 -7.3409959 -7.3209959 9 -7.3409959 -7.3409959 10 -3.0609959 -7.3409959 11 -7.2009959 -3.0609959 12 -0.1008299 -7.2009959 13 -7.5400000 -0.1008299 14 -3.7000000 -7.5400000 15 -2.7409959 -3.7000000 16 -9.9209959 -2.7409959 17 -0.5209959 -9.9209959 18 0.5990041 -0.5209959 19 -2.9209959 0.5990041 20 -2.5409959 -2.9209959 21 3.4590041 -2.5409959 22 -5.1609959 3.4590041 23 4.5990041 -5.1609959 24 0.5991701 4.5990041 25 -3.0400000 0.5991701 26 1.1000000 -3.0400000 27 -1.1409959 1.1000000 28 0.6790041 -1.1409959 29 3.5790041 0.6790041 30 0.2990041 3.5790041 31 4.0790041 0.2990041 32 2.0590041 4.0790041 33 6.7590041 2.0590041 34 0.2390041 6.7590041 35 3.9990041 0.2390041 36 3.1991701 3.9990041 37 4.0600000 3.1991701 38 4.8000000 4.0600000 39 -3.4409959 4.8000000 40 6.5790041 -3.4409959 41 3.9790041 6.5790041 42 -1.7009959 3.9790041 43 8.7790041 -1.7009959 44 9.5590041 8.7790041 45 -2.2409959 9.5590041 46 11.4390041 -2.2409959 47 3.7990041 11.4390041 48 1.8991701 3.7990041 49 7.5600000 1.8991701 50 0.4000000 7.5600000 51 9.1639834 0.4000000 52 8.1839834 9.1639834 53 -1.6160166 8.1839834 54 0.9039834 -1.6160166 55 -2.6160166 0.9039834 56 -1.7360166 -2.6160166 57 -0.6360166 -1.7360166 58 -3.4560166 -0.6360166 59 -5.1960166 -3.4560166 60 -2.9958506 -5.1960166 61 NA -2.9958506 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -1.0400000 -2.6008299 [2,] -2.6000000 -1.0400000 [3,] -1.8409959 -2.6000000 [4,] -5.5209959 -1.8409959 [5,] -5.4209959 -5.5209959 [6,] -0.1009959 -5.4209959 [7,] -7.3209959 -0.1009959 [8,] -7.3409959 -7.3209959 [9,] -7.3409959 -7.3409959 [10,] -3.0609959 -7.3409959 [11,] -7.2009959 -3.0609959 [12,] -0.1008299 -7.2009959 [13,] -7.5400000 -0.1008299 [14,] -3.7000000 -7.5400000 [15,] -2.7409959 -3.7000000 [16,] -9.9209959 -2.7409959 [17,] -0.5209959 -9.9209959 [18,] 0.5990041 -0.5209959 [19,] -2.9209959 0.5990041 [20,] -2.5409959 -2.9209959 [21,] 3.4590041 -2.5409959 [22,] -5.1609959 3.4590041 [23,] 4.5990041 -5.1609959 [24,] 0.5991701 4.5990041 [25,] -3.0400000 0.5991701 [26,] 1.1000000 -3.0400000 [27,] -1.1409959 1.1000000 [28,] 0.6790041 -1.1409959 [29,] 3.5790041 0.6790041 [30,] 0.2990041 3.5790041 [31,] 4.0790041 0.2990041 [32,] 2.0590041 4.0790041 [33,] 6.7590041 2.0590041 [34,] 0.2390041 6.7590041 [35,] 3.9990041 0.2390041 [36,] 3.1991701 3.9990041 [37,] 4.0600000 3.1991701 [38,] 4.8000000 4.0600000 [39,] -3.4409959 4.8000000 [40,] 6.5790041 -3.4409959 [41,] 3.9790041 6.5790041 [42,] -1.7009959 3.9790041 [43,] 8.7790041 -1.7009959 [44,] 9.5590041 8.7790041 [45,] -2.2409959 9.5590041 [46,] 11.4390041 -2.2409959 [47,] 3.7990041 11.4390041 [48,] 1.8991701 3.7990041 [49,] 7.5600000 1.8991701 [50,] 0.4000000 7.5600000 [51,] 9.1639834 0.4000000 [52,] 8.1839834 9.1639834 [53,] -1.6160166 8.1839834 [54,] 0.9039834 -1.6160166 [55,] -2.6160166 0.9039834 [56,] -1.7360166 -2.6160166 [57,] -0.6360166 -1.7360166 [58,] -3.4560166 -0.6360166 [59,] -5.1960166 -3.4560166 [60,] -2.9958506 -5.1960166 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -1.0400000 -2.6008299 2 -2.6000000 -1.0400000 3 -1.8409959 -2.6000000 4 -5.5209959 -1.8409959 5 -5.4209959 -5.5209959 6 -0.1009959 -5.4209959 7 -7.3209959 -0.1009959 8 -7.3409959 -7.3209959 9 -7.3409959 -7.3409959 10 -3.0609959 -7.3409959 11 -7.2009959 -3.0609959 12 -0.1008299 -7.2009959 13 -7.5400000 -0.1008299 14 -3.7000000 -7.5400000 15 -2.7409959 -3.7000000 16 -9.9209959 -2.7409959 17 -0.5209959 -9.9209959 18 0.5990041 -0.5209959 19 -2.9209959 0.5990041 20 -2.5409959 -2.9209959 21 3.4590041 -2.5409959 22 -5.1609959 3.4590041 23 4.5990041 -5.1609959 24 0.5991701 4.5990041 25 -3.0400000 0.5991701 26 1.1000000 -3.0400000 27 -1.1409959 1.1000000 28 0.6790041 -1.1409959 29 3.5790041 0.6790041 30 0.2990041 3.5790041 31 4.0790041 0.2990041 32 2.0590041 4.0790041 33 6.7590041 2.0590041 34 0.2390041 6.7590041 35 3.9990041 0.2390041 36 3.1991701 3.9990041 37 4.0600000 3.1991701 38 4.8000000 4.0600000 39 -3.4409959 4.8000000 40 6.5790041 -3.4409959 41 3.9790041 6.5790041 42 -1.7009959 3.9790041 43 8.7790041 -1.7009959 44 9.5590041 8.7790041 45 -2.2409959 9.5590041 46 11.4390041 -2.2409959 47 3.7990041 11.4390041 48 1.8991701 3.7990041 49 7.5600000 1.8991701 50 0.4000000 7.5600000 51 9.1639834 0.4000000 52 8.1839834 9.1639834 53 -1.6160166 8.1839834 54 0.9039834 -1.6160166 55 -2.6160166 0.9039834 56 -1.7360166 -2.6160166 57 -0.6360166 -1.7360166 58 -3.4560166 -0.6360166 59 -5.1960166 -3.4560166 60 -2.9958506 -5.1960166 > 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/7eopr1258734706.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/8s5p61258734706.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/9ak641258734706.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/10cwzu1258734706.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/11rtq21258734706.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/12yygf1258734706.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/13k8tp1258734706.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/143a5x1258734706.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/153zhu1258734706.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/16qwhu1258734706.tab") + } > > system("convert tmp/16jlm1258734706.ps tmp/16jlm1258734706.png") > system("convert tmp/2hm6y1258734706.ps tmp/2hm6y1258734706.png") > system("convert tmp/3rxxa1258734706.ps tmp/3rxxa1258734706.png") > system("convert tmp/4f99k1258734706.ps tmp/4f99k1258734706.png") > system("convert tmp/5m6aq1258734706.ps tmp/5m6aq1258734706.png") > system("convert tmp/6g30a1258734706.ps tmp/6g30a1258734706.png") > system("convert tmp/7eopr1258734706.ps tmp/7eopr1258734706.png") > system("convert tmp/8s5p61258734706.ps tmp/8s5p61258734706.png") > system("convert tmp/9ak641258734706.ps tmp/9ak641258734706.png") > system("convert tmp/10cwzu1258734706.ps tmp/10cwzu1258734706.png") > > > proc.time() user system elapsed 2.414 1.552 2.824