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 = '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 111.4 0 1 0 0 0 0 0 0 0 0 0 0 1 2 87.4 0 0 1 0 0 0 0 0 0 0 0 0 2 3 96.8 0 0 0 1 0 0 0 0 0 0 0 0 3 4 114.1 0 0 0 0 1 0 0 0 0 0 0 0 4 5 110.3 0 0 0 0 0 1 0 0 0 0 0 0 5 6 103.9 0 0 0 0 0 0 1 0 0 0 0 0 6 7 101.6 0 0 0 0 0 0 0 1 0 0 0 0 7 8 94.6 0 0 0 0 0 0 0 0 1 0 0 0 8 9 95.9 0 0 0 0 0 0 0 0 0 1 0 0 9 10 104.7 0 0 0 0 0 0 0 0 0 0 1 0 10 11 102.8 0 0 0 0 0 0 0 0 0 0 0 1 11 12 98.1 0 0 0 0 0 0 0 0 0 0 0 0 12 13 113.9 0 1 0 0 0 0 0 0 0 0 0 0 13 14 80.9 0 0 1 0 0 0 0 0 0 0 0 0 14 15 95.7 0 0 0 1 0 0 0 0 0 0 0 0 15 16 113.2 0 0 0 0 1 0 0 0 0 0 0 0 16 17 105.9 0 0 0 0 0 1 0 0 0 0 0 0 17 18 108.8 0 0 0 0 0 0 1 0 0 0 0 0 18 19 102.3 0 0 0 0 0 0 0 1 0 0 0 0 19 20 99.0 0 0 0 0 0 0 0 0 1 0 0 0 20 21 100.7 0 0 0 0 0 0 0 0 0 1 0 0 21 22 115.5 0 0 0 0 0 0 0 0 0 0 1 0 22 23 100.7 0 0 0 0 0 0 0 0 0 0 0 1 23 24 109.9 0 0 0 0 0 0 0 0 0 0 0 0 24 25 114.6 0 1 0 0 0 0 0 0 0 0 0 0 25 26 85.4 0 0 1 0 0 0 0 0 0 0 0 0 26 27 100.5 0 0 0 1 0 0 0 0 0 0 0 0 27 28 114.8 0 0 0 0 1 0 0 0 0 0 0 0 28 29 116.5 0 0 0 0 0 1 0 0 0 0 0 0 29 30 112.9 0 0 0 0 0 0 1 0 0 0 0 0 30 31 102.0 0 0 0 0 0 0 0 1 0 0 0 0 31 32 106.0 0 0 0 0 0 0 0 0 1 0 0 0 32 33 105.3 0 0 0 0 0 0 0 0 0 1 0 0 33 34 118.8 0 0 0 0 0 0 0 0 0 0 1 0 34 35 106.1 0 0 0 0 0 0 0 0 0 0 0 1 35 36 109.3 0 0 0 0 0 0 0 0 0 0 0 0 36 37 117.2 0 1 0 0 0 0 0 0 0 0 0 0 37 38 92.5 0 0 1 0 0 0 0 0 0 0 0 0 38 39 104.2 0 0 0 1 0 0 0 0 0 0 0 0 39 40 112.5 0 0 0 0 1 0 0 0 0 0 0 0 40 41 122.4 0 0 0 0 0 1 0 0 0 0 0 0 41 42 113.3 0 0 0 0 0 0 1 0 0 0 0 0 42 43 100.0 0 0 0 0 0 0 0 1 0 0 0 0 43 44 110.7 0 0 0 0 0 0 0 0 1 0 0 0 44 45 112.8 0 0 0 0 0 0 0 0 0 1 0 0 45 46 109.8 0 0 0 0 0 0 0 0 0 0 1 0 46 47 117.3 0 0 0 0 0 0 0 0 0 0 0 1 47 48 109.1 0 0 0 0 0 0 0 0 0 0 0 0 48 49 115.9 0 1 0 0 0 0 0 0 0 0 0 0 49 50 96.0 0 0 1 0 0 0 0 0 0 0 0 0 50 51 99.8 0 0 0 1 0 0 0 0 0 0 0 0 51 52 116.8 1 0 0 0 1 0 0 0 0 0 0 0 52 53 115.7 1 0 0 0 0 1 0 0 0 0 0 0 53 54 99.4 1 0 0 0 0 0 1 0 0 0 0 0 54 55 94.3 1 0 0 0 0 0 0 1 0 0 0 0 55 56 91.0 1 0 0 0 0 0 0 0 1 0 0 0 56 57 93.2 1 0 0 0 0 0 0 0 0 1 0 0 57 58 103.1 1 0 0 0 0 0 0 0 0 0 1 0 58 59 94.1 1 0 0 0 0 0 0 0 0 0 0 1 59 60 91.8 1 0 0 0 0 0 0 0 0 0 0 0 60 61 102.7 1 1 0 0 0 0 0 0 0 0 0 0 61 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) X M1 M2 M3 M4 98.8506 -14.9166 9.5590 -16.0242 -5.2801 12.3673 M5 M6 M7 M8 M9 M10 12.0314 5.3155 -2.5205 -2.5164 -1.4123 7.1718 M11 t 0.7759 0.2159 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -8.6524 -3.0400 -0.1142 2.5818 9.2715 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 98.85060 2.30862 42.818 < 2e-16 *** X -14.91664 1.97849 -7.539 1.25e-09 *** M1 9.55899 2.61324 3.658 0.000641 *** M2 -16.02424 2.74509 -5.837 4.74e-07 *** M3 -5.28014 2.74298 -1.925 0.060298 . M4 12.36727 2.74355 4.508 4.35e-05 *** M5 12.03136 2.73886 4.393 6.33e-05 *** M6 5.31546 2.73479 1.944 0.057940 . M7 -2.52045 2.73135 -0.923 0.360831 M8 -2.51636 2.72852 -0.922 0.361112 M9 -1.41227 2.72633 -0.518 0.606879 M10 7.17182 2.72475 2.632 0.011445 * M11 0.77591 2.72381 0.285 0.777002 t 0.21591 0.04139 5.217 4.02e-06 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 4.306 on 47 degrees of freedom Multiple R-squared: 0.8305, Adjusted R-squared: 0.7836 F-statistic: 17.71 on 13 and 47 DF, p-value: 7.074e-14 > 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.253278762 0.50655752 0.7467212 [2,] 0.298159055 0.59631811 0.7018409 [3,] 0.182101150 0.36420230 0.8178988 [4,] 0.162175030 0.32435006 0.8378250 [5,] 0.140275499 0.28055100 0.8597245 [6,] 0.281099139 0.56219828 0.7189009 [7,] 0.242114362 0.48422872 0.7578856 [8,] 0.375554373 0.75110875 0.6244456 [9,] 0.280854085 0.56170817 0.7191459 [10,] 0.233311476 0.46662295 0.7666885 [11,] 0.163883874 0.32776775 0.8361161 [12,] 0.123389280 0.24677856 0.8766107 [13,] 0.155473287 0.31094657 0.8445267 [14,] 0.113796345 0.22759269 0.8862037 [15,] 0.083140979 0.16628196 0.9168590 [16,] 0.074333300 0.14866660 0.9256667 [17,] 0.057373848 0.11474770 0.9426262 [18,] 0.054256599 0.10851320 0.9457434 [19,] 0.043834653 0.08766931 0.9561653 [20,] 0.025426372 0.05085274 0.9745736 [21,] 0.014304335 0.02860867 0.9856957 [22,] 0.009835917 0.01967183 0.9901641 [23,] 0.004655055 0.00931011 0.9953449 [24,] 0.081651435 0.16330287 0.9183486 [25,] 0.116169749 0.23233950 0.8838303 [26,] 0.066198057 0.13239611 0.9338019 [27,] 0.177083641 0.35416728 0.8229164 [28,] 0.126005659 0.25201132 0.8739943 > postscript(file="/var/www/html/rcomp/tmp/1sstz1258735502.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/2m3331258735502.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/3k9vv1258735502.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/4xw041258735502.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/5sp801258735502.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 2.77450331 4.14182119 2.58182119 2.01849338 -1.66150662 -1.56150662 7 8 9 10 11 12 3.75849338 -3.46150662 -3.48150662 -3.48150662 0.79849338 -3.34150662 13 14 15 16 17 18 2.68359272 -4.94908940 -1.10908940 -1.47241722 -8.65241722 0.74758278 19 20 21 22 23 24 1.86758278 -1.65241722 -1.27241722 4.72758278 -3.89241722 5.86758278 25 26 27 28 29 30 0.79268212 -3.04000000 1.10000000 -2.46332781 -0.64332781 2.25667219 31 32 33 34 35 36 -1.02332781 2.75667219 0.73667219 5.43667219 -1.08332781 2.67667219 37 38 39 40 41 42 0.80177152 1.46908940 2.20908940 -7.35423841 2.66576159 0.06576159 43 44 45 46 47 48 -5.61423841 4.86576159 5.64576159 -6.15423841 7.52576159 -0.11423841 49 50 51 52 53 54 -3.08913907 2.37817881 -4.78182119 9.27149007 8.29149007 -1.50850993 55 56 57 58 59 60 1.01149007 -2.50850993 -1.62850993 -0.52850993 -3.34850993 -5.08850993 61 -3.96341060 > postscript(file="/var/www/html/rcomp/tmp/6ngb61258735502.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.77450331 NA 1 4.14182119 2.77450331 2 2.58182119 4.14182119 3 2.01849338 2.58182119 4 -1.66150662 2.01849338 5 -1.56150662 -1.66150662 6 3.75849338 -1.56150662 7 -3.46150662 3.75849338 8 -3.48150662 -3.46150662 9 -3.48150662 -3.48150662 10 0.79849338 -3.48150662 11 -3.34150662 0.79849338 12 2.68359272 -3.34150662 13 -4.94908940 2.68359272 14 -1.10908940 -4.94908940 15 -1.47241722 -1.10908940 16 -8.65241722 -1.47241722 17 0.74758278 -8.65241722 18 1.86758278 0.74758278 19 -1.65241722 1.86758278 20 -1.27241722 -1.65241722 21 4.72758278 -1.27241722 22 -3.89241722 4.72758278 23 5.86758278 -3.89241722 24 0.79268212 5.86758278 25 -3.04000000 0.79268212 26 1.10000000 -3.04000000 27 -2.46332781 1.10000000 28 -0.64332781 -2.46332781 29 2.25667219 -0.64332781 30 -1.02332781 2.25667219 31 2.75667219 -1.02332781 32 0.73667219 2.75667219 33 5.43667219 0.73667219 34 -1.08332781 5.43667219 35 2.67667219 -1.08332781 36 0.80177152 2.67667219 37 1.46908940 0.80177152 38 2.20908940 1.46908940 39 -7.35423841 2.20908940 40 2.66576159 -7.35423841 41 0.06576159 2.66576159 42 -5.61423841 0.06576159 43 4.86576159 -5.61423841 44 5.64576159 4.86576159 45 -6.15423841 5.64576159 46 7.52576159 -6.15423841 47 -0.11423841 7.52576159 48 -3.08913907 -0.11423841 49 2.37817881 -3.08913907 50 -4.78182119 2.37817881 51 9.27149007 -4.78182119 52 8.29149007 9.27149007 53 -1.50850993 8.29149007 54 1.01149007 -1.50850993 55 -2.50850993 1.01149007 56 -1.62850993 -2.50850993 57 -0.52850993 -1.62850993 58 -3.34850993 -0.52850993 59 -5.08850993 -3.34850993 60 -3.96341060 -5.08850993 61 NA -3.96341060 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] 4.14182119 2.77450331 [2,] 2.58182119 4.14182119 [3,] 2.01849338 2.58182119 [4,] -1.66150662 2.01849338 [5,] -1.56150662 -1.66150662 [6,] 3.75849338 -1.56150662 [7,] -3.46150662 3.75849338 [8,] -3.48150662 -3.46150662 [9,] -3.48150662 -3.48150662 [10,] 0.79849338 -3.48150662 [11,] -3.34150662 0.79849338 [12,] 2.68359272 -3.34150662 [13,] -4.94908940 2.68359272 [14,] -1.10908940 -4.94908940 [15,] -1.47241722 -1.10908940 [16,] -8.65241722 -1.47241722 [17,] 0.74758278 -8.65241722 [18,] 1.86758278 0.74758278 [19,] -1.65241722 1.86758278 [20,] -1.27241722 -1.65241722 [21,] 4.72758278 -1.27241722 [22,] -3.89241722 4.72758278 [23,] 5.86758278 -3.89241722 [24,] 0.79268212 5.86758278 [25,] -3.04000000 0.79268212 [26,] 1.10000000 -3.04000000 [27,] -2.46332781 1.10000000 [28,] -0.64332781 -2.46332781 [29,] 2.25667219 -0.64332781 [30,] -1.02332781 2.25667219 [31,] 2.75667219 -1.02332781 [32,] 0.73667219 2.75667219 [33,] 5.43667219 0.73667219 [34,] -1.08332781 5.43667219 [35,] 2.67667219 -1.08332781 [36,] 0.80177152 2.67667219 [37,] 1.46908940 0.80177152 [38,] 2.20908940 1.46908940 [39,] -7.35423841 2.20908940 [40,] 2.66576159 -7.35423841 [41,] 0.06576159 2.66576159 [42,] -5.61423841 0.06576159 [43,] 4.86576159 -5.61423841 [44,] 5.64576159 4.86576159 [45,] -6.15423841 5.64576159 [46,] 7.52576159 -6.15423841 [47,] -0.11423841 7.52576159 [48,] -3.08913907 -0.11423841 [49,] 2.37817881 -3.08913907 [50,] -4.78182119 2.37817881 [51,] 9.27149007 -4.78182119 [52,] 8.29149007 9.27149007 [53,] -1.50850993 8.29149007 [54,] 1.01149007 -1.50850993 [55,] -2.50850993 1.01149007 [56,] -1.62850993 -2.50850993 [57,] -0.52850993 -1.62850993 [58,] -3.34850993 -0.52850993 [59,] -5.08850993 -3.34850993 [60,] -3.96341060 -5.08850993 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 4.14182119 2.77450331 2 2.58182119 4.14182119 3 2.01849338 2.58182119 4 -1.66150662 2.01849338 5 -1.56150662 -1.66150662 6 3.75849338 -1.56150662 7 -3.46150662 3.75849338 8 -3.48150662 -3.46150662 9 -3.48150662 -3.48150662 10 0.79849338 -3.48150662 11 -3.34150662 0.79849338 12 2.68359272 -3.34150662 13 -4.94908940 2.68359272 14 -1.10908940 -4.94908940 15 -1.47241722 -1.10908940 16 -8.65241722 -1.47241722 17 0.74758278 -8.65241722 18 1.86758278 0.74758278 19 -1.65241722 1.86758278 20 -1.27241722 -1.65241722 21 4.72758278 -1.27241722 22 -3.89241722 4.72758278 23 5.86758278 -3.89241722 24 0.79268212 5.86758278 25 -3.04000000 0.79268212 26 1.10000000 -3.04000000 27 -2.46332781 1.10000000 28 -0.64332781 -2.46332781 29 2.25667219 -0.64332781 30 -1.02332781 2.25667219 31 2.75667219 -1.02332781 32 0.73667219 2.75667219 33 5.43667219 0.73667219 34 -1.08332781 5.43667219 35 2.67667219 -1.08332781 36 0.80177152 2.67667219 37 1.46908940 0.80177152 38 2.20908940 1.46908940 39 -7.35423841 2.20908940 40 2.66576159 -7.35423841 41 0.06576159 2.66576159 42 -5.61423841 0.06576159 43 4.86576159 -5.61423841 44 5.64576159 4.86576159 45 -6.15423841 5.64576159 46 7.52576159 -6.15423841 47 -0.11423841 7.52576159 48 -3.08913907 -0.11423841 49 2.37817881 -3.08913907 50 -4.78182119 2.37817881 51 9.27149007 -4.78182119 52 8.29149007 9.27149007 53 -1.50850993 8.29149007 54 1.01149007 -1.50850993 55 -2.50850993 1.01149007 56 -1.62850993 -2.50850993 57 -0.52850993 -1.62850993 58 -3.34850993 -0.52850993 59 -5.08850993 -3.34850993 60 -3.96341060 -5.08850993 > 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/7knt41258735502.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/8v9by1258735502.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/9hc891258735502.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/101x1b1258735502.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/113t1o1258735502.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/12r7m01258735502.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/133gnh1258735502.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/14kxms1258735502.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/15bty51258735502.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/16unqd1258735502.tab") + } > > system("convert tmp/1sstz1258735502.ps tmp/1sstz1258735502.png") > system("convert tmp/2m3331258735502.ps tmp/2m3331258735502.png") > system("convert tmp/3k9vv1258735502.ps tmp/3k9vv1258735502.png") > system("convert tmp/4xw041258735502.ps tmp/4xw041258735502.png") > system("convert tmp/5sp801258735502.ps tmp/5sp801258735502.png") > system("convert tmp/6ngb61258735502.ps tmp/6ngb61258735502.png") > system("convert tmp/7knt41258735502.ps tmp/7knt41258735502.png") > system("convert tmp/8v9by1258735502.ps tmp/8v9by1258735502.png") > system("convert tmp/9hc891258735502.ps tmp/9hc891258735502.png") > system("convert tmp/101x1b1258735502.ps tmp/101x1b1258735502.png") > > > proc.time() user system elapsed 2.497 1.637 8.892