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(97.4,116.7,97,109,105.4,119.5,102.7,115.1,98.1,107.1,104.5,109.7,87.4,110.4,89.9,105,109.8,115.8,111.7,116.4,98.6,111.1,96.9,119.5,95.1,110.9,97,115.1,112.7,125.2,102.9,116,97.4,112.9,111.4,121.7,87.4,123.2,96.8,116.6,114.1,136.2,110.3,120.9,103.9,119.6,101.6,125.9,94.6,116.1,95.9,107.5,104.7,116.7,102.8,112.5,98.1,113,113.9,126.4,80.9,114.1,95.7,112.5,113.2,112.4,105.9,113.1,108.8,116.3,102.3,111.7,99,118.8,100.7,116.5,115.5,125.1,100.7,113.1,109.9,119.6,114.6,114.4,85.4,114,100.5,117.8,114.8,117,116.5,120.9,112.9,115,102,117.3,106,119.4,105.3,114.9,118.8,125.8,106.1,117.6,109.3,117.6,117.2,114.9,92.5,121.9,104.2,117,112.5,106.4,122.4,110.5,113.3,113.6,100,114.2),dim=c(2,60),dimnames=list(c('Tip','ipchn'),1:60)) > y <- array(NA,dim=c(2,60),dimnames=list(c('Tip','ipchn'),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 = 'No Linear Trend' > par2 = 'Include Monthly Dummies' > par1 = '2' > #'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 ipchn Tip M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 1 116.7 97.4 1 0 0 0 0 0 0 0 0 0 0 2 109.0 97.0 0 1 0 0 0 0 0 0 0 0 0 3 119.5 105.4 0 0 1 0 0 0 0 0 0 0 0 4 115.1 102.7 0 0 0 1 0 0 0 0 0 0 0 5 107.1 98.1 0 0 0 0 1 0 0 0 0 0 0 6 109.7 104.5 0 0 0 0 0 1 0 0 0 0 0 7 110.4 87.4 0 0 0 0 0 0 1 0 0 0 0 8 105.0 89.9 0 0 0 0 0 0 0 1 0 0 0 9 115.8 109.8 0 0 0 0 0 0 0 0 1 0 0 10 116.4 111.7 0 0 0 0 0 0 0 0 0 1 0 11 111.1 98.6 0 0 0 0 0 0 0 0 0 0 1 12 119.5 96.9 0 0 0 0 0 0 0 0 0 0 0 13 110.9 95.1 1 0 0 0 0 0 0 0 0 0 0 14 115.1 97.0 0 1 0 0 0 0 0 0 0 0 0 15 125.2 112.7 0 0 1 0 0 0 0 0 0 0 0 16 116.0 102.9 0 0 0 1 0 0 0 0 0 0 0 17 112.9 97.4 0 0 0 0 1 0 0 0 0 0 0 18 121.7 111.4 0 0 0 0 0 1 0 0 0 0 0 19 123.2 87.4 0 0 0 0 0 0 1 0 0 0 0 20 116.6 96.8 0 0 0 0 0 0 0 1 0 0 0 21 136.2 114.1 0 0 0 0 0 0 0 0 1 0 0 22 120.9 110.3 0 0 0 0 0 0 0 0 0 1 0 23 119.6 103.9 0 0 0 0 0 0 0 0 0 0 1 24 125.9 101.6 0 0 0 0 0 0 0 0 0 0 0 25 116.1 94.6 1 0 0 0 0 0 0 0 0 0 0 26 107.5 95.9 0 1 0 0 0 0 0 0 0 0 0 27 116.7 104.7 0 0 1 0 0 0 0 0 0 0 0 28 112.5 102.8 0 0 0 1 0 0 0 0 0 0 0 29 113.0 98.1 0 0 0 0 1 0 0 0 0 0 0 30 126.4 113.9 0 0 0 0 0 1 0 0 0 0 0 31 114.1 80.9 0 0 0 0 0 0 1 0 0 0 0 32 112.5 95.7 0 0 0 0 0 0 0 1 0 0 0 33 112.4 113.2 0 0 0 0 0 0 0 0 1 0 0 34 113.1 105.9 0 0 0 0 0 0 0 0 0 1 0 35 116.3 108.8 0 0 0 0 0 0 0 0 0 0 1 36 111.7 102.3 0 0 0 0 0 0 0 0 0 0 0 37 118.8 99.0 1 0 0 0 0 0 0 0 0 0 0 38 116.5 100.7 0 1 0 0 0 0 0 0 0 0 0 39 125.1 115.5 0 0 1 0 0 0 0 0 0 0 0 40 113.1 100.7 0 0 0 1 0 0 0 0 0 0 0 41 119.6 109.9 0 0 0 0 1 0 0 0 0 0 0 42 114.4 114.6 0 0 0 0 0 1 0 0 0 0 0 43 114.0 85.4 0 0 0 0 0 0 1 0 0 0 0 44 117.8 100.5 0 0 0 0 0 0 0 1 0 0 0 45 117.0 114.8 0 0 0 0 0 0 0 0 1 0 0 46 120.9 116.5 0 0 0 0 0 0 0 0 0 1 0 47 115.0 112.9 0 0 0 0 0 0 0 0 0 0 1 48 117.3 102.0 0 0 0 0 0 0 0 0 0 0 0 49 119.4 106.0 1 0 0 0 0 0 0 0 0 0 0 50 114.9 105.3 0 1 0 0 0 0 0 0 0 0 0 51 125.8 118.8 0 0 1 0 0 0 0 0 0 0 0 52 117.6 106.1 0 0 0 1 0 0 0 0 0 0 0 53 117.6 109.3 0 0 0 0 1 0 0 0 0 0 0 54 114.9 117.2 0 0 0 0 0 1 0 0 0 0 0 55 121.9 92.5 0 0 0 0 0 0 1 0 0 0 0 56 117.0 104.2 0 0 0 0 0 0 0 1 0 0 0 57 106.4 112.5 0 0 0 0 0 0 0 0 1 0 0 58 110.5 122.4 0 0 0 0 0 0 0 0 0 1 0 59 113.6 113.3 0 0 0 0 0 0 0 0 0 0 1 60 114.2 100.0 0 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) Tip M1 M2 M3 M4 72.0310 0.4543 -0.3677 -4.4930 -0.1942 -3.9868 M5 M6 M7 M8 M9 M10 -4.5887 -5.6431 5.2881 -2.5134 -5.7575 -7.1756 M11 -5.7532 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -10.98735 -2.63384 0.07685 2.17510 18.08570 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 72.0310 15.5434 4.634 2.86e-05 *** Tip 0.4543 0.1529 2.972 0.00466 ** M1 -0.3677 3.2369 -0.114 0.91004 M2 -4.4930 3.2272 -1.392 0.17041 M3 -0.1942 3.6232 -0.054 0.95748 M4 -3.9868 3.2426 -1.230 0.22500 M5 -4.5887 3.2348 -1.419 0.16263 M6 -5.6431 3.6883 -1.530 0.13272 M7 5.2881 3.8534 1.372 0.17647 M8 -2.5134 3.2559 -0.772 0.44402 M9 -5.7575 3.7308 -1.543 0.12948 M10 -7.1756 3.7684 -1.904 0.06302 . M11 -5.7532 3.3907 -1.697 0.09635 . --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 5.092 on 47 degrees of freedom Multiple R-squared: 0.325, Adjusted R-squared: 0.1527 F-statistic: 1.886 on 12 and 47 DF, p-value: 0.06105 > 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.1544879 0.3089758 0.8455121 [2,] 0.1603380 0.3206759 0.8396620 [3,] 0.1135572 0.2271144 0.8864428 [4,] 0.3336434 0.6672869 0.6663566 [5,] 0.2313054 0.4626108 0.7686946 [6,] 0.7895519 0.4208963 0.2104481 [7,] 0.8060948 0.3878104 0.1939052 [8,] 0.7794020 0.4411959 0.2205980 [9,] 0.8463348 0.3073303 0.1536652 [10,] 0.8120650 0.3758700 0.1879350 [11,] 0.7867734 0.4264531 0.2132266 [12,] 0.7446281 0.5107438 0.2553719 [13,] 0.6861135 0.6277731 0.3138865 [14,] 0.6194258 0.7611484 0.3805742 [15,] 0.8229223 0.3541553 0.1770777 [16,] 0.8228816 0.3542369 0.1771184 [17,] 0.7836817 0.4326365 0.2163183 [18,] 0.8997094 0.2005811 0.1002906 [19,] 0.8476193 0.3047614 0.1523807 [20,] 0.8353335 0.3293331 0.1646665 [21,] 0.8914748 0.2170505 0.1085252 [22,] 0.8308379 0.3383242 0.1691621 [23,] 0.7635884 0.4728233 0.2364116 [24,] 0.6694388 0.6611224 0.3305612 [25,] 0.5696317 0.8607366 0.4303683 [26,] 0.4524142 0.9048285 0.5475858 [27,] 0.3672292 0.7344585 0.6327708 [28,] 0.3922696 0.7845393 0.6077304 [29,] 0.2487961 0.4975922 0.7512039 > postscript(file="/var/www/html/rcomp/tmp/1fijw1259062491.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/2k3j81259062491.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/3bmkl1259062491.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/41mwm1259062491.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/5hd701259062491.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.78343251 -2.60952659 -0.22483949 0.39447750 -4.91361863 -4.16701741 7 8 9 10 11 12 -6.62895501 -5.36332109 -0.36061555 0.79421369 0.02367583 3.44290489 13 14 15 16 17 18 -3.97157261 3.49047341 2.15843763 1.20360838 1.20442329 4.69799795 19 20 21 22 23 24 6.17104499 3.10169427 18.08569837 5.93029753 6.11564416 7.70748058 25 26 27 28 29 30 1.45560019 -3.60974643 -2.70679757 -2.25095706 0.98638137 8.26213395 31 32 33 34 35 36 0.02429139 -0.49852557 -5.30539059 0.12941817 0.58935072 -6.81056134 37 38 39 40 41 42 2.15647955 3.20939469 0.78626996 -0.69683130 2.22510330 -4.05590797 43 44 45 46 47 48 -2.12026381 2.62061555 -1.43234355 3.11335482 -2.57346624 -1.07425766 49 50 51 52 53 54 -0.42393964 -0.48059507 -0.01307052 1.34970247 0.49771066 -4.73720652 55 56 57 58 59 60 2.55388244 0.13953684 -10.98734867 -9.96728422 -4.15520448 -3.26556646 > postscript(file="/var/www/html/rcomp/tmp/64aaa1259062491.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.78343251 NA 1 -2.60952659 0.78343251 2 -0.22483949 -2.60952659 3 0.39447750 -0.22483949 4 -4.91361863 0.39447750 5 -4.16701741 -4.91361863 6 -6.62895501 -4.16701741 7 -5.36332109 -6.62895501 8 -0.36061555 -5.36332109 9 0.79421369 -0.36061555 10 0.02367583 0.79421369 11 3.44290489 0.02367583 12 -3.97157261 3.44290489 13 3.49047341 -3.97157261 14 2.15843763 3.49047341 15 1.20360838 2.15843763 16 1.20442329 1.20360838 17 4.69799795 1.20442329 18 6.17104499 4.69799795 19 3.10169427 6.17104499 20 18.08569837 3.10169427 21 5.93029753 18.08569837 22 6.11564416 5.93029753 23 7.70748058 6.11564416 24 1.45560019 7.70748058 25 -3.60974643 1.45560019 26 -2.70679757 -3.60974643 27 -2.25095706 -2.70679757 28 0.98638137 -2.25095706 29 8.26213395 0.98638137 30 0.02429139 8.26213395 31 -0.49852557 0.02429139 32 -5.30539059 -0.49852557 33 0.12941817 -5.30539059 34 0.58935072 0.12941817 35 -6.81056134 0.58935072 36 2.15647955 -6.81056134 37 3.20939469 2.15647955 38 0.78626996 3.20939469 39 -0.69683130 0.78626996 40 2.22510330 -0.69683130 41 -4.05590797 2.22510330 42 -2.12026381 -4.05590797 43 2.62061555 -2.12026381 44 -1.43234355 2.62061555 45 3.11335482 -1.43234355 46 -2.57346624 3.11335482 47 -1.07425766 -2.57346624 48 -0.42393964 -1.07425766 49 -0.48059507 -0.42393964 50 -0.01307052 -0.48059507 51 1.34970247 -0.01307052 52 0.49771066 1.34970247 53 -4.73720652 0.49771066 54 2.55388244 -4.73720652 55 0.13953684 2.55388244 56 -10.98734867 0.13953684 57 -9.96728422 -10.98734867 58 -4.15520448 -9.96728422 59 -3.26556646 -4.15520448 60 NA -3.26556646 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -2.60952659 0.78343251 [2,] -0.22483949 -2.60952659 [3,] 0.39447750 -0.22483949 [4,] -4.91361863 0.39447750 [5,] -4.16701741 -4.91361863 [6,] -6.62895501 -4.16701741 [7,] -5.36332109 -6.62895501 [8,] -0.36061555 -5.36332109 [9,] 0.79421369 -0.36061555 [10,] 0.02367583 0.79421369 [11,] 3.44290489 0.02367583 [12,] -3.97157261 3.44290489 [13,] 3.49047341 -3.97157261 [14,] 2.15843763 3.49047341 [15,] 1.20360838 2.15843763 [16,] 1.20442329 1.20360838 [17,] 4.69799795 1.20442329 [18,] 6.17104499 4.69799795 [19,] 3.10169427 6.17104499 [20,] 18.08569837 3.10169427 [21,] 5.93029753 18.08569837 [22,] 6.11564416 5.93029753 [23,] 7.70748058 6.11564416 [24,] 1.45560019 7.70748058 [25,] -3.60974643 1.45560019 [26,] -2.70679757 -3.60974643 [27,] -2.25095706 -2.70679757 [28,] 0.98638137 -2.25095706 [29,] 8.26213395 0.98638137 [30,] 0.02429139 8.26213395 [31,] -0.49852557 0.02429139 [32,] -5.30539059 -0.49852557 [33,] 0.12941817 -5.30539059 [34,] 0.58935072 0.12941817 [35,] -6.81056134 0.58935072 [36,] 2.15647955 -6.81056134 [37,] 3.20939469 2.15647955 [38,] 0.78626996 3.20939469 [39,] -0.69683130 0.78626996 [40,] 2.22510330 -0.69683130 [41,] -4.05590797 2.22510330 [42,] -2.12026381 -4.05590797 [43,] 2.62061555 -2.12026381 [44,] -1.43234355 2.62061555 [45,] 3.11335482 -1.43234355 [46,] -2.57346624 3.11335482 [47,] -1.07425766 -2.57346624 [48,] -0.42393964 -1.07425766 [49,] -0.48059507 -0.42393964 [50,] -0.01307052 -0.48059507 [51,] 1.34970247 -0.01307052 [52,] 0.49771066 1.34970247 [53,] -4.73720652 0.49771066 [54,] 2.55388244 -4.73720652 [55,] 0.13953684 2.55388244 [56,] -10.98734867 0.13953684 [57,] -9.96728422 -10.98734867 [58,] -4.15520448 -9.96728422 [59,] -3.26556646 -4.15520448 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -2.60952659 0.78343251 2 -0.22483949 -2.60952659 3 0.39447750 -0.22483949 4 -4.91361863 0.39447750 5 -4.16701741 -4.91361863 6 -6.62895501 -4.16701741 7 -5.36332109 -6.62895501 8 -0.36061555 -5.36332109 9 0.79421369 -0.36061555 10 0.02367583 0.79421369 11 3.44290489 0.02367583 12 -3.97157261 3.44290489 13 3.49047341 -3.97157261 14 2.15843763 3.49047341 15 1.20360838 2.15843763 16 1.20442329 1.20360838 17 4.69799795 1.20442329 18 6.17104499 4.69799795 19 3.10169427 6.17104499 20 18.08569837 3.10169427 21 5.93029753 18.08569837 22 6.11564416 5.93029753 23 7.70748058 6.11564416 24 1.45560019 7.70748058 25 -3.60974643 1.45560019 26 -2.70679757 -3.60974643 27 -2.25095706 -2.70679757 28 0.98638137 -2.25095706 29 8.26213395 0.98638137 30 0.02429139 8.26213395 31 -0.49852557 0.02429139 32 -5.30539059 -0.49852557 33 0.12941817 -5.30539059 34 0.58935072 0.12941817 35 -6.81056134 0.58935072 36 2.15647955 -6.81056134 37 3.20939469 2.15647955 38 0.78626996 3.20939469 39 -0.69683130 0.78626996 40 2.22510330 -0.69683130 41 -4.05590797 2.22510330 42 -2.12026381 -4.05590797 43 2.62061555 -2.12026381 44 -1.43234355 2.62061555 45 3.11335482 -1.43234355 46 -2.57346624 3.11335482 47 -1.07425766 -2.57346624 48 -0.42393964 -1.07425766 49 -0.48059507 -0.42393964 50 -0.01307052 -0.48059507 51 1.34970247 -0.01307052 52 0.49771066 1.34970247 53 -4.73720652 0.49771066 54 2.55388244 -4.73720652 55 0.13953684 2.55388244 56 -10.98734867 0.13953684 57 -9.96728422 -10.98734867 58 -4.15520448 -9.96728422 59 -3.26556646 -4.15520448 > 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/7ykik1259062491.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/8o3t71259062491.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/9df881259062491.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/10tq3y1259062491.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/11u5vf1259062491.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/12s3zv1259062491.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/1304vh1259062491.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/14uxyn1259062491.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/15h5v41259062491.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/1674kh1259062491.tab") + } > > system("convert tmp/1fijw1259062491.ps tmp/1fijw1259062491.png") > system("convert tmp/2k3j81259062491.ps tmp/2k3j81259062491.png") > system("convert tmp/3bmkl1259062491.ps tmp/3bmkl1259062491.png") > system("convert tmp/41mwm1259062491.ps tmp/41mwm1259062491.png") > system("convert tmp/5hd701259062491.ps tmp/5hd701259062491.png") > system("convert tmp/64aaa1259062491.ps tmp/64aaa1259062491.png") > system("convert tmp/7ykik1259062491.ps tmp/7ykik1259062491.png") > system("convert tmp/8o3t71259062491.ps tmp/8o3t71259062491.png") > system("convert tmp/9df881259062491.ps tmp/9df881259062491.png") > system("convert tmp/10tq3y1259062491.ps tmp/10tq3y1259062491.png") > > > proc.time() user system elapsed 2.435 1.583 4.384