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(1.4816,133.91,1.4562,133.14,1.4268,135.31,1.4088,133.09,1.4016,135.39,1.3650,131.85,1.3190,130.25,1.3050,127.65,1.2785,118.30,1.3239,119.73,1.3449,122.51,1.2732,123.28,1.3322,133.52,1.4369,153.20,1.4975,163.63,1.5770,168.45,1.5553,166.26,1.5557,162.31,1.5750,161.56,1.5527,156.59,1.4748,157.97,1.4718,158.68,1.4570,163.55,1.4684,162.89,1.4227,164.95,1.3896,159.82,1.3622,159.05,1.3716,166.76,1.3419,164.55,1.3511,163.22,1.3516,160.68,1.3242,155.24,1.3074,157.60,1.2999,156.56,1.3213,154.82,1.2881,151.11,1.2611,149.65,1.2727,148.99,1.2811,148.53,1.2684,146.70,1.2650,145.11,1.2770,142.70,1.2271,143.59,1.2020,140.96,1.1938,140.77,1.2103,139.81,1.1856,140.58,1.1786,139.59,1.2015,138.05,1.2256,136.06,1.2292,135.98,1.2037,134.75,1.2165,132.22,1.2694,135.37,1.2938,138.84,1.3201,138.83,1.3014,136.55,1.3119,135.63,1.3408,139.14,1.2991,136.09),dim=c(2,60),dimnames=list(c('dollar/euro','japanseyen/euro'),1:60)) > y <- array(NA,dim=c(2,60),dimnames=list(c('dollar/euro','japanseyen/euro'),1:60)) > for (i in 1:dim(x)[1]) + { + for (j in 1:dim(x)[2]) + { + y[i,j] <- as.numeric(x[i,j]) + } + } > par3 = '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 dollar/euro japanseyen/euro M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 1 1.4816 133.91 1 0 0 0 0 0 0 0 0 0 0 2 1.4562 133.14 0 1 0 0 0 0 0 0 0 0 0 3 1.4268 135.31 0 0 1 0 0 0 0 0 0 0 0 4 1.4088 133.09 0 0 0 1 0 0 0 0 0 0 0 5 1.4016 135.39 0 0 0 0 1 0 0 0 0 0 0 6 1.3650 131.85 0 0 0 0 0 1 0 0 0 0 0 7 1.3190 130.25 0 0 0 0 0 0 1 0 0 0 0 8 1.3050 127.65 0 0 0 0 0 0 0 1 0 0 0 9 1.2785 118.30 0 0 0 0 0 0 0 0 1 0 0 10 1.3239 119.73 0 0 0 0 0 0 0 0 0 1 0 11 1.3449 122.51 0 0 0 0 0 0 0 0 0 0 1 12 1.2732 123.28 0 0 0 0 0 0 0 0 0 0 0 13 1.3322 133.52 1 0 0 0 0 0 0 0 0 0 0 14 1.4369 153.20 0 1 0 0 0 0 0 0 0 0 0 15 1.4975 163.63 0 0 1 0 0 0 0 0 0 0 0 16 1.5770 168.45 0 0 0 1 0 0 0 0 0 0 0 17 1.5553 166.26 0 0 0 0 1 0 0 0 0 0 0 18 1.5557 162.31 0 0 0 0 0 1 0 0 0 0 0 19 1.5750 161.56 0 0 0 0 0 0 1 0 0 0 0 20 1.5527 156.59 0 0 0 0 0 0 0 1 0 0 0 21 1.4748 157.97 0 0 0 0 0 0 0 0 1 0 0 22 1.4718 158.68 0 0 0 0 0 0 0 0 0 1 0 23 1.4570 163.55 0 0 0 0 0 0 0 0 0 0 1 24 1.4684 162.89 0 0 0 0 0 0 0 0 0 0 0 25 1.4227 164.95 1 0 0 0 0 0 0 0 0 0 0 26 1.3896 159.82 0 1 0 0 0 0 0 0 0 0 0 27 1.3622 159.05 0 0 1 0 0 0 0 0 0 0 0 28 1.3716 166.76 0 0 0 1 0 0 0 0 0 0 0 29 1.3419 164.55 0 0 0 0 1 0 0 0 0 0 0 30 1.3511 163.22 0 0 0 0 0 1 0 0 0 0 0 31 1.3516 160.68 0 0 0 0 0 0 1 0 0 0 0 32 1.3242 155.24 0 0 0 0 0 0 0 1 0 0 0 33 1.3074 157.60 0 0 0 0 0 0 0 0 1 0 0 34 1.2999 156.56 0 0 0 0 0 0 0 0 0 1 0 35 1.3213 154.82 0 0 0 0 0 0 0 0 0 0 1 36 1.2881 151.11 0 0 0 0 0 0 0 0 0 0 0 37 1.2611 149.65 1 0 0 0 0 0 0 0 0 0 0 38 1.2727 148.99 0 1 0 0 0 0 0 0 0 0 0 39 1.2811 148.53 0 0 1 0 0 0 0 0 0 0 0 40 1.2684 146.70 0 0 0 1 0 0 0 0 0 0 0 41 1.2650 145.11 0 0 0 0 1 0 0 0 0 0 0 42 1.2770 142.70 0 0 0 0 0 1 0 0 0 0 0 43 1.2271 143.59 0 0 0 0 0 0 1 0 0 0 0 44 1.2020 140.96 0 0 0 0 0 0 0 1 0 0 0 45 1.1938 140.77 0 0 0 0 0 0 0 0 1 0 0 46 1.2103 139.81 0 0 0 0 0 0 0 0 0 1 0 47 1.1856 140.58 0 0 0 0 0 0 0 0 0 0 1 48 1.1786 139.59 0 0 0 0 0 0 0 0 0 0 0 49 1.2015 138.05 1 0 0 0 0 0 0 0 0 0 0 50 1.2256 136.06 0 1 0 0 0 0 0 0 0 0 0 51 1.2292 135.98 0 0 1 0 0 0 0 0 0 0 0 52 1.2037 134.75 0 0 0 1 0 0 0 0 0 0 0 53 1.2165 132.22 0 0 0 0 1 0 0 0 0 0 0 54 1.2694 135.37 0 0 0 0 0 1 0 0 0 0 0 55 1.2938 138.84 0 0 0 0 0 0 1 0 0 0 0 56 1.3201 138.83 0 0 0 0 0 0 0 1 0 0 0 57 1.3014 136.55 0 0 0 0 0 0 0 0 1 0 0 58 1.3119 135.63 0 0 0 0 0 0 0 0 0 1 0 59 1.3408 139.14 0 0 0 0 0 0 0 0 0 0 1 60 1.2991 136.09 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) `japanseyen/euro` M1 M2 0.736379 0.003963 0.032697 0.040255 M3 M4 M5 M6 0.034466 0.035260 0.030350 0.044334 M7 M8 M9 M10 0.034414 0.034319 0.011103 0.024101 M11 0.022384 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -0.13029 -0.07731 -0.01060 0.07925 0.18183 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 0.7363793 0.1485581 4.957 9.73e-06 *** `japanseyen/euro` 0.0039631 0.0009926 3.993 0.000228 *** M1 0.0326966 0.0638245 0.512 0.610848 M2 0.0402548 0.0639116 0.630 0.531842 M3 0.0344662 0.0640778 0.538 0.593197 M4 0.0352598 0.0642255 0.549 0.585604 M5 0.0303498 0.0640968 0.474 0.638048 M6 0.0443342 0.0639648 0.693 0.491657 M7 0.0344142 0.0639576 0.538 0.593062 M8 0.0343186 0.0638211 0.538 0.593300 M9 0.0111029 0.0638098 0.174 0.862613 M10 0.0241012 0.0638108 0.378 0.707356 M11 0.0223844 0.0638269 0.351 0.727376 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 0.1009 on 47 degrees of freedom Multiple R-squared: 0.281, Adjusted R-squared: 0.09747 F-statistic: 1.531 on 12 and 47 DF, p-value: 0.1468 > 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.5257523 0.94849532 0.47424766 [2,] 0.4190381 0.83807618 0.58096191 [3,] 0.3818961 0.76379214 0.61810393 [4,] 0.5057302 0.98853953 0.49426977 [5,] 0.6475641 0.70487185 0.35243593 [6,] 0.6297160 0.74056793 0.37028397 [7,] 0.6407215 0.71855710 0.35927855 [8,] 0.6613969 0.67720619 0.33860309 [9,] 0.6721169 0.65576627 0.32788314 [10,] 0.8230468 0.35390646 0.17695323 [11,] 0.8906777 0.21864461 0.10932231 [12,] 0.9255594 0.14888117 0.07444058 [13,] 0.9647854 0.07042912 0.03521456 [14,] 0.9776485 0.04470292 0.02235146 [15,] 0.9789533 0.04209349 0.02104675 [16,] 0.9769519 0.04609617 0.02304808 [17,] 0.9724441 0.05511176 0.02755588 [18,] 0.9620250 0.07594999 0.03797500 [19,] 0.9501572 0.09968556 0.04984278 [20,] 0.9285099 0.14298014 0.07149007 [21,] 0.8970948 0.20581048 0.10290524 [22,] 0.8808579 0.23828424 0.11914212 [23,] 0.8513846 0.29723086 0.14861543 [24,] 0.8135209 0.37295818 0.18647909 [25,] 0.8059877 0.38802456 0.19401228 [26,] 0.8841123 0.23177541 0.11588771 [27,] 0.9547642 0.09047170 0.04523585 [28,] 0.9417189 0.11656217 0.05828109 [29,] 0.8915392 0.21692153 0.10846076 > postscript(file="/var/www/html/rcomp/tmp/1h23d1258721873.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/2t2ov1258721873.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/3mt9c1258721873.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/4gig01258721873.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/5czfm1258721873.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > qqnorm(mysum$resid, main='Residual Normal Q-Q Plot') > qqline(mysum$resid) > grid() > dev.off() null device 1 > (myerror <- as.ts(mysum$resid)) Time Series: Start = 1 End = 60 Frequency = 1 1 2 3 4 5 1.818307e-01 1.519240e-01 1.197128e-01 1.097172e-01 9.831211e-02 6 7 8 9 10 6.175704e-02 3.201785e-02 2.841743e-02 6.218774e-02 8.892233e-02 11 12 13 14 15 1.006217e-01 4.825462e-02 3.397628e-02 5.312503e-02 7.817890e-02 16 17 18 19 20 1.377834e-01 1.296724e-01 1.317422e-01 1.639344e-01 1.614265e-01 21 22 23 24 25 1.012731e-01 8.246112e-02 5.007774e-02 8.647780e-02 -8.270553e-05 26 27 28 29 30 -2.041043e-02 -3.897029e-02 -6.091904e-02 -7.695073e-02 -7.646416e-02 31 32 33 34 35 -5.597807e-02 -6.172341e-02 -6.466053e-02 -8.103719e-02 -5.102475e-02 36 37 38 39 40 -4.713735e-02 -1.010479e-01 -9.439049e-02 -7.837889e-02 -8.462005e-02 41 42 43 44 45 -7.680883e-02 -6.924217e-02 -1.127494e-01 -1.273309e-01 -1.115622e-01 46 47 48 49 50 -1.042559e-01 -1.302908e-01 -1.109829e-01 -1.146764e-01 -9.024812e-02 51 52 53 54 55 -8.054248e-02 -1.019615e-01 -7.422499e-02 -4.779293e-02 -2.722484e-02 56 57 58 59 60 -7.895848e-04 1.276189e-02 1.390967e-02 3.061604e-02 2.338782e-02 > postscript(file="/var/www/html/rcomp/tmp/66mhg1258721873.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > dum <- cbind(lag(myerror,k=1),myerror) > dum Time Series: Start = 0 End = 60 Frequency = 1 lag(myerror, k = 1) myerror 0 1.818307e-01 NA 1 1.519240e-01 1.818307e-01 2 1.197128e-01 1.519240e-01 3 1.097172e-01 1.197128e-01 4 9.831211e-02 1.097172e-01 5 6.175704e-02 9.831211e-02 6 3.201785e-02 6.175704e-02 7 2.841743e-02 3.201785e-02 8 6.218774e-02 2.841743e-02 9 8.892233e-02 6.218774e-02 10 1.006217e-01 8.892233e-02 11 4.825462e-02 1.006217e-01 12 3.397628e-02 4.825462e-02 13 5.312503e-02 3.397628e-02 14 7.817890e-02 5.312503e-02 15 1.377834e-01 7.817890e-02 16 1.296724e-01 1.377834e-01 17 1.317422e-01 1.296724e-01 18 1.639344e-01 1.317422e-01 19 1.614265e-01 1.639344e-01 20 1.012731e-01 1.614265e-01 21 8.246112e-02 1.012731e-01 22 5.007774e-02 8.246112e-02 23 8.647780e-02 5.007774e-02 24 -8.270553e-05 8.647780e-02 25 -2.041043e-02 -8.270553e-05 26 -3.897029e-02 -2.041043e-02 27 -6.091904e-02 -3.897029e-02 28 -7.695073e-02 -6.091904e-02 29 -7.646416e-02 -7.695073e-02 30 -5.597807e-02 -7.646416e-02 31 -6.172341e-02 -5.597807e-02 32 -6.466053e-02 -6.172341e-02 33 -8.103719e-02 -6.466053e-02 34 -5.102475e-02 -8.103719e-02 35 -4.713735e-02 -5.102475e-02 36 -1.010479e-01 -4.713735e-02 37 -9.439049e-02 -1.010479e-01 38 -7.837889e-02 -9.439049e-02 39 -8.462005e-02 -7.837889e-02 40 -7.680883e-02 -8.462005e-02 41 -6.924217e-02 -7.680883e-02 42 -1.127494e-01 -6.924217e-02 43 -1.273309e-01 -1.127494e-01 44 -1.115622e-01 -1.273309e-01 45 -1.042559e-01 -1.115622e-01 46 -1.302908e-01 -1.042559e-01 47 -1.109829e-01 -1.302908e-01 48 -1.146764e-01 -1.109829e-01 49 -9.024812e-02 -1.146764e-01 50 -8.054248e-02 -9.024812e-02 51 -1.019615e-01 -8.054248e-02 52 -7.422499e-02 -1.019615e-01 53 -4.779293e-02 -7.422499e-02 54 -2.722484e-02 -4.779293e-02 55 -7.895848e-04 -2.722484e-02 56 1.276189e-02 -7.895848e-04 57 1.390967e-02 1.276189e-02 58 3.061604e-02 1.390967e-02 59 2.338782e-02 3.061604e-02 60 NA 2.338782e-02 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] 1.519240e-01 1.818307e-01 [2,] 1.197128e-01 1.519240e-01 [3,] 1.097172e-01 1.197128e-01 [4,] 9.831211e-02 1.097172e-01 [5,] 6.175704e-02 9.831211e-02 [6,] 3.201785e-02 6.175704e-02 [7,] 2.841743e-02 3.201785e-02 [8,] 6.218774e-02 2.841743e-02 [9,] 8.892233e-02 6.218774e-02 [10,] 1.006217e-01 8.892233e-02 [11,] 4.825462e-02 1.006217e-01 [12,] 3.397628e-02 4.825462e-02 [13,] 5.312503e-02 3.397628e-02 [14,] 7.817890e-02 5.312503e-02 [15,] 1.377834e-01 7.817890e-02 [16,] 1.296724e-01 1.377834e-01 [17,] 1.317422e-01 1.296724e-01 [18,] 1.639344e-01 1.317422e-01 [19,] 1.614265e-01 1.639344e-01 [20,] 1.012731e-01 1.614265e-01 [21,] 8.246112e-02 1.012731e-01 [22,] 5.007774e-02 8.246112e-02 [23,] 8.647780e-02 5.007774e-02 [24,] -8.270553e-05 8.647780e-02 [25,] -2.041043e-02 -8.270553e-05 [26,] -3.897029e-02 -2.041043e-02 [27,] -6.091904e-02 -3.897029e-02 [28,] -7.695073e-02 -6.091904e-02 [29,] -7.646416e-02 -7.695073e-02 [30,] -5.597807e-02 -7.646416e-02 [31,] -6.172341e-02 -5.597807e-02 [32,] -6.466053e-02 -6.172341e-02 [33,] -8.103719e-02 -6.466053e-02 [34,] -5.102475e-02 -8.103719e-02 [35,] -4.713735e-02 -5.102475e-02 [36,] -1.010479e-01 -4.713735e-02 [37,] -9.439049e-02 -1.010479e-01 [38,] -7.837889e-02 -9.439049e-02 [39,] -8.462005e-02 -7.837889e-02 [40,] -7.680883e-02 -8.462005e-02 [41,] -6.924217e-02 -7.680883e-02 [42,] -1.127494e-01 -6.924217e-02 [43,] -1.273309e-01 -1.127494e-01 [44,] -1.115622e-01 -1.273309e-01 [45,] -1.042559e-01 -1.115622e-01 [46,] -1.302908e-01 -1.042559e-01 [47,] -1.109829e-01 -1.302908e-01 [48,] -1.146764e-01 -1.109829e-01 [49,] -9.024812e-02 -1.146764e-01 [50,] -8.054248e-02 -9.024812e-02 [51,] -1.019615e-01 -8.054248e-02 [52,] -7.422499e-02 -1.019615e-01 [53,] -4.779293e-02 -7.422499e-02 [54,] -2.722484e-02 -4.779293e-02 [55,] -7.895848e-04 -2.722484e-02 [56,] 1.276189e-02 -7.895848e-04 [57,] 1.390967e-02 1.276189e-02 [58,] 3.061604e-02 1.390967e-02 [59,] 2.338782e-02 3.061604e-02 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 1.519240e-01 1.818307e-01 2 1.197128e-01 1.519240e-01 3 1.097172e-01 1.197128e-01 4 9.831211e-02 1.097172e-01 5 6.175704e-02 9.831211e-02 6 3.201785e-02 6.175704e-02 7 2.841743e-02 3.201785e-02 8 6.218774e-02 2.841743e-02 9 8.892233e-02 6.218774e-02 10 1.006217e-01 8.892233e-02 11 4.825462e-02 1.006217e-01 12 3.397628e-02 4.825462e-02 13 5.312503e-02 3.397628e-02 14 7.817890e-02 5.312503e-02 15 1.377834e-01 7.817890e-02 16 1.296724e-01 1.377834e-01 17 1.317422e-01 1.296724e-01 18 1.639344e-01 1.317422e-01 19 1.614265e-01 1.639344e-01 20 1.012731e-01 1.614265e-01 21 8.246112e-02 1.012731e-01 22 5.007774e-02 8.246112e-02 23 8.647780e-02 5.007774e-02 24 -8.270553e-05 8.647780e-02 25 -2.041043e-02 -8.270553e-05 26 -3.897029e-02 -2.041043e-02 27 -6.091904e-02 -3.897029e-02 28 -7.695073e-02 -6.091904e-02 29 -7.646416e-02 -7.695073e-02 30 -5.597807e-02 -7.646416e-02 31 -6.172341e-02 -5.597807e-02 32 -6.466053e-02 -6.172341e-02 33 -8.103719e-02 -6.466053e-02 34 -5.102475e-02 -8.103719e-02 35 -4.713735e-02 -5.102475e-02 36 -1.010479e-01 -4.713735e-02 37 -9.439049e-02 -1.010479e-01 38 -7.837889e-02 -9.439049e-02 39 -8.462005e-02 -7.837889e-02 40 -7.680883e-02 -8.462005e-02 41 -6.924217e-02 -7.680883e-02 42 -1.127494e-01 -6.924217e-02 43 -1.273309e-01 -1.127494e-01 44 -1.115622e-01 -1.273309e-01 45 -1.042559e-01 -1.115622e-01 46 -1.302908e-01 -1.042559e-01 47 -1.109829e-01 -1.302908e-01 48 -1.146764e-01 -1.109829e-01 49 -9.024812e-02 -1.146764e-01 50 -8.054248e-02 -9.024812e-02 51 -1.019615e-01 -8.054248e-02 52 -7.422499e-02 -1.019615e-01 53 -4.779293e-02 -7.422499e-02 54 -2.722484e-02 -4.779293e-02 55 -7.895848e-04 -2.722484e-02 56 1.276189e-02 -7.895848e-04 57 1.390967e-02 1.276189e-02 58 3.061604e-02 1.390967e-02 59 2.338782e-02 3.061604e-02 > 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/7fdn21258721873.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/8n2191258721873.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/9if5w1258721873.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/10z1dd1258721873.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/115y4y1258721873.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/12ss3c1258721873.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/13haq61258721873.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/14npbu1258721873.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/15168f1258721873.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/16hulz1258721873.tab") + } > > system("convert tmp/1h23d1258721873.ps tmp/1h23d1258721873.png") > system("convert tmp/2t2ov1258721873.ps tmp/2t2ov1258721873.png") > system("convert tmp/3mt9c1258721873.ps tmp/3mt9c1258721873.png") > system("convert tmp/4gig01258721873.ps tmp/4gig01258721873.png") > system("convert tmp/5czfm1258721873.ps tmp/5czfm1258721873.png") > system("convert tmp/66mhg1258721873.ps tmp/66mhg1258721873.png") > system("convert tmp/7fdn21258721873.ps tmp/7fdn21258721873.png") > system("convert tmp/8n2191258721873.ps tmp/8n2191258721873.png") > system("convert tmp/9if5w1258721873.ps tmp/9if5w1258721873.png") > system("convert tmp/10z1dd1258721873.ps tmp/10z1dd1258721873.png") > > > proc.time() user system elapsed 2.455 1.605 2.846