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 = 'No Linear Trend' > par2 = 'Do not include Seasonal 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) 1 1.3322 133.52 7.4545 0 2 1.4369 153.20 7.4583 0 3 1.4975 163.63 7.4595 0 4 1.5770 168.45 7.4599 0 5 1.5553 166.26 7.4586 0 6 1.5557 162.31 7.4609 0 7 1.5750 161.56 7.4603 0 8 1.5527 156.59 7.4561 0 9 1.4748 157.97 7.4540 0 10 1.4718 158.68 7.4505 0 11 1.4570 163.55 7.4599 0 12 1.4684 162.89 7.4543 0 13 1.4227 164.95 7.4534 0 14 1.3896 159.82 7.4506 0 15 1.3622 159.05 7.4429 0 16 1.3716 166.76 7.4410 0 17 1.3419 164.55 7.4452 0 18 1.3511 163.22 7.4519 0 19 1.3516 160.68 7.4530 0 20 1.3242 155.24 7.4494 0 21 1.3074 157.60 7.4541 0 22 1.2999 156.56 7.4539 0 23 1.3213 154.82 7.4549 0 24 1.2881 151.11 7.4564 0 25 1.2611 149.65 7.4555 0 26 1.2727 148.99 7.4601 0 27 1.2811 148.53 7.4609 0 28 1.2684 146.70 7.4602 0 29 1.2650 145.11 7.4566 0 30 1.2770 142.70 7.4565 0 31 1.2271 143.59 7.4618 0 32 1.2020 140.96 7.4612 0 33 1.1938 140.77 7.4641 0 34 1.2103 139.81 7.4613 0 35 1.1856 140.58 7.4541 0 36 1.1786 139.59 7.4596 0 37 1.2015 138.05 7.4620 0 38 1.2256 136.06 7.4584 0 39 1.2292 135.98 7.4596 0 40 1.2037 134.75 7.4584 0 41 1.2165 132.22 7.4448 0 42 1.2694 135.37 7.4443 1 43 1.2938 138.84 7.4499 1 44 1.3201 138.83 7.4466 1 45 1.3014 136.55 7.4427 1 46 1.3119 135.63 7.4405 1 47 1.3408 139.14 7.4338 1 48 1.2991 136.09 7.4313 1 49 1.2490 135.97 7.4379 1 50 1.2218 134.51 7.4381 1 51 1.2176 134.54 7.4365 1 52 1.2266 134.08 7.4355 1 53 1.2138 132.86 7.4342 1 54 1.2007 134.48 7.4405 1 55 1.1985 129.08 7.4436 1 56 1.2262 133.13 7.4493 1 57 1.2646 134.78 7.4511 1 58 1.2613 134.13 7.4481 1 59 1.2286 132.43 7.4419 1 60 1.1702 127.84 7.4370 1 61 1.1692 128.12 7.4301 1 62 1.1222 128.94 7.4273 1 63 1.1139 132.38 7.4322 1 64 1.1372 134.99 7.4332 1 65 1.1663 138.05 7.4250 1 66 1.1582 135.83 7.4246 1 67 1.0848 130.12 7.4255 1 68 1.0807 128.16 7.4274 1 69 1.0773 128.60 7.4317 1 70 1.0622 126.12 7.4324 1 71 1.0183 124.20 7.4264 1 72 1.0014 121.65 7.4280 1 73 0.9811 121.57 7.4297 1 74 0.9808 118.38 7.4271 1 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) Yen DeenseKroon `(Y/N)` -38.70200 0.01032 5.16050 0.14811 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -0.08682 -0.04453 -0.01239 0.02688 0.18736 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) -3.870e+01 7.880e+00 -4.912 5.71e-06 *** Yen 1.032e-02 7.938e-04 13.000 < 2e-16 *** DeenseKroon 5.160e+00 1.056e+00 4.885 6.31e-06 *** `(Y/N)` 1.481e-01 3.006e-02 4.927 5.38e-06 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 0.05971 on 70 degrees of freedom Multiple R-squared: 0.8213, Adjusted R-squared: 0.8137 F-statistic: 107.3 on 3 and 70 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.3474966 6.949932e-01 6.525034e-01 [2,] 0.5691301 8.617397e-01 4.308699e-01 [3,] 0.5273558 9.452884e-01 4.726442e-01 [4,] 0.4675150 9.350299e-01 5.324850e-01 [5,] 0.7030259 5.939483e-01 2.969741e-01 [6,] 0.6970867 6.058266e-01 3.029133e-01 [7,] 0.7953592 4.092816e-01 2.046408e-01 [8,] 0.7825455 4.349090e-01 2.174545e-01 [9,] 0.7317655 5.364690e-01 2.682345e-01 [10,] 0.6527097 6.945806e-01 3.472903e-01 [11,] 0.6576920 6.846160e-01 3.423080e-01 [12,] 0.8090424 3.819151e-01 1.909576e-01 [13,] 0.8785267 2.429466e-01 1.214733e-01 [14,] 0.8704575 2.590850e-01 1.295425e-01 [15,] 0.9563128 8.737446e-02 4.368723e-02 [16,] 0.9831855 3.362897e-02 1.681448e-02 [17,] 0.9875372 2.492558e-02 1.246279e-02 [18,] 0.9931086 1.378288e-02 6.891439e-03 [19,] 0.9959957 8.008700e-03 4.004350e-03 [20,] 0.9981524 3.695148e-03 1.847574e-03 [21,] 0.9986899 2.620133e-03 1.310067e-03 [22,] 0.9986977 2.604550e-03 1.302275e-03 [23,] 0.9978966 4.206886e-03 2.103443e-03 [24,] 0.9965756 6.848824e-03 3.424412e-03 [25,] 0.9972889 5.422272e-03 2.711136e-03 [26,] 0.9974071 5.185843e-03 2.592922e-03 [27,] 0.9985033 2.993475e-03 1.496738e-03 [28,] 0.9981280 3.744001e-03 1.872000e-03 [29,] 0.9980825 3.834980e-03 1.917490e-03 [30,] 0.9991237 1.752637e-03 8.763185e-04 [31,] 0.9994192 1.161665e-03 5.808323e-04 [32,] 0.9991573 1.685493e-03 8.427467e-04 [33,] 0.9988943 2.211386e-03 1.105693e-03 [34,] 0.9992878 1.424309e-03 7.121543e-04 [35,] 0.9993852 1.229689e-03 6.148447e-04 [36,] 0.9988395 2.321014e-03 1.160507e-03 [37,] 0.9985840 2.831978e-03 1.415989e-03 [38,] 0.9974803 5.039393e-03 2.519696e-03 [39,] 0.9960215 7.957092e-03 3.978546e-03 [40,] 0.9965106 6.978875e-03 3.489438e-03 [41,] 0.9983753 3.249476e-03 1.624738e-03 [42,] 0.9998031 3.938716e-04 1.969358e-04 [43,] 0.9996524 6.951049e-04 3.475525e-04 [44,] 0.9993336 1.332749e-03 6.663747e-04 [45,] 0.9987853 2.429471e-03 1.214736e-03 [46,] 0.9984326 3.134897e-03 1.567449e-03 [47,] 0.9985081 2.983767e-03 1.491884e-03 [48,] 0.9973546 5.290838e-03 2.645419e-03 [49,] 0.9955617 8.876589e-03 4.438294e-03 [50,] 0.9926208 1.475833e-02 7.379165e-03 [51,] 0.9870698 2.586044e-02 1.293022e-02 [52,] 0.9758000 4.840000e-02 2.420000e-02 [53,] 0.9624993 7.500134e-02 3.750067e-02 [54,] 0.9777492 4.450157e-02 2.225079e-02 [55,] 0.9997411 5.178882e-04 2.589441e-04 [56,] 0.9999744 5.118115e-05 2.559058e-05 [57,] 0.9998798 2.404451e-04 1.202225e-04 [58,] 0.9995188 9.623584e-04 4.811792e-04 [59,] 0.9981628 3.674452e-03 1.837226e-03 [60,] 0.9921997 1.560054e-02 7.800271e-03 [61,] 0.9689981 6.200380e-02 3.100190e-02 > postscript(file="/var/www/html/rcomp/tmp/177hq1227535224.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/2246f1227535224.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/3qp9x1227535224.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/4ipnv1227535224.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/5xcec1227535224.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.187363086 0.069359702 0.016131682 0.043826090 0.051435081 0.080729108 7 8 9 10 11 12 0.110865250 0.161528708 0.080224444 0.087959139 -0.025606934 0.021502923 13 14 15 16 17 18 -0.040811398 -0.006521472 0.013760609 -0.046600031 -0.075167389 -0.086817411 19 20 21 22 23 24 -0.065781690 -0.018464231 -0.083873283 -0.079608600 -0.045412663 -0.048066987 25 26 27 28 29 30 -0.055355643 -0.060682876 -0.051664172 -0.041866605 -0.010280340 0.027106406 31 32 33 34 35 36 -0.059328853 -0.054191503 -0.075396190 -0.034539793 -0.030030439 -0.055196591 37 38 39 40 41 42 -0.028789310 0.034424870 0.032657855 0.026043797 0.135135655 0.010001272 43 44 45 46 47 48 -0.030307197 0.013125647 0.038080717 0.069428023 0.096680900 0.099357510 49 50 51 52 53 54 0.016436591 0.003271387 0.007018591 0.025926194 0.032424988 -0.029904217 55 56 57 58 59 60 0.007625107 -0.035884891 -0.023801445 -0.004912083 0.011926656 0.026180942 61 62 63 64 65 66 0.057898844 0.016886012 -0.052200514 -0.060995668 -0.021158136 -0.004284001 67 68 69 70 71 72 -0.023402443 -0.017080601 -0.047211455 -0.040330722 -0.033453729 -0.032295060 73 74 -0.060542325 -0.014504894 > postscript(file="/var/www/html/rcomp/tmp/63a5l1227535224.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.187363086 NA 1 0.069359702 0.187363086 2 0.016131682 0.069359702 3 0.043826090 0.016131682 4 0.051435081 0.043826090 5 0.080729108 0.051435081 6 0.110865250 0.080729108 7 0.161528708 0.110865250 8 0.080224444 0.161528708 9 0.087959139 0.080224444 10 -0.025606934 0.087959139 11 0.021502923 -0.025606934 12 -0.040811398 0.021502923 13 -0.006521472 -0.040811398 14 0.013760609 -0.006521472 15 -0.046600031 0.013760609 16 -0.075167389 -0.046600031 17 -0.086817411 -0.075167389 18 -0.065781690 -0.086817411 19 -0.018464231 -0.065781690 20 -0.083873283 -0.018464231 21 -0.079608600 -0.083873283 22 -0.045412663 -0.079608600 23 -0.048066987 -0.045412663 24 -0.055355643 -0.048066987 25 -0.060682876 -0.055355643 26 -0.051664172 -0.060682876 27 -0.041866605 -0.051664172 28 -0.010280340 -0.041866605 29 0.027106406 -0.010280340 30 -0.059328853 0.027106406 31 -0.054191503 -0.059328853 32 -0.075396190 -0.054191503 33 -0.034539793 -0.075396190 34 -0.030030439 -0.034539793 35 -0.055196591 -0.030030439 36 -0.028789310 -0.055196591 37 0.034424870 -0.028789310 38 0.032657855 0.034424870 39 0.026043797 0.032657855 40 0.135135655 0.026043797 41 0.010001272 0.135135655 42 -0.030307197 0.010001272 43 0.013125647 -0.030307197 44 0.038080717 0.013125647 45 0.069428023 0.038080717 46 0.096680900 0.069428023 47 0.099357510 0.096680900 48 0.016436591 0.099357510 49 0.003271387 0.016436591 50 0.007018591 0.003271387 51 0.025926194 0.007018591 52 0.032424988 0.025926194 53 -0.029904217 0.032424988 54 0.007625107 -0.029904217 55 -0.035884891 0.007625107 56 -0.023801445 -0.035884891 57 -0.004912083 -0.023801445 58 0.011926656 -0.004912083 59 0.026180942 0.011926656 60 0.057898844 0.026180942 61 0.016886012 0.057898844 62 -0.052200514 0.016886012 63 -0.060995668 -0.052200514 64 -0.021158136 -0.060995668 65 -0.004284001 -0.021158136 66 -0.023402443 -0.004284001 67 -0.017080601 -0.023402443 68 -0.047211455 -0.017080601 69 -0.040330722 -0.047211455 70 -0.033453729 -0.040330722 71 -0.032295060 -0.033453729 72 -0.060542325 -0.032295060 73 -0.014504894 -0.060542325 74 NA -0.014504894 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] 0.069359702 0.187363086 [2,] 0.016131682 0.069359702 [3,] 0.043826090 0.016131682 [4,] 0.051435081 0.043826090 [5,] 0.080729108 0.051435081 [6,] 0.110865250 0.080729108 [7,] 0.161528708 0.110865250 [8,] 0.080224444 0.161528708 [9,] 0.087959139 0.080224444 [10,] -0.025606934 0.087959139 [11,] 0.021502923 -0.025606934 [12,] -0.040811398 0.021502923 [13,] -0.006521472 -0.040811398 [14,] 0.013760609 -0.006521472 [15,] -0.046600031 0.013760609 [16,] -0.075167389 -0.046600031 [17,] -0.086817411 -0.075167389 [18,] -0.065781690 -0.086817411 [19,] -0.018464231 -0.065781690 [20,] -0.083873283 -0.018464231 [21,] -0.079608600 -0.083873283 [22,] -0.045412663 -0.079608600 [23,] -0.048066987 -0.045412663 [24,] -0.055355643 -0.048066987 [25,] -0.060682876 -0.055355643 [26,] -0.051664172 -0.060682876 [27,] -0.041866605 -0.051664172 [28,] -0.010280340 -0.041866605 [29,] 0.027106406 -0.010280340 [30,] -0.059328853 0.027106406 [31,] -0.054191503 -0.059328853 [32,] -0.075396190 -0.054191503 [33,] -0.034539793 -0.075396190 [34,] -0.030030439 -0.034539793 [35,] -0.055196591 -0.030030439 [36,] -0.028789310 -0.055196591 [37,] 0.034424870 -0.028789310 [38,] 0.032657855 0.034424870 [39,] 0.026043797 0.032657855 [40,] 0.135135655 0.026043797 [41,] 0.010001272 0.135135655 [42,] -0.030307197 0.010001272 [43,] 0.013125647 -0.030307197 [44,] 0.038080717 0.013125647 [45,] 0.069428023 0.038080717 [46,] 0.096680900 0.069428023 [47,] 0.099357510 0.096680900 [48,] 0.016436591 0.099357510 [49,] 0.003271387 0.016436591 [50,] 0.007018591 0.003271387 [51,] 0.025926194 0.007018591 [52,] 0.032424988 0.025926194 [53,] -0.029904217 0.032424988 [54,] 0.007625107 -0.029904217 [55,] -0.035884891 0.007625107 [56,] -0.023801445 -0.035884891 [57,] -0.004912083 -0.023801445 [58,] 0.011926656 -0.004912083 [59,] 0.026180942 0.011926656 [60,] 0.057898844 0.026180942 [61,] 0.016886012 0.057898844 [62,] -0.052200514 0.016886012 [63,] -0.060995668 -0.052200514 [64,] -0.021158136 -0.060995668 [65,] -0.004284001 -0.021158136 [66,] -0.023402443 -0.004284001 [67,] -0.017080601 -0.023402443 [68,] -0.047211455 -0.017080601 [69,] -0.040330722 -0.047211455 [70,] -0.033453729 -0.040330722 [71,] -0.032295060 -0.033453729 [72,] -0.060542325 -0.032295060 [73,] -0.014504894 -0.060542325 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 0.069359702 0.187363086 2 0.016131682 0.069359702 3 0.043826090 0.016131682 4 0.051435081 0.043826090 5 0.080729108 0.051435081 6 0.110865250 0.080729108 7 0.161528708 0.110865250 8 0.080224444 0.161528708 9 0.087959139 0.080224444 10 -0.025606934 0.087959139 11 0.021502923 -0.025606934 12 -0.040811398 0.021502923 13 -0.006521472 -0.040811398 14 0.013760609 -0.006521472 15 -0.046600031 0.013760609 16 -0.075167389 -0.046600031 17 -0.086817411 -0.075167389 18 -0.065781690 -0.086817411 19 -0.018464231 -0.065781690 20 -0.083873283 -0.018464231 21 -0.079608600 -0.083873283 22 -0.045412663 -0.079608600 23 -0.048066987 -0.045412663 24 -0.055355643 -0.048066987 25 -0.060682876 -0.055355643 26 -0.051664172 -0.060682876 27 -0.041866605 -0.051664172 28 -0.010280340 -0.041866605 29 0.027106406 -0.010280340 30 -0.059328853 0.027106406 31 -0.054191503 -0.059328853 32 -0.075396190 -0.054191503 33 -0.034539793 -0.075396190 34 -0.030030439 -0.034539793 35 -0.055196591 -0.030030439 36 -0.028789310 -0.055196591 37 0.034424870 -0.028789310 38 0.032657855 0.034424870 39 0.026043797 0.032657855 40 0.135135655 0.026043797 41 0.010001272 0.135135655 42 -0.030307197 0.010001272 43 0.013125647 -0.030307197 44 0.038080717 0.013125647 45 0.069428023 0.038080717 46 0.096680900 0.069428023 47 0.099357510 0.096680900 48 0.016436591 0.099357510 49 0.003271387 0.016436591 50 0.007018591 0.003271387 51 0.025926194 0.007018591 52 0.032424988 0.025926194 53 -0.029904217 0.032424988 54 0.007625107 -0.029904217 55 -0.035884891 0.007625107 56 -0.023801445 -0.035884891 57 -0.004912083 -0.023801445 58 0.011926656 -0.004912083 59 0.026180942 0.011926656 60 0.057898844 0.026180942 61 0.016886012 0.057898844 62 -0.052200514 0.016886012 63 -0.060995668 -0.052200514 64 -0.021158136 -0.060995668 65 -0.004284001 -0.021158136 66 -0.023402443 -0.004284001 67 -0.017080601 -0.023402443 68 -0.047211455 -0.017080601 69 -0.040330722 -0.047211455 70 -0.033453729 -0.040330722 71 -0.032295060 -0.033453729 72 -0.060542325 -0.032295060 73 -0.014504894 -0.060542325 > 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/7m28j1227535224.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/8udfr1227535224.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/9ptq01227535224.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/108yga1227535224.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/11ytub1227535224.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/127wqx1227535224.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/135fvm1227535224.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/14wgc01227535224.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/15tew51227535224.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/162iie1227535224.tab") + } > > system("convert tmp/177hq1227535224.ps tmp/177hq1227535224.png") > system("convert tmp/2246f1227535224.ps tmp/2246f1227535224.png") > system("convert tmp/3qp9x1227535224.ps tmp/3qp9x1227535224.png") > system("convert tmp/4ipnv1227535224.ps tmp/4ipnv1227535224.png") > system("convert tmp/5xcec1227535224.ps tmp/5xcec1227535224.png") > system("convert tmp/63a5l1227535224.ps tmp/63a5l1227535224.png") > system("convert tmp/7m28j1227535224.ps tmp/7m28j1227535224.png") > system("convert tmp/8udfr1227535224.ps tmp/8udfr1227535224.png") > system("convert tmp/9ptq01227535224.ps tmp/9ptq01227535224.png") > system("convert tmp/108yga1227535224.ps tmp/108yga1227535224.png") > > > proc.time() user system elapsed 2.655 1.593 6.653