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(151.7,105.2,121.3,105.2,133.0,105.6,119.6,105.6,122.2,106.2,117.4,106.3,106.7,106.4,87.5,106.9,81.0,107.2,110.3,107.3,87.0,107.3,55.7,107.4,146.0,107.55,137.5,107.87,138.5,108.37,135.6,108.38,107.3,107.92,99.0,108.03,91.4,108.14,68.4,108.3,82.6,108.64,98.4,108.66,71.3,109.04,47.6,109.03,130.8,109.03,113.6,109.54,125.7,109.75,113.6,109.83,97.1,109.65,104.4,109.82,91.8,109.95,75.1,110.12,89.2,110.15,110.2,110.2,78.4,109.99,68.4,110.14,122.8,110.14,129.7,110.81,159.1,110.97,139.0,110.99,102.2,109.73,113.6,109.81,81.5,110.02,77.4,110.18,87.6,110.21,101.2,110.25,87.2,110.36,64.9,110.51,133.1,110.64,118.0,110.95,135.9,111.18,125.7,111.19,108.0,111.69,128.3,111.7,84.7,111.83,86.4,111.77,92.2,111.73,95.8,112.01,92.3,111.86,54.3,112.04),dim=c(2,60),dimnames=list(c('Yt','Xt'),1:60)) > y <- array(NA,dim=c(2,60),dimnames=list(c('Yt','Xt'),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 Yt Xt M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t 1 151.7 105.20 1 0 0 0 0 0 0 0 0 0 0 1 2 121.3 105.20 0 1 0 0 0 0 0 0 0 0 0 2 3 133.0 105.60 0 0 1 0 0 0 0 0 0 0 0 3 4 119.6 105.60 0 0 0 1 0 0 0 0 0 0 0 4 5 122.2 106.20 0 0 0 0 1 0 0 0 0 0 0 5 6 117.4 106.30 0 0 0 0 0 1 0 0 0 0 0 6 7 106.7 106.40 0 0 0 0 0 0 1 0 0 0 0 7 8 87.5 106.90 0 0 0 0 0 0 0 1 0 0 0 8 9 81.0 107.20 0 0 0 0 0 0 0 0 1 0 0 9 10 110.3 107.30 0 0 0 0 0 0 0 0 0 1 0 10 11 87.0 107.30 0 0 0 0 0 0 0 0 0 0 1 11 12 55.7 107.40 0 0 0 0 0 0 0 0 0 0 0 12 13 146.0 107.55 1 0 0 0 0 0 0 0 0 0 0 13 14 137.5 107.87 0 1 0 0 0 0 0 0 0 0 0 14 15 138.5 108.37 0 0 1 0 0 0 0 0 0 0 0 15 16 135.6 108.38 0 0 0 1 0 0 0 0 0 0 0 16 17 107.3 107.92 0 0 0 0 1 0 0 0 0 0 0 17 18 99.0 108.03 0 0 0 0 0 1 0 0 0 0 0 18 19 91.4 108.14 0 0 0 0 0 0 1 0 0 0 0 19 20 68.4 108.30 0 0 0 0 0 0 0 1 0 0 0 20 21 82.6 108.64 0 0 0 0 0 0 0 0 1 0 0 21 22 98.4 108.66 0 0 0 0 0 0 0 0 0 1 0 22 23 71.3 109.04 0 0 0 0 0 0 0 0 0 0 1 23 24 47.6 109.03 0 0 0 0 0 0 0 0 0 0 0 24 25 130.8 109.03 1 0 0 0 0 0 0 0 0 0 0 25 26 113.6 109.54 0 1 0 0 0 0 0 0 0 0 0 26 27 125.7 109.75 0 0 1 0 0 0 0 0 0 0 0 27 28 113.6 109.83 0 0 0 1 0 0 0 0 0 0 0 28 29 97.1 109.65 0 0 0 0 1 0 0 0 0 0 0 29 30 104.4 109.82 0 0 0 0 0 1 0 0 0 0 0 30 31 91.8 109.95 0 0 0 0 0 0 1 0 0 0 0 31 32 75.1 110.12 0 0 0 0 0 0 0 1 0 0 0 32 33 89.2 110.15 0 0 0 0 0 0 0 0 1 0 0 33 34 110.2 110.20 0 0 0 0 0 0 0 0 0 1 0 34 35 78.4 109.99 0 0 0 0 0 0 0 0 0 0 1 35 36 68.4 110.14 0 0 0 0 0 0 0 0 0 0 0 36 37 122.8 110.14 1 0 0 0 0 0 0 0 0 0 0 37 38 129.7 110.81 0 1 0 0 0 0 0 0 0 0 0 38 39 159.1 110.97 0 0 1 0 0 0 0 0 0 0 0 39 40 139.0 110.99 0 0 0 1 0 0 0 0 0 0 0 40 41 102.2 109.73 0 0 0 0 1 0 0 0 0 0 0 41 42 113.6 109.81 0 0 0 0 0 1 0 0 0 0 0 42 43 81.5 110.02 0 0 0 0 0 0 1 0 0 0 0 43 44 77.4 110.18 0 0 0 0 0 0 0 1 0 0 0 44 45 87.6 110.21 0 0 0 0 0 0 0 0 1 0 0 45 46 101.2 110.25 0 0 0 0 0 0 0 0 0 1 0 46 47 87.2 110.36 0 0 0 0 0 0 0 0 0 0 1 47 48 64.9 110.51 0 0 0 0 0 0 0 0 0 0 0 48 49 133.1 110.64 1 0 0 0 0 0 0 0 0 0 0 49 50 118.0 110.95 0 1 0 0 0 0 0 0 0 0 0 50 51 135.9 111.18 0 0 1 0 0 0 0 0 0 0 0 51 52 125.7 111.19 0 0 0 1 0 0 0 0 0 0 0 52 53 108.0 111.69 0 0 0 0 1 0 0 0 0 0 0 53 54 128.3 111.70 0 0 0 0 0 1 0 0 0 0 0 54 55 84.7 111.83 0 0 0 0 0 0 1 0 0 0 0 55 56 86.4 111.77 0 0 0 0 0 0 0 1 0 0 0 56 57 92.2 111.73 0 0 0 0 0 0 0 0 1 0 0 57 58 95.8 112.01 0 0 0 0 0 0 0 0 0 1 0 58 59 92.3 111.86 0 0 0 0 0 0 0 0 0 0 1 59 60 54.3 112.04 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) Xt M1 M2 M3 M4 247.3808 -1.7746 78.1126 65.7367 80.5309 68.6752 M5 M6 M7 M8 M9 M10 48.8930 54.0815 32.8446 20.7564 28.3924 45.0681 M11 t 25.0160 0.1583 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -13.596 -6.001 -1.717 6.820 21.948 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 247.3808 262.8640 0.941 0.351571 Xt -1.7746 2.4765 -0.717 0.477250 M1 78.1126 6.1680 12.664 < 2e-16 *** M2 65.7367 6.1455 10.697 4.58e-14 *** M3 80.5309 6.1719 13.048 < 2e-16 *** M4 68.6752 6.1459 11.174 1.06e-14 *** M5 48.8930 6.1223 7.986 3.10e-10 *** M6 54.0815 6.1172 8.841 1.76e-11 *** M7 32.8446 6.1104 5.375 2.47e-06 *** M8 20.7564 6.1064 3.399 0.001406 ** M9 28.3924 6.1049 4.651 2.81e-05 *** M10 45.0681 6.1024 7.385 2.42e-09 *** M11 25.0160 6.0990 4.102 0.000166 *** t 0.1583 0.2649 0.597 0.553196 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 9.643 on 46 degrees of freedom Multiple R-squared: 0.8898, Adjusted R-squared: 0.8586 F-statistic: 28.57 on 13 and 46 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.21642997 0.43285994 0.78357003 [2,] 0.10456451 0.20912901 0.89543549 [3,] 0.05411409 0.10822819 0.94588591 [4,] 0.03342474 0.06684948 0.96657526 [5,] 0.25903801 0.51807602 0.74096199 [6,] 0.18631911 0.37263822 0.81368089 [7,] 0.14323787 0.28647573 0.85676213 [8,] 0.10082755 0.20165510 0.89917245 [9,] 0.06893010 0.13786020 0.93106990 [10,] 0.05660508 0.11321015 0.94339492 [11,] 0.06078056 0.12156113 0.93921944 [12,] 0.06511679 0.13023357 0.93488321 [13,] 0.04556461 0.09112922 0.95443539 [14,] 0.14104800 0.28209600 0.85895200 [15,] 0.11701304 0.23402608 0.88298696 [16,] 0.20107313 0.40214626 0.79892687 [17,] 0.50219923 0.99560154 0.49780077 [18,] 0.58469225 0.83061550 0.41530775 [19,] 0.78796271 0.42407459 0.21203729 [20,] 0.84023492 0.31953016 0.15976508 [21,] 0.95778616 0.08442768 0.04221384 [22,] 0.94795149 0.10409703 0.05204851 [23,] 0.96878762 0.06242476 0.03121238 [24,] 0.94622457 0.10755085 0.05377543 [25,] 0.88969562 0.22060875 0.11030438 [26,] 0.87892897 0.24214205 0.12107103 [27,] 0.78752680 0.42494640 0.21247320 > postscript(file="/var/www/html/rcomp/tmp/1fpik1258738442.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/2kuf21258738442.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/3qshk1258738442.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/4fsnj1258738442.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/5vdg11258738442.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 12.74072276 -5.44169786 -7.98423360 -9.68682502 13.60190336 3.63255122 7 8 9 10 11 12 14.18866409 7.80590187 -5.95595817 6.68759111 3.28145040 -2.98339459 13 14 15 16 17 18 9.31196336 13.59742837 0.53235689 9.34751189 -0.14488089 -13.59648661 19 20 21 22 23 24 0.07737268 -10.70876803 -3.69964236 -4.69806449 -11.22984100 -10.08989668 25 26 27 28 29 30 -5.16073513 -9.23808802 -11.71780585 -11.97842587 -9.17391872 -6.91904588 31 32 33 34 35 36 1.79030626 -2.67808802 3.68089843 7.93571559 -4.34310007 10.78078707 37 38 39 40 41 42 -13.09005138 7.21653855 21.94808858 13.58099001 -5.83111686 0.36403814 43 44 45 46 47 48 -10.28463831 -2.17077901 0.28820744 -2.87472183 3.21434815 6.03823528 49 50 51 52 53 54 -3.80189962 -6.13418104 -2.77840602 -1.26325102 1.54801311 16.51894313 55 56 57 58 59 60 -5.77170473 7.75173319 5.68649466 -7.05052038 9.07714252 -3.74573107 > postscript(file="/var/www/html/rcomp/tmp/6pens1258738442.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 12.74072276 NA 1 -5.44169786 12.74072276 2 -7.98423360 -5.44169786 3 -9.68682502 -7.98423360 4 13.60190336 -9.68682502 5 3.63255122 13.60190336 6 14.18866409 3.63255122 7 7.80590187 14.18866409 8 -5.95595817 7.80590187 9 6.68759111 -5.95595817 10 3.28145040 6.68759111 11 -2.98339459 3.28145040 12 9.31196336 -2.98339459 13 13.59742837 9.31196336 14 0.53235689 13.59742837 15 9.34751189 0.53235689 16 -0.14488089 9.34751189 17 -13.59648661 -0.14488089 18 0.07737268 -13.59648661 19 -10.70876803 0.07737268 20 -3.69964236 -10.70876803 21 -4.69806449 -3.69964236 22 -11.22984100 -4.69806449 23 -10.08989668 -11.22984100 24 -5.16073513 -10.08989668 25 -9.23808802 -5.16073513 26 -11.71780585 -9.23808802 27 -11.97842587 -11.71780585 28 -9.17391872 -11.97842587 29 -6.91904588 -9.17391872 30 1.79030626 -6.91904588 31 -2.67808802 1.79030626 32 3.68089843 -2.67808802 33 7.93571559 3.68089843 34 -4.34310007 7.93571559 35 10.78078707 -4.34310007 36 -13.09005138 10.78078707 37 7.21653855 -13.09005138 38 21.94808858 7.21653855 39 13.58099001 21.94808858 40 -5.83111686 13.58099001 41 0.36403814 -5.83111686 42 -10.28463831 0.36403814 43 -2.17077901 -10.28463831 44 0.28820744 -2.17077901 45 -2.87472183 0.28820744 46 3.21434815 -2.87472183 47 6.03823528 3.21434815 48 -3.80189962 6.03823528 49 -6.13418104 -3.80189962 50 -2.77840602 -6.13418104 51 -1.26325102 -2.77840602 52 1.54801311 -1.26325102 53 16.51894313 1.54801311 54 -5.77170473 16.51894313 55 7.75173319 -5.77170473 56 5.68649466 7.75173319 57 -7.05052038 5.68649466 58 9.07714252 -7.05052038 59 -3.74573107 9.07714252 60 NA -3.74573107 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -5.44169786 12.74072276 [2,] -7.98423360 -5.44169786 [3,] -9.68682502 -7.98423360 [4,] 13.60190336 -9.68682502 [5,] 3.63255122 13.60190336 [6,] 14.18866409 3.63255122 [7,] 7.80590187 14.18866409 [8,] -5.95595817 7.80590187 [9,] 6.68759111 -5.95595817 [10,] 3.28145040 6.68759111 [11,] -2.98339459 3.28145040 [12,] 9.31196336 -2.98339459 [13,] 13.59742837 9.31196336 [14,] 0.53235689 13.59742837 [15,] 9.34751189 0.53235689 [16,] -0.14488089 9.34751189 [17,] -13.59648661 -0.14488089 [18,] 0.07737268 -13.59648661 [19,] -10.70876803 0.07737268 [20,] -3.69964236 -10.70876803 [21,] -4.69806449 -3.69964236 [22,] -11.22984100 -4.69806449 [23,] -10.08989668 -11.22984100 [24,] -5.16073513 -10.08989668 [25,] -9.23808802 -5.16073513 [26,] -11.71780585 -9.23808802 [27,] -11.97842587 -11.71780585 [28,] -9.17391872 -11.97842587 [29,] -6.91904588 -9.17391872 [30,] 1.79030626 -6.91904588 [31,] -2.67808802 1.79030626 [32,] 3.68089843 -2.67808802 [33,] 7.93571559 3.68089843 [34,] -4.34310007 7.93571559 [35,] 10.78078707 -4.34310007 [36,] -13.09005138 10.78078707 [37,] 7.21653855 -13.09005138 [38,] 21.94808858 7.21653855 [39,] 13.58099001 21.94808858 [40,] -5.83111686 13.58099001 [41,] 0.36403814 -5.83111686 [42,] -10.28463831 0.36403814 [43,] -2.17077901 -10.28463831 [44,] 0.28820744 -2.17077901 [45,] -2.87472183 0.28820744 [46,] 3.21434815 -2.87472183 [47,] 6.03823528 3.21434815 [48,] -3.80189962 6.03823528 [49,] -6.13418104 -3.80189962 [50,] -2.77840602 -6.13418104 [51,] -1.26325102 -2.77840602 [52,] 1.54801311 -1.26325102 [53,] 16.51894313 1.54801311 [54,] -5.77170473 16.51894313 [55,] 7.75173319 -5.77170473 [56,] 5.68649466 7.75173319 [57,] -7.05052038 5.68649466 [58,] 9.07714252 -7.05052038 [59,] -3.74573107 9.07714252 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -5.44169786 12.74072276 2 -7.98423360 -5.44169786 3 -9.68682502 -7.98423360 4 13.60190336 -9.68682502 5 3.63255122 13.60190336 6 14.18866409 3.63255122 7 7.80590187 14.18866409 8 -5.95595817 7.80590187 9 6.68759111 -5.95595817 10 3.28145040 6.68759111 11 -2.98339459 3.28145040 12 9.31196336 -2.98339459 13 13.59742837 9.31196336 14 0.53235689 13.59742837 15 9.34751189 0.53235689 16 -0.14488089 9.34751189 17 -13.59648661 -0.14488089 18 0.07737268 -13.59648661 19 -10.70876803 0.07737268 20 -3.69964236 -10.70876803 21 -4.69806449 -3.69964236 22 -11.22984100 -4.69806449 23 -10.08989668 -11.22984100 24 -5.16073513 -10.08989668 25 -9.23808802 -5.16073513 26 -11.71780585 -9.23808802 27 -11.97842587 -11.71780585 28 -9.17391872 -11.97842587 29 -6.91904588 -9.17391872 30 1.79030626 -6.91904588 31 -2.67808802 1.79030626 32 3.68089843 -2.67808802 33 7.93571559 3.68089843 34 -4.34310007 7.93571559 35 10.78078707 -4.34310007 36 -13.09005138 10.78078707 37 7.21653855 -13.09005138 38 21.94808858 7.21653855 39 13.58099001 21.94808858 40 -5.83111686 13.58099001 41 0.36403814 -5.83111686 42 -10.28463831 0.36403814 43 -2.17077901 -10.28463831 44 0.28820744 -2.17077901 45 -2.87472183 0.28820744 46 3.21434815 -2.87472183 47 6.03823528 3.21434815 48 -3.80189962 6.03823528 49 -6.13418104 -3.80189962 50 -2.77840602 -6.13418104 51 -1.26325102 -2.77840602 52 1.54801311 -1.26325102 53 16.51894313 1.54801311 54 -5.77170473 16.51894313 55 7.75173319 -5.77170473 56 5.68649466 7.75173319 57 -7.05052038 5.68649466 58 9.07714252 -7.05052038 59 -3.74573107 9.07714252 > 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/7xihf1258738442.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/8rmuf1258738442.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/9me3b1258738442.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/10cjha1258738442.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/11j7ue1258738442.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/12ab231258738442.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/13wxbr1258738442.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/143ec11258738443.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/15gwbh1258738443.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/1683ab1258738443.tab") + } > > system("convert tmp/1fpik1258738442.ps tmp/1fpik1258738442.png") > system("convert tmp/2kuf21258738442.ps tmp/2kuf21258738442.png") > system("convert tmp/3qshk1258738442.ps tmp/3qshk1258738442.png") > system("convert tmp/4fsnj1258738442.ps tmp/4fsnj1258738442.png") > system("convert tmp/5vdg11258738442.ps tmp/5vdg11258738442.png") > system("convert tmp/6pens1258738442.ps tmp/6pens1258738442.png") > system("convert tmp/7xihf1258738442.ps tmp/7xihf1258738442.png") > system("convert tmp/8rmuf1258738442.ps tmp/8rmuf1258738442.png") > system("convert tmp/9me3b1258738442.ps tmp/9me3b1258738442.png") > system("convert tmp/10cjha1258738442.ps tmp/10cjha1258738442.png") > > > proc.time() user system elapsed 2.493 1.623 2.908