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(1.3322 + ,133.52 + ,7.4545 + ,0 + ,1.4369 + ,153.2 + ,7.4583 + ,0 + ,1.4975 + ,163.63 + ,7.4595 + ,0 + ,1.577 + ,168.45 + ,7.4599 + ,0 + ,1.5553 + ,166.26 + ,7.4586 + ,0 + ,1.5557 + ,162.31 + ,7.4609 + ,0 + ,1.575 + ,161.56 + ,7.4603 + ,0 + ,1.5527 + ,156.59 + ,7.4561 + ,0 + ,1.4748 + ,157.97 + ,7.454 + ,0 + ,1.4718 + ,158.68 + ,7.4505 + ,0 + ,1.457 + ,163.55 + ,7.4599 + ,0 + ,1.4684 + ,162.89 + ,7.4543 + ,0 + ,1.4227 + ,164.95 + ,7.4534 + ,0 + ,1.3896 + ,159.82 + ,7.4506 + ,0 + ,1.3622 + ,159.05 + ,7.4429 + ,0 + ,1.3716 + ,166.76 + ,7.441 + ,0 + ,1.3419 + ,164.55 + ,7.4452 + ,0 + ,1.3511 + ,163.22 + ,7.4519 + ,0 + ,1.3516 + ,160.68 + ,7.453 + ,0 + ,1.3242 + ,155.24 + ,7.4494 + ,0 + ,1.3074 + ,157.6 + ,7.4541 + ,0 + ,1.2999 + ,156.56 + ,7.4539 + ,0 + ,1.3213 + ,154.82 + ,7.4549 + ,0 + ,1.2881 + ,151.11 + ,7.4564 + ,0 + ,1.2611 + ,149.65 + ,7.4555 + ,0 + ,1.2727 + ,148.99 + ,7.4601 + ,0 + ,1.2811 + ,148.53 + ,7.4609 + ,0 + ,1.2684 + ,146.7 + ,7.4602 + ,0 + ,1.265 + ,145.11 + ,7.4566 + ,0 + ,1.277 + ,142.7 + ,7.4565 + ,0 + ,1.2271 + ,143.59 + ,7.4618 + ,0 + ,1.202 + ,140.96 + ,7.4612 + ,0 + ,1.1938 + ,140.77 + ,7.4641 + ,0 + ,1.2103 + ,139.81 + ,7.4613 + ,0 + ,1.1856 + ,140.58 + ,7.4541 + ,0 + ,1.1786 + ,139.59 + ,7.4596 + ,0 + ,1.2015 + ,138.05 + ,7.462 + ,0 + ,1.2256 + ,136.06 + ,7.4584 + ,0 + ,1.2292 + ,135.98 + ,7.4596 + ,0 + ,1.2037 + ,134.75 + ,7.4584 + ,0 + ,1.2165 + ,132.22 + ,7.4448 + ,0 + ,1.2694 + ,135.37 + ,7.4443 + ,1 + ,1.2938 + ,138.84 + ,7.4499 + ,1 + ,1.3201 + ,138.83 + ,7.4466 + ,1 + ,1.3014 + ,136.55 + ,7.4427 + ,1 + ,1.3119 + ,135.63 + ,7.4405 + ,1 + ,1.3408 + ,139.14 + ,7.4338 + ,1 + ,1.2991 + ,136.09 + ,7.4313 + ,1 + ,1.249 + ,135.97 + ,7.4379 + ,1 + ,1.2218 + ,134.51 + ,7.4381 + ,1 + ,1.2176 + ,134.54 + ,7.4365 + ,1 + ,1.2266 + ,134.08 + ,7.4355 + ,1 + ,1.2138 + ,132.86 + ,7.4342 + ,1 + ,1.2007 + ,134.48 + ,7.4405 + ,1 + ,1.1985 + ,129.08 + ,7.4436 + ,1 + ,1.2262 + ,133.13 + ,7.4493 + ,1 + ,1.2646 + ,134.78 + ,7.4511 + ,1 + ,1.2613 + ,134.13 + ,7.4481 + ,1 + ,1.2286 + ,132.43 + ,7.4419 + ,1 + ,1.1702 + ,127.84 + ,7.437 + ,1 + ,1.1692 + ,128.12 + ,7.4301 + ,1 + ,1.1222 + ,128.94 + ,7.4273 + ,1 + ,1.1139 + ,132.38 + ,7.4322 + ,1 + ,1.1372 + ,134.99 + ,7.4332 + ,1 + ,1.1663 + ,138.05 + ,7.425 + ,1 + ,1.1582 + ,135.83 + ,7.4246 + ,1 + ,1.0848 + ,130.12 + ,7.4255 + ,1 + ,1.0807 + ,128.16 + ,7.4274 + ,1 + ,1.0773 + ,128.6 + ,7.4317 + ,1 + ,1.0622 + ,126.12 + ,7.4324 + ,1 + ,1.0183 + ,124.2 + ,7.4264 + ,1 + ,1.0014 + ,121.65 + ,7.428 + ,1 + ,0.9811 + ,121.57 + ,7.4297 + ,1 + ,0.9808 + ,118.38 + ,7.4271 + ,1) + ,dim=c(4 + ,74) + ,dimnames=list(c('Dollar' + ,'Yen' + ,'DeenseKroon' + ,'(Y/N)') + ,1:74)) > y <- array(NA,dim=c(4,74),dimnames=list(c('Dollar','Yen','DeenseKroon','(Y/N)'),1:74)) > 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 Dollar Yen DeenseKroon (Y/N) M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t 1 1.3322 133.52 7.4545 0 1 0 0 0 0 0 0 0 0 0 0 1 2 1.4369 153.20 7.4583 0 0 1 0 0 0 0 0 0 0 0 0 2 3 1.4975 163.63 7.4595 0 0 0 1 0 0 0 0 0 0 0 0 3 4 1.5770 168.45 7.4599 0 0 0 0 1 0 0 0 0 0 0 0 4 5 1.5553 166.26 7.4586 0 0 0 0 0 1 0 0 0 0 0 0 5 6 1.5557 162.31 7.4609 0 0 0 0 0 0 1 0 0 0 0 0 6 7 1.5750 161.56 7.4603 0 0 0 0 0 0 0 1 0 0 0 0 7 8 1.5527 156.59 7.4561 0 0 0 0 0 0 0 0 1 0 0 0 8 9 1.4748 157.97 7.4540 0 0 0 0 0 0 0 0 0 1 0 0 9 10 1.4718 158.68 7.4505 0 0 0 0 0 0 0 0 0 0 1 0 10 11 1.4570 163.55 7.4599 0 0 0 0 0 0 0 0 0 0 0 1 11 12 1.4684 162.89 7.4543 0 0 0 0 0 0 0 0 0 0 0 0 12 13 1.4227 164.95 7.4534 0 1 0 0 0 0 0 0 0 0 0 0 13 14 1.3896 159.82 7.4506 0 0 1 0 0 0 0 0 0 0 0 0 14 15 1.3622 159.05 7.4429 0 0 0 1 0 0 0 0 0 0 0 0 15 16 1.3716 166.76 7.4410 0 0 0 0 1 0 0 0 0 0 0 0 16 17 1.3419 164.55 7.4452 0 0 0 0 0 1 0 0 0 0 0 0 17 18 1.3511 163.22 7.4519 0 0 0 0 0 0 1 0 0 0 0 0 18 19 1.3516 160.68 7.4530 0 0 0 0 0 0 0 1 0 0 0 0 19 20 1.3242 155.24 7.4494 0 0 0 0 0 0 0 0 1 0 0 0 20 21 1.3074 157.60 7.4541 0 0 0 0 0 0 0 0 0 1 0 0 21 22 1.2999 156.56 7.4539 0 0 0 0 0 0 0 0 0 0 1 0 22 23 1.3213 154.82 7.4549 0 0 0 0 0 0 0 0 0 0 0 1 23 24 1.2881 151.11 7.4564 0 0 0 0 0 0 0 0 0 0 0 0 24 25 1.2611 149.65 7.4555 0 1 0 0 0 0 0 0 0 0 0 0 25 26 1.2727 148.99 7.4601 0 0 1 0 0 0 0 0 0 0 0 0 26 27 1.2811 148.53 7.4609 0 0 0 1 0 0 0 0 0 0 0 0 27 28 1.2684 146.70 7.4602 0 0 0 0 1 0 0 0 0 0 0 0 28 29 1.2650 145.11 7.4566 0 0 0 0 0 1 0 0 0 0 0 0 29 30 1.2770 142.70 7.4565 0 0 0 0 0 0 1 0 0 0 0 0 30 31 1.2271 143.59 7.4618 0 0 0 0 0 0 0 1 0 0 0 0 31 32 1.2020 140.96 7.4612 0 0 0 0 0 0 0 0 1 0 0 0 32 33 1.1938 140.77 7.4641 0 0 0 0 0 0 0 0 0 1 0 0 33 34 1.2103 139.81 7.4613 0 0 0 0 0 0 0 0 0 0 1 0 34 35 1.1856 140.58 7.4541 0 0 0 0 0 0 0 0 0 0 0 1 35 36 1.1786 139.59 7.4596 0 0 0 0 0 0 0 0 0 0 0 0 36 37 1.2015 138.05 7.4620 0 1 0 0 0 0 0 0 0 0 0 0 37 38 1.2256 136.06 7.4584 0 0 1 0 0 0 0 0 0 0 0 0 38 39 1.2292 135.98 7.4596 0 0 0 1 0 0 0 0 0 0 0 0 39 40 1.2037 134.75 7.4584 0 0 0 0 1 0 0 0 0 0 0 0 40 41 1.2165 132.22 7.4448 0 0 0 0 0 1 0 0 0 0 0 0 41 42 1.2694 135.37 7.4443 1 0 0 0 0 0 1 0 0 0 0 0 42 43 1.2938 138.84 7.4499 1 0 0 0 0 0 0 1 0 0 0 0 43 44 1.3201 138.83 7.4466 1 0 0 0 0 0 0 0 1 0 0 0 44 45 1.3014 136.55 7.4427 1 0 0 0 0 0 0 0 0 1 0 0 45 46 1.3119 135.63 7.4405 1 0 0 0 0 0 0 0 0 0 1 0 46 47 1.3408 139.14 7.4338 1 0 0 0 0 0 0 0 0 0 0 1 47 48 1.2991 136.09 7.4313 1 0 0 0 0 0 0 0 0 0 0 0 48 49 1.2490 135.97 7.4379 1 1 0 0 0 0 0 0 0 0 0 0 49 50 1.2218 134.51 7.4381 1 0 1 0 0 0 0 0 0 0 0 0 50 51 1.2176 134.54 7.4365 1 0 0 1 0 0 0 0 0 0 0 0 51 52 1.2266 134.08 7.4355 1 0 0 0 1 0 0 0 0 0 0 0 52 53 1.2138 132.86 7.4342 1 0 0 0 0 1 0 0 0 0 0 0 53 54 1.2007 134.48 7.4405 1 0 0 0 0 0 1 0 0 0 0 0 54 55 1.1985 129.08 7.4436 1 0 0 0 0 0 0 1 0 0 0 0 55 56 1.2262 133.13 7.4493 1 0 0 0 0 0 0 0 1 0 0 0 56 57 1.2646 134.78 7.4511 1 0 0 0 0 0 0 0 0 1 0 0 57 58 1.2613 134.13 7.4481 1 0 0 0 0 0 0 0 0 0 1 0 58 59 1.2286 132.43 7.4419 1 0 0 0 0 0 0 0 0 0 0 1 59 60 1.1702 127.84 7.4370 1 0 0 0 0 0 0 0 0 0 0 0 60 61 1.1692 128.12 7.4301 1 1 0 0 0 0 0 0 0 0 0 0 61 62 1.1222 128.94 7.4273 1 0 1 0 0 0 0 0 0 0 0 0 62 63 1.1139 132.38 7.4322 1 0 0 1 0 0 0 0 0 0 0 0 63 64 1.1372 134.99 7.4332 1 0 0 0 1 0 0 0 0 0 0 0 64 65 1.1663 138.05 7.4250 1 0 0 0 0 1 0 0 0 0 0 0 65 66 1.1582 135.83 7.4246 1 0 0 0 0 0 1 0 0 0 0 0 66 67 1.0848 130.12 7.4255 1 0 0 0 0 0 0 1 0 0 0 0 67 68 1.0807 128.16 7.4274 1 0 0 0 0 0 0 0 1 0 0 0 68 69 1.0773 128.60 7.4317 1 0 0 0 0 0 0 0 0 1 0 0 69 70 1.0622 126.12 7.4324 1 0 0 0 0 0 0 0 0 0 1 0 70 71 1.0183 124.20 7.4264 1 0 0 0 0 0 0 0 0 0 0 1 71 72 1.0014 121.65 7.4280 1 0 0 0 0 0 0 0 0 0 0 0 72 73 0.9811 121.57 7.4297 1 1 0 0 0 0 0 0 0 0 0 0 73 74 0.9808 118.38 7.4271 1 0 1 0 0 0 0 0 0 0 0 0 74 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) Yen DeenseKroon `(Y/N)` M1 M2 -1.756e+01 3.505e-03 2.483e+00 2.177e-01 -2.333e-02 -1.457e-02 M3 M4 M5 M6 M7 M8 -7.963e-03 7.466e-03 2.391e-02 5.658e-04 -6.519e-03 4.405e-03 M9 M10 M11 t -8.202e-03 6.128e-03 6.421e-03 -6.975e-03 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -0.07026 -0.02514 -0.01224 0.02734 0.09810 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) -1.756e+01 6.494e+00 -2.704 0.008979 ** Yen 3.505e-03 9.641e-04 3.635 0.000591 *** DeenseKroon 2.483e+00 8.632e-01 2.877 0.005611 ** `(Y/N)` 2.177e-01 2.342e-02 9.297 4.31e-13 *** M1 -2.333e-02 2.352e-02 -0.992 0.325427 M2 -1.457e-02 2.331e-02 -0.625 0.534267 M3 -7.963e-03 2.417e-02 -0.329 0.743026 M4 7.466e-03 2.435e-02 0.307 0.760213 M5 2.391e-02 2.437e-02 0.981 0.330700 M6 5.658e-04 2.436e-02 0.023 0.981550 M7 -6.519e-03 2.448e-02 -0.266 0.791003 M8 4.405e-03 2.430e-02 0.181 0.856798 M9 -8.202e-03 2.454e-02 -0.334 0.739357 M10 6.128e-03 2.427e-02 0.253 0.801531 M11 6.421e-03 2.416e-02 0.266 0.791395 t -6.975e-03 7.738e-04 -9.014 1.26e-12 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 0.04168 on 58 degrees of freedom Multiple R-squared: 0.9279, Adjusted R-squared: 0.9092 F-statistic: 49.75 on 15 and 58 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.8534554 0.293089265 0.146544632 [2,] 0.7578631 0.484273748 0.242136874 [3,] 0.6988465 0.602306966 0.301153483 [4,] 0.6254897 0.749020546 0.374510273 [5,] 0.7870875 0.425825087 0.212912544 [6,] 0.7471100 0.505779907 0.252889953 [7,] 0.8009001 0.398199759 0.199099879 [8,] 0.7981367 0.403726554 0.201863277 [9,] 0.7580326 0.483934741 0.241967370 [10,] 0.6960475 0.607904971 0.303952486 [11,] 0.7083044 0.583391255 0.291695627 [12,] 0.7362763 0.527447483 0.263723742 [13,] 0.6854136 0.629172820 0.314586410 [14,] 0.6999124 0.600175287 0.300087644 [15,] 0.7102201 0.579559817 0.289779909 [16,] 0.7125322 0.574935687 0.287467843 [17,] 0.8314520 0.337095995 0.168547998 [18,] 0.9400840 0.119831995 0.059915998 [19,] 0.9834530 0.033093905 0.016546953 [20,] 0.9947854 0.010429144 0.005214572 [21,] 0.9954152 0.009169623 0.004584812 [22,] 0.9951371 0.009725869 0.004862934 [23,] 0.9969900 0.006020006 0.003010003 [24,] 0.9952461 0.009507827 0.004753914 [25,] 0.9966576 0.006684744 0.003342372 [26,] 0.9946161 0.010767736 0.005383868 [27,] 0.9920020 0.015995914 0.007997957 [28,] 0.9861149 0.027770201 0.013885101 [29,] 0.9818675 0.036264950 0.018132475 [30,] 0.9704831 0.059033779 0.029516889 [31,] 0.9658679 0.068264233 0.034132117 [32,] 0.9882575 0.023485001 0.011742501 [33,] 0.9734120 0.053175968 0.026587984 [34,] 0.9446428 0.110714411 0.055357206 [35,] 0.8923236 0.215352701 0.107676350 [36,] 0.9074446 0.185110726 0.092555363 [37,] 0.8257289 0.348542265 0.174271132 > postscript(file="/var/www/html/rcomp/tmp/1vqbg1227535501.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/2r3gh1227535501.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/3lmom1227535501.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/4jiqm1227535501.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/5f2a61227535501.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 = 74 Frequency = 1 1 2 3 4 5 6 -0.058665509 -0.034155179 -0.012723815 0.040437067 0.020171427 0.059022582 7 8 9 10 11 12 0.096500632 0.098100261 0.040161862 0.036010000 -0.012519347 0.028496561 13 14 15 16 17 18 0.008114990 -0.001833065 -0.007047098 -0.028402982 -0.070257133 -0.042715142 19 20 21 22 23 24 -0.021985452 -0.025328650 -0.042488644 -0.053202466 -0.021505416 -0.032032228 25 26 27 28 29 30 -0.021377300 -0.020668338 -0.012277576 -0.025278803 -0.023635476 0.027378579 31 32 33 34 35 36 -0.024743015 -0.043084532 -0.038237485 -0.018774887 -0.021610865 -0.025403957 37 38 39 40 41 42 0.027236184 0.065470117 0.066735745 0.040073397 0.086044956 -0.058251940 43 44 45 46 47 48 -0.045860642 -0.015279306 0.003279539 0.015111920 0.055031407 0.043625031 49 50 51 52 53 54 0.007858309 -0.016502095 -0.016468512 -0.011826146 -0.026591333 -0.030694816 55 56 57 58 59 60 -0.007608486 -0.012206623 0.035523520 0.034596342 0.029933558 0.013184519 61 62 63 64 65 66 0.058641587 0.013940643 -0.018218744 -0.015002533 0.014267559 0.045260737 67 68 69 70 71 72 0.003696962 -0.002201151 0.001761208 -0.013740909 -0.029329338 -0.027869925 73 74 -0.021808260 -0.006252084 > postscript(file="/var/www/html/rcomp/tmp/6oxbj1227535501.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 = 74 Frequency = 1 lag(myerror, k = 1) myerror 0 -0.058665509 NA 1 -0.034155179 -0.058665509 2 -0.012723815 -0.034155179 3 0.040437067 -0.012723815 4 0.020171427 0.040437067 5 0.059022582 0.020171427 6 0.096500632 0.059022582 7 0.098100261 0.096500632 8 0.040161862 0.098100261 9 0.036010000 0.040161862 10 -0.012519347 0.036010000 11 0.028496561 -0.012519347 12 0.008114990 0.028496561 13 -0.001833065 0.008114990 14 -0.007047098 -0.001833065 15 -0.028402982 -0.007047098 16 -0.070257133 -0.028402982 17 -0.042715142 -0.070257133 18 -0.021985452 -0.042715142 19 -0.025328650 -0.021985452 20 -0.042488644 -0.025328650 21 -0.053202466 -0.042488644 22 -0.021505416 -0.053202466 23 -0.032032228 -0.021505416 24 -0.021377300 -0.032032228 25 -0.020668338 -0.021377300 26 -0.012277576 -0.020668338 27 -0.025278803 -0.012277576 28 -0.023635476 -0.025278803 29 0.027378579 -0.023635476 30 -0.024743015 0.027378579 31 -0.043084532 -0.024743015 32 -0.038237485 -0.043084532 33 -0.018774887 -0.038237485 34 -0.021610865 -0.018774887 35 -0.025403957 -0.021610865 36 0.027236184 -0.025403957 37 0.065470117 0.027236184 38 0.066735745 0.065470117 39 0.040073397 0.066735745 40 0.086044956 0.040073397 41 -0.058251940 0.086044956 42 -0.045860642 -0.058251940 43 -0.015279306 -0.045860642 44 0.003279539 -0.015279306 45 0.015111920 0.003279539 46 0.055031407 0.015111920 47 0.043625031 0.055031407 48 0.007858309 0.043625031 49 -0.016502095 0.007858309 50 -0.016468512 -0.016502095 51 -0.011826146 -0.016468512 52 -0.026591333 -0.011826146 53 -0.030694816 -0.026591333 54 -0.007608486 -0.030694816 55 -0.012206623 -0.007608486 56 0.035523520 -0.012206623 57 0.034596342 0.035523520 58 0.029933558 0.034596342 59 0.013184519 0.029933558 60 0.058641587 0.013184519 61 0.013940643 0.058641587 62 -0.018218744 0.013940643 63 -0.015002533 -0.018218744 64 0.014267559 -0.015002533 65 0.045260737 0.014267559 66 0.003696962 0.045260737 67 -0.002201151 0.003696962 68 0.001761208 -0.002201151 69 -0.013740909 0.001761208 70 -0.029329338 -0.013740909 71 -0.027869925 -0.029329338 72 -0.021808260 -0.027869925 73 -0.006252084 -0.021808260 74 NA -0.006252084 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -0.034155179 -0.058665509 [2,] -0.012723815 -0.034155179 [3,] 0.040437067 -0.012723815 [4,] 0.020171427 0.040437067 [5,] 0.059022582 0.020171427 [6,] 0.096500632 0.059022582 [7,] 0.098100261 0.096500632 [8,] 0.040161862 0.098100261 [9,] 0.036010000 0.040161862 [10,] -0.012519347 0.036010000 [11,] 0.028496561 -0.012519347 [12,] 0.008114990 0.028496561 [13,] -0.001833065 0.008114990 [14,] -0.007047098 -0.001833065 [15,] -0.028402982 -0.007047098 [16,] -0.070257133 -0.028402982 [17,] -0.042715142 -0.070257133 [18,] -0.021985452 -0.042715142 [19,] -0.025328650 -0.021985452 [20,] -0.042488644 -0.025328650 [21,] -0.053202466 -0.042488644 [22,] -0.021505416 -0.053202466 [23,] -0.032032228 -0.021505416 [24,] -0.021377300 -0.032032228 [25,] -0.020668338 -0.021377300 [26,] -0.012277576 -0.020668338 [27,] -0.025278803 -0.012277576 [28,] -0.023635476 -0.025278803 [29,] 0.027378579 -0.023635476 [30,] -0.024743015 0.027378579 [31,] -0.043084532 -0.024743015 [32,] -0.038237485 -0.043084532 [33,] -0.018774887 -0.038237485 [34,] -0.021610865 -0.018774887 [35,] -0.025403957 -0.021610865 [36,] 0.027236184 -0.025403957 [37,] 0.065470117 0.027236184 [38,] 0.066735745 0.065470117 [39,] 0.040073397 0.066735745 [40,] 0.086044956 0.040073397 [41,] -0.058251940 0.086044956 [42,] -0.045860642 -0.058251940 [43,] -0.015279306 -0.045860642 [44,] 0.003279539 -0.015279306 [45,] 0.015111920 0.003279539 [46,] 0.055031407 0.015111920 [47,] 0.043625031 0.055031407 [48,] 0.007858309 0.043625031 [49,] -0.016502095 0.007858309 [50,] -0.016468512 -0.016502095 [51,] -0.011826146 -0.016468512 [52,] -0.026591333 -0.011826146 [53,] -0.030694816 -0.026591333 [54,] -0.007608486 -0.030694816 [55,] -0.012206623 -0.007608486 [56,] 0.035523520 -0.012206623 [57,] 0.034596342 0.035523520 [58,] 0.029933558 0.034596342 [59,] 0.013184519 0.029933558 [60,] 0.058641587 0.013184519 [61,] 0.013940643 0.058641587 [62,] -0.018218744 0.013940643 [63,] -0.015002533 -0.018218744 [64,] 0.014267559 -0.015002533 [65,] 0.045260737 0.014267559 [66,] 0.003696962 0.045260737 [67,] -0.002201151 0.003696962 [68,] 0.001761208 -0.002201151 [69,] -0.013740909 0.001761208 [70,] -0.029329338 -0.013740909 [71,] -0.027869925 -0.029329338 [72,] -0.021808260 -0.027869925 [73,] -0.006252084 -0.021808260 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -0.034155179 -0.058665509 2 -0.012723815 -0.034155179 3 0.040437067 -0.012723815 4 0.020171427 0.040437067 5 0.059022582 0.020171427 6 0.096500632 0.059022582 7 0.098100261 0.096500632 8 0.040161862 0.098100261 9 0.036010000 0.040161862 10 -0.012519347 0.036010000 11 0.028496561 -0.012519347 12 0.008114990 0.028496561 13 -0.001833065 0.008114990 14 -0.007047098 -0.001833065 15 -0.028402982 -0.007047098 16 -0.070257133 -0.028402982 17 -0.042715142 -0.070257133 18 -0.021985452 -0.042715142 19 -0.025328650 -0.021985452 20 -0.042488644 -0.025328650 21 -0.053202466 -0.042488644 22 -0.021505416 -0.053202466 23 -0.032032228 -0.021505416 24 -0.021377300 -0.032032228 25 -0.020668338 -0.021377300 26 -0.012277576 -0.020668338 27 -0.025278803 -0.012277576 28 -0.023635476 -0.025278803 29 0.027378579 -0.023635476 30 -0.024743015 0.027378579 31 -0.043084532 -0.024743015 32 -0.038237485 -0.043084532 33 -0.018774887 -0.038237485 34 -0.021610865 -0.018774887 35 -0.025403957 -0.021610865 36 0.027236184 -0.025403957 37 0.065470117 0.027236184 38 0.066735745 0.065470117 39 0.040073397 0.066735745 40 0.086044956 0.040073397 41 -0.058251940 0.086044956 42 -0.045860642 -0.058251940 43 -0.015279306 -0.045860642 44 0.003279539 -0.015279306 45 0.015111920 0.003279539 46 0.055031407 0.015111920 47 0.043625031 0.055031407 48 0.007858309 0.043625031 49 -0.016502095 0.007858309 50 -0.016468512 -0.016502095 51 -0.011826146 -0.016468512 52 -0.026591333 -0.011826146 53 -0.030694816 -0.026591333 54 -0.007608486 -0.030694816 55 -0.012206623 -0.007608486 56 0.035523520 -0.012206623 57 0.034596342 0.035523520 58 0.029933558 0.034596342 59 0.013184519 0.029933558 60 0.058641587 0.013184519 61 0.013940643 0.058641587 62 -0.018218744 0.013940643 63 -0.015002533 -0.018218744 64 0.014267559 -0.015002533 65 0.045260737 0.014267559 66 0.003696962 0.045260737 67 -0.002201151 0.003696962 68 0.001761208 -0.002201151 69 -0.013740909 0.001761208 70 -0.029329338 -0.013740909 71 -0.027869925 -0.029329338 72 -0.021808260 -0.027869925 73 -0.006252084 -0.021808260 > 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/7af8s1227535501.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/8tbf41227535501.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/91pl11227535501.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/106t2w1227535501.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/11k9w41227535501.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/12jdjo1227535501.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/136d1e1227535501.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/14iqmu1227535501.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/15ws061227535501.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/161q2g1227535501.tab") + } > > system("convert tmp/1vqbg1227535501.ps tmp/1vqbg1227535501.png") > system("convert tmp/2r3gh1227535501.ps tmp/2r3gh1227535501.png") > system("convert tmp/3lmom1227535501.ps tmp/3lmom1227535501.png") > system("convert tmp/4jiqm1227535501.ps tmp/4jiqm1227535501.png") > system("convert tmp/5f2a61227535501.ps tmp/5f2a61227535501.png") > system("convert tmp/6oxbj1227535501.ps tmp/6oxbj1227535501.png") > system("convert tmp/7af8s1227535501.ps tmp/7af8s1227535501.png") > system("convert tmp/8tbf41227535501.ps tmp/8tbf41227535501.png") > system("convert tmp/91pl11227535501.ps tmp/91pl11227535501.png") > system("convert tmp/106t2w1227535501.ps tmp/106t2w1227535501.png") > > > proc.time() user system elapsed 2.636 1.598 3.490