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(103.52,0,103.5,0,103.52,0,103.53,0,103.53,0,103.53,0,103.52,0,103.54,0,103.59,0,103.59,0,103.59,0,103.59,0,103.63,0,103.74,0,103.7,0,103.72,0,103.81,0,103.8,0,104.22,0,106.91,1,107.06,1,107.17,1,107.25,1,107.28,1,107.24,1,107.23,1,107.34,1,107.34,1,107.3,1,107.24,1,107.3,1,107.32,1,107.28,1,107.33,1,107.33,1,107.33,1,107.28,1,107.28,1,107.29,1,107.29,1,107.23,1,107.24,1,107.24,1,107.2,1,107.23,1,107.2,1,107.21,1,107.24,1,107.21,1,113.89,1,114.05,1,114.05,1,114.05,1,114.05,1,115.12,1,115.68,1,116.05,1,116.18,1,116.35,1,116.44,1,117,1,117.61,1,118.17,1,118.33,1,118.33,1,118.42,1,118.5,1,118.67,1,119.09,1,119.14,1,119.23,1,119.33,1),dim=c(2,72),dimnames=list(c('Y','X'),1:72)) > y <- array(NA,dim=c(2,72),dimnames=list(c('Y','X'),1:72)) > 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 Y X M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 1 103.52 0 1 0 0 0 0 0 0 0 0 0 0 2 103.50 0 0 1 0 0 0 0 0 0 0 0 0 3 103.52 0 0 0 1 0 0 0 0 0 0 0 0 4 103.53 0 0 0 0 1 0 0 0 0 0 0 0 5 103.53 0 0 0 0 0 1 0 0 0 0 0 0 6 103.53 0 0 0 0 0 0 1 0 0 0 0 0 7 103.52 0 0 0 0 0 0 0 1 0 0 0 0 8 103.54 0 0 0 0 0 0 0 0 1 0 0 0 9 103.59 0 0 0 0 0 0 0 0 0 1 0 0 10 103.59 0 0 0 0 0 0 0 0 0 0 1 0 11 103.59 0 0 0 0 0 0 0 0 0 0 0 1 12 103.59 0 0 0 0 0 0 0 0 0 0 0 0 13 103.63 0 1 0 0 0 0 0 0 0 0 0 0 14 103.74 0 0 1 0 0 0 0 0 0 0 0 0 15 103.70 0 0 0 1 0 0 0 0 0 0 0 0 16 103.72 0 0 0 0 1 0 0 0 0 0 0 0 17 103.81 0 0 0 0 0 1 0 0 0 0 0 0 18 103.80 0 0 0 0 0 0 1 0 0 0 0 0 19 104.22 0 0 0 0 0 0 0 1 0 0 0 0 20 106.91 1 0 0 0 0 0 0 0 1 0 0 0 21 107.06 1 0 0 0 0 0 0 0 0 1 0 0 22 107.17 1 0 0 0 0 0 0 0 0 0 1 0 23 107.25 1 0 0 0 0 0 0 0 0 0 0 1 24 107.28 1 0 0 0 0 0 0 0 0 0 0 0 25 107.24 1 1 0 0 0 0 0 0 0 0 0 0 26 107.23 1 0 1 0 0 0 0 0 0 0 0 0 27 107.34 1 0 0 1 0 0 0 0 0 0 0 0 28 107.34 1 0 0 0 1 0 0 0 0 0 0 0 29 107.30 1 0 0 0 0 1 0 0 0 0 0 0 30 107.24 1 0 0 0 0 0 1 0 0 0 0 0 31 107.30 1 0 0 0 0 0 0 1 0 0 0 0 32 107.32 1 0 0 0 0 0 0 0 1 0 0 0 33 107.28 1 0 0 0 0 0 0 0 0 1 0 0 34 107.33 1 0 0 0 0 0 0 0 0 0 1 0 35 107.33 1 0 0 0 0 0 0 0 0 0 0 1 36 107.33 1 0 0 0 0 0 0 0 0 0 0 0 37 107.28 1 1 0 0 0 0 0 0 0 0 0 0 38 107.28 1 0 1 0 0 0 0 0 0 0 0 0 39 107.29 1 0 0 1 0 0 0 0 0 0 0 0 40 107.29 1 0 0 0 1 0 0 0 0 0 0 0 41 107.23 1 0 0 0 0 1 0 0 0 0 0 0 42 107.24 1 0 0 0 0 0 1 0 0 0 0 0 43 107.24 1 0 0 0 0 0 0 1 0 0 0 0 44 107.20 1 0 0 0 0 0 0 0 1 0 0 0 45 107.23 1 0 0 0 0 0 0 0 0 1 0 0 46 107.20 1 0 0 0 0 0 0 0 0 0 1 0 47 107.21 1 0 0 0 0 0 0 0 0 0 0 1 48 107.24 1 0 0 0 0 0 0 0 0 0 0 0 49 107.21 1 1 0 0 0 0 0 0 0 0 0 0 50 113.89 1 0 1 0 0 0 0 0 0 0 0 0 51 114.05 1 0 0 1 0 0 0 0 0 0 0 0 52 114.05 1 0 0 0 1 0 0 0 0 0 0 0 53 114.05 1 0 0 0 0 1 0 0 0 0 0 0 54 114.05 1 0 0 0 0 0 1 0 0 0 0 0 55 115.12 1 0 0 0 0 0 0 1 0 0 0 0 56 115.68 1 0 0 0 0 0 0 0 1 0 0 0 57 116.05 1 0 0 0 0 0 0 0 0 1 0 0 58 116.18 1 0 0 0 0 0 0 0 0 0 1 0 59 116.35 1 0 0 0 0 0 0 0 0 0 0 1 60 116.44 1 0 0 0 0 0 0 0 0 0 0 0 61 117.00 1 1 0 0 0 0 0 0 0 0 0 0 62 117.61 1 0 1 0 0 0 0 0 0 0 0 0 63 118.17 1 0 0 1 0 0 0 0 0 0 0 0 64 118.33 1 0 0 0 1 0 0 0 0 0 0 0 65 118.33 1 0 0 0 0 1 0 0 0 0 0 0 66 118.42 1 0 0 0 0 0 1 0 0 0 0 0 67 118.50 1 0 0 0 0 0 0 1 0 0 0 0 68 118.67 1 0 0 0 0 0 0 0 1 0 0 0 69 119.09 1 0 0 0 0 0 0 0 0 1 0 0 70 119.14 1 0 0 0 0 0 0 0 0 0 1 0 71 119.23 1 0 0 0 0 0 0 0 0 0 0 1 72 119.33 1 0 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) X M1 M2 M3 M4 103.70825 7.79210 -1.25632 -0.02798 0.10868 0.14035 M5 M6 M7 M8 M9 M10 0.13868 0.14368 0.41368 -0.31500 -0.15167 -0.10000 M11 -0.04167 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -4.6740 -4.2024 -0.1544 2.6322 7.8297 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 103.70825 2.17140 47.761 < 2e-16 *** X 7.79210 1.26543 6.158 7.07e-08 *** M1 -1.25632 2.69266 -0.467 0.643 M2 -0.02798 2.69266 -0.010 0.992 M3 0.10868 2.69266 0.040 0.968 M4 0.14035 2.69266 0.052 0.959 M5 0.13868 2.69266 0.052 0.959 M6 0.14368 2.69266 0.053 0.958 M7 0.41368 2.69266 0.154 0.878 M8 -0.31500 2.68439 -0.117 0.907 M9 -0.15167 2.68439 -0.056 0.955 M10 -0.10000 2.68439 -0.037 0.970 M11 -0.04167 2.68439 -0.016 0.988 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 4.649 on 59 degrees of freedom Multiple R-squared: 0.4019, Adjusted R-squared: 0.2803 F-statistic: 3.304 on 12 and 59 DF, p-value: 0.001062 > 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,] 3.057616e-05 6.115231e-05 0.9999694 [2,] 1.676163e-06 3.352326e-06 0.9999983 [3,] 8.650712e-08 1.730142e-07 0.9999999 [4,] 4.421908e-08 8.843815e-08 1.0000000 [5,] 1.865617e-09 3.731235e-09 1.0000000 [6,] 7.642470e-11 1.528494e-10 1.0000000 [7,] 3.205608e-12 6.411217e-12 1.0000000 [8,] 1.385810e-13 2.771619e-13 1.0000000 [9,] 5.809151e-15 1.161830e-14 1.0000000 [10,] 2.079122e-16 4.158243e-16 1.0000000 [11,] 7.244353e-18 1.448871e-17 1.0000000 [12,] 2.986160e-19 5.972320e-19 1.0000000 [13,] 1.132906e-20 2.265812e-20 1.0000000 [14,] 3.786625e-22 7.573250e-22 1.0000000 [15,] 1.280990e-23 2.561981e-23 1.0000000 [16,] 6.441300e-25 1.288260e-24 1.0000000 [17,] 6.586275e-26 1.317255e-25 1.0000000 [18,] 3.282570e-27 6.565141e-27 1.0000000 [19,] 1.634068e-28 3.268136e-28 1.0000000 [20,] 7.451623e-30 1.490325e-29 1.0000000 [21,] 3.394375e-31 6.788751e-31 1.0000000 [22,] 1.120018e-32 2.240035e-32 1.0000000 [23,] 5.890019e-34 1.178004e-33 1.0000000 [24,] 3.528631e-35 7.057262e-35 1.0000000 [25,] 2.378965e-36 4.757931e-36 1.0000000 [26,] 2.045525e-37 4.091051e-37 1.0000000 [27,] 1.943761e-38 3.887522e-38 1.0000000 [28,] 5.486347e-39 1.097269e-38 1.0000000 [29,] 1.449656e-39 2.899313e-39 1.0000000 [30,] 7.678106e-40 1.535621e-39 1.0000000 [31,] 1.060833e-39 2.121666e-39 1.0000000 [32,] 7.667575e-39 1.533515e-38 1.0000000 [33,] 1.274269e-36 2.548539e-36 1.0000000 [34,] 4.816022e-34 9.632044e-34 1.0000000 [35,] 4.117403e-06 8.234806e-06 0.9999959 [36,] 2.524443e-03 5.048885e-03 0.9974756 [37,] 3.284371e-02 6.568743e-02 0.9671563 [38,] 1.205977e-01 2.411954e-01 0.8794023 [39,] 2.645493e-01 5.290985e-01 0.7354507 [40,] 3.692430e-01 7.384861e-01 0.6307570 [41,] 4.251770e-01 8.503540e-01 0.5748230 > postscript(file="/var/www/html/rcomp/tmp/15opq1259057119.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/2n75z1259057119.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/3aocl1259057119.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/4pr1d1259057119.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/5itc31259057119.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 = 72 Frequency = 1 1 2 3 4 5 6 1.06806584 -0.18026749 -0.29693416 -0.31860082 -0.31693416 -0.32193416 7 8 9 10 11 12 -0.60193416 0.14674897 0.03341564 -0.01825103 -0.07658436 -0.11825103 13 14 15 16 17 18 1.17806584 0.05973251 -0.11693416 -0.12860082 -0.03693416 -0.05193416 19 20 21 22 23 24 0.09806584 -4.27534979 -4.28868313 -4.23034979 -4.20868313 -4.22034979 25 26 27 28 29 30 -3.00403292 -4.24236626 -4.26903292 -4.30069959 -4.33903292 -4.40403292 31 32 33 34 35 36 -4.61403292 -3.86534979 -4.06868313 -4.07034979 -4.12868313 -4.17034979 37 38 39 40 41 42 -2.96403292 -4.19236626 -4.31903292 -4.35069959 -4.40903292 -4.40403292 43 44 45 46 47 48 -4.67403292 -3.98534979 -4.11868313 -4.20034979 -4.24868313 -4.26034979 49 50 51 52 53 54 -3.03403292 2.41763374 2.44096708 2.40930041 2.41096708 2.40596708 55 56 57 58 59 60 3.20596708 4.49465021 4.70131687 4.77965021 4.89131687 4.93965021 61 62 63 64 65 66 6.75596708 6.13763374 6.56096708 6.68930041 6.69096708 6.77596708 67 68 69 70 71 72 6.58596708 7.48465021 7.74131687 7.73965021 7.77131687 7.82965021 > postscript(file="/var/www/html/rcomp/tmp/6fqg01259057119.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 = 72 Frequency = 1 lag(myerror, k = 1) myerror 0 1.06806584 NA 1 -0.18026749 1.06806584 2 -0.29693416 -0.18026749 3 -0.31860082 -0.29693416 4 -0.31693416 -0.31860082 5 -0.32193416 -0.31693416 6 -0.60193416 -0.32193416 7 0.14674897 -0.60193416 8 0.03341564 0.14674897 9 -0.01825103 0.03341564 10 -0.07658436 -0.01825103 11 -0.11825103 -0.07658436 12 1.17806584 -0.11825103 13 0.05973251 1.17806584 14 -0.11693416 0.05973251 15 -0.12860082 -0.11693416 16 -0.03693416 -0.12860082 17 -0.05193416 -0.03693416 18 0.09806584 -0.05193416 19 -4.27534979 0.09806584 20 -4.28868313 -4.27534979 21 -4.23034979 -4.28868313 22 -4.20868313 -4.23034979 23 -4.22034979 -4.20868313 24 -3.00403292 -4.22034979 25 -4.24236626 -3.00403292 26 -4.26903292 -4.24236626 27 -4.30069959 -4.26903292 28 -4.33903292 -4.30069959 29 -4.40403292 -4.33903292 30 -4.61403292 -4.40403292 31 -3.86534979 -4.61403292 32 -4.06868313 -3.86534979 33 -4.07034979 -4.06868313 34 -4.12868313 -4.07034979 35 -4.17034979 -4.12868313 36 -2.96403292 -4.17034979 37 -4.19236626 -2.96403292 38 -4.31903292 -4.19236626 39 -4.35069959 -4.31903292 40 -4.40903292 -4.35069959 41 -4.40403292 -4.40903292 42 -4.67403292 -4.40403292 43 -3.98534979 -4.67403292 44 -4.11868313 -3.98534979 45 -4.20034979 -4.11868313 46 -4.24868313 -4.20034979 47 -4.26034979 -4.24868313 48 -3.03403292 -4.26034979 49 2.41763374 -3.03403292 50 2.44096708 2.41763374 51 2.40930041 2.44096708 52 2.41096708 2.40930041 53 2.40596708 2.41096708 54 3.20596708 2.40596708 55 4.49465021 3.20596708 56 4.70131687 4.49465021 57 4.77965021 4.70131687 58 4.89131687 4.77965021 59 4.93965021 4.89131687 60 6.75596708 4.93965021 61 6.13763374 6.75596708 62 6.56096708 6.13763374 63 6.68930041 6.56096708 64 6.69096708 6.68930041 65 6.77596708 6.69096708 66 6.58596708 6.77596708 67 7.48465021 6.58596708 68 7.74131687 7.48465021 69 7.73965021 7.74131687 70 7.77131687 7.73965021 71 7.82965021 7.77131687 72 NA 7.82965021 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -0.18026749 1.06806584 [2,] -0.29693416 -0.18026749 [3,] -0.31860082 -0.29693416 [4,] -0.31693416 -0.31860082 [5,] -0.32193416 -0.31693416 [6,] -0.60193416 -0.32193416 [7,] 0.14674897 -0.60193416 [8,] 0.03341564 0.14674897 [9,] -0.01825103 0.03341564 [10,] -0.07658436 -0.01825103 [11,] -0.11825103 -0.07658436 [12,] 1.17806584 -0.11825103 [13,] 0.05973251 1.17806584 [14,] -0.11693416 0.05973251 [15,] -0.12860082 -0.11693416 [16,] -0.03693416 -0.12860082 [17,] -0.05193416 -0.03693416 [18,] 0.09806584 -0.05193416 [19,] -4.27534979 0.09806584 [20,] -4.28868313 -4.27534979 [21,] -4.23034979 -4.28868313 [22,] -4.20868313 -4.23034979 [23,] -4.22034979 -4.20868313 [24,] -3.00403292 -4.22034979 [25,] -4.24236626 -3.00403292 [26,] -4.26903292 -4.24236626 [27,] -4.30069959 -4.26903292 [28,] -4.33903292 -4.30069959 [29,] -4.40403292 -4.33903292 [30,] -4.61403292 -4.40403292 [31,] -3.86534979 -4.61403292 [32,] -4.06868313 -3.86534979 [33,] -4.07034979 -4.06868313 [34,] -4.12868313 -4.07034979 [35,] -4.17034979 -4.12868313 [36,] -2.96403292 -4.17034979 [37,] -4.19236626 -2.96403292 [38,] -4.31903292 -4.19236626 [39,] -4.35069959 -4.31903292 [40,] -4.40903292 -4.35069959 [41,] -4.40403292 -4.40903292 [42,] -4.67403292 -4.40403292 [43,] -3.98534979 -4.67403292 [44,] -4.11868313 -3.98534979 [45,] -4.20034979 -4.11868313 [46,] -4.24868313 -4.20034979 [47,] -4.26034979 -4.24868313 [48,] -3.03403292 -4.26034979 [49,] 2.41763374 -3.03403292 [50,] 2.44096708 2.41763374 [51,] 2.40930041 2.44096708 [52,] 2.41096708 2.40930041 [53,] 2.40596708 2.41096708 [54,] 3.20596708 2.40596708 [55,] 4.49465021 3.20596708 [56,] 4.70131687 4.49465021 [57,] 4.77965021 4.70131687 [58,] 4.89131687 4.77965021 [59,] 4.93965021 4.89131687 [60,] 6.75596708 4.93965021 [61,] 6.13763374 6.75596708 [62,] 6.56096708 6.13763374 [63,] 6.68930041 6.56096708 [64,] 6.69096708 6.68930041 [65,] 6.77596708 6.69096708 [66,] 6.58596708 6.77596708 [67,] 7.48465021 6.58596708 [68,] 7.74131687 7.48465021 [69,] 7.73965021 7.74131687 [70,] 7.77131687 7.73965021 [71,] 7.82965021 7.77131687 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -0.18026749 1.06806584 2 -0.29693416 -0.18026749 3 -0.31860082 -0.29693416 4 -0.31693416 -0.31860082 5 -0.32193416 -0.31693416 6 -0.60193416 -0.32193416 7 0.14674897 -0.60193416 8 0.03341564 0.14674897 9 -0.01825103 0.03341564 10 -0.07658436 -0.01825103 11 -0.11825103 -0.07658436 12 1.17806584 -0.11825103 13 0.05973251 1.17806584 14 -0.11693416 0.05973251 15 -0.12860082 -0.11693416 16 -0.03693416 -0.12860082 17 -0.05193416 -0.03693416 18 0.09806584 -0.05193416 19 -4.27534979 0.09806584 20 -4.28868313 -4.27534979 21 -4.23034979 -4.28868313 22 -4.20868313 -4.23034979 23 -4.22034979 -4.20868313 24 -3.00403292 -4.22034979 25 -4.24236626 -3.00403292 26 -4.26903292 -4.24236626 27 -4.30069959 -4.26903292 28 -4.33903292 -4.30069959 29 -4.40403292 -4.33903292 30 -4.61403292 -4.40403292 31 -3.86534979 -4.61403292 32 -4.06868313 -3.86534979 33 -4.07034979 -4.06868313 34 -4.12868313 -4.07034979 35 -4.17034979 -4.12868313 36 -2.96403292 -4.17034979 37 -4.19236626 -2.96403292 38 -4.31903292 -4.19236626 39 -4.35069959 -4.31903292 40 -4.40903292 -4.35069959 41 -4.40403292 -4.40903292 42 -4.67403292 -4.40403292 43 -3.98534979 -4.67403292 44 -4.11868313 -3.98534979 45 -4.20034979 -4.11868313 46 -4.24868313 -4.20034979 47 -4.26034979 -4.24868313 48 -3.03403292 -4.26034979 49 2.41763374 -3.03403292 50 2.44096708 2.41763374 51 2.40930041 2.44096708 52 2.41096708 2.40930041 53 2.40596708 2.41096708 54 3.20596708 2.40596708 55 4.49465021 3.20596708 56 4.70131687 4.49465021 57 4.77965021 4.70131687 58 4.89131687 4.77965021 59 4.93965021 4.89131687 60 6.75596708 4.93965021 61 6.13763374 6.75596708 62 6.56096708 6.13763374 63 6.68930041 6.56096708 64 6.69096708 6.68930041 65 6.77596708 6.69096708 66 6.58596708 6.77596708 67 7.48465021 6.58596708 68 7.74131687 7.48465021 69 7.73965021 7.74131687 70 7.77131687 7.73965021 71 7.82965021 7.77131687 > 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/7aey21259057119.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/8uvup1259057119.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/91orr1259057119.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/104jra1259057119.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/11vgbx1259057119.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/12b71w1259057119.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/135uqm1259057119.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/14n8fz1259057119.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/15hayo1259057119.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/16z44y1259057119.tab") + } > > system("convert tmp/15opq1259057119.ps tmp/15opq1259057119.png") > system("convert tmp/2n75z1259057119.ps tmp/2n75z1259057119.png") > system("convert tmp/3aocl1259057119.ps tmp/3aocl1259057119.png") > system("convert tmp/4pr1d1259057119.ps tmp/4pr1d1259057119.png") > system("convert tmp/5itc31259057119.ps tmp/5itc31259057119.png") > system("convert tmp/6fqg01259057119.ps tmp/6fqg01259057119.png") > system("convert tmp/7aey21259057119.ps tmp/7aey21259057119.png") > system("convert tmp/8uvup1259057119.ps tmp/8uvup1259057119.png") > system("convert tmp/91orr1259057119.ps tmp/91orr1259057119.png") > system("convert tmp/104jra1259057119.ps tmp/104jra1259057119.png") > > > proc.time() user system elapsed 2.562 1.587 3.622