R version 2.9.0 (2009-04-17) Copyright (C) 2009 The R Foundation for Statistical Computing ISBN 3-900051-07-0 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > x <- array(list(95.1,121.8,97.0,127.6,112.7,129.9,102.9,128.0,97.4,123.5,111.4,124.0,87.4,127.4,96.8,127.6,114.1,128.4,110.3,131.4,103.9,135.1,101.6,134.0,94.6,144.5,95.9,147.3,104.7,150.9,102.8,148.7,98.1,141.4,113.9,138.9,80.9,139.8,95.7,145.6,113.2,147.9,105.9,148.5,108.8,151.1,102.3,157.5,99.0,167.5,100.7,172.3,115.5,173.5,100.7,187.5,109.9,205.5,114.6,195.1,85.4,204.5,100.5,204.5,114.8,201.7,116.5,207.0,112.9,206.6,102.0,210.6,106.0,211.1,105.3,215.0,118.8,223.9,106.1,238.2,109.3,238.9,117.2,229.6,92.5,232.2,104.2,222.1,112.5,221.6,122.4,227.3,113.3,221.0,100.0,213.6,110.7,243.4,112.8,253.8,109.8,265.3,117.3,268.2,109.1,268.5,115.9,266.9,96.0,268.4,99.8,250.8,116.8,231.2,115.7,192.0,99.4,171.4,94.3,160.0),dim=c(2,60),dimnames=list(c('TIP','Grondstofprijzen'),1:60)) > y <- array(NA,dim=c(2,60),dimnames=list(c('TIP','Grondstofprijzen'),1:60)) > for (i in 1:dim(x)[1]) + { + for (j in 1:dim(x)[2]) + { + y[i,j] <- as.numeric(x[i,j]) + } + } > par3 = '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 TIP Grondstofprijzen M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t 1 95.1 121.8 1 0 0 0 0 0 0 0 0 0 0 1 2 97.0 127.6 0 1 0 0 0 0 0 0 0 0 0 2 3 112.7 129.9 0 0 1 0 0 0 0 0 0 0 0 3 4 102.9 128.0 0 0 0 1 0 0 0 0 0 0 0 4 5 97.4 123.5 0 0 0 0 1 0 0 0 0 0 0 5 6 111.4 124.0 0 0 0 0 0 1 0 0 0 0 0 6 7 87.4 127.4 0 0 0 0 0 0 1 0 0 0 0 7 8 96.8 127.6 0 0 0 0 0 0 0 1 0 0 0 8 9 114.1 128.4 0 0 0 0 0 0 0 0 1 0 0 9 10 110.3 131.4 0 0 0 0 0 0 0 0 0 1 0 10 11 103.9 135.1 0 0 0 0 0 0 0 0 0 0 1 11 12 101.6 134.0 0 0 0 0 0 0 0 0 0 0 0 12 13 94.6 144.5 1 0 0 0 0 0 0 0 0 0 0 13 14 95.9 147.3 0 1 0 0 0 0 0 0 0 0 0 14 15 104.7 150.9 0 0 1 0 0 0 0 0 0 0 0 15 16 102.8 148.7 0 0 0 1 0 0 0 0 0 0 0 16 17 98.1 141.4 0 0 0 0 1 0 0 0 0 0 0 17 18 113.9 138.9 0 0 0 0 0 1 0 0 0 0 0 18 19 80.9 139.8 0 0 0 0 0 0 1 0 0 0 0 19 20 95.7 145.6 0 0 0 0 0 0 0 1 0 0 0 20 21 113.2 147.9 0 0 0 0 0 0 0 0 1 0 0 21 22 105.9 148.5 0 0 0 0 0 0 0 0 0 1 0 22 23 108.8 151.1 0 0 0 0 0 0 0 0 0 0 1 23 24 102.3 157.5 0 0 0 0 0 0 0 0 0 0 0 24 25 99.0 167.5 1 0 0 0 0 0 0 0 0 0 0 25 26 100.7 172.3 0 1 0 0 0 0 0 0 0 0 0 26 27 115.5 173.5 0 0 1 0 0 0 0 0 0 0 0 27 28 100.7 187.5 0 0 0 1 0 0 0 0 0 0 0 28 29 109.9 205.5 0 0 0 0 1 0 0 0 0 0 0 29 30 114.6 195.1 0 0 0 0 0 1 0 0 0 0 0 30 31 85.4 204.5 0 0 0 0 0 0 1 0 0 0 0 31 32 100.5 204.5 0 0 0 0 0 0 0 1 0 0 0 32 33 114.8 201.7 0 0 0 0 0 0 0 0 1 0 0 33 34 116.5 207.0 0 0 0 0 0 0 0 0 0 1 0 34 35 112.9 206.6 0 0 0 0 0 0 0 0 0 0 1 35 36 102.0 210.6 0 0 0 0 0 0 0 0 0 0 0 36 37 106.0 211.1 1 0 0 0 0 0 0 0 0 0 0 37 38 105.3 215.0 0 1 0 0 0 0 0 0 0 0 0 38 39 118.8 223.9 0 0 1 0 0 0 0 0 0 0 0 39 40 106.1 238.2 0 0 0 1 0 0 0 0 0 0 0 40 41 109.3 238.9 0 0 0 0 1 0 0 0 0 0 0 41 42 117.2 229.6 0 0 0 0 0 1 0 0 0 0 0 42 43 92.5 232.2 0 0 0 0 0 0 1 0 0 0 0 43 44 104.2 222.1 0 0 0 0 0 0 0 1 0 0 0 44 45 112.5 221.6 0 0 0 0 0 0 0 0 1 0 0 45 46 122.4 227.3 0 0 0 0 0 0 0 0 0 1 0 46 47 113.3 221.0 0 0 0 0 0 0 0 0 0 0 1 47 48 100.0 213.6 0 0 0 0 0 0 0 0 0 0 0 48 49 110.7 243.4 1 0 0 0 0 0 0 0 0 0 0 49 50 112.8 253.8 0 1 0 0 0 0 0 0 0 0 0 50 51 109.8 265.3 0 0 1 0 0 0 0 0 0 0 0 51 52 117.3 268.2 0 0 0 1 0 0 0 0 0 0 0 52 53 109.1 268.5 0 0 0 0 1 0 0 0 0 0 0 53 54 115.9 266.9 0 0 0 0 0 1 0 0 0 0 0 54 55 96.0 268.4 0 0 0 0 0 0 1 0 0 0 0 55 56 99.8 250.8 0 0 0 0 0 0 0 1 0 0 0 56 57 116.8 231.2 0 0 0 0 0 0 0 0 1 0 0 57 58 115.7 192.0 0 0 0 0 0 0 0 0 0 1 0 58 59 99.4 171.4 0 0 0 0 0 0 0 0 0 0 1 59 60 94.3 160.0 0 0 0 0 0 0 0 0 0 0 0 60 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) Grondstofprijzen M1 M2 83.4089 0.1269 -0.9891 -0.2767 M3 M4 M5 M6 9.1407 2.2683 1.0410 11.6277 M7 M8 M9 M10 -14.8287 -3.1625 12.3754 13.0351 M11 t 7.2235 -0.1554 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -8.491103 -2.486242 -0.002219 2.576916 5.668685 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 83.40890 2.88036 28.958 < 2e-16 *** Grondstofprijzen 0.12690 0.02460 5.158 5.16e-06 *** M1 -0.98911 2.46203 -0.402 0.689732 M2 -0.27674 2.48216 -0.111 0.911711 M3 9.14070 2.50439 3.650 0.000668 *** M4 2.26830 2.52822 0.897 0.374289 M5 1.04095 2.51660 0.414 0.681064 M6 11.62770 2.45557 4.735 2.12e-05 *** M7 -14.82867 2.46226 -6.022 2.68e-07 *** M8 -3.16253 2.41323 -1.310 0.196534 M9 12.37538 2.37708 5.206 4.39e-06 *** M10 13.03512 2.34848 5.550 1.36e-06 *** M11 7.22350 2.33476 3.094 0.003355 ** t -0.15539 0.06659 -2.334 0.024042 * --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 3.687 on 46 degrees of freedom Multiple R-squared: 0.8691, Adjusted R-squared: 0.8321 F-statistic: 23.5 on 13 and 46 DF, p-value: 5.134e-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.31482114 0.6296423 0.6851789 [2,] 0.18456224 0.3691245 0.8154378 [3,] 0.28815370 0.5763074 0.7118463 [4,] 0.17735778 0.3547156 0.8226422 [5,] 0.10896167 0.2179233 0.8910383 [6,] 0.09882425 0.1976485 0.9011758 [7,] 0.15356409 0.3071282 0.8464359 [8,] 0.11554623 0.2310925 0.8844538 [9,] 0.12292120 0.2458424 0.8770788 [10,] 0.09684895 0.1936979 0.9031511 [11,] 0.14615635 0.2923127 0.8538436 [12,] 0.23567545 0.4713509 0.7643246 [13,] 0.23839627 0.4767925 0.7616037 [14,] 0.23240131 0.4648026 0.7675987 [15,] 0.26597756 0.5319551 0.7340224 [16,] 0.18988525 0.3797705 0.8101147 [17,] 0.14113473 0.2822695 0.8588653 [18,] 0.14599733 0.2919947 0.8540027 [19,] 0.10337881 0.2067576 0.8966212 [20,] 0.08209530 0.1641906 0.9179047 [21,] 0.08313268 0.1662654 0.9168673 [22,] 0.07831241 0.1566248 0.9216876 [23,] 0.20918736 0.4183747 0.7908126 [24,] 0.47721797 0.9544359 0.5227820 [25,] 0.34621949 0.6924390 0.6537805 [26,] 0.26190286 0.5238057 0.7380971 [27,] 0.16389920 0.3277984 0.8361008 > postscript(file="/var/www/html/rcomp/tmp/1zoy21260784142.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/215a01260784142.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/35ul31260784142.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/47t2h1260784142.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/5nx0r1260784142.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > qqnorm(mysum$resid, main='Residual Normal Q-Q Plot') > qqline(mysum$resid) > grid() > dev.off() null device 1 > (myerror <- as.ts(mysum$resid)) Time Series: Start = 1 End = 60 Frequency = 1 1 2 3 4 5 6 -2.62080098 -2.01379495 4.13228468 1.60119183 -1.94502285 1.56017374 7 8 9 10 11 12 3.74047773 1.60435225 3.42030880 -1.26473828 -2.16724737 3.05123272 13 14 15 16 17 18 -4.13671409 -3.74900841 -4.66789863 0.73907849 -1.65181652 4.03407973 19 20 21 22 23 24 -2.46836658 0.08486859 1.91047532 -5.97001205 2.56706874 2.63379970 25 26 27 28 29 30 -0.79069717 -0.25679126 5.12887824 -4.41992276 3.87861515 -0.53297951 31 32 33 34 35 36 -4.31407484 -0.72482034 -1.45202420 -0.92894102 1.48883942 -2.53986990 37 38 39 40 41 42 2.54118213 0.78929794 3.89783833 -3.58903264 0.90487327 -0.44631127 43 44 45 46 47 48 1.13551262 2.60645596 -4.41261764 4.25970559 1.92619534 -3.05585529 49 50 51 52 53 54 5.00703012 5.23029668 -8.49110262 5.66868509 -1.18664905 -4.61496269 55 56 57 58 59 60 1.90645107 -3.57085646 0.53385773 3.90398577 -3.81485613 -0.08930722 > postscript(file="/var/www/html/rcomp/tmp/67q5v1260784142.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > dum <- cbind(lag(myerror,k=1),myerror) > dum Time Series: Start = 0 End = 60 Frequency = 1 lag(myerror, k = 1) myerror 0 -2.62080098 NA 1 -2.01379495 -2.62080098 2 4.13228468 -2.01379495 3 1.60119183 4.13228468 4 -1.94502285 1.60119183 5 1.56017374 -1.94502285 6 3.74047773 1.56017374 7 1.60435225 3.74047773 8 3.42030880 1.60435225 9 -1.26473828 3.42030880 10 -2.16724737 -1.26473828 11 3.05123272 -2.16724737 12 -4.13671409 3.05123272 13 -3.74900841 -4.13671409 14 -4.66789863 -3.74900841 15 0.73907849 -4.66789863 16 -1.65181652 0.73907849 17 4.03407973 -1.65181652 18 -2.46836658 4.03407973 19 0.08486859 -2.46836658 20 1.91047532 0.08486859 21 -5.97001205 1.91047532 22 2.56706874 -5.97001205 23 2.63379970 2.56706874 24 -0.79069717 2.63379970 25 -0.25679126 -0.79069717 26 5.12887824 -0.25679126 27 -4.41992276 5.12887824 28 3.87861515 -4.41992276 29 -0.53297951 3.87861515 30 -4.31407484 -0.53297951 31 -0.72482034 -4.31407484 32 -1.45202420 -0.72482034 33 -0.92894102 -1.45202420 34 1.48883942 -0.92894102 35 -2.53986990 1.48883942 36 2.54118213 -2.53986990 37 0.78929794 2.54118213 38 3.89783833 0.78929794 39 -3.58903264 3.89783833 40 0.90487327 -3.58903264 41 -0.44631127 0.90487327 42 1.13551262 -0.44631127 43 2.60645596 1.13551262 44 -4.41261764 2.60645596 45 4.25970559 -4.41261764 46 1.92619534 4.25970559 47 -3.05585529 1.92619534 48 5.00703012 -3.05585529 49 5.23029668 5.00703012 50 -8.49110262 5.23029668 51 5.66868509 -8.49110262 52 -1.18664905 5.66868509 53 -4.61496269 -1.18664905 54 1.90645107 -4.61496269 55 -3.57085646 1.90645107 56 0.53385773 -3.57085646 57 3.90398577 0.53385773 58 -3.81485613 3.90398577 59 -0.08930722 -3.81485613 60 NA -0.08930722 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -2.01379495 -2.6208010 [2,] 4.13228468 -2.0137950 [3,] 1.60119183 4.1322847 [4,] -1.94502285 1.6011918 [5,] 1.56017374 -1.9450229 [6,] 3.74047773 1.5601737 [7,] 1.60435225 3.7404777 [8,] 3.42030880 1.6043522 [9,] -1.26473828 3.4203088 [10,] -2.16724737 -1.2647383 [11,] 3.05123272 -2.1672474 [12,] -4.13671409 3.0512327 [13,] -3.74900841 -4.1367141 [14,] -4.66789863 -3.7490084 [15,] 0.73907849 -4.6678986 [16,] -1.65181652 0.7390785 [17,] 4.03407973 -1.6518165 [18,] -2.46836658 4.0340797 [19,] 0.08486859 -2.4683666 [20,] 1.91047532 0.0848686 [21,] -5.97001205 1.9104753 [22,] 2.56706874 -5.9700120 [23,] 2.63379970 2.5670687 [24,] -0.79069717 2.6337997 [25,] -0.25679126 -0.7906972 [26,] 5.12887824 -0.2567913 [27,] -4.41992276 5.1288782 [28,] 3.87861515 -4.4199228 [29,] -0.53297951 3.8786151 [30,] -4.31407484 -0.5329795 [31,] -0.72482034 -4.3140748 [32,] -1.45202420 -0.7248203 [33,] -0.92894102 -1.4520242 [34,] 1.48883942 -0.9289410 [35,] -2.53986990 1.4888394 [36,] 2.54118213 -2.5398699 [37,] 0.78929794 2.5411821 [38,] 3.89783833 0.7892979 [39,] -3.58903264 3.8978383 [40,] 0.90487327 -3.5890326 [41,] -0.44631127 0.9048733 [42,] 1.13551262 -0.4463113 [43,] 2.60645596 1.1355126 [44,] -4.41261764 2.6064560 [45,] 4.25970559 -4.4126176 [46,] 1.92619534 4.2597056 [47,] -3.05585529 1.9261953 [48,] 5.00703012 -3.0558553 [49,] 5.23029668 5.0070301 [50,] -8.49110262 5.2302967 [51,] 5.66868509 -8.4911026 [52,] -1.18664905 5.6686851 [53,] -4.61496269 -1.1866490 [54,] 1.90645107 -4.6149627 [55,] -3.57085646 1.9064511 [56,] 0.53385773 -3.5708565 [57,] 3.90398577 0.5338577 [58,] -3.81485613 3.9039858 [59,] -0.08930722 -3.8148561 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -2.01379495 -2.6208010 2 4.13228468 -2.0137950 3 1.60119183 4.1322847 4 -1.94502285 1.6011918 5 1.56017374 -1.9450229 6 3.74047773 1.5601737 7 1.60435225 3.7404777 8 3.42030880 1.6043522 9 -1.26473828 3.4203088 10 -2.16724737 -1.2647383 11 3.05123272 -2.1672474 12 -4.13671409 3.0512327 13 -3.74900841 -4.1367141 14 -4.66789863 -3.7490084 15 0.73907849 -4.6678986 16 -1.65181652 0.7390785 17 4.03407973 -1.6518165 18 -2.46836658 4.0340797 19 0.08486859 -2.4683666 20 1.91047532 0.0848686 21 -5.97001205 1.9104753 22 2.56706874 -5.9700120 23 2.63379970 2.5670687 24 -0.79069717 2.6337997 25 -0.25679126 -0.7906972 26 5.12887824 -0.2567913 27 -4.41992276 5.1288782 28 3.87861515 -4.4199228 29 -0.53297951 3.8786151 30 -4.31407484 -0.5329795 31 -0.72482034 -4.3140748 32 -1.45202420 -0.7248203 33 -0.92894102 -1.4520242 34 1.48883942 -0.9289410 35 -2.53986990 1.4888394 36 2.54118213 -2.5398699 37 0.78929794 2.5411821 38 3.89783833 0.7892979 39 -3.58903264 3.8978383 40 0.90487327 -3.5890326 41 -0.44631127 0.9048733 42 1.13551262 -0.4463113 43 2.60645596 1.1355126 44 -4.41261764 2.6064560 45 4.25970559 -4.4126176 46 1.92619534 4.2597056 47 -3.05585529 1.9261953 48 5.00703012 -3.0558553 49 5.23029668 5.0070301 50 -8.49110262 5.2302967 51 5.66868509 -8.4911026 52 -1.18664905 5.6686851 53 -4.61496269 -1.1866490 54 1.90645107 -4.6149627 55 -3.57085646 1.9064511 56 0.53385773 -3.5708565 57 3.90398577 0.5338577 58 -3.81485613 3.9039858 59 -0.08930722 -3.8148561 > 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/79abf1260784142.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/8wrvz1260784142.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/9q1xc1260784142.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/105sym1260784142.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/117d2e1260784142.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/12lkyl1260784142.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/13ax5b1260784142.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/14sf1r1260784142.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/15fjfu1260784142.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/16fpkb1260784142.tab") + } > > try(system("convert tmp/1zoy21260784142.ps tmp/1zoy21260784142.png",intern=TRUE)) character(0) > try(system("convert tmp/215a01260784142.ps tmp/215a01260784142.png",intern=TRUE)) character(0) > try(system("convert tmp/35ul31260784142.ps tmp/35ul31260784142.png",intern=TRUE)) character(0) > try(system("convert tmp/47t2h1260784142.ps tmp/47t2h1260784142.png",intern=TRUE)) character(0) > try(system("convert tmp/5nx0r1260784142.ps tmp/5nx0r1260784142.png",intern=TRUE)) character(0) > try(system("convert tmp/67q5v1260784142.ps tmp/67q5v1260784142.png",intern=TRUE)) character(0) > try(system("convert tmp/79abf1260784142.ps tmp/79abf1260784142.png",intern=TRUE)) character(0) > try(system("convert tmp/8wrvz1260784142.ps tmp/8wrvz1260784142.png",intern=TRUE)) character(0) > try(system("convert tmp/9q1xc1260784142.ps tmp/9q1xc1260784142.png",intern=TRUE)) character(0) > try(system("convert tmp/105sym1260784142.ps tmp/105sym1260784142.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.429 1.595 2.940