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(95.1,93.8,97,93.8,112.7,107.6,102.9,101,97.4,95.4,111.4,96.5,87.4,89.2,96.8,87.1,114.1,110.5,110.3,110.8,103.9,104.2,101.6,88.9,94.6,89.8,95.9,90,104.7,93.9,102.8,91.3,98.1,87.8,113.9,99.7,80.9,73.5,95.7,79.2,113.2,96.9,105.9,95.2,108.8,95.6,102.3,89.7,99,92.8,100.7,88,115.5,101.1,100.7,92.7,109.9,95.8,114.6,103.8,85.4,81.8,100.5,87.1,114.8,105.9,116.5,108.1,112.9,102.6,102,93.7,106,103.5,105.3,100.6,118.8,113.3,106.1,102.4,109.3,102.1,117.2,106.9,92.5,87.3,104.2,93.1,112.5,109.1,122.4,120.3,113.3,104.9,100,92.6,110.7,109.8,112.8,111.4,109.8,117.9,117.3,121.6,109.1,117.8,115.9,124.2,96,106.8,99.8,102.7,116.8,116.8,115.7,113.6,99.4,96.1,94.3,85),dim=c(2,60),dimnames=list(c('TIA','IAidM'),1:60)) > y <- array(NA,dim=c(2,60),dimnames=list(c('TIA','IAidM'),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 = '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 TIA IAidM M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 1 95.1 93.8 1 0 0 0 0 0 0 0 0 0 0 2 97.0 93.8 0 1 0 0 0 0 0 0 0 0 0 3 112.7 107.6 0 0 1 0 0 0 0 0 0 0 0 4 102.9 101.0 0 0 0 1 0 0 0 0 0 0 0 5 97.4 95.4 0 0 0 0 1 0 0 0 0 0 0 6 111.4 96.5 0 0 0 0 0 1 0 0 0 0 0 7 87.4 89.2 0 0 0 0 0 0 1 0 0 0 0 8 96.8 87.1 0 0 0 0 0 0 0 1 0 0 0 9 114.1 110.5 0 0 0 0 0 0 0 0 1 0 0 10 110.3 110.8 0 0 0 0 0 0 0 0 0 1 0 11 103.9 104.2 0 0 0 0 0 0 0 0 0 0 1 12 101.6 88.9 0 0 0 0 0 0 0 0 0 0 0 13 94.6 89.8 1 0 0 0 0 0 0 0 0 0 0 14 95.9 90.0 0 1 0 0 0 0 0 0 0 0 0 15 104.7 93.9 0 0 1 0 0 0 0 0 0 0 0 16 102.8 91.3 0 0 0 1 0 0 0 0 0 0 0 17 98.1 87.8 0 0 0 0 1 0 0 0 0 0 0 18 113.9 99.7 0 0 0 0 0 1 0 0 0 0 0 19 80.9 73.5 0 0 0 0 0 0 1 0 0 0 0 20 95.7 79.2 0 0 0 0 0 0 0 1 0 0 0 21 113.2 96.9 0 0 0 0 0 0 0 0 1 0 0 22 105.9 95.2 0 0 0 0 0 0 0 0 0 1 0 23 108.8 95.6 0 0 0 0 0 0 0 0 0 0 1 24 102.3 89.7 0 0 0 0 0 0 0 0 0 0 0 25 99.0 92.8 1 0 0 0 0 0 0 0 0 0 0 26 100.7 88.0 0 1 0 0 0 0 0 0 0 0 0 27 115.5 101.1 0 0 1 0 0 0 0 0 0 0 0 28 100.7 92.7 0 0 0 1 0 0 0 0 0 0 0 29 109.9 95.8 0 0 0 0 1 0 0 0 0 0 0 30 114.6 103.8 0 0 0 0 0 1 0 0 0 0 0 31 85.4 81.8 0 0 0 0 0 0 1 0 0 0 0 32 100.5 87.1 0 0 0 0 0 0 0 1 0 0 0 33 114.8 105.9 0 0 0 0 0 0 0 0 1 0 0 34 116.5 108.1 0 0 0 0 0 0 0 0 0 1 0 35 112.9 102.6 0 0 0 0 0 0 0 0 0 0 1 36 102.0 93.7 0 0 0 0 0 0 0 0 0 0 0 37 106.0 103.5 1 0 0 0 0 0 0 0 0 0 0 38 105.3 100.6 0 1 0 0 0 0 0 0 0 0 0 39 118.8 113.3 0 0 1 0 0 0 0 0 0 0 0 40 106.1 102.4 0 0 0 1 0 0 0 0 0 0 0 41 109.3 102.1 0 0 0 0 1 0 0 0 0 0 0 42 117.2 106.9 0 0 0 0 0 1 0 0 0 0 0 43 92.5 87.3 0 0 0 0 0 0 1 0 0 0 0 44 104.2 93.1 0 0 0 0 0 0 0 1 0 0 0 45 112.5 109.1 0 0 0 0 0 0 0 0 1 0 0 46 122.4 120.3 0 0 0 0 0 0 0 0 0 1 0 47 113.3 104.9 0 0 0 0 0 0 0 0 0 0 1 48 100.0 92.6 0 0 0 0 0 0 0 0 0 0 0 49 110.7 109.8 1 0 0 0 0 0 0 0 0 0 0 50 112.8 111.4 0 1 0 0 0 0 0 0 0 0 0 51 109.8 117.9 0 0 1 0 0 0 0 0 0 0 0 52 117.3 121.6 0 0 0 1 0 0 0 0 0 0 0 53 109.1 117.8 0 0 0 0 1 0 0 0 0 0 0 54 115.9 124.2 0 0 0 0 0 1 0 0 0 0 0 55 96.0 106.8 0 0 0 0 0 0 1 0 0 0 0 56 99.8 102.7 0 0 0 0 0 0 0 1 0 0 0 57 116.8 116.8 0 0 0 0 0 0 0 0 1 0 0 58 115.7 113.6 0 0 0 0 0 0 0 0 0 1 0 59 99.4 96.1 0 0 0 0 0 0 0 0 0 0 1 60 94.3 85.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) IAidM M1 M2 M3 M4 61.8576 0.4243 -2.3378 -0.5770 5.1395 0.9043 M5 M6 M7 M8 M9 M10 0.5614 7.6687 -10.6410 -0.5806 6.6612 5.7944 M11 3.0795 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -7.22719 -2.19076 0.07234 2.65499 6.82889 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 61.85757 5.49052 11.266 5.95e-15 *** IAidM 0.42434 0.05811 7.303 2.85e-09 *** M1 -2.33777 2.41431 -0.968 0.33785 M2 -0.57705 2.40212 -0.240 0.81120 M3 5.13952 2.56236 2.006 0.05066 . M4 0.90426 2.46712 0.367 0.71562 M5 0.56143 2.43706 0.230 0.81880 M6 7.66866 2.55059 3.007 0.00423 ** M7 -10.64098 2.37322 -4.484 4.70e-05 *** M8 -0.58059 2.36960 -0.245 0.80751 M9 6.66122 2.58689 2.575 0.01323 * M10 5.79438 2.62959 2.204 0.03249 * M11 3.07952 2.44980 1.257 0.21495 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 3.747 on 47 degrees of freedom Multiple R-squared: 0.8619, Adjusted R-squared: 0.8267 F-statistic: 24.45 on 12 and 47 DF, p-value: 3.292e-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,] 0.146336957 0.29267391 0.8536630 [2,] 0.119266633 0.23853327 0.8807334 [3,] 0.060754308 0.12150862 0.9392457 [4,] 0.029536183 0.05907237 0.9704638 [5,] 0.014133879 0.02826776 0.9858661 [6,] 0.012468043 0.02493609 0.9875320 [7,] 0.006276414 0.01255283 0.9937236 [8,] 0.034770776 0.06954155 0.9652292 [9,] 0.019649810 0.03929962 0.9803502 [10,] 0.024302578 0.04860516 0.9756974 [11,] 0.037047755 0.07409551 0.9629522 [12,] 0.091080223 0.18216045 0.9089198 [13,] 0.072231647 0.14446329 0.9277684 [14,] 0.311138090 0.62227618 0.6888619 [15,] 0.234283772 0.46856754 0.7657162 [16,] 0.189745109 0.37949022 0.8102549 [17,] 0.148182910 0.29636582 0.8518171 [18,] 0.103105110 0.20621022 0.8968949 [19,] 0.111556083 0.22311217 0.8884439 [20,] 0.135306828 0.27061366 0.8646932 [21,] 0.099953350 0.19990670 0.9000466 [22,] 0.092418470 0.18483694 0.9075815 [23,] 0.075139330 0.15027866 0.9248607 [24,] 0.126912817 0.25382563 0.8730872 [25,] 0.123233847 0.24646769 0.8767662 [26,] 0.092680249 0.18536050 0.9073198 [27,] 0.091600877 0.18320175 0.9083991 [28,] 0.094274617 0.18854923 0.9057254 [29,] 0.583864317 0.83227137 0.4161357 > postscript(file="/var/www/html/rcomp/tmp/172cs1258744170.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/2hntn1258744170.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/3amu61258744170.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/4fxru1258744170.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/5vtef1258744170.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 -4.22321768 -4.08394308 0.04355141 -2.72052516 -5.50137523 0.92461935 7 8 9 10 11 12 -1.66802846 -1.43729866 -1.30875386 -4.36921227 -5.25368931 2.01829104 13 14 15 16 17 18 -3.02584346 -3.57143757 -2.14294188 1.29560733 -1.57636421 2.06671998 19 20 21 22 23 24 -1.50583465 0.81501542 3.56231849 -2.14945281 3.29566526 2.37881620 25 26 27 28 29 30 0.10112587 2.07724954 5.60178452 -1.39847365 6.82888735 1.02691140 31 32 33 34 35 36 -0.52788616 2.26270134 1.34322650 2.97651533 4.42526037 0.38144198 37 38 39 40 41 42 2.56064983 1.33052075 3.72479315 -0.11460613 3.55552295 2.31144638 43 44 45 46 47 48 4.23822429 3.41664001 -2.31467288 3.69952396 3.84927020 -1.15178011 49 50 51 52 53 54 4.58728544 4.24761036 -7.22718720 2.93799761 -3.30667086 -6.32969712 55 56 57 58 59 60 -0.53647503 -5.05705812 -1.28211825 -0.15737422 -6.31650652 -3.62676910 > postscript(file="/var/www/html/rcomp/tmp/6g0n11258744170.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 -4.22321768 NA 1 -4.08394308 -4.22321768 2 0.04355141 -4.08394308 3 -2.72052516 0.04355141 4 -5.50137523 -2.72052516 5 0.92461935 -5.50137523 6 -1.66802846 0.92461935 7 -1.43729866 -1.66802846 8 -1.30875386 -1.43729866 9 -4.36921227 -1.30875386 10 -5.25368931 -4.36921227 11 2.01829104 -5.25368931 12 -3.02584346 2.01829104 13 -3.57143757 -3.02584346 14 -2.14294188 -3.57143757 15 1.29560733 -2.14294188 16 -1.57636421 1.29560733 17 2.06671998 -1.57636421 18 -1.50583465 2.06671998 19 0.81501542 -1.50583465 20 3.56231849 0.81501542 21 -2.14945281 3.56231849 22 3.29566526 -2.14945281 23 2.37881620 3.29566526 24 0.10112587 2.37881620 25 2.07724954 0.10112587 26 5.60178452 2.07724954 27 -1.39847365 5.60178452 28 6.82888735 -1.39847365 29 1.02691140 6.82888735 30 -0.52788616 1.02691140 31 2.26270134 -0.52788616 32 1.34322650 2.26270134 33 2.97651533 1.34322650 34 4.42526037 2.97651533 35 0.38144198 4.42526037 36 2.56064983 0.38144198 37 1.33052075 2.56064983 38 3.72479315 1.33052075 39 -0.11460613 3.72479315 40 3.55552295 -0.11460613 41 2.31144638 3.55552295 42 4.23822429 2.31144638 43 3.41664001 4.23822429 44 -2.31467288 3.41664001 45 3.69952396 -2.31467288 46 3.84927020 3.69952396 47 -1.15178011 3.84927020 48 4.58728544 -1.15178011 49 4.24761036 4.58728544 50 -7.22718720 4.24761036 51 2.93799761 -7.22718720 52 -3.30667086 2.93799761 53 -6.32969712 -3.30667086 54 -0.53647503 -6.32969712 55 -5.05705812 -0.53647503 56 -1.28211825 -5.05705812 57 -0.15737422 -1.28211825 58 -6.31650652 -0.15737422 59 -3.62676910 -6.31650652 60 NA -3.62676910 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -4.08394308 -4.22321768 [2,] 0.04355141 -4.08394308 [3,] -2.72052516 0.04355141 [4,] -5.50137523 -2.72052516 [5,] 0.92461935 -5.50137523 [6,] -1.66802846 0.92461935 [7,] -1.43729866 -1.66802846 [8,] -1.30875386 -1.43729866 [9,] -4.36921227 -1.30875386 [10,] -5.25368931 -4.36921227 [11,] 2.01829104 -5.25368931 [12,] -3.02584346 2.01829104 [13,] -3.57143757 -3.02584346 [14,] -2.14294188 -3.57143757 [15,] 1.29560733 -2.14294188 [16,] -1.57636421 1.29560733 [17,] 2.06671998 -1.57636421 [18,] -1.50583465 2.06671998 [19,] 0.81501542 -1.50583465 [20,] 3.56231849 0.81501542 [21,] -2.14945281 3.56231849 [22,] 3.29566526 -2.14945281 [23,] 2.37881620 3.29566526 [24,] 0.10112587 2.37881620 [25,] 2.07724954 0.10112587 [26,] 5.60178452 2.07724954 [27,] -1.39847365 5.60178452 [28,] 6.82888735 -1.39847365 [29,] 1.02691140 6.82888735 [30,] -0.52788616 1.02691140 [31,] 2.26270134 -0.52788616 [32,] 1.34322650 2.26270134 [33,] 2.97651533 1.34322650 [34,] 4.42526037 2.97651533 [35,] 0.38144198 4.42526037 [36,] 2.56064983 0.38144198 [37,] 1.33052075 2.56064983 [38,] 3.72479315 1.33052075 [39,] -0.11460613 3.72479315 [40,] 3.55552295 -0.11460613 [41,] 2.31144638 3.55552295 [42,] 4.23822429 2.31144638 [43,] 3.41664001 4.23822429 [44,] -2.31467288 3.41664001 [45,] 3.69952396 -2.31467288 [46,] 3.84927020 3.69952396 [47,] -1.15178011 3.84927020 [48,] 4.58728544 -1.15178011 [49,] 4.24761036 4.58728544 [50,] -7.22718720 4.24761036 [51,] 2.93799761 -7.22718720 [52,] -3.30667086 2.93799761 [53,] -6.32969712 -3.30667086 [54,] -0.53647503 -6.32969712 [55,] -5.05705812 -0.53647503 [56,] -1.28211825 -5.05705812 [57,] -0.15737422 -1.28211825 [58,] -6.31650652 -0.15737422 [59,] -3.62676910 -6.31650652 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -4.08394308 -4.22321768 2 0.04355141 -4.08394308 3 -2.72052516 0.04355141 4 -5.50137523 -2.72052516 5 0.92461935 -5.50137523 6 -1.66802846 0.92461935 7 -1.43729866 -1.66802846 8 -1.30875386 -1.43729866 9 -4.36921227 -1.30875386 10 -5.25368931 -4.36921227 11 2.01829104 -5.25368931 12 -3.02584346 2.01829104 13 -3.57143757 -3.02584346 14 -2.14294188 -3.57143757 15 1.29560733 -2.14294188 16 -1.57636421 1.29560733 17 2.06671998 -1.57636421 18 -1.50583465 2.06671998 19 0.81501542 -1.50583465 20 3.56231849 0.81501542 21 -2.14945281 3.56231849 22 3.29566526 -2.14945281 23 2.37881620 3.29566526 24 0.10112587 2.37881620 25 2.07724954 0.10112587 26 5.60178452 2.07724954 27 -1.39847365 5.60178452 28 6.82888735 -1.39847365 29 1.02691140 6.82888735 30 -0.52788616 1.02691140 31 2.26270134 -0.52788616 32 1.34322650 2.26270134 33 2.97651533 1.34322650 34 4.42526037 2.97651533 35 0.38144198 4.42526037 36 2.56064983 0.38144198 37 1.33052075 2.56064983 38 3.72479315 1.33052075 39 -0.11460613 3.72479315 40 3.55552295 -0.11460613 41 2.31144638 3.55552295 42 4.23822429 2.31144638 43 3.41664001 4.23822429 44 -2.31467288 3.41664001 45 3.69952396 -2.31467288 46 3.84927020 3.69952396 47 -1.15178011 3.84927020 48 4.58728544 -1.15178011 49 4.24761036 4.58728544 50 -7.22718720 4.24761036 51 2.93799761 -7.22718720 52 -3.30667086 2.93799761 53 -6.32969712 -3.30667086 54 -0.53647503 -6.32969712 55 -5.05705812 -0.53647503 56 -1.28211825 -5.05705812 57 -0.15737422 -1.28211825 58 -6.31650652 -0.15737422 59 -3.62676910 -6.31650652 > 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/7f5oj1258744170.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/8w3l91258744170.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/91s1w1258744170.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/10xmrm1258744170.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/11z5kf1258744170.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/12kz1r1258744170.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/13ihsk1258744170.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/14ctuk1258744170.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/15dzc31258744170.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/16mvuz1258744170.tab") + } > > system("convert tmp/172cs1258744170.ps tmp/172cs1258744170.png") > system("convert tmp/2hntn1258744170.ps tmp/2hntn1258744170.png") > system("convert tmp/3amu61258744170.ps tmp/3amu61258744170.png") > system("convert tmp/4fxru1258744170.ps tmp/4fxru1258744170.png") > system("convert tmp/5vtef1258744170.ps tmp/5vtef1258744170.png") > system("convert tmp/6g0n11258744170.ps tmp/6g0n11258744170.png") > system("convert tmp/7f5oj1258744170.ps tmp/7f5oj1258744170.png") > system("convert tmp/8w3l91258744170.ps tmp/8w3l91258744170.png") > system("convert tmp/91s1w1258744170.ps tmp/91s1w1258744170.png") > system("convert tmp/10xmrm1258744170.ps tmp/10xmrm1258744170.png") > > > proc.time() user system elapsed 2.409 1.554 2.769