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(100.00,0,100.83,0,101.51,0,102.16,0,102.39,0,102.54,0,102.85,0,103.47,0,103.57,0,103.69,0,103.50,0,103.47,0,103.45,0,103.48,0,103.93,0,103.89,0,104.40,0,104.79,0,104.77,0,105.13,0,105.26,0,104.96,0,104.75,0,105.01,0,105.15,0,105.20,0,105.77,0,105.78,0,106.26,0,106.13,0,106.12,0,106.57,0,106.44,0,106.54,0,107.10,0,108.10,0,108.40,0,108.84,0,109.62,0,110.42,0,110.67,0,111.66,0,112.28,0,112.87,1,112.18,1,112.36,1,112.16,1,111.49,1,111.25,1,111.36,1,111.74,1,111.10,1,111.33,1,111.25,1,111.04,1,110.97,1,111.31,1,111.02,1,111.07,1,111.36,1),dim=c(2,60),dimnames=list(c('Y','X'),1:60)) > y <- array(NA,dim=c(2,60),dimnames=list(c('Y','X'),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 Y X M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t 1 100.00 0 1 0 0 0 0 0 0 0 0 0 0 1 2 100.83 0 0 1 0 0 0 0 0 0 0 0 0 2 3 101.51 0 0 0 1 0 0 0 0 0 0 0 0 3 4 102.16 0 0 0 0 1 0 0 0 0 0 0 0 4 5 102.39 0 0 0 0 0 1 0 0 0 0 0 0 5 6 102.54 0 0 0 0 0 0 1 0 0 0 0 0 6 7 102.85 0 0 0 0 0 0 0 1 0 0 0 0 7 8 103.47 0 0 0 0 0 0 0 0 1 0 0 0 8 9 103.57 0 0 0 0 0 0 0 0 0 1 0 0 9 10 103.69 0 0 0 0 0 0 0 0 0 0 1 0 10 11 103.50 0 0 0 0 0 0 0 0 0 0 0 1 11 12 103.47 0 0 0 0 0 0 0 0 0 0 0 0 12 13 103.45 0 1 0 0 0 0 0 0 0 0 0 0 13 14 103.48 0 0 1 0 0 0 0 0 0 0 0 0 14 15 103.93 0 0 0 1 0 0 0 0 0 0 0 0 15 16 103.89 0 0 0 0 1 0 0 0 0 0 0 0 16 17 104.40 0 0 0 0 0 1 0 0 0 0 0 0 17 18 104.79 0 0 0 0 0 0 1 0 0 0 0 0 18 19 104.77 0 0 0 0 0 0 0 1 0 0 0 0 19 20 105.13 0 0 0 0 0 0 0 0 1 0 0 0 20 21 105.26 0 0 0 0 0 0 0 0 0 1 0 0 21 22 104.96 0 0 0 0 0 0 0 0 0 0 1 0 22 23 104.75 0 0 0 0 0 0 0 0 0 0 0 1 23 24 105.01 0 0 0 0 0 0 0 0 0 0 0 0 24 25 105.15 0 1 0 0 0 0 0 0 0 0 0 0 25 26 105.20 0 0 1 0 0 0 0 0 0 0 0 0 26 27 105.77 0 0 0 1 0 0 0 0 0 0 0 0 27 28 105.78 0 0 0 0 1 0 0 0 0 0 0 0 28 29 106.26 0 0 0 0 0 1 0 0 0 0 0 0 29 30 106.13 0 0 0 0 0 0 1 0 0 0 0 0 30 31 106.12 0 0 0 0 0 0 0 1 0 0 0 0 31 32 106.57 0 0 0 0 0 0 0 0 1 0 0 0 32 33 106.44 0 0 0 0 0 0 0 0 0 1 0 0 33 34 106.54 0 0 0 0 0 0 0 0 0 0 1 0 34 35 107.10 0 0 0 0 0 0 0 0 0 0 0 1 35 36 108.10 0 0 0 0 0 0 0 0 0 0 0 0 36 37 108.40 0 1 0 0 0 0 0 0 0 0 0 0 37 38 108.84 0 0 1 0 0 0 0 0 0 0 0 0 38 39 109.62 0 0 0 1 0 0 0 0 0 0 0 0 39 40 110.42 0 0 0 0 1 0 0 0 0 0 0 0 40 41 110.67 0 0 0 0 0 1 0 0 0 0 0 0 41 42 111.66 0 0 0 0 0 0 1 0 0 0 0 0 42 43 112.28 0 0 0 0 0 0 0 1 0 0 0 0 43 44 112.87 1 0 0 0 0 0 0 0 1 0 0 0 44 45 112.18 1 0 0 0 0 0 0 0 0 1 0 0 45 46 112.36 1 0 0 0 0 0 0 0 0 0 1 0 46 47 112.16 1 0 0 0 0 0 0 0 0 0 0 1 47 48 111.49 1 0 0 0 0 0 0 0 0 0 0 0 48 49 111.25 1 1 0 0 0 0 0 0 0 0 0 0 49 50 111.36 1 0 1 0 0 0 0 0 0 0 0 0 50 51 111.74 1 0 0 1 0 0 0 0 0 0 0 0 51 52 111.10 1 0 0 0 1 0 0 0 0 0 0 0 52 53 111.33 1 0 0 0 0 1 0 0 0 0 0 0 53 54 111.25 1 0 0 0 0 0 1 0 0 0 0 0 54 55 111.04 1 0 0 0 0 0 0 1 0 0 0 0 55 56 110.97 1 0 0 0 0 0 0 0 1 0 0 0 56 57 111.31 1 0 0 0 0 0 0 0 0 1 0 0 57 58 111.02 1 0 0 0 0 0 0 0 0 0 1 0 58 59 111.07 1 0 0 0 0 0 0 0 0 0 0 1 59 60 111.36 1 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) X M1 M2 M3 M4 100.79854 0.40550 -0.03885 0.06078 0.44042 0.40405 M5 M6 M7 M8 M9 M10 0.55168 0.62331 0.56894 0.68547 0.44311 0.21274 M11 t 0.02237 0.19237 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -1.6921 -0.6644 -0.1979 0.5328 2.6407 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 100.79854 0.64347 156.647 <2e-16 *** X 0.40550 0.55009 0.737 0.465 M1 -0.03885 0.75209 -0.052 0.959 M2 0.06078 0.75088 0.081 0.936 M3 0.44042 0.74993 0.587 0.560 M4 0.40405 0.74925 0.539 0.592 M5 0.55168 0.74885 0.737 0.465 M6 0.62331 0.74871 0.833 0.409 M7 0.56894 0.74885 0.760 0.451 M8 0.68547 0.74768 0.917 0.364 M9 0.44311 0.74673 0.593 0.556 M10 0.21274 0.74605 0.285 0.777 M11 0.02237 0.74564 0.030 0.976 t 0.19237 0.01425 13.497 <2e-16 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 1.179 on 46 degrees of freedom Multiple R-squared: 0.9193, Adjusted R-squared: 0.8964 F-statistic: 40.28 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,] 6.553611e-02 1.310722e-01 0.9344639 [2,] 1.991623e-02 3.983246e-02 0.9800838 [3,] 6.853304e-03 1.370661e-02 0.9931467 [4,] 2.927157e-03 5.854313e-03 0.9970728 [5,] 1.075402e-03 2.150803e-03 0.9989246 [6,] 6.737223e-04 1.347445e-03 0.9993263 [7,] 3.629101e-04 7.258203e-04 0.9996371 [8,] 1.226974e-04 2.453947e-04 0.9998773 [9,] 4.247354e-05 8.494707e-05 0.9999575 [10,] 1.198123e-05 2.396245e-05 0.9999880 [11,] 3.389972e-06 6.779945e-06 0.9999966 [12,] 1.180720e-06 2.361440e-06 0.9999988 [13,] 3.723062e-07 7.446123e-07 0.9999996 [14,] 3.055556e-07 6.111112e-07 0.9999997 [15,] 7.078834e-07 1.415767e-06 0.9999993 [16,] 9.302440e-07 1.860488e-06 0.9999991 [17,] 3.221448e-06 6.442896e-06 0.9999968 [18,] 1.696091e-05 3.392181e-05 0.9999830 [19,] 1.505455e-04 3.010909e-04 0.9998495 [20,] 3.459496e-03 6.918991e-03 0.9965405 [21,] 4.697152e-02 9.394304e-02 0.9530285 [22,] 2.319520e-01 4.639041e-01 0.7680480 [23,] 6.558416e-01 6.883169e-01 0.3441584 [24,] 7.673864e-01 4.652272e-01 0.2326136 [25,] 8.853303e-01 2.293394e-01 0.1146697 [26,] 8.858213e-01 2.283574e-01 0.1141787 [27,] 8.211342e-01 3.577316e-01 0.1788658 > postscript(file="/var/www/html/rcomp/tmp/1l0jx1260061077.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/2oqut1260061077.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/3d29d1260061077.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/4w4301260061077.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/5xwz21260061077.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.95205808 -0.41405808 -0.30605808 0.18794192 0.07794192 -0.03605808 7 8 9 10 11 12 0.13594192 0.44704174 0.59704174 0.75504174 0.56304174 0.36304174 13 14 15 16 17 18 0.18952087 -0.07247913 -0.19447913 -0.39047913 -0.22047913 -0.09447913 19 20 21 22 23 24 -0.25247913 -0.20137931 -0.02137931 -0.28337931 -0.49537931 -0.40537931 25 26 27 28 29 30 -0.41890018 -0.66090018 -0.66290018 -0.80890018 -0.66890018 -1.06290018 31 32 33 34 35 36 -1.21090018 -1.06980036 -1.14980036 -1.01180036 -0.45380036 0.37619964 37 38 39 40 41 42 0.52267877 0.67067877 0.87867877 1.52267877 1.43267877 2.15867877 43 44 45 46 47 48 2.64067877 2.51627949 1.87627949 2.09427949 1.89227949 1.05227949 49 50 51 52 53 54 0.65875862 0.47675862 0.28475862 -0.51124138 -0.62124138 -0.96524138 55 56 57 58 59 60 -1.31324138 -1.69214156 -1.30214156 -1.55414156 -1.50614156 -1.38614156 > postscript(file="/var/www/html/rcomp/tmp/64nrs1260061077.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.95205808 NA 1 -0.41405808 -0.95205808 2 -0.30605808 -0.41405808 3 0.18794192 -0.30605808 4 0.07794192 0.18794192 5 -0.03605808 0.07794192 6 0.13594192 -0.03605808 7 0.44704174 0.13594192 8 0.59704174 0.44704174 9 0.75504174 0.59704174 10 0.56304174 0.75504174 11 0.36304174 0.56304174 12 0.18952087 0.36304174 13 -0.07247913 0.18952087 14 -0.19447913 -0.07247913 15 -0.39047913 -0.19447913 16 -0.22047913 -0.39047913 17 -0.09447913 -0.22047913 18 -0.25247913 -0.09447913 19 -0.20137931 -0.25247913 20 -0.02137931 -0.20137931 21 -0.28337931 -0.02137931 22 -0.49537931 -0.28337931 23 -0.40537931 -0.49537931 24 -0.41890018 -0.40537931 25 -0.66090018 -0.41890018 26 -0.66290018 -0.66090018 27 -0.80890018 -0.66290018 28 -0.66890018 -0.80890018 29 -1.06290018 -0.66890018 30 -1.21090018 -1.06290018 31 -1.06980036 -1.21090018 32 -1.14980036 -1.06980036 33 -1.01180036 -1.14980036 34 -0.45380036 -1.01180036 35 0.37619964 -0.45380036 36 0.52267877 0.37619964 37 0.67067877 0.52267877 38 0.87867877 0.67067877 39 1.52267877 0.87867877 40 1.43267877 1.52267877 41 2.15867877 1.43267877 42 2.64067877 2.15867877 43 2.51627949 2.64067877 44 1.87627949 2.51627949 45 2.09427949 1.87627949 46 1.89227949 2.09427949 47 1.05227949 1.89227949 48 0.65875862 1.05227949 49 0.47675862 0.65875862 50 0.28475862 0.47675862 51 -0.51124138 0.28475862 52 -0.62124138 -0.51124138 53 -0.96524138 -0.62124138 54 -1.31324138 -0.96524138 55 -1.69214156 -1.31324138 56 -1.30214156 -1.69214156 57 -1.55414156 -1.30214156 58 -1.50614156 -1.55414156 59 -1.38614156 -1.50614156 60 NA -1.38614156 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -0.41405808 -0.95205808 [2,] -0.30605808 -0.41405808 [3,] 0.18794192 -0.30605808 [4,] 0.07794192 0.18794192 [5,] -0.03605808 0.07794192 [6,] 0.13594192 -0.03605808 [7,] 0.44704174 0.13594192 [8,] 0.59704174 0.44704174 [9,] 0.75504174 0.59704174 [10,] 0.56304174 0.75504174 [11,] 0.36304174 0.56304174 [12,] 0.18952087 0.36304174 [13,] -0.07247913 0.18952087 [14,] -0.19447913 -0.07247913 [15,] -0.39047913 -0.19447913 [16,] -0.22047913 -0.39047913 [17,] -0.09447913 -0.22047913 [18,] -0.25247913 -0.09447913 [19,] -0.20137931 -0.25247913 [20,] -0.02137931 -0.20137931 [21,] -0.28337931 -0.02137931 [22,] -0.49537931 -0.28337931 [23,] -0.40537931 -0.49537931 [24,] -0.41890018 -0.40537931 [25,] -0.66090018 -0.41890018 [26,] -0.66290018 -0.66090018 [27,] -0.80890018 -0.66290018 [28,] -0.66890018 -0.80890018 [29,] -1.06290018 -0.66890018 [30,] -1.21090018 -1.06290018 [31,] -1.06980036 -1.21090018 [32,] -1.14980036 -1.06980036 [33,] -1.01180036 -1.14980036 [34,] -0.45380036 -1.01180036 [35,] 0.37619964 -0.45380036 [36,] 0.52267877 0.37619964 [37,] 0.67067877 0.52267877 [38,] 0.87867877 0.67067877 [39,] 1.52267877 0.87867877 [40,] 1.43267877 1.52267877 [41,] 2.15867877 1.43267877 [42,] 2.64067877 2.15867877 [43,] 2.51627949 2.64067877 [44,] 1.87627949 2.51627949 [45,] 2.09427949 1.87627949 [46,] 1.89227949 2.09427949 [47,] 1.05227949 1.89227949 [48,] 0.65875862 1.05227949 [49,] 0.47675862 0.65875862 [50,] 0.28475862 0.47675862 [51,] -0.51124138 0.28475862 [52,] -0.62124138 -0.51124138 [53,] -0.96524138 -0.62124138 [54,] -1.31324138 -0.96524138 [55,] -1.69214156 -1.31324138 [56,] -1.30214156 -1.69214156 [57,] -1.55414156 -1.30214156 [58,] -1.50614156 -1.55414156 [59,] -1.38614156 -1.50614156 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -0.41405808 -0.95205808 2 -0.30605808 -0.41405808 3 0.18794192 -0.30605808 4 0.07794192 0.18794192 5 -0.03605808 0.07794192 6 0.13594192 -0.03605808 7 0.44704174 0.13594192 8 0.59704174 0.44704174 9 0.75504174 0.59704174 10 0.56304174 0.75504174 11 0.36304174 0.56304174 12 0.18952087 0.36304174 13 -0.07247913 0.18952087 14 -0.19447913 -0.07247913 15 -0.39047913 -0.19447913 16 -0.22047913 -0.39047913 17 -0.09447913 -0.22047913 18 -0.25247913 -0.09447913 19 -0.20137931 -0.25247913 20 -0.02137931 -0.20137931 21 -0.28337931 -0.02137931 22 -0.49537931 -0.28337931 23 -0.40537931 -0.49537931 24 -0.41890018 -0.40537931 25 -0.66090018 -0.41890018 26 -0.66290018 -0.66090018 27 -0.80890018 -0.66290018 28 -0.66890018 -0.80890018 29 -1.06290018 -0.66890018 30 -1.21090018 -1.06290018 31 -1.06980036 -1.21090018 32 -1.14980036 -1.06980036 33 -1.01180036 -1.14980036 34 -0.45380036 -1.01180036 35 0.37619964 -0.45380036 36 0.52267877 0.37619964 37 0.67067877 0.52267877 38 0.87867877 0.67067877 39 1.52267877 0.87867877 40 1.43267877 1.52267877 41 2.15867877 1.43267877 42 2.64067877 2.15867877 43 2.51627949 2.64067877 44 1.87627949 2.51627949 45 2.09427949 1.87627949 46 1.89227949 2.09427949 47 1.05227949 1.89227949 48 0.65875862 1.05227949 49 0.47675862 0.65875862 50 0.28475862 0.47675862 51 -0.51124138 0.28475862 52 -0.62124138 -0.51124138 53 -0.96524138 -0.62124138 54 -1.31324138 -0.96524138 55 -1.69214156 -1.31324138 56 -1.30214156 -1.69214156 57 -1.55414156 -1.30214156 58 -1.50614156 -1.55414156 59 -1.38614156 -1.50614156 > 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/72wy51260061077.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/8vyux1260061077.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/9kgjf1260061077.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/10yvk31260061077.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/1116md1260061077.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/129s6x1260061077.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/13ok9t1260061077.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/14ppne1260061077.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/15jkh21260061077.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/16rlcv1260061077.tab") + } > system("convert tmp/1l0jx1260061077.ps tmp/1l0jx1260061077.png") > system("convert tmp/2oqut1260061077.ps tmp/2oqut1260061077.png") > system("convert tmp/3d29d1260061077.ps tmp/3d29d1260061077.png") > system("convert tmp/4w4301260061077.ps tmp/4w4301260061077.png") > system("convert tmp/5xwz21260061077.ps tmp/5xwz21260061077.png") > system("convert tmp/64nrs1260061077.ps tmp/64nrs1260061077.png") > system("convert tmp/72wy51260061077.ps tmp/72wy51260061077.png") > system("convert tmp/8vyux1260061077.ps tmp/8vyux1260061077.png") > system("convert tmp/9kgjf1260061077.ps tmp/9kgjf1260061077.png") > system("convert tmp/10yvk31260061077.ps tmp/10yvk31260061077.png") > > > proc.time() user system elapsed 2.423 1.557 3.766