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 = '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 tot_indus prijsindex M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 1 97.6 82.9 1 0 0 0 0 0 0 0 0 0 0 2 96.9 83.8 0 1 0 0 0 0 0 0 0 0 0 3 105.6 86.2 0 0 1 0 0 0 0 0 0 0 0 4 102.8 86.1 0 0 0 1 0 0 0 0 0 0 0 5 101.7 86.2 0 0 0 0 1 0 0 0 0 0 0 6 104.2 88.8 0 0 0 0 0 1 0 0 0 0 0 7 92.7 89.6 0 0 0 0 0 0 1 0 0 0 0 8 91.9 87.8 0 0 0 0 0 0 0 1 0 0 0 9 106.5 88.3 0 0 0 0 0 0 0 0 1 0 0 10 112.3 88.6 0 0 0 0 0 0 0 0 0 1 0 11 102.8 91.0 0 0 0 0 0 0 0 0 0 0 1 12 96.5 91.5 0 0 0 0 0 0 0 0 0 0 0 13 101.0 95.4 1 0 0 0 0 0 0 0 0 0 0 14 98.9 98.7 0 1 0 0 0 0 0 0 0 0 0 15 105.1 99.9 0 0 1 0 0 0 0 0 0 0 0 16 103.0 98.6 0 0 0 1 0 0 0 0 0 0 0 17 99.0 100.3 0 0 0 0 1 0 0 0 0 0 0 18 104.3 100.2 0 0 0 0 0 1 0 0 0 0 0 19 94.6 100.4 0 0 0 0 0 0 1 0 0 0 0 20 90.4 101.4 0 0 0 0 0 0 0 1 0 0 0 21 108.9 103.0 0 0 0 0 0 0 0 0 1 0 0 22 111.4 109.1 0 0 0 0 0 0 0 0 0 1 0 23 100.8 111.4 0 0 0 0 0 0 0 0 0 0 1 24 102.5 114.1 0 0 0 0 0 0 0 0 0 0 0 25 98.2 121.8 1 0 0 0 0 0 0 0 0 0 0 26 98.7 127.6 0 1 0 0 0 0 0 0 0 0 0 27 113.3 129.9 0 0 1 0 0 0 0 0 0 0 0 28 104.6 128.0 0 0 0 1 0 0 0 0 0 0 0 29 99.3 123.5 0 0 0 0 1 0 0 0 0 0 0 30 111.8 124.0 0 0 0 0 0 1 0 0 0 0 0 31 97.3 127.4 0 0 0 0 0 0 1 0 0 0 0 32 97.7 127.6 0 0 0 0 0 0 0 1 0 0 0 33 115.6 128.4 0 0 0 0 0 0 0 0 1 0 0 34 111.9 131.4 0 0 0 0 0 0 0 0 0 1 0 35 107.0 135.1 0 0 0 0 0 0 0 0 0 0 1 36 107.1 134.0 0 0 0 0 0 0 0 0 0 0 0 37 100.6 144.5 1 0 0 0 0 0 0 0 0 0 0 38 99.2 147.3 0 1 0 0 0 0 0 0 0 0 0 39 108.4 150.9 0 0 1 0 0 0 0 0 0 0 0 40 103.0 148.7 0 0 0 1 0 0 0 0 0 0 0 41 99.8 141.4 0 0 0 0 1 0 0 0 0 0 0 42 115.0 138.9 0 0 0 0 0 1 0 0 0 0 0 43 90.8 139.8 0 0 0 0 0 0 1 0 0 0 0 44 95.9 145.6 0 0 0 0 0 0 0 1 0 0 0 45 114.4 147.9 0 0 0 0 0 0 0 0 1 0 0 46 108.2 148.5 0 0 0 0 0 0 0 0 0 1 0 47 112.6 151.1 0 0 0 0 0 0 0 0 0 0 1 48 109.1 157.5 0 0 0 0 0 0 0 0 0 0 0 49 105.0 167.5 1 0 0 0 0 0 0 0 0 0 0 50 105.0 172.3 0 1 0 0 0 0 0 0 0 0 0 51 118.5 173.5 0 0 1 0 0 0 0 0 0 0 0 52 103.7 187.5 0 0 0 1 0 0 0 0 0 0 0 53 112.5 205.5 0 0 0 0 1 0 0 0 0 0 0 54 116.6 195.1 0 0 0 0 0 1 0 0 0 0 0 55 96.6 204.5 0 0 0 0 0 0 1 0 0 0 0 56 101.9 204.5 0 0 0 0 0 0 0 1 0 0 0 57 116.5 201.7 0 0 0 0 0 0 0 0 1 0 0 58 119.3 207.0 0 0 0 0 0 0 0 0 0 1 0 59 115.4 206.6 0 0 0 0 0 0 0 0 0 0 1 60 108.5 210.6 0 0 0 0 0 0 0 0 0 0 0 61 111.5 211.1 1 0 0 0 0 0 0 0 0 0 0 62 108.8 215.0 0 1 0 0 0 0 0 0 0 0 0 63 121.8 223.9 0 0 1 0 0 0 0 0 0 0 0 64 109.6 238.2 0 0 0 1 0 0 0 0 0 0 0 65 112.2 238.9 0 0 0 0 1 0 0 0 0 0 0 66 119.6 229.6 0 0 0 0 0 1 0 0 0 0 0 67 104.1 232.2 0 0 0 0 0 0 1 0 0 0 0 68 105.3 222.1 0 0 0 0 0 0 0 1 0 0 0 69 115.0 221.6 0 0 0 0 0 0 0 0 1 0 0 70 124.1 227.3 0 0 0 0 0 0 0 0 0 1 0 71 116.8 221.0 0 0 0 0 0 0 0 0 0 0 1 72 107.5 213.6 0 0 0 0 0 0 0 0 0 0 0 73 115.6 243.4 1 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) prijsindex M1 M2 M3 M4 91.50941 0.08916 -0.88063 -2.81172 7.76369 -0.24179 M5 M6 M7 M8 M9 M10 -0.73773 7.38091 -8.77617 -7.53669 8.06841 9.47302 M11 4.10912 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -6.0228 -2.4830 0.1386 2.0494 4.5740 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 91.509413 1.587977 57.626 < 2e-16 *** prijsindex 0.089160 0.006837 13.041 < 2e-16 *** M1 -0.880632 1.623658 -0.542 0.5896 M2 -2.811718 1.687188 -1.667 0.1008 M3 7.763691 1.686180 4.604 2.20e-05 *** M4 -0.241785 1.685379 -0.143 0.8864 M5 -0.737735 1.685179 -0.438 0.6631 M6 7.380912 1.685698 4.379 4.86e-05 *** M7 -8.776167 1.685218 -5.208 2.46e-06 *** M8 -7.536686 1.685330 -4.472 3.51e-05 *** M9 8.068413 1.685285 4.788 1.14e-05 *** M10 9.473018 1.684963 5.622 5.20e-07 *** M11 4.109120 1.684939 2.439 0.0177 * --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 2.918 on 60 degrees of freedom Multiple R-squared: 0.8848, Adjusted R-squared: 0.8617 F-statistic: 38.39 on 12 and 60 DF, p-value: < 2.2e-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.087650426 0.17530085 0.91234957 [2,] 0.124866993 0.24973399 0.87513301 [3,] 0.061406238 0.12281248 0.93859376 [4,] 0.036209902 0.07241980 0.96379010 [5,] 0.023846745 0.04769349 0.97615326 [6,] 0.014737176 0.02947435 0.98526282 [7,] 0.008273015 0.01654603 0.99172698 [8,] 0.008173297 0.01634659 0.99182670 [9,] 0.032356649 0.06471330 0.96764335 [10,] 0.028151435 0.05630287 0.97184857 [11,] 0.015133524 0.03026705 0.98486648 [12,] 0.076528619 0.15305724 0.92347138 [13,] 0.061347898 0.12269580 0.93865210 [14,] 0.055432119 0.11086424 0.94456788 [15,] 0.105960128 0.21192026 0.89403987 [16,] 0.111346452 0.22269290 0.88865355 [17,] 0.122237559 0.24447512 0.87776244 [18,] 0.227355380 0.45471076 0.77264462 [19,] 0.205233764 0.41046753 0.79476624 [20,] 0.168868954 0.33773791 0.83113105 [21,] 0.236195946 0.47239189 0.76380405 [22,] 0.237419590 0.47483918 0.76258041 [23,] 0.231099357 0.46219871 0.76890064 [24,] 0.370651506 0.74130301 0.62934849 [25,] 0.381014125 0.76202825 0.61898587 [26,] 0.435673844 0.87134769 0.56432616 [27,] 0.543795253 0.91240949 0.45620475 [28,] 0.609053586 0.78189283 0.39094641 [29,] 0.533012670 0.93397466 0.46698733 [30,] 0.573552476 0.85289505 0.42644752 [31,] 0.863437275 0.27312545 0.13656273 [32,] 0.871600632 0.25679874 0.12839937 [33,] 0.975748349 0.04850330 0.02425165 [34,] 0.970199916 0.05960017 0.02980008 [35,] 0.947629411 0.10474118 0.05237059 [36,] 0.938433891 0.12313222 0.06156611 [37,] 0.911086547 0.17782691 0.08891345 [38,] 0.943813063 0.11237387 0.05618694 [39,] 0.911942545 0.17611491 0.08805745 [40,] 0.935682569 0.12863486 0.06431743 [41,] 0.878758431 0.24248314 0.12124157 [42,] 0.951517084 0.09696583 0.04848292 > postscript(file="/var/www/html/rcomp/tmp/1a0oc1258644167.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/29bq11258644167.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/35ofh1258644167.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/4hzhw1258644167.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/5wezg1258644167.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 -0.42018199 0.73065955 -1.35873473 3.85565769 3.24269096 -2.60777297 7 8 9 10 11 12 1.97797796 0.09898574 -0.95069368 3.41795309 -0.93213367 -3.16759418 13 14 15 16 17 18 1.86531240 1.40216887 -3.08023287 2.94115208 -0.71447136 -3.52420208 19 20 21 22 23 24 2.91504512 -2.61359636 0.13864773 0.69016390 -4.75100681 0.81737969 25 26 27 28 29 30 -3.28852343 -1.37456809 2.44495368 1.91983490 -2.48299376 1.85377924 31 32 33 34 35 36 3.20771301 2.35039989 4.57397234 -0.79811410 -0.66410944 3.64308677 37 38 39 40 41 42 -2.91246561 -2.63102892 -4.32741574 -1.52578638 -3.57896579 3.72528856 43 44 45 46 47 48 -4.39787655 -1.05448818 1.63534359 -6.02275777 3.50932338 3.54781623 49 50 51 52 53 54 -0.56315593 0.93995987 3.75755813 -4.28521178 3.40584947 0.31447136 55 56 57 58 59 60 -4.36655756 -0.30603859 -1.06148853 -0.13864400 1.36091850 -1.78660358 61 62 63 64 65 66 2.04944852 0.93280872 2.56387153 -2.90564651 0.12789049 0.23843589 67 68 69 70 71 72 0.66369802 1.52473751 -4.33578145 2.85139889 1.47700804 -3.05408493 73 3.26956604 > postscript(file="/var/www/html/rcomp/tmp/6k0t61258644167.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 -0.42018199 NA 1 0.73065955 -0.42018199 2 -1.35873473 0.73065955 3 3.85565769 -1.35873473 4 3.24269096 3.85565769 5 -2.60777297 3.24269096 6 1.97797796 -2.60777297 7 0.09898574 1.97797796 8 -0.95069368 0.09898574 9 3.41795309 -0.95069368 10 -0.93213367 3.41795309 11 -3.16759418 -0.93213367 12 1.86531240 -3.16759418 13 1.40216887 1.86531240 14 -3.08023287 1.40216887 15 2.94115208 -3.08023287 16 -0.71447136 2.94115208 17 -3.52420208 -0.71447136 18 2.91504512 -3.52420208 19 -2.61359636 2.91504512 20 0.13864773 -2.61359636 21 0.69016390 0.13864773 22 -4.75100681 0.69016390 23 0.81737969 -4.75100681 24 -3.28852343 0.81737969 25 -1.37456809 -3.28852343 26 2.44495368 -1.37456809 27 1.91983490 2.44495368 28 -2.48299376 1.91983490 29 1.85377924 -2.48299376 30 3.20771301 1.85377924 31 2.35039989 3.20771301 32 4.57397234 2.35039989 33 -0.79811410 4.57397234 34 -0.66410944 -0.79811410 35 3.64308677 -0.66410944 36 -2.91246561 3.64308677 37 -2.63102892 -2.91246561 38 -4.32741574 -2.63102892 39 -1.52578638 -4.32741574 40 -3.57896579 -1.52578638 41 3.72528856 -3.57896579 42 -4.39787655 3.72528856 43 -1.05448818 -4.39787655 44 1.63534359 -1.05448818 45 -6.02275777 1.63534359 46 3.50932338 -6.02275777 47 3.54781623 3.50932338 48 -0.56315593 3.54781623 49 0.93995987 -0.56315593 50 3.75755813 0.93995987 51 -4.28521178 3.75755813 52 3.40584947 -4.28521178 53 0.31447136 3.40584947 54 -4.36655756 0.31447136 55 -0.30603859 -4.36655756 56 -1.06148853 -0.30603859 57 -0.13864400 -1.06148853 58 1.36091850 -0.13864400 59 -1.78660358 1.36091850 60 2.04944852 -1.78660358 61 0.93280872 2.04944852 62 2.56387153 0.93280872 63 -2.90564651 2.56387153 64 0.12789049 -2.90564651 65 0.23843589 0.12789049 66 0.66369802 0.23843589 67 1.52473751 0.66369802 68 -4.33578145 1.52473751 69 2.85139889 -4.33578145 70 1.47700804 2.85139889 71 -3.05408493 1.47700804 72 3.26956604 -3.05408493 73 NA 3.26956604 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] 0.73065955 -0.42018199 [2,] -1.35873473 0.73065955 [3,] 3.85565769 -1.35873473 [4,] 3.24269096 3.85565769 [5,] -2.60777297 3.24269096 [6,] 1.97797796 -2.60777297 [7,] 0.09898574 1.97797796 [8,] -0.95069368 0.09898574 [9,] 3.41795309 -0.95069368 [10,] -0.93213367 3.41795309 [11,] -3.16759418 -0.93213367 [12,] 1.86531240 -3.16759418 [13,] 1.40216887 1.86531240 [14,] -3.08023287 1.40216887 [15,] 2.94115208 -3.08023287 [16,] -0.71447136 2.94115208 [17,] -3.52420208 -0.71447136 [18,] 2.91504512 -3.52420208 [19,] -2.61359636 2.91504512 [20,] 0.13864773 -2.61359636 [21,] 0.69016390 0.13864773 [22,] -4.75100681 0.69016390 [23,] 0.81737969 -4.75100681 [24,] -3.28852343 0.81737969 [25,] -1.37456809 -3.28852343 [26,] 2.44495368 -1.37456809 [27,] 1.91983490 2.44495368 [28,] -2.48299376 1.91983490 [29,] 1.85377924 -2.48299376 [30,] 3.20771301 1.85377924 [31,] 2.35039989 3.20771301 [32,] 4.57397234 2.35039989 [33,] -0.79811410 4.57397234 [34,] -0.66410944 -0.79811410 [35,] 3.64308677 -0.66410944 [36,] -2.91246561 3.64308677 [37,] -2.63102892 -2.91246561 [38,] -4.32741574 -2.63102892 [39,] -1.52578638 -4.32741574 [40,] -3.57896579 -1.52578638 [41,] 3.72528856 -3.57896579 [42,] -4.39787655 3.72528856 [43,] -1.05448818 -4.39787655 [44,] 1.63534359 -1.05448818 [45,] -6.02275777 1.63534359 [46,] 3.50932338 -6.02275777 [47,] 3.54781623 3.50932338 [48,] -0.56315593 3.54781623 [49,] 0.93995987 -0.56315593 [50,] 3.75755813 0.93995987 [51,] -4.28521178 3.75755813 [52,] 3.40584947 -4.28521178 [53,] 0.31447136 3.40584947 [54,] -4.36655756 0.31447136 [55,] -0.30603859 -4.36655756 [56,] -1.06148853 -0.30603859 [57,] -0.13864400 -1.06148853 [58,] 1.36091850 -0.13864400 [59,] -1.78660358 1.36091850 [60,] 2.04944852 -1.78660358 [61,] 0.93280872 2.04944852 [62,] 2.56387153 0.93280872 [63,] -2.90564651 2.56387153 [64,] 0.12789049 -2.90564651 [65,] 0.23843589 0.12789049 [66,] 0.66369802 0.23843589 [67,] 1.52473751 0.66369802 [68,] -4.33578145 1.52473751 [69,] 2.85139889 -4.33578145 [70,] 1.47700804 2.85139889 [71,] -3.05408493 1.47700804 [72,] 3.26956604 -3.05408493 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 0.73065955 -0.42018199 2 -1.35873473 0.73065955 3 3.85565769 -1.35873473 4 3.24269096 3.85565769 5 -2.60777297 3.24269096 6 1.97797796 -2.60777297 7 0.09898574 1.97797796 8 -0.95069368 0.09898574 9 3.41795309 -0.95069368 10 -0.93213367 3.41795309 11 -3.16759418 -0.93213367 12 1.86531240 -3.16759418 13 1.40216887 1.86531240 14 -3.08023287 1.40216887 15 2.94115208 -3.08023287 16 -0.71447136 2.94115208 17 -3.52420208 -0.71447136 18 2.91504512 -3.52420208 19 -2.61359636 2.91504512 20 0.13864773 -2.61359636 21 0.69016390 0.13864773 22 -4.75100681 0.69016390 23 0.81737969 -4.75100681 24 -3.28852343 0.81737969 25 -1.37456809 -3.28852343 26 2.44495368 -1.37456809 27 1.91983490 2.44495368 28 -2.48299376 1.91983490 29 1.85377924 -2.48299376 30 3.20771301 1.85377924 31 2.35039989 3.20771301 32 4.57397234 2.35039989 33 -0.79811410 4.57397234 34 -0.66410944 -0.79811410 35 3.64308677 -0.66410944 36 -2.91246561 3.64308677 37 -2.63102892 -2.91246561 38 -4.32741574 -2.63102892 39 -1.52578638 -4.32741574 40 -3.57896579 -1.52578638 41 3.72528856 -3.57896579 42 -4.39787655 3.72528856 43 -1.05448818 -4.39787655 44 1.63534359 -1.05448818 45 -6.02275777 1.63534359 46 3.50932338 -6.02275777 47 3.54781623 3.50932338 48 -0.56315593 3.54781623 49 0.93995987 -0.56315593 50 3.75755813 0.93995987 51 -4.28521178 3.75755813 52 3.40584947 -4.28521178 53 0.31447136 3.40584947 54 -4.36655756 0.31447136 55 -0.30603859 -4.36655756 56 -1.06148853 -0.30603859 57 -0.13864400 -1.06148853 58 1.36091850 -0.13864400 59 -1.78660358 1.36091850 60 2.04944852 -1.78660358 61 0.93280872 2.04944852 62 2.56387153 0.93280872 63 -2.90564651 2.56387153 64 0.12789049 -2.90564651 65 0.23843589 0.12789049 66 0.66369802 0.23843589 67 1.52473751 0.66369802 68 -4.33578145 1.52473751 69 2.85139889 -4.33578145 70 1.47700804 2.85139889 71 -3.05408493 1.47700804 72 3.26956604 -3.05408493 > 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/7h4vc1258644167.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/8uced1258644167.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/9me811258644167.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/10vaut1258644167.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/11v6eh1258644167.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/12nfgg1258644167.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/13kcrz1258644167.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/145q181258644167.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/15vshz1258644167.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/16o0qj1258644167.tab") + } > > system("convert tmp/1a0oc1258644167.ps tmp/1a0oc1258644167.png") > system("convert tmp/29bq11258644167.ps tmp/29bq11258644167.png") > system("convert tmp/35ofh1258644167.ps tmp/35ofh1258644167.png") > system("convert tmp/4hzhw1258644167.ps tmp/4hzhw1258644167.png") > system("convert tmp/5wezg1258644167.ps tmp/5wezg1258644167.png") > system("convert tmp/6k0t61258644167.ps tmp/6k0t61258644167.png") > system("convert tmp/7h4vc1258644167.ps tmp/7h4vc1258644167.png") > system("convert tmp/8uced1258644167.ps tmp/8uced1258644167.png") > system("convert tmp/9me811258644167.ps tmp/9me811258644167.png") > system("convert tmp/10vaut1258644167.ps tmp/10vaut1258644167.png") > > > proc.time() user system elapsed 2.623 1.602 3.483