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(105.6 + ,86.2 + ,96.9 + ,97.6 + ,102.8 + ,86.1 + ,105.6 + ,96.9 + ,101.7 + ,86.2 + ,102.8 + ,105.6 + ,104.2 + ,88.8 + ,101.7 + ,102.8 + ,92.7 + ,89.6 + ,104.2 + ,101.7 + ,91.9 + ,87.8 + ,92.7 + ,104.2 + ,106.5 + ,88.3 + ,91.9 + ,92.7 + ,112.3 + ,88.6 + ,106.5 + ,91.9 + ,102.8 + ,91 + ,112.3 + ,106.5 + ,96.5 + ,91.5 + ,102.8 + ,112.3 + ,101 + ,95.4 + ,96.5 + ,102.8 + ,98.9 + ,98.7 + ,101 + ,96.5 + ,105.1 + ,99.9 + ,98.9 + ,101 + ,103 + ,98.6 + ,105.1 + ,98.9 + ,99 + ,100.3 + ,103 + ,105.1 + ,104.3 + ,100.2 + ,99 + ,103 + ,94.6 + ,100.4 + ,104.3 + ,99 + ,90.4 + ,101.4 + ,94.6 + ,104.3 + ,108.9 + ,103 + ,90.4 + ,94.6 + ,111.4 + ,109.1 + ,108.9 + ,90.4 + ,100.8 + ,111.4 + ,111.4 + ,108.9 + ,102.5 + ,114.1 + ,100.8 + ,111.4 + ,98.2 + ,121.8 + ,102.5 + ,100.8 + ,98.7 + ,127.6 + ,98.2 + ,102.5 + ,113.3 + ,129.9 + ,98.7 + ,98.2 + ,104.6 + ,128 + ,113.3 + ,98.7 + ,99.3 + ,123.5 + ,104.6 + ,113.3 + ,111.8 + ,124 + ,99.3 + ,104.6 + ,97.3 + ,127.4 + ,111.8 + ,99.3 + ,97.7 + ,127.6 + ,97.3 + ,111.8 + ,115.6 + ,128.4 + ,97.7 + ,97.3 + ,111.9 + ,131.4 + ,115.6 + ,97.7 + ,107 + ,135.1 + ,111.9 + ,115.6 + ,107.1 + ,134 + ,107 + ,111.9 + ,100.6 + ,144.5 + ,107.1 + ,107 + ,99.2 + ,147.3 + ,100.6 + ,107.1 + ,108.4 + ,150.9 + ,99.2 + ,100.6 + ,103 + ,148.7 + ,108.4 + ,99.2 + ,99.8 + ,141.4 + ,103 + ,108.4 + ,115 + ,138.9 + ,99.8 + ,103 + ,90.8 + ,139.8 + ,115 + ,99.8 + ,95.9 + ,145.6 + ,90.8 + ,115 + ,114.4 + ,147.9 + ,95.9 + ,90.8 + ,108.2 + ,148.5 + ,114.4 + ,95.9 + ,112.6 + ,151.1 + ,108.2 + ,114.4 + ,109.1 + ,157.5 + ,112.6 + ,108.2 + ,105 + ,167.5 + ,109.1 + ,112.6 + ,105 + ,172.3 + ,105 + ,109.1 + ,118.5 + ,173.5 + ,105 + ,105 + ,103.7 + ,187.5 + ,118.5 + ,105 + ,112.5 + ,205.5 + ,103.7 + ,118.5 + ,116.6 + ,195.1 + ,112.5 + ,103.7 + ,96.6 + ,204.5 + ,116.6 + ,112.5 + ,101.9 + ,204.5 + ,96.6 + ,116.6 + ,116.5 + ,201.7 + ,101.9 + ,96.6 + ,119.3 + ,207 + ,116.5 + ,101.9 + ,115.4 + ,206.6 + ,119.3 + ,116.5 + ,108.5 + ,210.6 + ,115.4 + ,119.3 + ,111.5 + ,211.1 + ,108.5 + ,115.4 + ,108.8 + ,215 + ,111.5 + ,108.5 + ,121.8 + ,223.9 + ,108.8 + ,111.5 + ,109.6 + ,238.2 + ,121.8 + ,108.8 + ,112.2 + ,238.9 + ,109.6 + ,121.8 + ,119.6 + ,229.6 + ,112.2 + ,109.6 + ,104.1 + ,232.2 + ,119.6 + ,112.2 + ,105.3 + ,222.1 + ,104.1 + ,119.6 + ,115 + ,221.6 + ,105.3 + ,104.1 + ,124.1 + ,227.3 + ,115 + ,105.3 + ,116.8 + ,221 + ,124.1 + ,115 + ,107.5 + ,213.6 + ,116.8 + ,124.1 + ,115.6 + ,243.4 + ,107.5 + ,116.8) + ,dim=c(4 + ,71) + ,dimnames=list(c('tot_indus' + ,'prijsindex' + ,'y(t-1)' + ,'y(t-2)') + ,1:71)) > y <- array(NA,dim=c(4,71),dimnames=list(c('tot_indus','prijsindex','y(t-1)','y(t-2)'),1:71)) > 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 y(t-1) y(t-2) 1 105.6 86.2 96.9 97.6 2 102.8 86.1 105.6 96.9 3 101.7 86.2 102.8 105.6 4 104.2 88.8 101.7 102.8 5 92.7 89.6 104.2 101.7 6 91.9 87.8 92.7 104.2 7 106.5 88.3 91.9 92.7 8 112.3 88.6 106.5 91.9 9 102.8 91.0 112.3 106.5 10 96.5 91.5 102.8 112.3 11 101.0 95.4 96.5 102.8 12 98.9 98.7 101.0 96.5 13 105.1 99.9 98.9 101.0 14 103.0 98.6 105.1 98.9 15 99.0 100.3 103.0 105.1 16 104.3 100.2 99.0 103.0 17 94.6 100.4 104.3 99.0 18 90.4 101.4 94.6 104.3 19 108.9 103.0 90.4 94.6 20 111.4 109.1 108.9 90.4 21 100.8 111.4 111.4 108.9 22 102.5 114.1 100.8 111.4 23 98.2 121.8 102.5 100.8 24 98.7 127.6 98.2 102.5 25 113.3 129.9 98.7 98.2 26 104.6 128.0 113.3 98.7 27 99.3 123.5 104.6 113.3 28 111.8 124.0 99.3 104.6 29 97.3 127.4 111.8 99.3 30 97.7 127.6 97.3 111.8 31 115.6 128.4 97.7 97.3 32 111.9 131.4 115.6 97.7 33 107.0 135.1 111.9 115.6 34 107.1 134.0 107.0 111.9 35 100.6 144.5 107.1 107.0 36 99.2 147.3 100.6 107.1 37 108.4 150.9 99.2 100.6 38 103.0 148.7 108.4 99.2 39 99.8 141.4 103.0 108.4 40 115.0 138.9 99.8 103.0 41 90.8 139.8 115.0 99.8 42 95.9 145.6 90.8 115.0 43 114.4 147.9 95.9 90.8 44 108.2 148.5 114.4 95.9 45 112.6 151.1 108.2 114.4 46 109.1 157.5 112.6 108.2 47 105.0 167.5 109.1 112.6 48 105.0 172.3 105.0 109.1 49 118.5 173.5 105.0 105.0 50 103.7 187.5 118.5 105.0 51 112.5 205.5 103.7 118.5 52 116.6 195.1 112.5 103.7 53 96.6 204.5 116.6 112.5 54 101.9 204.5 96.6 116.6 55 116.5 201.7 101.9 96.6 56 119.3 207.0 116.5 101.9 57 115.4 206.6 119.3 116.5 58 108.5 210.6 115.4 119.3 59 111.5 211.1 108.5 115.4 60 108.8 215.0 111.5 108.5 61 121.8 223.9 108.8 111.5 62 109.6 238.2 121.8 108.8 63 112.2 238.9 109.6 121.8 64 119.6 229.6 112.2 109.6 65 104.1 232.2 119.6 112.2 66 105.3 222.1 104.1 119.6 67 115.0 221.6 105.3 104.1 68 124.1 227.3 115.0 105.3 69 116.8 221.0 124.1 115.0 70 107.5 213.6 116.8 124.1 71 115.6 243.4 107.5 116.8 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) prijsindex `y(t-1)` `y(t-2)` 134.9401 0.1284 -0.0277 -0.4252 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -16.4696 -4.4760 0.9307 4.3613 9.8988 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 134.94015 14.89429 9.060 2.99e-13 *** prijsindex 0.12837 0.02023 6.347 2.19e-08 *** `y(t-1)` -0.02770 0.11089 -0.250 0.803504 `y(t-2)` -0.42517 0.11193 -3.798 0.000316 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 6.017 on 67 degrees of freedom Multiple R-squared: 0.4326, Adjusted R-squared: 0.4072 F-statistic: 17.02 on 3 and 67 DF, p-value: 2.524e-08 > 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.60470967 0.7905807 0.3952903 [2,] 0.51361558 0.9727688 0.4863844 [3,] 0.46644792 0.9328958 0.5335521 [4,] 0.38164580 0.7632916 0.6183542 [5,] 0.27229781 0.5445956 0.7277022 [6,] 0.24425682 0.4885136 0.7557432 [7,] 0.23200471 0.4640094 0.7679953 [8,] 0.15911830 0.3182366 0.8408817 [9,] 0.10350458 0.2070092 0.8964954 [10,] 0.08698755 0.1739751 0.9130125 [11,] 0.14861607 0.2972321 0.8513839 [12,] 0.17950725 0.3590145 0.8204927 [13,] 0.20093115 0.4018623 0.7990688 [14,] 0.15780370 0.3156074 0.8421963 [15,] 0.12162429 0.2432486 0.8783757 [16,] 0.12515886 0.2503177 0.8748411 [17,] 0.12108569 0.2421714 0.8789143 [18,] 0.09712675 0.1942535 0.9028732 [19,] 0.13986933 0.2797387 0.8601307 [20,] 0.10667736 0.2133547 0.8933226 [21,] 0.07878996 0.1575799 0.9212100 [22,] 0.12772596 0.2554519 0.8722740 [23,] 0.17642768 0.3528554 0.8235723 [24,] 0.13893875 0.2778775 0.8610612 [25,] 0.18483274 0.3696655 0.8151673 [26,] 0.16694423 0.3338885 0.8330558 [27,] 0.19213863 0.3842773 0.8078614 [28,] 0.18869602 0.3773920 0.8113040 [29,] 0.16835635 0.3367127 0.8316437 [30,] 0.16242193 0.3248439 0.8375781 [31,] 0.12200803 0.2440161 0.8779920 [32,] 0.11341331 0.2268266 0.8865867 [33,] 0.09162483 0.1832497 0.9083752 [34,] 0.14121016 0.2824203 0.8587898 [35,] 0.46909999 0.9382000 0.5309000 [36,] 0.48286704 0.9657341 0.5171330 [37,] 0.41655044 0.8331009 0.5834496 [38,] 0.36242344 0.7248469 0.6375766 [39,] 0.45856273 0.9171255 0.5414373 [40,] 0.40384964 0.8076993 0.5961504 [41,] 0.33185231 0.6637046 0.6681477 [42,] 0.27889829 0.5577966 0.7211017 [43,] 0.35605461 0.7121092 0.6439454 [44,] 0.36938149 0.7387630 0.6306185 [45,] 0.34626790 0.6925358 0.6537321 [46,] 0.30157893 0.6031579 0.6984211 [47,] 0.63157940 0.7368412 0.3684206 [48,] 0.65154549 0.6969090 0.3484545 [49,] 0.58648077 0.8270385 0.4135192 [50,] 0.51159405 0.9768119 0.4884059 [51,] 0.49441294 0.9888259 0.5055871 [52,] 0.39440413 0.7888083 0.6055959 [53,] 0.29855358 0.5971072 0.7014464 [54,] 0.29791504 0.5958301 0.7020850 [55,] 0.31784850 0.6356970 0.6821515 [56,] 0.33459887 0.6691977 0.6654011 [57,] 0.23161033 0.4632207 0.7683897 [58,] 0.15885962 0.3177192 0.8411404 > postscript(file="/var/www/html/rcomp/tmp/17u6x1258645764.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/2chh21258645764.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/3421p1258645764.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/4dswn1258645764.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/58fin1258645764.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 = 71 Frequency = 1 1 2 3 4 5 6 3.7744448 0.9306667 3.4392051 4.3844995 -7.6166283 -7.4412061 7 8 9 10 11 12 2.1830440 8.0088369 4.5688224 0.4074337 0.1931881 -4.8843313 13 14 15 16 17 18 3.0166923 0.3624779 -1.2779040 3.0312812 -8.2482388 -10.5919372 19 20 21 22 23 24 3.4622157 3.9059145 0.9454684 3.0681408 -6.6799966 -6.3208970 25 26 27 28 29 30 6.1694833 -1.6695870 -0.4254915 8.1645664 -8.6790154 -3.3917897 31 32 33 34 35 36 8.2516935 4.8324904 6.9654748 5.4978378 -4.4306245 -6.3276116 37 38 39 40 41 42 -0.3921131 -5.8500720 -4.3510099 8.7853869 -16.4696206 -6.3220415 43 44 45 46 47 48 1.7349725 -1.8612360 9.8988056 3.0630747 -0.5468869 -2.7647336 49 50 51 52 53 54 8.8380400 -7.3852233 4.4338088 3.8202158 -13.5314648 -7.0423104 55 56 57 58 59 60 -0.4393565 4.3380779 6.7744056 0.4433401 1.5298700 -4.5213245 61 62 63 64 65 66 8.5368542 -6.2867184 1.4126160 4.8914948 -9.6318574 -4.4184293 67 68 69 70 71 -1.2110649 7.9361060 5.8210445 1.1377951 2.0509356 > postscript(file="/var/www/html/rcomp/tmp/6erdy1258645764.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 = 71 Frequency = 1 lag(myerror, k = 1) myerror 0 3.7744448 NA 1 0.9306667 3.7744448 2 3.4392051 0.9306667 3 4.3844995 3.4392051 4 -7.6166283 4.3844995 5 -7.4412061 -7.6166283 6 2.1830440 -7.4412061 7 8.0088369 2.1830440 8 4.5688224 8.0088369 9 0.4074337 4.5688224 10 0.1931881 0.4074337 11 -4.8843313 0.1931881 12 3.0166923 -4.8843313 13 0.3624779 3.0166923 14 -1.2779040 0.3624779 15 3.0312812 -1.2779040 16 -8.2482388 3.0312812 17 -10.5919372 -8.2482388 18 3.4622157 -10.5919372 19 3.9059145 3.4622157 20 0.9454684 3.9059145 21 3.0681408 0.9454684 22 -6.6799966 3.0681408 23 -6.3208970 -6.6799966 24 6.1694833 -6.3208970 25 -1.6695870 6.1694833 26 -0.4254915 -1.6695870 27 8.1645664 -0.4254915 28 -8.6790154 8.1645664 29 -3.3917897 -8.6790154 30 8.2516935 -3.3917897 31 4.8324904 8.2516935 32 6.9654748 4.8324904 33 5.4978378 6.9654748 34 -4.4306245 5.4978378 35 -6.3276116 -4.4306245 36 -0.3921131 -6.3276116 37 -5.8500720 -0.3921131 38 -4.3510099 -5.8500720 39 8.7853869 -4.3510099 40 -16.4696206 8.7853869 41 -6.3220415 -16.4696206 42 1.7349725 -6.3220415 43 -1.8612360 1.7349725 44 9.8988056 -1.8612360 45 3.0630747 9.8988056 46 -0.5468869 3.0630747 47 -2.7647336 -0.5468869 48 8.8380400 -2.7647336 49 -7.3852233 8.8380400 50 4.4338088 -7.3852233 51 3.8202158 4.4338088 52 -13.5314648 3.8202158 53 -7.0423104 -13.5314648 54 -0.4393565 -7.0423104 55 4.3380779 -0.4393565 56 6.7744056 4.3380779 57 0.4433401 6.7744056 58 1.5298700 0.4433401 59 -4.5213245 1.5298700 60 8.5368542 -4.5213245 61 -6.2867184 8.5368542 62 1.4126160 -6.2867184 63 4.8914948 1.4126160 64 -9.6318574 4.8914948 65 -4.4184293 -9.6318574 66 -1.2110649 -4.4184293 67 7.9361060 -1.2110649 68 5.8210445 7.9361060 69 1.1377951 5.8210445 70 2.0509356 1.1377951 71 NA 2.0509356 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] 0.9306667 3.7744448 [2,] 3.4392051 0.9306667 [3,] 4.3844995 3.4392051 [4,] -7.6166283 4.3844995 [5,] -7.4412061 -7.6166283 [6,] 2.1830440 -7.4412061 [7,] 8.0088369 2.1830440 [8,] 4.5688224 8.0088369 [9,] 0.4074337 4.5688224 [10,] 0.1931881 0.4074337 [11,] -4.8843313 0.1931881 [12,] 3.0166923 -4.8843313 [13,] 0.3624779 3.0166923 [14,] -1.2779040 0.3624779 [15,] 3.0312812 -1.2779040 [16,] -8.2482388 3.0312812 [17,] -10.5919372 -8.2482388 [18,] 3.4622157 -10.5919372 [19,] 3.9059145 3.4622157 [20,] 0.9454684 3.9059145 [21,] 3.0681408 0.9454684 [22,] -6.6799966 3.0681408 [23,] -6.3208970 -6.6799966 [24,] 6.1694833 -6.3208970 [25,] -1.6695870 6.1694833 [26,] -0.4254915 -1.6695870 [27,] 8.1645664 -0.4254915 [28,] -8.6790154 8.1645664 [29,] -3.3917897 -8.6790154 [30,] 8.2516935 -3.3917897 [31,] 4.8324904 8.2516935 [32,] 6.9654748 4.8324904 [33,] 5.4978378 6.9654748 [34,] -4.4306245 5.4978378 [35,] -6.3276116 -4.4306245 [36,] -0.3921131 -6.3276116 [37,] -5.8500720 -0.3921131 [38,] -4.3510099 -5.8500720 [39,] 8.7853869 -4.3510099 [40,] -16.4696206 8.7853869 [41,] -6.3220415 -16.4696206 [42,] 1.7349725 -6.3220415 [43,] -1.8612360 1.7349725 [44,] 9.8988056 -1.8612360 [45,] 3.0630747 9.8988056 [46,] -0.5468869 3.0630747 [47,] -2.7647336 -0.5468869 [48,] 8.8380400 -2.7647336 [49,] -7.3852233 8.8380400 [50,] 4.4338088 -7.3852233 [51,] 3.8202158 4.4338088 [52,] -13.5314648 3.8202158 [53,] -7.0423104 -13.5314648 [54,] -0.4393565 -7.0423104 [55,] 4.3380779 -0.4393565 [56,] 6.7744056 4.3380779 [57,] 0.4433401 6.7744056 [58,] 1.5298700 0.4433401 [59,] -4.5213245 1.5298700 [60,] 8.5368542 -4.5213245 [61,] -6.2867184 8.5368542 [62,] 1.4126160 -6.2867184 [63,] 4.8914948 1.4126160 [64,] -9.6318574 4.8914948 [65,] -4.4184293 -9.6318574 [66,] -1.2110649 -4.4184293 [67,] 7.9361060 -1.2110649 [68,] 5.8210445 7.9361060 [69,] 1.1377951 5.8210445 [70,] 2.0509356 1.1377951 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 0.9306667 3.7744448 2 3.4392051 0.9306667 3 4.3844995 3.4392051 4 -7.6166283 4.3844995 5 -7.4412061 -7.6166283 6 2.1830440 -7.4412061 7 8.0088369 2.1830440 8 4.5688224 8.0088369 9 0.4074337 4.5688224 10 0.1931881 0.4074337 11 -4.8843313 0.1931881 12 3.0166923 -4.8843313 13 0.3624779 3.0166923 14 -1.2779040 0.3624779 15 3.0312812 -1.2779040 16 -8.2482388 3.0312812 17 -10.5919372 -8.2482388 18 3.4622157 -10.5919372 19 3.9059145 3.4622157 20 0.9454684 3.9059145 21 3.0681408 0.9454684 22 -6.6799966 3.0681408 23 -6.3208970 -6.6799966 24 6.1694833 -6.3208970 25 -1.6695870 6.1694833 26 -0.4254915 -1.6695870 27 8.1645664 -0.4254915 28 -8.6790154 8.1645664 29 -3.3917897 -8.6790154 30 8.2516935 -3.3917897 31 4.8324904 8.2516935 32 6.9654748 4.8324904 33 5.4978378 6.9654748 34 -4.4306245 5.4978378 35 -6.3276116 -4.4306245 36 -0.3921131 -6.3276116 37 -5.8500720 -0.3921131 38 -4.3510099 -5.8500720 39 8.7853869 -4.3510099 40 -16.4696206 8.7853869 41 -6.3220415 -16.4696206 42 1.7349725 -6.3220415 43 -1.8612360 1.7349725 44 9.8988056 -1.8612360 45 3.0630747 9.8988056 46 -0.5468869 3.0630747 47 -2.7647336 -0.5468869 48 8.8380400 -2.7647336 49 -7.3852233 8.8380400 50 4.4338088 -7.3852233 51 3.8202158 4.4338088 52 -13.5314648 3.8202158 53 -7.0423104 -13.5314648 54 -0.4393565 -7.0423104 55 4.3380779 -0.4393565 56 6.7744056 4.3380779 57 0.4433401 6.7744056 58 1.5298700 0.4433401 59 -4.5213245 1.5298700 60 8.5368542 -4.5213245 61 -6.2867184 8.5368542 62 1.4126160 -6.2867184 63 4.8914948 1.4126160 64 -9.6318574 4.8914948 65 -4.4184293 -9.6318574 66 -1.2110649 -4.4184293 67 7.9361060 -1.2110649 68 5.8210445 7.9361060 69 1.1377951 5.8210445 70 2.0509356 1.1377951 > 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/79ghk1258645764.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/8kby91258645764.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/9kgd01258645764.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/10ywlg1258645764.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/1181zi1258645764.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/1200np1258645764.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/132kyc1258645764.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/146hm01258645764.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/15sgzy1258645764.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/16u67w1258645764.tab") + } > > system("convert tmp/17u6x1258645764.ps tmp/17u6x1258645764.png") > system("convert tmp/2chh21258645764.ps tmp/2chh21258645764.png") > system("convert tmp/3421p1258645764.ps tmp/3421p1258645764.png") > system("convert tmp/4dswn1258645764.ps tmp/4dswn1258645764.png") > system("convert tmp/58fin1258645764.ps tmp/58fin1258645764.png") > system("convert tmp/6erdy1258645764.ps tmp/6erdy1258645764.png") > system("convert tmp/79ghk1258645764.ps tmp/79ghk1258645764.png") > system("convert tmp/8kby91258645764.ps tmp/8kby91258645764.png") > system("convert tmp/9kgd01258645764.ps tmp/9kgd01258645764.png") > system("convert tmp/10ywlg1258645764.ps tmp/10ywlg1258645764.png") > > > proc.time() user system elapsed 2.583 1.586 3.369