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(0.7905 + ,0.313 + ,0.7744 + ,0.779 + ,0.7775 + ,0.7461 + ,0.7719 + ,0.364 + ,0.7905 + ,0.7744 + ,0.779 + ,0.7775 + ,0.7811 + ,0.363 + ,0.7719 + ,0.7905 + ,0.7744 + ,0.779 + ,0.7557 + ,-0.155 + ,0.7811 + ,0.7719 + ,0.7905 + ,0.7744 + ,0.7637 + ,0.052 + ,0.7557 + ,0.7811 + ,0.7719 + ,0.7905 + ,0.7595 + ,0.568 + ,0.7637 + ,0.7557 + ,0.7811 + ,0.7719 + ,0.7471 + ,0.668 + ,0.7595 + ,0.7637 + ,0.7557 + ,0.7811 + ,0.7615 + ,1.378 + ,0.7471 + ,0.7595 + ,0.7637 + ,0.7557 + ,0.7487 + ,0.252 + ,0.7615 + ,0.7471 + ,0.7595 + ,0.7637 + ,0.7389 + ,-0.402 + ,0.7487 + ,0.7615 + ,0.7471 + ,0.7595 + ,0.7337 + ,-0.05 + ,0.7389 + ,0.7487 + ,0.7615 + ,0.7471 + ,0.751 + ,0.555 + ,0.7337 + ,0.7389 + ,0.7487 + ,0.7615 + ,0.7382 + ,0.05 + ,0.751 + ,0.7337 + ,0.7389 + ,0.7487 + ,0.7159 + ,0.15 + ,0.7382 + ,0.751 + ,0.7337 + ,0.7389 + ,0.7542 + ,0.45 + ,0.7159 + ,0.7382 + ,0.751 + ,0.7337 + ,0.7636 + ,0.299 + ,0.7542 + ,0.7159 + ,0.7382 + ,0.751 + ,0.7433 + ,0.199 + ,0.7636 + ,0.7542 + ,0.7159 + ,0.7382 + ,0.7658 + ,0.496 + ,0.7433 + ,0.7636 + ,0.7542 + ,0.7159 + ,0.7627 + ,0.444 + ,0.7658 + ,0.7433 + ,0.7636 + ,0.7542 + ,0.748 + ,-0.393 + ,0.7627 + ,0.7658 + ,0.7433 + ,0.7636 + ,0.7692 + ,-0.444 + ,0.748 + ,0.7627 + ,0.7658 + ,0.7433 + ,0.785 + ,0.198 + ,0.7692 + ,0.748 + ,0.7627 + ,0.7658 + ,0.7913 + ,0.494 + ,0.785 + ,0.7692 + ,0.748 + ,0.7627 + ,0.772 + ,0.133 + ,0.7913 + ,0.785 + ,0.7692 + ,0.748 + ,0.788 + ,0.388 + ,0.772 + ,0.7913 + ,0.785 + ,0.7692 + ,0.807 + ,0.484 + ,0.788 + ,0.772 + ,0.7913 + ,0.785 + ,0.8268 + ,0.278 + ,0.807 + ,0.788 + ,0.772 + ,0.7913 + ,0.8244 + ,0.369 + ,0.8268 + ,0.807 + ,0.788 + ,0.772 + ,0.8487 + ,0.165 + ,0.8244 + ,0.8268 + ,0.807 + ,0.788 + ,0.8572 + ,0.155 + ,0.8487 + ,0.8244 + ,0.8268 + ,0.807 + ,0.8214 + ,0.087 + ,0.8572 + ,0.8487 + ,0.8244 + ,0.8268 + ,0.8827 + ,0.414 + ,0.8214 + ,0.8572 + ,0.8487 + ,0.8244 + ,0.9216 + ,0.36 + ,0.8827 + ,0.8214 + ,0.8572 + ,0.8487 + ,0.8865 + ,0.975 + ,0.9216 + ,0.8827 + ,0.8214 + ,0.8572 + ,0.8816 + ,0.27 + ,0.8865 + ,0.9216 + ,0.8827 + ,0.8214 + ,0.8884 + ,0.359 + ,0.8816 + ,0.8865 + ,0.9216 + ,0.8827 + ,0.9466 + ,0.169 + ,0.8884 + ,0.8816 + ,0.8865 + ,0.9216 + ,0.918 + ,0.381 + ,0.9466 + ,0.8884 + ,0.8816 + ,0.8865 + ,0.9337 + ,0.154 + ,0.918 + ,0.9466 + ,0.8884 + ,0.8816 + ,0.9559 + ,0.486 + ,0.9337 + ,0.918 + ,0.9466 + ,0.8884 + ,0.9626 + ,0.925 + ,0.9559 + ,0.9337 + ,0.918 + ,0.9466 + ,0.9434 + ,0.728 + ,0.9626 + ,0.9559 + ,0.9337 + ,0.918 + ,0.8639 + ,-0.014 + ,0.9434 + ,0.9626 + ,0.9559 + ,0.9337 + ,0.7996 + ,0.046 + ,0.8639 + ,0.9434 + ,0.9626 + ,0.9559 + ,0.668 + ,-0.819 + ,0.7996 + ,0.8639 + ,0.9434 + ,0.9626 + ,0.6572 + ,-1.674 + ,0.668 + ,0.7996 + ,0.8639 + ,0.9434 + ,0.6928 + ,-0.788 + ,0.6572 + ,0.668 + ,0.7996 + ,0.8639 + ,0.6438 + ,0.279 + ,0.6928 + ,0.6572 + ,0.668 + ,0.7996 + ,0.6454 + ,0.396 + ,0.6438 + ,0.6928 + ,0.6572 + ,0.668 + ,0.6873 + ,-0.141 + ,0.6454 + ,0.6438 + ,0.6928 + ,0.6572 + ,0.7265 + ,-0.019 + ,0.6873 + ,0.6454 + ,0.6438 + ,0.6928 + ,0.7912 + ,0.099 + ,0.7265 + ,0.6873 + ,0.6454 + ,0.6438 + ,0.8114 + ,0.742 + ,0.7912 + ,0.7265 + ,0.6873 + ,0.6454 + ,0.8281 + ,0.005 + ,0.8114 + ,0.7912 + ,0.7265 + ,0.6873 + ,0.8393 + ,0.448 + ,0.8281 + ,0.8114 + ,0.7912 + ,0.7265) + ,dim=c(6 + ,55) + ,dimnames=list(c('USDOLLAR' + ,'Amerikaanse_inflatie' + ,'Y[t-1]' + ,'Y[t-2]' + ,'Y[t-3]' + ,'Y[t-4]') + ,1:55)) > y <- array(NA,dim=c(6,55),dimnames=list(c('USDOLLAR','Amerikaanse_inflatie','Y[t-1]','Y[t-2]','Y[t-3]','Y[t-4]'),1:55)) > 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 USDOLLAR Amerikaanse_inflatie Y[t-1] Y[t-2] Y[t-3] Y[t-4] M1 M2 M3 M4 M5 M6 1 0.7905 0.313 0.7744 0.7790 0.7775 0.7461 1 0 0 0 0 0 2 0.7719 0.364 0.7905 0.7744 0.7790 0.7775 0 1 0 0 0 0 3 0.7811 0.363 0.7719 0.7905 0.7744 0.7790 0 0 1 0 0 0 4 0.7557 -0.155 0.7811 0.7719 0.7905 0.7744 0 0 0 1 0 0 5 0.7637 0.052 0.7557 0.7811 0.7719 0.7905 0 0 0 0 1 0 6 0.7595 0.568 0.7637 0.7557 0.7811 0.7719 0 0 0 0 0 1 7 0.7471 0.668 0.7595 0.7637 0.7557 0.7811 0 0 0 0 0 0 8 0.7615 1.378 0.7471 0.7595 0.7637 0.7557 0 0 0 0 0 0 9 0.7487 0.252 0.7615 0.7471 0.7595 0.7637 0 0 0 0 0 0 10 0.7389 -0.402 0.7487 0.7615 0.7471 0.7595 0 0 0 0 0 0 11 0.7337 -0.050 0.7389 0.7487 0.7615 0.7471 0 0 0 0 0 0 12 0.7510 0.555 0.7337 0.7389 0.7487 0.7615 0 0 0 0 0 0 13 0.7382 0.050 0.7510 0.7337 0.7389 0.7487 1 0 0 0 0 0 14 0.7159 0.150 0.7382 0.7510 0.7337 0.7389 0 1 0 0 0 0 15 0.7542 0.450 0.7159 0.7382 0.7510 0.7337 0 0 1 0 0 0 16 0.7636 0.299 0.7542 0.7159 0.7382 0.7510 0 0 0 1 0 0 17 0.7433 0.199 0.7636 0.7542 0.7159 0.7382 0 0 0 0 1 0 18 0.7658 0.496 0.7433 0.7636 0.7542 0.7159 0 0 0 0 0 1 19 0.7627 0.444 0.7658 0.7433 0.7636 0.7542 0 0 0 0 0 0 20 0.7480 -0.393 0.7627 0.7658 0.7433 0.7636 0 0 0 0 0 0 21 0.7692 -0.444 0.7480 0.7627 0.7658 0.7433 0 0 0 0 0 0 22 0.7850 0.198 0.7692 0.7480 0.7627 0.7658 0 0 0 0 0 0 23 0.7913 0.494 0.7850 0.7692 0.7480 0.7627 0 0 0 0 0 0 24 0.7720 0.133 0.7913 0.7850 0.7692 0.7480 0 0 0 0 0 0 25 0.7880 0.388 0.7720 0.7913 0.7850 0.7692 1 0 0 0 0 0 26 0.8070 0.484 0.7880 0.7720 0.7913 0.7850 0 1 0 0 0 0 27 0.8268 0.278 0.8070 0.7880 0.7720 0.7913 0 0 1 0 0 0 28 0.8244 0.369 0.8268 0.8070 0.7880 0.7720 0 0 0 1 0 0 29 0.8487 0.165 0.8244 0.8268 0.8070 0.7880 0 0 0 0 1 0 30 0.8572 0.155 0.8487 0.8244 0.8268 0.8070 0 0 0 0 0 1 31 0.8214 0.087 0.8572 0.8487 0.8244 0.8268 0 0 0 0 0 0 32 0.8827 0.414 0.8214 0.8572 0.8487 0.8244 0 0 0 0 0 0 33 0.9216 0.360 0.8827 0.8214 0.8572 0.8487 0 0 0 0 0 0 34 0.8865 0.975 0.9216 0.8827 0.8214 0.8572 0 0 0 0 0 0 35 0.8816 0.270 0.8865 0.9216 0.8827 0.8214 0 0 0 0 0 0 36 0.8884 0.359 0.8816 0.8865 0.9216 0.8827 0 0 0 0 0 0 37 0.9466 0.169 0.8884 0.8816 0.8865 0.9216 1 0 0 0 0 0 38 0.9180 0.381 0.9466 0.8884 0.8816 0.8865 0 1 0 0 0 0 39 0.9337 0.154 0.9180 0.9466 0.8884 0.8816 0 0 1 0 0 0 40 0.9559 0.486 0.9337 0.9180 0.9466 0.8884 0 0 0 1 0 0 41 0.9626 0.925 0.9559 0.9337 0.9180 0.9466 0 0 0 0 1 0 42 0.9434 0.728 0.9626 0.9559 0.9337 0.9180 0 0 0 0 0 1 43 0.8639 -0.014 0.9434 0.9626 0.9559 0.9337 0 0 0 0 0 0 44 0.7996 0.046 0.8639 0.9434 0.9626 0.9559 0 0 0 0 0 0 45 0.6680 -0.819 0.7996 0.8639 0.9434 0.9626 0 0 0 0 0 0 46 0.6572 -1.674 0.6680 0.7996 0.8639 0.9434 0 0 0 0 0 0 47 0.6928 -0.788 0.6572 0.6680 0.7996 0.8639 0 0 0 0 0 0 48 0.6438 0.279 0.6928 0.6572 0.6680 0.7996 0 0 0 0 0 0 49 0.6454 0.396 0.6438 0.6928 0.6572 0.6680 1 0 0 0 0 0 50 0.6873 -0.141 0.6454 0.6438 0.6928 0.6572 0 1 0 0 0 0 51 0.7265 -0.019 0.6873 0.6454 0.6438 0.6928 0 0 1 0 0 0 52 0.7912 0.099 0.7265 0.6873 0.6454 0.6438 0 0 0 1 0 0 53 0.8114 0.742 0.7912 0.7265 0.6873 0.6454 0 0 0 0 1 0 54 0.8281 0.005 0.8114 0.7912 0.7265 0.6873 0 0 0 0 0 1 55 0.8393 0.448 0.8281 0.8114 0.7912 0.7265 0 0 0 0 0 0 M7 M8 M9 M10 M11 t 1 0 0 0 0 0 1 2 0 0 0 0 0 2 3 0 0 0 0 0 3 4 0 0 0 0 0 4 5 0 0 0 0 0 5 6 0 0 0 0 0 6 7 1 0 0 0 0 7 8 0 1 0 0 0 8 9 0 0 1 0 0 9 10 0 0 0 1 0 10 11 0 0 0 0 1 11 12 0 0 0 0 0 12 13 0 0 0 0 0 13 14 0 0 0 0 0 14 15 0 0 0 0 0 15 16 0 0 0 0 0 16 17 0 0 0 0 0 17 18 0 0 0 0 0 18 19 1 0 0 0 0 19 20 0 1 0 0 0 20 21 0 0 1 0 0 21 22 0 0 0 1 0 22 23 0 0 0 0 1 23 24 0 0 0 0 0 24 25 0 0 0 0 0 25 26 0 0 0 0 0 26 27 0 0 0 0 0 27 28 0 0 0 0 0 28 29 0 0 0 0 0 29 30 0 0 0 0 0 30 31 1 0 0 0 0 31 32 0 1 0 0 0 32 33 0 0 1 0 0 33 34 0 0 0 1 0 34 35 0 0 0 0 1 35 36 0 0 0 0 0 36 37 0 0 0 0 0 37 38 0 0 0 0 0 38 39 0 0 0 0 0 39 40 0 0 0 0 0 40 41 0 0 0 0 0 41 42 0 0 0 0 0 42 43 1 0 0 0 0 43 44 0 1 0 0 0 44 45 0 0 1 0 0 45 46 0 0 0 1 0 46 47 0 0 0 0 1 47 48 0 0 0 0 0 48 49 0 0 0 0 0 49 50 0 0 0 0 0 50 51 0 0 0 0 0 51 52 0 0 0 0 0 52 53 0 0 0 0 0 53 54 0 0 0 0 0 54 55 1 0 0 0 0 55 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) Amerikaanse_inflatie `Y[t-1]` 0.1055970 0.0094120 1.2059612 `Y[t-2]` `Y[t-3]` `Y[t-4]` -0.5272015 0.5478133 -0.3889426 M1 M2 M3 0.0293146 -0.0011163 0.0413735 M4 M5 M6 0.0121472 0.0212072 0.0097723 M7 M8 M9 -0.0136302 0.0219708 -0.0099637 M10 M11 t 0.0239631 0.0182904 0.0003243 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -0.085767 -0.011184 -0.003386 0.014212 0.064317 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 0.1055970 0.0496539 2.127 0.0402 * Amerikaanse_inflatie 0.0094120 0.0138101 0.682 0.4998 `Y[t-1]` 1.2059612 0.1833089 6.579 1.04e-07 *** `Y[t-2]` -0.5272015 0.2476778 -2.129 0.0400 * `Y[t-3]` 0.5478133 0.2389976 2.292 0.0277 * `Y[t-4]` -0.3889426 0.1517093 -2.564 0.0146 * M1 0.0293146 0.0210116 1.395 0.1713 M2 -0.0011163 0.0211641 -0.053 0.9582 M3 0.0413735 0.0210364 1.967 0.0567 . M4 0.0121472 0.0218176 0.557 0.5810 M5 0.0212072 0.0211599 1.002 0.3227 M6 0.0097723 0.0215680 0.453 0.6531 M7 -0.0136302 0.0212309 -0.642 0.5248 M8 0.0219708 0.0228594 0.961 0.3427 M9 -0.0099637 0.0232191 -0.429 0.6703 M10 0.0239631 0.0229115 1.046 0.3024 M11 0.0182904 0.0222309 0.823 0.4159 t 0.0003243 0.0002816 1.151 0.2569 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 0.03052 on 37 degrees of freedom Multiple R-squared: 0.9002, Adjusted R-squared: 0.8544 F-statistic: 19.64 on 17 and 37 DF, p-value: 1.493e-13 > 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.1457302763 0.2914605525 0.8542697 [2,] 0.0666558641 0.1333117283 0.9333441 [3,] 0.0236722145 0.0473444291 0.9763278 [4,] 0.0232310826 0.0464621652 0.9767689 [5,] 0.0158342423 0.0316684846 0.9841658 [6,] 0.0074427846 0.0148855693 0.9925572 [7,] 0.0028250229 0.0056500458 0.9971750 [8,] 0.0012221235 0.0024442471 0.9987779 [9,] 0.0004035254 0.0008070509 0.9995965 [10,] 0.0002344835 0.0004689671 0.9997655 [11,] 0.0006971880 0.0013943760 0.9993028 [12,] 0.0004908591 0.0009817181 0.9995091 [13,] 0.0026897377 0.0053794755 0.9973103 [14,] 0.0012669921 0.0025339841 0.9987330 > postscript(file="/var/www/html/rcomp/tmp/1zfto1258654759.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/2x8n21258654759.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/3q14p1258654759.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/49gsf1258654759.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/5mezc1258654759.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 = 55 Frequency = 1 1 2 3 4 5 6 -0.006622992 -0.006046421 -0.005629018 -0.028761318 0.019839086 -0.013419652 7 8 9 10 11 12 0.023092675 -0.006637142 0.004280193 -0.005428177 -0.016233934 0.027055159 13 14 15 16 17 18 -0.033845128 -0.003385842 -0.002078536 -0.006559497 -0.019209036 0.011388305 19 20 21 22 23 24 0.003766614 -0.008603717 0.040558497 -0.006801930 0.001030162 -0.013504858 25 26 27 28 29 30 -0.003357221 0.018069536 -0.004460685 -0.008947966 0.017035313 0.002713162 31 32 33 34 35 36 0.002207463 0.057913706 0.040927847 -0.025888359 -0.003472228 0.010392919 37 38 39 40 41 42 0.064316624 -0.013741681 0.020823317 0.005551081 0.018543584 -0.003792090 43 44 45 46 47 48 -0.032598613 -0.042672847 -0.085766537 0.038118465 0.018675999 -0.023943220 49 50 51 52 53 54 -0.020491282 0.005104408 -0.008655078 0.038717700 -0.036208948 0.003110274 55 0.003531861 > postscript(file="/var/www/html/rcomp/tmp/6gr2s1258654759.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 = 55 Frequency = 1 lag(myerror, k = 1) myerror 0 -0.006622992 NA 1 -0.006046421 -0.006622992 2 -0.005629018 -0.006046421 3 -0.028761318 -0.005629018 4 0.019839086 -0.028761318 5 -0.013419652 0.019839086 6 0.023092675 -0.013419652 7 -0.006637142 0.023092675 8 0.004280193 -0.006637142 9 -0.005428177 0.004280193 10 -0.016233934 -0.005428177 11 0.027055159 -0.016233934 12 -0.033845128 0.027055159 13 -0.003385842 -0.033845128 14 -0.002078536 -0.003385842 15 -0.006559497 -0.002078536 16 -0.019209036 -0.006559497 17 0.011388305 -0.019209036 18 0.003766614 0.011388305 19 -0.008603717 0.003766614 20 0.040558497 -0.008603717 21 -0.006801930 0.040558497 22 0.001030162 -0.006801930 23 -0.013504858 0.001030162 24 -0.003357221 -0.013504858 25 0.018069536 -0.003357221 26 -0.004460685 0.018069536 27 -0.008947966 -0.004460685 28 0.017035313 -0.008947966 29 0.002713162 0.017035313 30 0.002207463 0.002713162 31 0.057913706 0.002207463 32 0.040927847 0.057913706 33 -0.025888359 0.040927847 34 -0.003472228 -0.025888359 35 0.010392919 -0.003472228 36 0.064316624 0.010392919 37 -0.013741681 0.064316624 38 0.020823317 -0.013741681 39 0.005551081 0.020823317 40 0.018543584 0.005551081 41 -0.003792090 0.018543584 42 -0.032598613 -0.003792090 43 -0.042672847 -0.032598613 44 -0.085766537 -0.042672847 45 0.038118465 -0.085766537 46 0.018675999 0.038118465 47 -0.023943220 0.018675999 48 -0.020491282 -0.023943220 49 0.005104408 -0.020491282 50 -0.008655078 0.005104408 51 0.038717700 -0.008655078 52 -0.036208948 0.038717700 53 0.003110274 -0.036208948 54 0.003531861 0.003110274 55 NA 0.003531861 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -0.006046421 -0.006622992 [2,] -0.005629018 -0.006046421 [3,] -0.028761318 -0.005629018 [4,] 0.019839086 -0.028761318 [5,] -0.013419652 0.019839086 [6,] 0.023092675 -0.013419652 [7,] -0.006637142 0.023092675 [8,] 0.004280193 -0.006637142 [9,] -0.005428177 0.004280193 [10,] -0.016233934 -0.005428177 [11,] 0.027055159 -0.016233934 [12,] -0.033845128 0.027055159 [13,] -0.003385842 -0.033845128 [14,] -0.002078536 -0.003385842 [15,] -0.006559497 -0.002078536 [16,] -0.019209036 -0.006559497 [17,] 0.011388305 -0.019209036 [18,] 0.003766614 0.011388305 [19,] -0.008603717 0.003766614 [20,] 0.040558497 -0.008603717 [21,] -0.006801930 0.040558497 [22,] 0.001030162 -0.006801930 [23,] -0.013504858 0.001030162 [24,] -0.003357221 -0.013504858 [25,] 0.018069536 -0.003357221 [26,] -0.004460685 0.018069536 [27,] -0.008947966 -0.004460685 [28,] 0.017035313 -0.008947966 [29,] 0.002713162 0.017035313 [30,] 0.002207463 0.002713162 [31,] 0.057913706 0.002207463 [32,] 0.040927847 0.057913706 [33,] -0.025888359 0.040927847 [34,] -0.003472228 -0.025888359 [35,] 0.010392919 -0.003472228 [36,] 0.064316624 0.010392919 [37,] -0.013741681 0.064316624 [38,] 0.020823317 -0.013741681 [39,] 0.005551081 0.020823317 [40,] 0.018543584 0.005551081 [41,] -0.003792090 0.018543584 [42,] -0.032598613 -0.003792090 [43,] -0.042672847 -0.032598613 [44,] -0.085766537 -0.042672847 [45,] 0.038118465 -0.085766537 [46,] 0.018675999 0.038118465 [47,] -0.023943220 0.018675999 [48,] -0.020491282 -0.023943220 [49,] 0.005104408 -0.020491282 [50,] -0.008655078 0.005104408 [51,] 0.038717700 -0.008655078 [52,] -0.036208948 0.038717700 [53,] 0.003110274 -0.036208948 [54,] 0.003531861 0.003110274 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -0.006046421 -0.006622992 2 -0.005629018 -0.006046421 3 -0.028761318 -0.005629018 4 0.019839086 -0.028761318 5 -0.013419652 0.019839086 6 0.023092675 -0.013419652 7 -0.006637142 0.023092675 8 0.004280193 -0.006637142 9 -0.005428177 0.004280193 10 -0.016233934 -0.005428177 11 0.027055159 -0.016233934 12 -0.033845128 0.027055159 13 -0.003385842 -0.033845128 14 -0.002078536 -0.003385842 15 -0.006559497 -0.002078536 16 -0.019209036 -0.006559497 17 0.011388305 -0.019209036 18 0.003766614 0.011388305 19 -0.008603717 0.003766614 20 0.040558497 -0.008603717 21 -0.006801930 0.040558497 22 0.001030162 -0.006801930 23 -0.013504858 0.001030162 24 -0.003357221 -0.013504858 25 0.018069536 -0.003357221 26 -0.004460685 0.018069536 27 -0.008947966 -0.004460685 28 0.017035313 -0.008947966 29 0.002713162 0.017035313 30 0.002207463 0.002713162 31 0.057913706 0.002207463 32 0.040927847 0.057913706 33 -0.025888359 0.040927847 34 -0.003472228 -0.025888359 35 0.010392919 -0.003472228 36 0.064316624 0.010392919 37 -0.013741681 0.064316624 38 0.020823317 -0.013741681 39 0.005551081 0.020823317 40 0.018543584 0.005551081 41 -0.003792090 0.018543584 42 -0.032598613 -0.003792090 43 -0.042672847 -0.032598613 44 -0.085766537 -0.042672847 45 0.038118465 -0.085766537 46 0.018675999 0.038118465 47 -0.023943220 0.018675999 48 -0.020491282 -0.023943220 49 0.005104408 -0.020491282 50 -0.008655078 0.005104408 51 0.038717700 -0.008655078 52 -0.036208948 0.038717700 53 0.003110274 -0.036208948 54 0.003531861 0.003110274 > 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/7n8a91258654759.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/89ylu1258654759.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/97vbi1258654759.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/10tnpv1258654759.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/11kj8t1258654759.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/12lluy1258654759.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/131ueo1258654759.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/14wqwm1258654759.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/158zuw1258654759.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/16u6q81258654759.tab") + } > > system("convert tmp/1zfto1258654759.ps tmp/1zfto1258654759.png") > system("convert tmp/2x8n21258654759.ps tmp/2x8n21258654759.png") > system("convert tmp/3q14p1258654759.ps tmp/3q14p1258654759.png") > system("convert tmp/49gsf1258654759.ps tmp/49gsf1258654759.png") > system("convert tmp/5mezc1258654759.ps tmp/5mezc1258654759.png") > system("convert tmp/6gr2s1258654759.ps tmp/6gr2s1258654759.png") > system("convert tmp/7n8a91258654759.ps tmp/7n8a91258654759.png") > system("convert tmp/89ylu1258654759.ps tmp/89ylu1258654759.png") > system("convert tmp/97vbi1258654759.ps tmp/97vbi1258654759.png") > system("convert tmp/10tnpv1258654759.ps tmp/10tnpv1258654759.png") > > > proc.time() user system elapsed 2.322 1.545 2.690