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.6,82.9,96.9,83.8,105.6,86.2,102.8,86.1,101.7,86.2,104.2,88.8,92.7,89.6,91.9,87.8,106.5,88.3,112.3,88.6,102.8,91,96.5,91.5,101,95.4,98.9,98.7,105.1,99.9,103,98.6,99,100.3,104.3,100.2,94.6,100.4,90.4,101.4,108.9,103,111.4,109.1,100.8,111.4,102.5,114.1,98.2,121.8,98.7,127.6,113.3,129.9,104.6,128,99.3,123.5,111.8,124,97.3,127.4,97.7,127.6,115.6,128.4,111.9,131.4,107,135.1,107.1,134,100.6,144.5,99.2,147.3,108.4,150.9,103,148.7,99.8,141.4,115,138.9,90.8,139.8,95.9,145.6,114.4,147.9,108.2,148.5,112.6,151.1,109.1,157.5,105,167.5,105,172.3,118.5,173.5,103.7,187.5,112.5,205.5,116.6,195.1,96.6,204.5,101.9,204.5,116.5,201.7,119.3,207,115.4,206.6,108.5,210.6,111.5,211.1,108.8,215,121.8,223.9,109.6,238.2,112.2,238.9,119.6,229.6,104.1,232.2,105.3,222.1,115,221.6,124.1,227.3,116.8,221,107.5,213.6,115.6,243.4),dim=c(2,73),dimnames=list(c('tot_indus','prijsindex'),1:73)) > y <- array(NA,dim=c(2,73),dimnames=list(c('tot_indus','prijsindex'),1:73)) > 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 = 'Do not include Seasonal 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 tot_indus prijsindex 1 97.6 82.9 2 96.9 83.8 3 105.6 86.2 4 102.8 86.1 5 101.7 86.2 6 104.2 88.8 7 92.7 89.6 8 91.9 87.8 9 106.5 88.3 10 112.3 88.6 11 102.8 91.0 12 96.5 91.5 13 101.0 95.4 14 98.9 98.7 15 105.1 99.9 16 103.0 98.6 17 99.0 100.3 18 104.3 100.2 19 94.6 100.4 20 90.4 101.4 21 108.9 103.0 22 111.4 109.1 23 100.8 111.4 24 102.5 114.1 25 98.2 121.8 26 98.7 127.6 27 113.3 129.9 28 104.6 128.0 29 99.3 123.5 30 111.8 124.0 31 97.3 127.4 32 97.7 127.6 33 115.6 128.4 34 111.9 131.4 35 107.0 135.1 36 107.1 134.0 37 100.6 144.5 38 99.2 147.3 39 108.4 150.9 40 103.0 148.7 41 99.8 141.4 42 115.0 138.9 43 90.8 139.8 44 95.9 145.6 45 114.4 147.9 46 108.2 148.5 47 112.6 151.1 48 109.1 157.5 49 105.0 167.5 50 105.0 172.3 51 118.5 173.5 52 103.7 187.5 53 112.5 205.5 54 116.6 195.1 55 96.6 204.5 56 101.9 204.5 57 116.5 201.7 58 119.3 207.0 59 115.4 206.6 60 108.5 210.6 61 111.5 211.1 62 108.8 215.0 63 121.8 223.9 64 109.6 238.2 65 112.2 238.9 66 119.6 229.6 67 104.1 232.2 68 105.3 222.1 69 115.0 221.6 70 124.1 227.3 71 116.8 221.0 72 107.5 213.6 73 115.6 243.4 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) prijsindex 92.75007 0.08947 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -14.4587 -4.5002 0.3971 5.1372 11.6225 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 92.75007 2.37132 39.113 < 2e-16 *** prijsindex 0.08947 0.01511 5.922 1.03e-07 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 6.466 on 71 degrees of freedom Multiple R-squared: 0.3306, Adjusted R-squared: 0.3212 F-statistic: 35.07 on 1 and 71 DF, p-value: 1.035e-07 > 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.03196391 0.06392782 0.9680361 [2,] 0.01971607 0.03943215 0.9802839 [3,] 0.28272730 0.56545459 0.7172727 [4,] 0.35474157 0.70948315 0.6452584 [5,] 0.38267611 0.76535222 0.6173239 [6,] 0.59617212 0.80765575 0.4038279 [7,] 0.49232164 0.98464328 0.5076784 [8,] 0.46732984 0.93465968 0.5326702 [9,] 0.37180057 0.74360115 0.6281994 [10,] 0.29454833 0.58909666 0.7054517 [11,] 0.24447691 0.48895381 0.7555231 [12,] 0.18034004 0.36068008 0.8196600 [13,] 0.13855812 0.27711625 0.8614419 [14,] 0.10225074 0.20450149 0.8977493 [15,] 0.11414809 0.22829619 0.8858519 [16,] 0.19505131 0.39010262 0.8049487 [17,] 0.24345895 0.48691790 0.7565411 [18,] 0.31118947 0.62237894 0.6888105 [19,] 0.25509001 0.51018003 0.7449100 [20,] 0.19847179 0.39694358 0.8015282 [21,] 0.17811591 0.35623182 0.8218841 [22,] 0.15017946 0.30035892 0.8498205 [23,] 0.21883385 0.43766770 0.7811661 [24,] 0.16924790 0.33849580 0.8307521 [25,] 0.14620219 0.29240438 0.8537978 [26,] 0.16891260 0.33782521 0.8310874 [27,] 0.17492132 0.34984264 0.8250787 [28,] 0.17129858 0.34259717 0.8287014 [29,] 0.28066606 0.56133212 0.7193339 [30,] 0.29278443 0.58556886 0.7072156 [31,] 0.24158832 0.48317665 0.7584117 [32,] 0.19745837 0.39491674 0.8025416 [33,] 0.18299313 0.36598627 0.8170069 [34,] 0.18376066 0.36752131 0.8162393 [35,] 0.14660274 0.29320549 0.8533973 [36,] 0.11661512 0.23323025 0.8833849 [37,] 0.10571902 0.21143805 0.8942810 [38,] 0.15369538 0.30739076 0.8463046 [39,] 0.35090315 0.70180630 0.6490968 [40,] 0.46599477 0.93198953 0.5340052 [41,] 0.48868392 0.97736784 0.5113161 [42,] 0.42356031 0.84712061 0.5764397 [43,] 0.40501788 0.81003577 0.5949821 [44,] 0.34301798 0.68603596 0.6569820 [45,] 0.29122985 0.58245970 0.7087701 [46,] 0.25253327 0.50506653 0.7474667 [47,] 0.32731595 0.65463191 0.6726840 [48,] 0.30657686 0.61315373 0.6934231 [49,] 0.24496054 0.48992109 0.7550395 [50,] 0.24327930 0.48655860 0.7567207 [51,] 0.51037914 0.97924172 0.4896209 [52,] 0.63944691 0.72110619 0.3605531 [53,] 0.59072704 0.81854591 0.4092730 [54,] 0.60877613 0.78244773 0.3912239 [55,] 0.55444191 0.89111618 0.4455581 [56,] 0.48103660 0.96207321 0.5189634 [57,] 0.38647945 0.77295889 0.6135206 [58,] 0.32593338 0.65186676 0.6740666 [59,] 0.38437577 0.76875154 0.6156242 [60,] 0.32358392 0.64716784 0.6764161 [61,] 0.24000086 0.48000172 0.7599991 [62,] 0.21090040 0.42180081 0.7890996 [63,] 0.34114442 0.68228884 0.6588556 [64,] 0.43925604 0.87851209 0.5607440 > postscript(file="/var/www/html/rcomp/tmp/15ei81258643624.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/2jjvm1258643624.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/3a4nw1258643624.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/4jgdz1258643624.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/5s0ra1258643624.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 = 73 Frequency = 1 1 2 3 4 5 6 -2.5675375 -3.3480648 5.1371956 2.3461430 1.2371956 3.5045610 7 8 9 10 11 12 -8.0670189 -8.7059642 5.8492984 11.6224559 1.9077163 -4.4370211 13 14 15 16 17 18 -0.2859730 -2.6812399 3.4113903 1.4277075 -2.7243997 2.5845478 19 20 21 22 23 24 -7.1333472 -11.4228220 6.9340183 8.8882217 -1.9175704 -0.4591525 25 26 27 28 29 30 -5.4481087 -5.4670628 8.9271451 0.3971473 -4.5002160 7.9550466 31 32 33 34 35 36 -6.8491678 -6.4670628 11.3613573 7.3929328 2.1618759 2.3602982 37 38 39 40 41 42 -5.0791876 -6.7297171 2.1481734 -3.0549819 -5.6018156 9.8218715 43 44 45 46 47 48 -14.4586559 -9.8776099 8.4165979 2.1629130 6.3302785 2.2576395 49 50 51 52 53 54 -2.7371089 -3.1665881 10.2260420 -5.8266057 1.3628472 6.3933855 55 56 57 58 59 60 -14.4476780 -9.1476780 5.7028516 8.0286349 4.1644249 -3.0934745 61 62 63 64 65 66 -0.1382119 -3.1871638 9.0165101 -4.4629801 -1.9256125 6.3065035 67 68 69 70 71 72 -9.4261310 -7.3224352 2.4223023 11.0122957 4.2759872 -4.3618990 73 1.0717507 > postscript(file="/var/www/html/rcomp/tmp/68tvd1258643624.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 = 73 Frequency = 1 lag(myerror, k = 1) myerror 0 -2.5675375 NA 1 -3.3480648 -2.5675375 2 5.1371956 -3.3480648 3 2.3461430 5.1371956 4 1.2371956 2.3461430 5 3.5045610 1.2371956 6 -8.0670189 3.5045610 7 -8.7059642 -8.0670189 8 5.8492984 -8.7059642 9 11.6224559 5.8492984 10 1.9077163 11.6224559 11 -4.4370211 1.9077163 12 -0.2859730 -4.4370211 13 -2.6812399 -0.2859730 14 3.4113903 -2.6812399 15 1.4277075 3.4113903 16 -2.7243997 1.4277075 17 2.5845478 -2.7243997 18 -7.1333472 2.5845478 19 -11.4228220 -7.1333472 20 6.9340183 -11.4228220 21 8.8882217 6.9340183 22 -1.9175704 8.8882217 23 -0.4591525 -1.9175704 24 -5.4481087 -0.4591525 25 -5.4670628 -5.4481087 26 8.9271451 -5.4670628 27 0.3971473 8.9271451 28 -4.5002160 0.3971473 29 7.9550466 -4.5002160 30 -6.8491678 7.9550466 31 -6.4670628 -6.8491678 32 11.3613573 -6.4670628 33 7.3929328 11.3613573 34 2.1618759 7.3929328 35 2.3602982 2.1618759 36 -5.0791876 2.3602982 37 -6.7297171 -5.0791876 38 2.1481734 -6.7297171 39 -3.0549819 2.1481734 40 -5.6018156 -3.0549819 41 9.8218715 -5.6018156 42 -14.4586559 9.8218715 43 -9.8776099 -14.4586559 44 8.4165979 -9.8776099 45 2.1629130 8.4165979 46 6.3302785 2.1629130 47 2.2576395 6.3302785 48 -2.7371089 2.2576395 49 -3.1665881 -2.7371089 50 10.2260420 -3.1665881 51 -5.8266057 10.2260420 52 1.3628472 -5.8266057 53 6.3933855 1.3628472 54 -14.4476780 6.3933855 55 -9.1476780 -14.4476780 56 5.7028516 -9.1476780 57 8.0286349 5.7028516 58 4.1644249 8.0286349 59 -3.0934745 4.1644249 60 -0.1382119 -3.0934745 61 -3.1871638 -0.1382119 62 9.0165101 -3.1871638 63 -4.4629801 9.0165101 64 -1.9256125 -4.4629801 65 6.3065035 -1.9256125 66 -9.4261310 6.3065035 67 -7.3224352 -9.4261310 68 2.4223023 -7.3224352 69 11.0122957 2.4223023 70 4.2759872 11.0122957 71 -4.3618990 4.2759872 72 1.0717507 -4.3618990 73 NA 1.0717507 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -3.3480648 -2.5675375 [2,] 5.1371956 -3.3480648 [3,] 2.3461430 5.1371956 [4,] 1.2371956 2.3461430 [5,] 3.5045610 1.2371956 [6,] -8.0670189 3.5045610 [7,] -8.7059642 -8.0670189 [8,] 5.8492984 -8.7059642 [9,] 11.6224559 5.8492984 [10,] 1.9077163 11.6224559 [11,] -4.4370211 1.9077163 [12,] -0.2859730 -4.4370211 [13,] -2.6812399 -0.2859730 [14,] 3.4113903 -2.6812399 [15,] 1.4277075 3.4113903 [16,] -2.7243997 1.4277075 [17,] 2.5845478 -2.7243997 [18,] -7.1333472 2.5845478 [19,] -11.4228220 -7.1333472 [20,] 6.9340183 -11.4228220 [21,] 8.8882217 6.9340183 [22,] -1.9175704 8.8882217 [23,] -0.4591525 -1.9175704 [24,] -5.4481087 -0.4591525 [25,] -5.4670628 -5.4481087 [26,] 8.9271451 -5.4670628 [27,] 0.3971473 8.9271451 [28,] -4.5002160 0.3971473 [29,] 7.9550466 -4.5002160 [30,] -6.8491678 7.9550466 [31,] -6.4670628 -6.8491678 [32,] 11.3613573 -6.4670628 [33,] 7.3929328 11.3613573 [34,] 2.1618759 7.3929328 [35,] 2.3602982 2.1618759 [36,] -5.0791876 2.3602982 [37,] -6.7297171 -5.0791876 [38,] 2.1481734 -6.7297171 [39,] -3.0549819 2.1481734 [40,] -5.6018156 -3.0549819 [41,] 9.8218715 -5.6018156 [42,] -14.4586559 9.8218715 [43,] -9.8776099 -14.4586559 [44,] 8.4165979 -9.8776099 [45,] 2.1629130 8.4165979 [46,] 6.3302785 2.1629130 [47,] 2.2576395 6.3302785 [48,] -2.7371089 2.2576395 [49,] -3.1665881 -2.7371089 [50,] 10.2260420 -3.1665881 [51,] -5.8266057 10.2260420 [52,] 1.3628472 -5.8266057 [53,] 6.3933855 1.3628472 [54,] -14.4476780 6.3933855 [55,] -9.1476780 -14.4476780 [56,] 5.7028516 -9.1476780 [57,] 8.0286349 5.7028516 [58,] 4.1644249 8.0286349 [59,] -3.0934745 4.1644249 [60,] -0.1382119 -3.0934745 [61,] -3.1871638 -0.1382119 [62,] 9.0165101 -3.1871638 [63,] -4.4629801 9.0165101 [64,] -1.9256125 -4.4629801 [65,] 6.3065035 -1.9256125 [66,] -9.4261310 6.3065035 [67,] -7.3224352 -9.4261310 [68,] 2.4223023 -7.3224352 [69,] 11.0122957 2.4223023 [70,] 4.2759872 11.0122957 [71,] -4.3618990 4.2759872 [72,] 1.0717507 -4.3618990 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -3.3480648 -2.5675375 2 5.1371956 -3.3480648 3 2.3461430 5.1371956 4 1.2371956 2.3461430 5 3.5045610 1.2371956 6 -8.0670189 3.5045610 7 -8.7059642 -8.0670189 8 5.8492984 -8.7059642 9 11.6224559 5.8492984 10 1.9077163 11.6224559 11 -4.4370211 1.9077163 12 -0.2859730 -4.4370211 13 -2.6812399 -0.2859730 14 3.4113903 -2.6812399 15 1.4277075 3.4113903 16 -2.7243997 1.4277075 17 2.5845478 -2.7243997 18 -7.1333472 2.5845478 19 -11.4228220 -7.1333472 20 6.9340183 -11.4228220 21 8.8882217 6.9340183 22 -1.9175704 8.8882217 23 -0.4591525 -1.9175704 24 -5.4481087 -0.4591525 25 -5.4670628 -5.4481087 26 8.9271451 -5.4670628 27 0.3971473 8.9271451 28 -4.5002160 0.3971473 29 7.9550466 -4.5002160 30 -6.8491678 7.9550466 31 -6.4670628 -6.8491678 32 11.3613573 -6.4670628 33 7.3929328 11.3613573 34 2.1618759 7.3929328 35 2.3602982 2.1618759 36 -5.0791876 2.3602982 37 -6.7297171 -5.0791876 38 2.1481734 -6.7297171 39 -3.0549819 2.1481734 40 -5.6018156 -3.0549819 41 9.8218715 -5.6018156 42 -14.4586559 9.8218715 43 -9.8776099 -14.4586559 44 8.4165979 -9.8776099 45 2.1629130 8.4165979 46 6.3302785 2.1629130 47 2.2576395 6.3302785 48 -2.7371089 2.2576395 49 -3.1665881 -2.7371089 50 10.2260420 -3.1665881 51 -5.8266057 10.2260420 52 1.3628472 -5.8266057 53 6.3933855 1.3628472 54 -14.4476780 6.3933855 55 -9.1476780 -14.4476780 56 5.7028516 -9.1476780 57 8.0286349 5.7028516 58 4.1644249 8.0286349 59 -3.0934745 4.1644249 60 -0.1382119 -3.0934745 61 -3.1871638 -0.1382119 62 9.0165101 -3.1871638 63 -4.4629801 9.0165101 64 -1.9256125 -4.4629801 65 6.3065035 -1.9256125 66 -9.4261310 6.3065035 67 -7.3224352 -9.4261310 68 2.4223023 -7.3224352 69 11.0122957 2.4223023 70 4.2759872 11.0122957 71 -4.3618990 4.2759872 72 1.0717507 -4.3618990 > 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/7gmdr1258643624.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/8zaxt1258643624.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/95ery1258643624.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/10yjg71258643624.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/11gsb51258643624.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/12dfzg1258643624.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/13r06q1258643624.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/14d2y61258643624.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/15aw0f1258643624.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/16ekz51258643624.tab") + } > > system("convert tmp/15ei81258643624.ps tmp/15ei81258643624.png") > system("convert tmp/2jjvm1258643624.ps tmp/2jjvm1258643624.png") > system("convert tmp/3a4nw1258643624.ps tmp/3a4nw1258643624.png") > system("convert tmp/4jgdz1258643624.ps tmp/4jgdz1258643624.png") > system("convert tmp/5s0ra1258643624.ps tmp/5s0ra1258643624.png") > system("convert tmp/68tvd1258643624.ps tmp/68tvd1258643624.png") > system("convert tmp/7gmdr1258643624.ps tmp/7gmdr1258643624.png") > system("convert tmp/8zaxt1258643624.ps tmp/8zaxt1258643624.png") > system("convert tmp/95ery1258643624.ps tmp/95ery1258643624.png") > system("convert tmp/10yjg71258643624.ps tmp/10yjg71258643624.png") > > > proc.time() user system elapsed 2.652 1.628 6.083