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(101.7 + ,86.2 + ,102.8 + ,105.6 + ,96.9 + ,97.6 + ,104.2 + ,88.8 + ,101.7 + ,102.8 + ,105.6 + ,96.9 + ,92.7 + ,89.6 + ,104.2 + ,101.7 + ,102.8 + ,105.6 + ,91.9 + ,87.8 + ,92.7 + ,104.2 + ,101.7 + ,102.8 + ,106.5 + ,88.3 + ,91.9 + ,92.7 + ,104.2 + ,101.7 + ,112.3 + ,88.6 + ,106.5 + ,91.9 + ,92.7 + ,104.2 + ,102.8 + ,91 + ,112.3 + ,106.5 + ,91.9 + ,92.7 + ,96.5 + ,91.5 + ,102.8 + ,112.3 + ,106.5 + ,91.9 + ,101 + ,95.4 + ,96.5 + ,102.8 + ,112.3 + ,106.5 + ,98.9 + ,98.7 + ,101 + ,96.5 + ,102.8 + ,112.3 + ,105.1 + ,99.9 + ,98.9 + ,101 + ,96.5 + ,102.8 + ,103 + ,98.6 + ,105.1 + ,98.9 + ,101 + ,96.5 + ,99 + ,100.3 + ,103 + ,105.1 + ,98.9 + ,101 + ,104.3 + ,100.2 + ,99 + ,103 + ,105.1 + ,98.9 + ,94.6 + ,100.4 + ,104.3 + ,99 + ,103 + ,105.1 + ,90.4 + ,101.4 + ,94.6 + ,104.3 + ,99 + ,103 + ,108.9 + ,103 + ,90.4 + ,94.6 + ,104.3 + ,99 + ,111.4 + ,109.1 + ,108.9 + ,90.4 + ,94.6 + ,104.3 + ,100.8 + ,111.4 + ,111.4 + ,108.9 + ,90.4 + ,94.6 + ,102.5 + ,114.1 + ,100.8 + ,111.4 + ,108.9 + ,90.4 + ,98.2 + ,121.8 + ,102.5 + ,100.8 + ,111.4 + ,108.9 + ,98.7 + ,127.6 + ,98.2 + ,102.5 + ,100.8 + ,111.4 + ,113.3 + ,129.9 + ,98.7 + ,98.2 + ,102.5 + ,100.8 + ,104.6 + ,128 + ,113.3 + ,98.7 + ,98.2 + ,102.5 + ,99.3 + ,123.5 + ,104.6 + ,113.3 + ,98.7 + ,98.2 + ,111.8 + ,124 + ,99.3 + ,104.6 + ,113.3 + ,98.7 + ,97.3 + ,127.4 + ,111.8 + ,99.3 + ,104.6 + ,113.3 + ,97.7 + ,127.6 + ,97.3 + ,111.8 + ,99.3 + ,104.6 + ,115.6 + ,128.4 + ,97.7 + ,97.3 + ,111.8 + ,99.3 + ,111.9 + ,131.4 + ,115.6 + ,97.7 + ,97.3 + ,111.8 + ,107 + ,135.1 + ,111.9 + ,115.6 + ,97.7 + ,97.3 + ,107.1 + ,134 + ,107 + ,111.9 + ,115.6 + ,97.7 + ,100.6 + ,144.5 + ,107.1 + ,107 + ,111.9 + ,115.6 + ,99.2 + ,147.3 + ,100.6 + ,107.1 + ,107 + ,111.9 + ,108.4 + ,150.9 + ,99.2 + ,100.6 + ,107.1 + ,107 + ,103 + ,148.7 + ,108.4 + ,99.2 + ,100.6 + ,107.1 + ,99.8 + ,141.4 + ,103 + ,108.4 + ,99.2 + ,100.6 + ,115 + ,138.9 + ,99.8 + ,103 + ,108.4 + ,99.2 + ,90.8 + ,139.8 + ,115 + ,99.8 + ,103 + ,108.4 + ,95.9 + ,145.6 + ,90.8 + ,115 + ,99.8 + ,103 + ,114.4 + ,147.9 + ,95.9 + ,90.8 + ,115 + ,99.8 + ,108.2 + ,148.5 + ,114.4 + ,95.9 + ,90.8 + ,115 + ,112.6 + ,151.1 + ,108.2 + ,114.4 + ,95.9 + ,90.8 + ,109.1 + ,157.5 + ,112.6 + ,108.2 + ,114.4 + ,95.9 + ,105 + ,167.5 + ,109.1 + ,112.6 + ,108.2 + ,114.4 + ,105 + ,172.3 + ,105 + ,109.1 + ,112.6 + ,108.2 + ,118.5 + ,173.5 + ,105 + ,105 + ,109.1 + ,112.6 + ,103.7 + ,187.5 + ,118.5 + ,105 + ,105 + ,109.1 + ,112.5 + ,205.5 + ,103.7 + ,118.5 + ,105 + ,105 + ,116.6 + ,195.1 + ,112.5 + ,103.7 + ,118.5 + ,105 + ,96.6 + ,204.5 + ,116.6 + ,112.5 + ,103.7 + ,118.5 + ,101.9 + ,204.5 + ,96.6 + ,116.6 + ,112.5 + ,103.7 + ,116.5 + ,201.7 + ,101.9 + ,96.6 + ,116.6 + ,112.5 + ,119.3 + ,207 + ,116.5 + ,101.9 + ,96.6 + ,116.6 + ,115.4 + ,206.6 + ,119.3 + ,116.5 + ,101.9 + ,96.6 + ,108.5 + ,210.6 + ,115.4 + ,119.3 + ,116.5 + ,101.9 + ,111.5 + ,211.1 + ,108.5 + ,115.4 + ,119.3 + ,116.5 + ,108.8 + ,215 + ,111.5 + ,108.5 + ,115.4 + ,119.3 + ,121.8 + ,223.9 + ,108.8 + ,111.5 + ,108.5 + ,115.4 + ,109.6 + ,238.2 + ,121.8 + ,108.8 + ,111.5 + ,108.5 + ,112.2 + ,238.9 + ,109.6 + ,121.8 + ,108.8 + ,111.5 + ,119.6 + ,229.6 + ,112.2 + ,109.6 + ,121.8 + ,108.8 + ,104.1 + ,232.2 + ,119.6 + ,112.2 + ,109.6 + ,121.8 + ,105.3 + ,222.1 + ,104.1 + ,119.6 + ,112.2 + ,109.6 + ,115 + ,221.6 + ,105.3 + ,104.1 + ,119.6 + ,112.2 + ,124.1 + ,227.3 + ,115 + ,105.3 + ,104.1 + ,119.6 + ,116.8 + ,221 + ,124.1 + ,115 + ,105.3 + ,104.1 + ,107.5 + ,213.6 + ,116.8 + ,124.1 + ,115 + ,105.3 + ,115.6 + ,243.4 + ,107.5 + ,116.8 + ,124.1 + ,115) + ,dim=c(6 + ,69) + ,dimnames=list(c('tot_indus' + ,'prijsindex' + ,'y(t-1)' + ,'y(t-2)' + ,'y(t-3)' + ,'y(t-4)') + ,1:69)) > y <- array(NA,dim=c(6,69),dimnames=list(c('tot_indus','prijsindex','y(t-1)','y(t-2)','y(t-3)','y(t-4)'),1:69)) > 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) y(t-3) y(t-4) 1 101.7 86.2 102.8 105.6 96.9 97.6 2 104.2 88.8 101.7 102.8 105.6 96.9 3 92.7 89.6 104.2 101.7 102.8 105.6 4 91.9 87.8 92.7 104.2 101.7 102.8 5 106.5 88.3 91.9 92.7 104.2 101.7 6 112.3 88.6 106.5 91.9 92.7 104.2 7 102.8 91.0 112.3 106.5 91.9 92.7 8 96.5 91.5 102.8 112.3 106.5 91.9 9 101.0 95.4 96.5 102.8 112.3 106.5 10 98.9 98.7 101.0 96.5 102.8 112.3 11 105.1 99.9 98.9 101.0 96.5 102.8 12 103.0 98.6 105.1 98.9 101.0 96.5 13 99.0 100.3 103.0 105.1 98.9 101.0 14 104.3 100.2 99.0 103.0 105.1 98.9 15 94.6 100.4 104.3 99.0 103.0 105.1 16 90.4 101.4 94.6 104.3 99.0 103.0 17 108.9 103.0 90.4 94.6 104.3 99.0 18 111.4 109.1 108.9 90.4 94.6 104.3 19 100.8 111.4 111.4 108.9 90.4 94.6 20 102.5 114.1 100.8 111.4 108.9 90.4 21 98.2 121.8 102.5 100.8 111.4 108.9 22 98.7 127.6 98.2 102.5 100.8 111.4 23 113.3 129.9 98.7 98.2 102.5 100.8 24 104.6 128.0 113.3 98.7 98.2 102.5 25 99.3 123.5 104.6 113.3 98.7 98.2 26 111.8 124.0 99.3 104.6 113.3 98.7 27 97.3 127.4 111.8 99.3 104.6 113.3 28 97.7 127.6 97.3 111.8 99.3 104.6 29 115.6 128.4 97.7 97.3 111.8 99.3 30 111.9 131.4 115.6 97.7 97.3 111.8 31 107.0 135.1 111.9 115.6 97.7 97.3 32 107.1 134.0 107.0 111.9 115.6 97.7 33 100.6 144.5 107.1 107.0 111.9 115.6 34 99.2 147.3 100.6 107.1 107.0 111.9 35 108.4 150.9 99.2 100.6 107.1 107.0 36 103.0 148.7 108.4 99.2 100.6 107.1 37 99.8 141.4 103.0 108.4 99.2 100.6 38 115.0 138.9 99.8 103.0 108.4 99.2 39 90.8 139.8 115.0 99.8 103.0 108.4 40 95.9 145.6 90.8 115.0 99.8 103.0 41 114.4 147.9 95.9 90.8 115.0 99.8 42 108.2 148.5 114.4 95.9 90.8 115.0 43 112.6 151.1 108.2 114.4 95.9 90.8 44 109.1 157.5 112.6 108.2 114.4 95.9 45 105.0 167.5 109.1 112.6 108.2 114.4 46 105.0 172.3 105.0 109.1 112.6 108.2 47 118.5 173.5 105.0 105.0 109.1 112.6 48 103.7 187.5 118.5 105.0 105.0 109.1 49 112.5 205.5 103.7 118.5 105.0 105.0 50 116.6 195.1 112.5 103.7 118.5 105.0 51 96.6 204.5 116.6 112.5 103.7 118.5 52 101.9 204.5 96.6 116.6 112.5 103.7 53 116.5 201.7 101.9 96.6 116.6 112.5 54 119.3 207.0 116.5 101.9 96.6 116.6 55 115.4 206.6 119.3 116.5 101.9 96.6 56 108.5 210.6 115.4 119.3 116.5 101.9 57 111.5 211.1 108.5 115.4 119.3 116.5 58 108.8 215.0 111.5 108.5 115.4 119.3 59 121.8 223.9 108.8 111.5 108.5 115.4 60 109.6 238.2 121.8 108.8 111.5 108.5 61 112.2 238.9 109.6 121.8 108.8 111.5 62 119.6 229.6 112.2 109.6 121.8 108.8 63 104.1 232.2 119.6 112.2 109.6 121.8 64 105.3 222.1 104.1 119.6 112.2 109.6 65 115.0 221.6 105.3 104.1 119.6 112.2 66 124.1 227.3 115.0 105.3 104.1 119.6 67 116.8 221.0 124.1 115.0 105.3 104.1 68 107.5 213.6 116.8 124.1 115.0 105.3 69 115.6 243.4 107.5 116.8 124.1 115.0 > 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)` `y(t-3)` `y(t-4)` 209.29898 0.20066 -0.04310 -0.65254 -0.03028 -0.53534 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -15.321 -3.248 0.351 3.627 11.012 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 209.29898 26.09173 8.022 3.27e-11 *** prijsindex 0.20066 0.02794 7.181 9.68e-10 *** `y(t-1)` -0.04310 0.11002 -0.392 0.697 `y(t-2)` -0.65254 0.11217 -5.817 2.17e-07 *** `y(t-3)` -0.03028 0.11095 -0.273 0.786 `y(t-4)` -0.53534 0.11706 -4.573 2.30e-05 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 5.358 on 63 degrees of freedom Multiple R-squared: 0.5756, Adjusted R-squared: 0.5419 F-statistic: 17.09 on 5 and 63 DF, p-value: 1.203e-10 > 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.50742623 0.98514755 0.4925738 [2,] 0.35746383 0.71492767 0.6425362 [3,] 0.24170810 0.48341621 0.7582919 [4,] 0.34704305 0.69408610 0.6529569 [5,] 0.23673373 0.47346745 0.7632663 [6,] 0.16736261 0.33472522 0.8326374 [7,] 0.24478756 0.48957513 0.7552124 [8,] 0.29885097 0.59770194 0.7011490 [9,] 0.21868218 0.43736437 0.7813178 [10,] 0.15682178 0.31364356 0.8431782 [11,] 0.10792430 0.21584860 0.8920757 [12,] 0.07504169 0.15008338 0.9249583 [13,] 0.04901281 0.09802563 0.9509872 [14,] 0.03942729 0.07885458 0.9605727 [15,] 0.03378434 0.06756868 0.9662157 [16,] 0.02612607 0.05225215 0.9738739 [17,] 0.01873906 0.03747812 0.9812609 [18,] 0.02871204 0.05742407 0.9712880 [19,] 0.01990067 0.03980134 0.9800993 [20,] 0.01420872 0.02841744 0.9857913 [21,] 0.01073537 0.02147075 0.9892646 [22,] 0.02659286 0.05318572 0.9734071 [23,] 0.03478948 0.06957896 0.9652105 [24,] 0.02995070 0.05990141 0.9700493 [25,] 0.02208426 0.04416853 0.9779157 [26,] 0.01428773 0.02857546 0.9857123 [27,] 0.00920689 0.01841378 0.9907931 [28,] 0.01362311 0.02724621 0.9863769 [29,] 0.01264365 0.02528731 0.9873563 [30,] 0.01502332 0.03004665 0.9849767 [31,] 0.17822489 0.35644978 0.8217751 [32,] 0.17695490 0.35390980 0.8230451 [33,] 0.16515126 0.33030252 0.8348487 [34,] 0.13656959 0.27313918 0.8634304 [35,] 0.11388035 0.22776070 0.8861197 [36,] 0.08352894 0.16705787 0.9164711 [37,] 0.07990674 0.15981348 0.9200933 [38,] 0.05626079 0.11252158 0.9437392 [39,] 0.16777511 0.33555021 0.8322249 [40,] 0.18749060 0.37498120 0.8125094 [41,] 0.15745194 0.31490388 0.8425481 [42,] 0.11835597 0.23671194 0.8816440 [43,] 0.24951267 0.49902534 0.7504873 [44,] 0.38490676 0.76981352 0.6150932 [45,] 0.33501592 0.67003183 0.6649841 [46,] 0.28013054 0.56026108 0.7198695 [47,] 0.19943745 0.39887490 0.8005626 [48,] 0.13505604 0.27011208 0.8649440 [49,] 0.10693810 0.21387619 0.8930619 [50,] 0.07055409 0.14110817 0.9294459 [51,] 0.08364003 0.16728007 0.9163600 [52,] 0.24690238 0.49380475 0.7530976 > postscript(file="/var/www/html/rcomp/tmp/1iz7a1258645213.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/257ku1258645214.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/3qvz41258645214.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/4pn7j1258645214.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/5anv51258645214.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 = 69 Frequency = 1 1 2 3 4 5 6 3.6267934 3.6192457 -4.0786533 -4.9140608 1.5337298 8.3709466 7 8 9 10 11 12 1.9858530 -1.0254163 4.2128879 0.3509868 3.8796421 -2.2989754 13 14 15 16 17 18 -0.3394179 2.5014170 -6.3649182 -8.9705377 0.7168519 2.5931688 19 20 21 22 23 24 -1.6085293 -0.9641072 -3.6733701 -2.3958197 3.3351791 -3.2481159 25 26 27 28 29 30 -0.7798722 6.4239863 -4.1254101 -1.0517006 4.7843622 7.7676423 31 32 33 34 35 36 5.8959168 4.3471613 2.0176434 -2.2882353 -0.7325952 -6.3514349 37 38 39 40 41 42 -5.8381062 5.7309777 -15.3209665 -5.4969777 -4.2830000 0.9263708 43 44 45 46 47 48 3.8086626 -1.5412568 4.7885199 -1.8211249 11.0121803 -8.0129574 49 50 51 52 53 54 3.1516952 0.4690011 -8.7191532 -9.2623569 -2.0877678 5.3258324 55 56 57 58 59 60 0.6075943 -2.1566557 5.8014152 -0.6735131 10.0851341 -9.7887833 61 62 63 64 65 66 2.1521919 2.5175869 -4.8985541 -3.9636161 -2.6100059 10.0395786 67 68 69 2.4641987 1.2086465 3.6329645 > postscript(file="/var/www/html/rcomp/tmp/6x2hs1258645214.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 = 69 Frequency = 1 lag(myerror, k = 1) myerror 0 3.6267934 NA 1 3.6192457 3.6267934 2 -4.0786533 3.6192457 3 -4.9140608 -4.0786533 4 1.5337298 -4.9140608 5 8.3709466 1.5337298 6 1.9858530 8.3709466 7 -1.0254163 1.9858530 8 4.2128879 -1.0254163 9 0.3509868 4.2128879 10 3.8796421 0.3509868 11 -2.2989754 3.8796421 12 -0.3394179 -2.2989754 13 2.5014170 -0.3394179 14 -6.3649182 2.5014170 15 -8.9705377 -6.3649182 16 0.7168519 -8.9705377 17 2.5931688 0.7168519 18 -1.6085293 2.5931688 19 -0.9641072 -1.6085293 20 -3.6733701 -0.9641072 21 -2.3958197 -3.6733701 22 3.3351791 -2.3958197 23 -3.2481159 3.3351791 24 -0.7798722 -3.2481159 25 6.4239863 -0.7798722 26 -4.1254101 6.4239863 27 -1.0517006 -4.1254101 28 4.7843622 -1.0517006 29 7.7676423 4.7843622 30 5.8959168 7.7676423 31 4.3471613 5.8959168 32 2.0176434 4.3471613 33 -2.2882353 2.0176434 34 -0.7325952 -2.2882353 35 -6.3514349 -0.7325952 36 -5.8381062 -6.3514349 37 5.7309777 -5.8381062 38 -15.3209665 5.7309777 39 -5.4969777 -15.3209665 40 -4.2830000 -5.4969777 41 0.9263708 -4.2830000 42 3.8086626 0.9263708 43 -1.5412568 3.8086626 44 4.7885199 -1.5412568 45 -1.8211249 4.7885199 46 11.0121803 -1.8211249 47 -8.0129574 11.0121803 48 3.1516952 -8.0129574 49 0.4690011 3.1516952 50 -8.7191532 0.4690011 51 -9.2623569 -8.7191532 52 -2.0877678 -9.2623569 53 5.3258324 -2.0877678 54 0.6075943 5.3258324 55 -2.1566557 0.6075943 56 5.8014152 -2.1566557 57 -0.6735131 5.8014152 58 10.0851341 -0.6735131 59 -9.7887833 10.0851341 60 2.1521919 -9.7887833 61 2.5175869 2.1521919 62 -4.8985541 2.5175869 63 -3.9636161 -4.8985541 64 -2.6100059 -3.9636161 65 10.0395786 -2.6100059 66 2.4641987 10.0395786 67 1.2086465 2.4641987 68 3.6329645 1.2086465 69 NA 3.6329645 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] 3.6192457 3.6267934 [2,] -4.0786533 3.6192457 [3,] -4.9140608 -4.0786533 [4,] 1.5337298 -4.9140608 [5,] 8.3709466 1.5337298 [6,] 1.9858530 8.3709466 [7,] -1.0254163 1.9858530 [8,] 4.2128879 -1.0254163 [9,] 0.3509868 4.2128879 [10,] 3.8796421 0.3509868 [11,] -2.2989754 3.8796421 [12,] -0.3394179 -2.2989754 [13,] 2.5014170 -0.3394179 [14,] -6.3649182 2.5014170 [15,] -8.9705377 -6.3649182 [16,] 0.7168519 -8.9705377 [17,] 2.5931688 0.7168519 [18,] -1.6085293 2.5931688 [19,] -0.9641072 -1.6085293 [20,] -3.6733701 -0.9641072 [21,] -2.3958197 -3.6733701 [22,] 3.3351791 -2.3958197 [23,] -3.2481159 3.3351791 [24,] -0.7798722 -3.2481159 [25,] 6.4239863 -0.7798722 [26,] -4.1254101 6.4239863 [27,] -1.0517006 -4.1254101 [28,] 4.7843622 -1.0517006 [29,] 7.7676423 4.7843622 [30,] 5.8959168 7.7676423 [31,] 4.3471613 5.8959168 [32,] 2.0176434 4.3471613 [33,] -2.2882353 2.0176434 [34,] -0.7325952 -2.2882353 [35,] -6.3514349 -0.7325952 [36,] -5.8381062 -6.3514349 [37,] 5.7309777 -5.8381062 [38,] -15.3209665 5.7309777 [39,] -5.4969777 -15.3209665 [40,] -4.2830000 -5.4969777 [41,] 0.9263708 -4.2830000 [42,] 3.8086626 0.9263708 [43,] -1.5412568 3.8086626 [44,] 4.7885199 -1.5412568 [45,] -1.8211249 4.7885199 [46,] 11.0121803 -1.8211249 [47,] -8.0129574 11.0121803 [48,] 3.1516952 -8.0129574 [49,] 0.4690011 3.1516952 [50,] -8.7191532 0.4690011 [51,] -9.2623569 -8.7191532 [52,] -2.0877678 -9.2623569 [53,] 5.3258324 -2.0877678 [54,] 0.6075943 5.3258324 [55,] -2.1566557 0.6075943 [56,] 5.8014152 -2.1566557 [57,] -0.6735131 5.8014152 [58,] 10.0851341 -0.6735131 [59,] -9.7887833 10.0851341 [60,] 2.1521919 -9.7887833 [61,] 2.5175869 2.1521919 [62,] -4.8985541 2.5175869 [63,] -3.9636161 -4.8985541 [64,] -2.6100059 -3.9636161 [65,] 10.0395786 -2.6100059 [66,] 2.4641987 10.0395786 [67,] 1.2086465 2.4641987 [68,] 3.6329645 1.2086465 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 3.6192457 3.6267934 2 -4.0786533 3.6192457 3 -4.9140608 -4.0786533 4 1.5337298 -4.9140608 5 8.3709466 1.5337298 6 1.9858530 8.3709466 7 -1.0254163 1.9858530 8 4.2128879 -1.0254163 9 0.3509868 4.2128879 10 3.8796421 0.3509868 11 -2.2989754 3.8796421 12 -0.3394179 -2.2989754 13 2.5014170 -0.3394179 14 -6.3649182 2.5014170 15 -8.9705377 -6.3649182 16 0.7168519 -8.9705377 17 2.5931688 0.7168519 18 -1.6085293 2.5931688 19 -0.9641072 -1.6085293 20 -3.6733701 -0.9641072 21 -2.3958197 -3.6733701 22 3.3351791 -2.3958197 23 -3.2481159 3.3351791 24 -0.7798722 -3.2481159 25 6.4239863 -0.7798722 26 -4.1254101 6.4239863 27 -1.0517006 -4.1254101 28 4.7843622 -1.0517006 29 7.7676423 4.7843622 30 5.8959168 7.7676423 31 4.3471613 5.8959168 32 2.0176434 4.3471613 33 -2.2882353 2.0176434 34 -0.7325952 -2.2882353 35 -6.3514349 -0.7325952 36 -5.8381062 -6.3514349 37 5.7309777 -5.8381062 38 -15.3209665 5.7309777 39 -5.4969777 -15.3209665 40 -4.2830000 -5.4969777 41 0.9263708 -4.2830000 42 3.8086626 0.9263708 43 -1.5412568 3.8086626 44 4.7885199 -1.5412568 45 -1.8211249 4.7885199 46 11.0121803 -1.8211249 47 -8.0129574 11.0121803 48 3.1516952 -8.0129574 49 0.4690011 3.1516952 50 -8.7191532 0.4690011 51 -9.2623569 -8.7191532 52 -2.0877678 -9.2623569 53 5.3258324 -2.0877678 54 0.6075943 5.3258324 55 -2.1566557 0.6075943 56 5.8014152 -2.1566557 57 -0.6735131 5.8014152 58 10.0851341 -0.6735131 59 -9.7887833 10.0851341 60 2.1521919 -9.7887833 61 2.5175869 2.1521919 62 -4.8985541 2.5175869 63 -3.9636161 -4.8985541 64 -2.6100059 -3.9636161 65 10.0395786 -2.6100059 66 2.4641987 10.0395786 67 1.2086465 2.4641987 68 3.6329645 1.2086465 > 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/7rez01258645214.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/8tz8g1258645214.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/9x0951258645214.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/10qh421258645214.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/11jshm1258645214.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/12tl661258645214.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/13g2a71258645214.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/146ghp1258645214.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/15yne81258645214.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/160zoc1258645214.tab") + } > > system("convert tmp/1iz7a1258645213.ps tmp/1iz7a1258645213.png") > system("convert tmp/257ku1258645214.ps tmp/257ku1258645214.png") > system("convert tmp/3qvz41258645214.ps tmp/3qvz41258645214.png") > system("convert tmp/4pn7j1258645214.ps tmp/4pn7j1258645214.png") > system("convert tmp/5anv51258645214.ps tmp/5anv51258645214.png") > system("convert tmp/6x2hs1258645214.ps tmp/6x2hs1258645214.png") > system("convert tmp/7rez01258645214.ps tmp/7rez01258645214.png") > system("convert tmp/8tz8g1258645214.ps tmp/8tz8g1258645214.png") > system("convert tmp/9x0951258645214.ps tmp/9x0951258645214.png") > system("convert tmp/10qh421258645214.ps tmp/10qh421258645214.png") > > > proc.time() user system elapsed 2.644 1.625 3.319