R version 2.8.0 (2008-10-20) Copyright (C) 2008 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(119.5,0,125,0,145,0,105.3,0,116.9,0,120.1,0,88.9,0,78.4,0,114.6,0,113.3,0,117,0,99.6,0,99.4,0,101.9,0,115.2,0,108.5,0,113.8,0,121,0,92.2,0,90.2,0,101.5,0,126.6,0,93.9,0,89.8,0,93.4,0,101.5,0,110.4,0,105.9,0,108.4,0,113.9,0,86.1,0,69.4,0,101.2,0,100.5,0,98,0,106.6,0,90.1,0,96.9,0,109.9,0,99,0,106.3,0,128.9,0,111.1,0,102.9,0,130,0,87,0,87.5,0,117.6,0,103.4,0,110.8,0,112.6,0,102.5,1,112.4,1,135.6,1,105.1,1,127.7,1,137,1,91,1,90.5,1,122.4,1,123.3,1,124.3,1,120,1,118.1,1,119,1,142.7,1,123.6,1,129.6,1,151.6,1,110.4,1,99.2,1,130.5,1,136.2,1,129.7,1,128,1,121.6,1),dim=c(2,76),dimnames=list(c('invest','dummyvar'),1:76)) > y <- array(NA,dim=c(2,76),dimnames=list(c('invest','dummyvar'),1:76)) > 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 invest dummyvar M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t 1 119.5 0 1 0 0 0 0 0 0 0 0 0 0 1 2 125.0 0 0 1 0 0 0 0 0 0 0 0 0 2 3 145.0 0 0 0 1 0 0 0 0 0 0 0 0 3 4 105.3 0 0 0 0 1 0 0 0 0 0 0 0 4 5 116.9 0 0 0 0 0 1 0 0 0 0 0 0 5 6 120.1 0 0 0 0 0 0 1 0 0 0 0 0 6 7 88.9 0 0 0 0 0 0 0 1 0 0 0 0 7 8 78.4 0 0 0 0 0 0 0 0 1 0 0 0 8 9 114.6 0 0 0 0 0 0 0 0 0 1 0 0 9 10 113.3 0 0 0 0 0 0 0 0 0 0 1 0 10 11 117.0 0 0 0 0 0 0 0 0 0 0 0 1 11 12 99.6 0 0 0 0 0 0 0 0 0 0 0 0 12 13 99.4 0 1 0 0 0 0 0 0 0 0 0 0 13 14 101.9 0 0 1 0 0 0 0 0 0 0 0 0 14 15 115.2 0 0 0 1 0 0 0 0 0 0 0 0 15 16 108.5 0 0 0 0 1 0 0 0 0 0 0 0 16 17 113.8 0 0 0 0 0 1 0 0 0 0 0 0 17 18 121.0 0 0 0 0 0 0 1 0 0 0 0 0 18 19 92.2 0 0 0 0 0 0 0 1 0 0 0 0 19 20 90.2 0 0 0 0 0 0 0 0 1 0 0 0 20 21 101.5 0 0 0 0 0 0 0 0 0 1 0 0 21 22 126.6 0 0 0 0 0 0 0 0 0 0 1 0 22 23 93.9 0 0 0 0 0 0 0 0 0 0 0 1 23 24 89.8 0 0 0 0 0 0 0 0 0 0 0 0 24 25 93.4 0 1 0 0 0 0 0 0 0 0 0 0 25 26 101.5 0 0 1 0 0 0 0 0 0 0 0 0 26 27 110.4 0 0 0 1 0 0 0 0 0 0 0 0 27 28 105.9 0 0 0 0 1 0 0 0 0 0 0 0 28 29 108.4 0 0 0 0 0 1 0 0 0 0 0 0 29 30 113.9 0 0 0 0 0 0 1 0 0 0 0 0 30 31 86.1 0 0 0 0 0 0 0 1 0 0 0 0 31 32 69.4 0 0 0 0 0 0 0 0 1 0 0 0 32 33 101.2 0 0 0 0 0 0 0 0 0 1 0 0 33 34 100.5 0 0 0 0 0 0 0 0 0 0 1 0 34 35 98.0 0 0 0 0 0 0 0 0 0 0 0 1 35 36 106.6 0 0 0 0 0 0 0 0 0 0 0 0 36 37 90.1 0 1 0 0 0 0 0 0 0 0 0 0 37 38 96.9 0 0 1 0 0 0 0 0 0 0 0 0 38 39 109.9 0 0 0 1 0 0 0 0 0 0 0 0 39 40 99.0 0 0 0 0 1 0 0 0 0 0 0 0 40 41 106.3 0 0 0 0 0 1 0 0 0 0 0 0 41 42 128.9 0 0 0 0 0 0 1 0 0 0 0 0 42 43 111.1 0 0 0 0 0 0 0 1 0 0 0 0 43 44 102.9 0 0 0 0 0 0 0 0 1 0 0 0 44 45 130.0 0 0 0 0 0 0 0 0 0 1 0 0 45 46 87.0 0 0 0 0 0 0 0 0 0 0 1 0 46 47 87.5 0 0 0 0 0 0 0 0 0 0 0 1 47 48 117.6 0 0 0 0 0 0 0 0 0 0 0 0 48 49 103.4 0 1 0 0 0 0 0 0 0 0 0 0 49 50 110.8 0 0 1 0 0 0 0 0 0 0 0 0 50 51 112.6 0 0 0 1 0 0 0 0 0 0 0 0 51 52 102.5 1 0 0 0 1 0 0 0 0 0 0 0 52 53 112.4 1 0 0 0 0 1 0 0 0 0 0 0 53 54 135.6 1 0 0 0 0 0 1 0 0 0 0 0 54 55 105.1 1 0 0 0 0 0 0 1 0 0 0 0 55 56 127.7 1 0 0 0 0 0 0 0 1 0 0 0 56 57 137.0 1 0 0 0 0 0 0 0 0 1 0 0 57 58 91.0 1 0 0 0 0 0 0 0 0 0 1 0 58 59 90.5 1 0 0 0 0 0 0 0 0 0 0 1 59 60 122.4 1 0 0 0 0 0 0 0 0 0 0 0 60 61 123.3 1 1 0 0 0 0 0 0 0 0 0 0 61 62 124.3 1 0 1 0 0 0 0 0 0 0 0 0 62 63 120.0 1 0 0 1 0 0 0 0 0 0 0 0 63 64 118.1 1 0 0 0 1 0 0 0 0 0 0 0 64 65 119.0 1 0 0 0 0 1 0 0 0 0 0 0 65 66 142.7 1 0 0 0 0 0 1 0 0 0 0 0 66 67 123.6 1 0 0 0 0 0 0 1 0 0 0 0 67 68 129.6 1 0 0 0 0 0 0 0 1 0 0 0 68 69 151.6 1 0 0 0 0 0 0 0 0 1 0 0 69 70 110.4 1 0 0 0 0 0 0 0 0 0 1 0 70 71 99.2 1 0 0 0 0 0 0 0 0 0 0 1 71 72 130.5 1 0 0 0 0 0 0 0 0 0 0 0 72 73 136.2 1 1 0 0 0 0 0 0 0 0 0 0 73 74 129.7 1 0 1 0 0 0 0 0 0 0 0 0 74 75 128.0 1 0 0 1 0 0 0 0 0 0 0 0 75 76 121.6 1 0 0 0 1 0 0 0 0 0 0 0 76 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) dummyvar M1 M2 M3 M4 107.82460 18.76280 -1.21791 2.39627 9.75331 -4.31291 M5 M6 M7 M8 M9 M10 1.21741 15.52207 -10.27328 -11.66862 11.35270 -6.42598 M11 t -13.47132 -0.07132 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -25.0247 -7.3108 -0.6623 6.1328 27.6361 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 107.82460 6.17454 17.463 < 2e-16 *** dummyvar 18.76280 5.31316 3.531 0.000786 *** M1 -1.21791 6.95583 -0.175 0.861578 M2 2.39627 6.95082 0.345 0.731452 M3 9.75331 6.94768 1.404 0.165361 M4 -4.31291 6.98050 -0.618 0.538936 M5 1.21741 7.25095 0.168 0.867211 M6 15.52207 7.23932 2.144 0.035951 * M7 -10.27328 7.22947 -1.421 0.160319 M8 -11.66862 7.22139 -1.616 0.111206 M9 11.35270 7.21510 1.573 0.120701 M10 -6.42598 7.21061 -0.891 0.376276 M11 -13.47132 7.20791 -1.869 0.066353 . t -0.07132 0.11387 -0.626 0.533374 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 12.48 on 62 degrees of freedom Multiple R-squared: 0.5094, Adjusted R-squared: 0.4065 F-statistic: 4.952 on 13 and 62 DF, p-value: 7.174e-06 > 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.6197935 0.7604129175 3.802065e-01 [2,] 0.5673344 0.8653312111 4.326656e-01 [3,] 0.5197923 0.9604153913 4.802077e-01 [4,] 0.5635516 0.8728968497 4.364484e-01 [5,] 0.4664977 0.9329953641 5.335023e-01 [6,] 0.7596002 0.4807995971 2.403998e-01 [7,] 0.8077076 0.3845847868 1.922924e-01 [8,] 0.7454947 0.5090105416 2.545053e-01 [9,] 0.6678735 0.6642529728 3.321265e-01 [10,] 0.5835998 0.8328003248 4.164002e-01 [11,] 0.5564302 0.8871395213 4.435698e-01 [12,] 0.6073911 0.7852178593 3.926089e-01 [13,] 0.5850005 0.8299989077 4.149995e-01 [14,] 0.5063050 0.9873900680 4.936950e-01 [15,] 0.4499231 0.8998462659 5.500769e-01 [16,] 0.6975824 0.6048352139 3.024176e-01 [17,] 0.8001040 0.3997919376 1.998960e-01 [18,] 0.9077483 0.1845033918 9.225170e-02 [19,] 0.9876667 0.0246665703 1.233329e-02 [20,] 0.9942861 0.0114278997 5.713950e-03 [21,] 0.9964713 0.0070574198 3.528710e-03 [22,] 0.9955192 0.0089616769 4.480838e-03 [23,] 0.9950929 0.0098141728 4.907086e-03 [24,] 0.9922280 0.0155440785 7.772039e-03 [25,] 0.9886113 0.0227773003 1.138865e-02 [26,] 0.9934517 0.0130966718 6.548336e-03 [27,] 0.9994097 0.0011806294 5.903147e-04 [28,] 0.9999313 0.0001374670 6.873351e-05 [29,] 0.9999427 0.0001146990 5.734950e-05 [30,] 0.9999072 0.0001855317 9.276585e-05 [31,] 0.9998895 0.0002209906 1.104953e-04 [32,] 0.9999270 0.0001459188 7.295940e-05 [33,] 0.9999668 0.0000664079 3.320395e-05 [34,] 0.9999182 0.0001635374 8.176871e-05 [35,] 0.9997368 0.0005264782 2.632391e-04 [36,] 0.9992833 0.0014333358 7.166679e-04 [37,] 0.9981161 0.0037677092 1.883855e-03 [38,] 0.9955147 0.0089706199 4.485310e-03 [39,] 0.9947710 0.0104580930 5.229047e-03 [40,] 0.9951051 0.0097898806 4.894940e-03 [41,] 0.9886010 0.0227979610 1.139898e-02 [42,] 0.9967724 0.0064552650 3.227633e-03 [43,] 0.9841195 0.0317609769 1.588049e-02 > postscript(file="/var/www/html/rcomp/tmp/1mfw41227816023.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/2oy8g1227816023.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/32k311227816023.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/4amd21227816023.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/55d0b1227816023.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 = 76 Frequency = 1 1 2 3 4 5 6 12.96462976 14.92177262 27.63605833 2.07360070 8.21460066 -2.81873267 7 8 9 10 11 12 -8.15206600 -17.18539934 -3.93539934 12.61460066 23.43126733 -7.36873267 13 14 15 16 17 18 -6.27950430 -7.32236144 -1.30807572 6.12946664 5.97046661 -1.06286673 19 20 21 22 23 24 -3.99620006 -4.52953339 -16.17953339 26.77046661 1.18713327 -16.31286673 25 26 27 28 29 30 -11.42363836 -6.86649550 -5.25220978 4.38533258 1.42633255 -7.30700079 31 32 33 34 35 36 -9.24033412 -24.47366745 -15.62366745 1.52633255 6.14299921 1.34299921 37 38 39 40 41 42 -13.86777241 -10.61062956 -4.89634384 -1.65880148 0.18219849 8.54886515 43 44 45 46 47 48 16.61553182 9.88219849 14.03219849 -11.11780151 -3.50113485 13.19886515 49 50 51 52 53 54 0.28809353 4.14523638 -1.34047790 -16.06573209 -11.62473212 -2.65806545 55 56 57 58 59 60 -7.29139879 16.77526788 3.12526788 -25.02473212 -18.40806545 0.09193455 61 62 63 64 65 66 2.28116292 -0.26169422 -11.84740851 0.39013385 -4.16886618 5.29780049 67 68 69 70 71 72 12.06446715 19.53113382 18.58113382 -4.76886618 -8.85219951 9.04780049 73 74 75 76 16.03702886 5.99417172 -2.99154257 4.74599979 > postscript(file="/var/www/html/rcomp/tmp/6xgzp1227816023.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 = 76 Frequency = 1 lag(myerror, k = 1) myerror 0 12.96462976 NA 1 14.92177262 12.96462976 2 27.63605833 14.92177262 3 2.07360070 27.63605833 4 8.21460066 2.07360070 5 -2.81873267 8.21460066 6 -8.15206600 -2.81873267 7 -17.18539934 -8.15206600 8 -3.93539934 -17.18539934 9 12.61460066 -3.93539934 10 23.43126733 12.61460066 11 -7.36873267 23.43126733 12 -6.27950430 -7.36873267 13 -7.32236144 -6.27950430 14 -1.30807572 -7.32236144 15 6.12946664 -1.30807572 16 5.97046661 6.12946664 17 -1.06286673 5.97046661 18 -3.99620006 -1.06286673 19 -4.52953339 -3.99620006 20 -16.17953339 -4.52953339 21 26.77046661 -16.17953339 22 1.18713327 26.77046661 23 -16.31286673 1.18713327 24 -11.42363836 -16.31286673 25 -6.86649550 -11.42363836 26 -5.25220978 -6.86649550 27 4.38533258 -5.25220978 28 1.42633255 4.38533258 29 -7.30700079 1.42633255 30 -9.24033412 -7.30700079 31 -24.47366745 -9.24033412 32 -15.62366745 -24.47366745 33 1.52633255 -15.62366745 34 6.14299921 1.52633255 35 1.34299921 6.14299921 36 -13.86777241 1.34299921 37 -10.61062956 -13.86777241 38 -4.89634384 -10.61062956 39 -1.65880148 -4.89634384 40 0.18219849 -1.65880148 41 8.54886515 0.18219849 42 16.61553182 8.54886515 43 9.88219849 16.61553182 44 14.03219849 9.88219849 45 -11.11780151 14.03219849 46 -3.50113485 -11.11780151 47 13.19886515 -3.50113485 48 0.28809353 13.19886515 49 4.14523638 0.28809353 50 -1.34047790 4.14523638 51 -16.06573209 -1.34047790 52 -11.62473212 -16.06573209 53 -2.65806545 -11.62473212 54 -7.29139879 -2.65806545 55 16.77526788 -7.29139879 56 3.12526788 16.77526788 57 -25.02473212 3.12526788 58 -18.40806545 -25.02473212 59 0.09193455 -18.40806545 60 2.28116292 0.09193455 61 -0.26169422 2.28116292 62 -11.84740851 -0.26169422 63 0.39013385 -11.84740851 64 -4.16886618 0.39013385 65 5.29780049 -4.16886618 66 12.06446715 5.29780049 67 19.53113382 12.06446715 68 18.58113382 19.53113382 69 -4.76886618 18.58113382 70 -8.85219951 -4.76886618 71 9.04780049 -8.85219951 72 16.03702886 9.04780049 73 5.99417172 16.03702886 74 -2.99154257 5.99417172 75 4.74599979 -2.99154257 76 NA 4.74599979 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] 14.92177262 12.96462976 [2,] 27.63605833 14.92177262 [3,] 2.07360070 27.63605833 [4,] 8.21460066 2.07360070 [5,] -2.81873267 8.21460066 [6,] -8.15206600 -2.81873267 [7,] -17.18539934 -8.15206600 [8,] -3.93539934 -17.18539934 [9,] 12.61460066 -3.93539934 [10,] 23.43126733 12.61460066 [11,] -7.36873267 23.43126733 [12,] -6.27950430 -7.36873267 [13,] -7.32236144 -6.27950430 [14,] -1.30807572 -7.32236144 [15,] 6.12946664 -1.30807572 [16,] 5.97046661 6.12946664 [17,] -1.06286673 5.97046661 [18,] -3.99620006 -1.06286673 [19,] -4.52953339 -3.99620006 [20,] -16.17953339 -4.52953339 [21,] 26.77046661 -16.17953339 [22,] 1.18713327 26.77046661 [23,] -16.31286673 1.18713327 [24,] -11.42363836 -16.31286673 [25,] -6.86649550 -11.42363836 [26,] -5.25220978 -6.86649550 [27,] 4.38533258 -5.25220978 [28,] 1.42633255 4.38533258 [29,] -7.30700079 1.42633255 [30,] -9.24033412 -7.30700079 [31,] -24.47366745 -9.24033412 [32,] -15.62366745 -24.47366745 [33,] 1.52633255 -15.62366745 [34,] 6.14299921 1.52633255 [35,] 1.34299921 6.14299921 [36,] -13.86777241 1.34299921 [37,] -10.61062956 -13.86777241 [38,] -4.89634384 -10.61062956 [39,] -1.65880148 -4.89634384 [40,] 0.18219849 -1.65880148 [41,] 8.54886515 0.18219849 [42,] 16.61553182 8.54886515 [43,] 9.88219849 16.61553182 [44,] 14.03219849 9.88219849 [45,] -11.11780151 14.03219849 [46,] -3.50113485 -11.11780151 [47,] 13.19886515 -3.50113485 [48,] 0.28809353 13.19886515 [49,] 4.14523638 0.28809353 [50,] -1.34047790 4.14523638 [51,] -16.06573209 -1.34047790 [52,] -11.62473212 -16.06573209 [53,] -2.65806545 -11.62473212 [54,] -7.29139879 -2.65806545 [55,] 16.77526788 -7.29139879 [56,] 3.12526788 16.77526788 [57,] -25.02473212 3.12526788 [58,] -18.40806545 -25.02473212 [59,] 0.09193455 -18.40806545 [60,] 2.28116292 0.09193455 [61,] -0.26169422 2.28116292 [62,] -11.84740851 -0.26169422 [63,] 0.39013385 -11.84740851 [64,] -4.16886618 0.39013385 [65,] 5.29780049 -4.16886618 [66,] 12.06446715 5.29780049 [67,] 19.53113382 12.06446715 [68,] 18.58113382 19.53113382 [69,] -4.76886618 18.58113382 [70,] -8.85219951 -4.76886618 [71,] 9.04780049 -8.85219951 [72,] 16.03702886 9.04780049 [73,] 5.99417172 16.03702886 [74,] -2.99154257 5.99417172 [75,] 4.74599979 -2.99154257 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 14.92177262 12.96462976 2 27.63605833 14.92177262 3 2.07360070 27.63605833 4 8.21460066 2.07360070 5 -2.81873267 8.21460066 6 -8.15206600 -2.81873267 7 -17.18539934 -8.15206600 8 -3.93539934 -17.18539934 9 12.61460066 -3.93539934 10 23.43126733 12.61460066 11 -7.36873267 23.43126733 12 -6.27950430 -7.36873267 13 -7.32236144 -6.27950430 14 -1.30807572 -7.32236144 15 6.12946664 -1.30807572 16 5.97046661 6.12946664 17 -1.06286673 5.97046661 18 -3.99620006 -1.06286673 19 -4.52953339 -3.99620006 20 -16.17953339 -4.52953339 21 26.77046661 -16.17953339 22 1.18713327 26.77046661 23 -16.31286673 1.18713327 24 -11.42363836 -16.31286673 25 -6.86649550 -11.42363836 26 -5.25220978 -6.86649550 27 4.38533258 -5.25220978 28 1.42633255 4.38533258 29 -7.30700079 1.42633255 30 -9.24033412 -7.30700079 31 -24.47366745 -9.24033412 32 -15.62366745 -24.47366745 33 1.52633255 -15.62366745 34 6.14299921 1.52633255 35 1.34299921 6.14299921 36 -13.86777241 1.34299921 37 -10.61062956 -13.86777241 38 -4.89634384 -10.61062956 39 -1.65880148 -4.89634384 40 0.18219849 -1.65880148 41 8.54886515 0.18219849 42 16.61553182 8.54886515 43 9.88219849 16.61553182 44 14.03219849 9.88219849 45 -11.11780151 14.03219849 46 -3.50113485 -11.11780151 47 13.19886515 -3.50113485 48 0.28809353 13.19886515 49 4.14523638 0.28809353 50 -1.34047790 4.14523638 51 -16.06573209 -1.34047790 52 -11.62473212 -16.06573209 53 -2.65806545 -11.62473212 54 -7.29139879 -2.65806545 55 16.77526788 -7.29139879 56 3.12526788 16.77526788 57 -25.02473212 3.12526788 58 -18.40806545 -25.02473212 59 0.09193455 -18.40806545 60 2.28116292 0.09193455 61 -0.26169422 2.28116292 62 -11.84740851 -0.26169422 63 0.39013385 -11.84740851 64 -4.16886618 0.39013385 65 5.29780049 -4.16886618 66 12.06446715 5.29780049 67 19.53113382 12.06446715 68 18.58113382 19.53113382 69 -4.76886618 18.58113382 70 -8.85219951 -4.76886618 71 9.04780049 -8.85219951 72 16.03702886 9.04780049 73 5.99417172 16.03702886 74 -2.99154257 5.99417172 75 4.74599979 -2.99154257 > 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/7x0mk1227816023.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/8fsjn1227816023.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/99hwj1227816023.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/109k9i1227816023.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/1162ht1227816023.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/12ztch1227816023.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/134gpj1227816023.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/14wn351227816023.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/15py1u1227816024.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/16jk2w1227816024.tab") + } > > system("convert tmp/1mfw41227816023.ps tmp/1mfw41227816023.png") > system("convert tmp/2oy8g1227816023.ps tmp/2oy8g1227816023.png") > system("convert tmp/32k311227816023.ps tmp/32k311227816023.png") > system("convert tmp/4amd21227816023.ps tmp/4amd21227816023.png") > system("convert tmp/55d0b1227816023.ps tmp/55d0b1227816023.png") > system("convert tmp/6xgzp1227816023.ps tmp/6xgzp1227816023.png") > system("convert tmp/7x0mk1227816023.ps tmp/7x0mk1227816023.png") > system("convert tmp/8fsjn1227816023.ps tmp/8fsjn1227816023.png") > system("convert tmp/99hwj1227816023.ps tmp/99hwj1227816023.png") > system("convert tmp/109k9i1227816023.ps tmp/109k9i1227816023.png") > > > proc.time() user system elapsed 2.899 1.748 13.210