R version 2.15.2 (2012-10-26) -- "Trick or Treat" Copyright (C) 2012 The R Foundation for Statistical Computing ISBN 3-900051-07-0 Platform: i686-pc-linux-gnu (32-bit) 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.2999,0,1.3074,1,1.3242,1,1.3516,1,1.3511,0,1.3419,0,1.3716,1,1.3622,0,1.3896,1,1.4227,1,1.4684,1,1.457,0,1.4718,1,1.4748,1,1.5527,1,1.5751,1,1.5557,0,1.5553,0,1.577,1,1.4975,0,1.437,0,1.3322,0,1.2732,0,1.3449,1,1.3239,0,1.2785,0,1.305,1,1.319,1,1.365,1,1.4016,1,1.4088,1,1.4268,1,1.4562,1,1.4816,1,1.4914,1,1.4614,0,1.4272,0,1.3686,0,1.3569,0,1.3406,0,1.2565,0,1.2209,0,1.277,1,1.2894,1,1.3067,1,1.3898,1,1.3661,0,1.322,0,1.336,0,1.3649,1,1.3999,1,1.4442,1,1.4349,0,1.4388,1,1.4264,0,1.4343,1,1.377,0,1.3706,0,1.3556,0,1.3179,0,1.2905,0,1.3224,1,1.3201,0,1.3162,0,1.2789,0,1.2526,0,1.2288,0,1.24,1,1.2856,1),dim=c(2,69),dimnames=list(c('Exchange_rate','Dummies'),1:69)) > y <- array(NA,dim=c(2,69),dimnames=list(c('Exchange_rate','Dummies'),1:69)) > 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' > library(lattice) > library(lmtest) Loading required package: zoo Attaching package: 'zoo' The following object(s) are masked from 'package:base': as.Date, 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 Exchange_rate Dummies M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t 1 1.2999 0 1 0 0 0 0 0 0 0 0 0 0 1 2 1.3074 1 0 1 0 0 0 0 0 0 0 0 0 2 3 1.3242 1 0 0 1 0 0 0 0 0 0 0 0 3 4 1.3516 1 0 0 0 1 0 0 0 0 0 0 0 4 5 1.3511 0 0 0 0 0 1 0 0 0 0 0 0 5 6 1.3419 0 0 0 0 0 0 1 0 0 0 0 0 6 7 1.3716 1 0 0 0 0 0 0 1 0 0 0 0 7 8 1.3622 0 0 0 0 0 0 0 0 1 0 0 0 8 9 1.3896 1 0 0 0 0 0 0 0 0 1 0 0 9 10 1.4227 1 0 0 0 0 0 0 0 0 0 1 0 10 11 1.4684 1 0 0 0 0 0 0 0 0 0 0 1 11 12 1.4570 0 0 0 0 0 0 0 0 0 0 0 0 12 13 1.4718 1 1 0 0 0 0 0 0 0 0 0 0 13 14 1.4748 1 0 1 0 0 0 0 0 0 0 0 0 14 15 1.5527 1 0 0 1 0 0 0 0 0 0 0 0 15 16 1.5751 1 0 0 0 1 0 0 0 0 0 0 0 16 17 1.5557 0 0 0 0 0 1 0 0 0 0 0 0 17 18 1.5553 0 0 0 0 0 0 1 0 0 0 0 0 18 19 1.5770 1 0 0 0 0 0 0 1 0 0 0 0 19 20 1.4975 0 0 0 0 0 0 0 0 1 0 0 0 20 21 1.4370 0 0 0 0 0 0 0 0 0 1 0 0 21 22 1.3322 0 0 0 0 0 0 0 0 0 0 1 0 22 23 1.2732 0 0 0 0 0 0 0 0 0 0 0 1 23 24 1.3449 1 0 0 0 0 0 0 0 0 0 0 0 24 25 1.3239 0 1 0 0 0 0 0 0 0 0 0 0 25 26 1.2785 0 0 1 0 0 0 0 0 0 0 0 0 26 27 1.3050 1 0 0 1 0 0 0 0 0 0 0 0 27 28 1.3190 1 0 0 0 1 0 0 0 0 0 0 0 28 29 1.3650 1 0 0 0 0 1 0 0 0 0 0 0 29 30 1.4016 1 0 0 0 0 0 1 0 0 0 0 0 30 31 1.4088 1 0 0 0 0 0 0 1 0 0 0 0 31 32 1.4268 1 0 0 0 0 0 0 0 1 0 0 0 32 33 1.4562 1 0 0 0 0 0 0 0 0 1 0 0 33 34 1.4816 1 0 0 0 0 0 0 0 0 0 1 0 34 35 1.4914 1 0 0 0 0 0 0 0 0 0 0 1 35 36 1.4614 0 0 0 0 0 0 0 0 0 0 0 0 36 37 1.4272 0 1 0 0 0 0 0 0 0 0 0 0 37 38 1.3686 0 0 1 0 0 0 0 0 0 0 0 0 38 39 1.3569 0 0 0 1 0 0 0 0 0 0 0 0 39 40 1.3406 0 0 0 0 1 0 0 0 0 0 0 0 40 41 1.2565 0 0 0 0 0 1 0 0 0 0 0 0 41 42 1.2209 0 0 0 0 0 0 1 0 0 0 0 0 42 43 1.2770 1 0 0 0 0 0 0 1 0 0 0 0 43 44 1.2894 1 0 0 0 0 0 0 0 1 0 0 0 44 45 1.3067 1 0 0 0 0 0 0 0 0 1 0 0 45 46 1.3898 1 0 0 0 0 0 0 0 0 0 1 0 46 47 1.3661 0 0 0 0 0 0 0 0 0 0 0 1 47 48 1.3220 0 0 0 0 0 0 0 0 0 0 0 0 48 49 1.3360 0 1 0 0 0 0 0 0 0 0 0 0 49 50 1.3649 1 0 1 0 0 0 0 0 0 0 0 0 50 51 1.3999 1 0 0 1 0 0 0 0 0 0 0 0 51 52 1.4442 1 0 0 0 1 0 0 0 0 0 0 0 52 53 1.4349 0 0 0 0 0 1 0 0 0 0 0 0 53 54 1.4388 1 0 0 0 0 0 1 0 0 0 0 0 54 55 1.4264 0 0 0 0 0 0 0 1 0 0 0 0 55 56 1.4343 1 0 0 0 0 0 0 0 1 0 0 0 56 57 1.3770 0 0 0 0 0 0 0 0 0 1 0 0 57 58 1.3706 0 0 0 0 0 0 0 0 0 0 1 0 58 59 1.3556 0 0 0 0 0 0 0 0 0 0 0 1 59 60 1.3179 0 0 0 0 0 0 0 0 0 0 0 0 60 61 1.2905 0 1 0 0 0 0 0 0 0 0 0 0 61 62 1.3224 1 0 1 0 0 0 0 0 0 0 0 0 62 63 1.3201 0 0 0 1 0 0 0 0 0 0 0 0 63 64 1.3162 0 0 0 0 1 0 0 0 0 0 0 0 64 65 1.2789 0 0 0 0 0 1 0 0 0 0 0 0 65 66 1.2526 0 0 0 0 0 0 1 0 0 0 0 0 66 67 1.2288 0 0 0 0 0 0 0 1 0 0 0 0 67 68 1.2400 1 0 0 0 0 0 0 0 1 0 0 0 68 69 1.2856 1 0 0 0 0 0 0 0 0 1 0 0 69 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) Dummies M1 M2 M3 M4 1.427591 0.031414 -0.028770 -0.048448 -0.023269 -0.007141 M5 M6 M7 M8 M9 M10 -0.007388 -0.016312 -0.012221 -0.017309 -0.015514 0.003217 M11 t 0.002538 -0.001479 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -0.128273 -0.062196 0.003268 0.060788 0.170638 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 1.4275906 0.0438135 32.583 < 2e-16 *** Dummies 0.0314144 0.0234095 1.342 0.18513 M1 -0.0287697 0.0522715 -0.550 0.58428 M2 -0.0484482 0.0532687 -0.910 0.36705 M3 -0.0232695 0.0532733 -0.437 0.66397 M4 -0.0071408 0.0532832 -0.134 0.89388 M5 -0.0073882 0.0521985 -0.142 0.88796 M6 -0.0163119 0.0522814 -0.312 0.75622 M7 -0.0122213 0.0533454 -0.229 0.81964 M8 -0.0173093 0.0533770 -0.324 0.74695 M9 -0.0155139 0.0534139 -0.290 0.77257 M10 0.0032168 0.0552788 0.058 0.95381 M11 0.0025384 0.0547023 0.046 0.96316 t -0.0014787 0.0005369 -2.754 0.00796 ** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 0.08619 on 55 degrees of freedom Multiple R-squared: 0.1908, Adjusted R-squared: -0.0004567 F-statistic: 0.9976 on 13 and 55 DF, p-value: 0.4662 > 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.017721227 0.035442455 0.982278773 [2,] 0.004239829 0.008479659 0.995760171 [3,] 0.001015577 0.002031153 0.998984423 [4,] 0.004543644 0.009087288 0.995456356 [5,] 0.030039662 0.060079324 0.969960338 [6,] 0.162997183 0.325994366 0.837002817 [7,] 0.468580802 0.937161603 0.531419198 [8,] 0.945900865 0.108198269 0.054099135 [9,] 0.956582055 0.086835890 0.043417945 [10,] 0.958404019 0.083191962 0.041595981 [11,] 0.984438720 0.031122560 0.015561280 [12,] 0.992978302 0.014043395 0.007021698 [13,] 0.993979890 0.012040220 0.006020110 [14,] 0.990401312 0.019197376 0.009598688 [15,] 0.983880364 0.032239272 0.016119636 [16,] 0.974219866 0.051560267 0.025780134 [17,] 0.962721333 0.074557334 0.037278667 [18,] 0.948441548 0.103116904 0.051558452 [19,] 0.933843482 0.132313036 0.066156518 [20,] 0.929379270 0.141241461 0.070620730 [21,] 0.916115499 0.167769002 0.083884501 [22,] 0.881251949 0.237496102 0.118748051 [23,] 0.829546382 0.340907236 0.170453618 [24,] 0.773438929 0.453122143 0.226561071 [25,] 0.813931368 0.372137263 0.186068632 [26,] 0.901703495 0.196593011 0.098296505 [27,] 0.928372061 0.143255878 0.071627939 [28,] 0.956087039 0.087825922 0.043912961 [29,] 0.982135714 0.035728572 0.017864286 [30,] 0.978396278 0.043207444 0.021603722 [31,] 0.974332841 0.051334317 0.025667159 [32,] 0.978871271 0.042257458 0.021128729 [33,] 0.973162839 0.053674321 0.026837161 [34,] 0.978065154 0.043869692 0.021934846 [35,] 0.980934515 0.038130969 0.019065485 [36,] 0.979676385 0.040647229 0.020323615 > postscript(file="/var/fisher/rcomp/tmp/1buy61356033783.ps",horizontal=F,onefile=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/fisher/rcomp/tmp/2qrva1356033783.ps",horizontal=F,onefile=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/fisher/rcomp/tmp/3tryk1356033783.ps",horizontal=F,onefile=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/fisher/rcomp/tmp/42r3g1356033783.ps",horizontal=F,onefile=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/fisher/rcomp/tmp/5v5go1356033783.ps",horizontal=F,onefile=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 = 69 Frequency = 1 1 2 3 4 5 6 -0.097442167 -0.100199347 -0.107099347 -0.094349347 -0.061708833 -0.060506440 7 8 9 10 11 12 -0.064832681 -0.036251653 -0.040582681 -0.024734726 0.023122401 0.047153891 13 14 15 16 17 18 0.060787962 0.084945143 0.139145143 0.146895143 0.160635657 0.170638051 19 20 21 22 23 24 0.158311810 0.116792838 0.055976172 -0.066075874 -0.122918746 -0.078615980 25 26 27 28 29 30 -0.037953185 -0.062196004 -0.090810366 -0.091460366 -0.043734213 0.003268180 31 32 33 34 35 36 0.007856301 0.032422967 0.061506301 0.069654255 0.081611383 0.087042872 37 38 39 40 41 42 0.083091306 0.045648486 0.010248486 -0.020701514 -0.103075361 -0.128272967 43 44 45 46 47 48 -0.106199208 -0.087232542 -0.070249208 -0.004401254 0.005470235 -0.034612637 49 50 51 52 53 54 0.009635796 0.028278616 0.039578616 0.069228616 0.093069130 0.075957162 55 56 57 58 59 60 0.092359644 0.075411949 0.049209644 0.025557599 0.012714726 -0.020968146 61 62 63 64 65 66 -0.018119713 0.003523106 0.008937468 -0.009612532 -0.045186379 -0.061083986 67 68 69 -0.087495865 -0.101143560 -0.055860227 > postscript(file="/var/fisher/rcomp/tmp/6sf3g1356033783.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > dum <- cbind(lag(myerror,k=1),myerror) > dum Time Series: Start = 0 End = 69 Frequency = 1 lag(myerror, k = 1) myerror 0 -0.097442167 NA 1 -0.100199347 -0.097442167 2 -0.107099347 -0.100199347 3 -0.094349347 -0.107099347 4 -0.061708833 -0.094349347 5 -0.060506440 -0.061708833 6 -0.064832681 -0.060506440 7 -0.036251653 -0.064832681 8 -0.040582681 -0.036251653 9 -0.024734726 -0.040582681 10 0.023122401 -0.024734726 11 0.047153891 0.023122401 12 0.060787962 0.047153891 13 0.084945143 0.060787962 14 0.139145143 0.084945143 15 0.146895143 0.139145143 16 0.160635657 0.146895143 17 0.170638051 0.160635657 18 0.158311810 0.170638051 19 0.116792838 0.158311810 20 0.055976172 0.116792838 21 -0.066075874 0.055976172 22 -0.122918746 -0.066075874 23 -0.078615980 -0.122918746 24 -0.037953185 -0.078615980 25 -0.062196004 -0.037953185 26 -0.090810366 -0.062196004 27 -0.091460366 -0.090810366 28 -0.043734213 -0.091460366 29 0.003268180 -0.043734213 30 0.007856301 0.003268180 31 0.032422967 0.007856301 32 0.061506301 0.032422967 33 0.069654255 0.061506301 34 0.081611383 0.069654255 35 0.087042872 0.081611383 36 0.083091306 0.087042872 37 0.045648486 0.083091306 38 0.010248486 0.045648486 39 -0.020701514 0.010248486 40 -0.103075361 -0.020701514 41 -0.128272967 -0.103075361 42 -0.106199208 -0.128272967 43 -0.087232542 -0.106199208 44 -0.070249208 -0.087232542 45 -0.004401254 -0.070249208 46 0.005470235 -0.004401254 47 -0.034612637 0.005470235 48 0.009635796 -0.034612637 49 0.028278616 0.009635796 50 0.039578616 0.028278616 51 0.069228616 0.039578616 52 0.093069130 0.069228616 53 0.075957162 0.093069130 54 0.092359644 0.075957162 55 0.075411949 0.092359644 56 0.049209644 0.075411949 57 0.025557599 0.049209644 58 0.012714726 0.025557599 59 -0.020968146 0.012714726 60 -0.018119713 -0.020968146 61 0.003523106 -0.018119713 62 0.008937468 0.003523106 63 -0.009612532 0.008937468 64 -0.045186379 -0.009612532 65 -0.061083986 -0.045186379 66 -0.087495865 -0.061083986 67 -0.101143560 -0.087495865 68 -0.055860227 -0.101143560 69 NA -0.055860227 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -0.100199347 -0.097442167 [2,] -0.107099347 -0.100199347 [3,] -0.094349347 -0.107099347 [4,] -0.061708833 -0.094349347 [5,] -0.060506440 -0.061708833 [6,] -0.064832681 -0.060506440 [7,] -0.036251653 -0.064832681 [8,] -0.040582681 -0.036251653 [9,] -0.024734726 -0.040582681 [10,] 0.023122401 -0.024734726 [11,] 0.047153891 0.023122401 [12,] 0.060787962 0.047153891 [13,] 0.084945143 0.060787962 [14,] 0.139145143 0.084945143 [15,] 0.146895143 0.139145143 [16,] 0.160635657 0.146895143 [17,] 0.170638051 0.160635657 [18,] 0.158311810 0.170638051 [19,] 0.116792838 0.158311810 [20,] 0.055976172 0.116792838 [21,] -0.066075874 0.055976172 [22,] -0.122918746 -0.066075874 [23,] -0.078615980 -0.122918746 [24,] -0.037953185 -0.078615980 [25,] -0.062196004 -0.037953185 [26,] -0.090810366 -0.062196004 [27,] -0.091460366 -0.090810366 [28,] -0.043734213 -0.091460366 [29,] 0.003268180 -0.043734213 [30,] 0.007856301 0.003268180 [31,] 0.032422967 0.007856301 [32,] 0.061506301 0.032422967 [33,] 0.069654255 0.061506301 [34,] 0.081611383 0.069654255 [35,] 0.087042872 0.081611383 [36,] 0.083091306 0.087042872 [37,] 0.045648486 0.083091306 [38,] 0.010248486 0.045648486 [39,] -0.020701514 0.010248486 [40,] -0.103075361 -0.020701514 [41,] -0.128272967 -0.103075361 [42,] -0.106199208 -0.128272967 [43,] -0.087232542 -0.106199208 [44,] -0.070249208 -0.087232542 [45,] -0.004401254 -0.070249208 [46,] 0.005470235 -0.004401254 [47,] -0.034612637 0.005470235 [48,] 0.009635796 -0.034612637 [49,] 0.028278616 0.009635796 [50,] 0.039578616 0.028278616 [51,] 0.069228616 0.039578616 [52,] 0.093069130 0.069228616 [53,] 0.075957162 0.093069130 [54,] 0.092359644 0.075957162 [55,] 0.075411949 0.092359644 [56,] 0.049209644 0.075411949 [57,] 0.025557599 0.049209644 [58,] 0.012714726 0.025557599 [59,] -0.020968146 0.012714726 [60,] -0.018119713 -0.020968146 [61,] 0.003523106 -0.018119713 [62,] 0.008937468 0.003523106 [63,] -0.009612532 0.008937468 [64,] -0.045186379 -0.009612532 [65,] -0.061083986 -0.045186379 [66,] -0.087495865 -0.061083986 [67,] -0.101143560 -0.087495865 [68,] -0.055860227 -0.101143560 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -0.100199347 -0.097442167 2 -0.107099347 -0.100199347 3 -0.094349347 -0.107099347 4 -0.061708833 -0.094349347 5 -0.060506440 -0.061708833 6 -0.064832681 -0.060506440 7 -0.036251653 -0.064832681 8 -0.040582681 -0.036251653 9 -0.024734726 -0.040582681 10 0.023122401 -0.024734726 11 0.047153891 0.023122401 12 0.060787962 0.047153891 13 0.084945143 0.060787962 14 0.139145143 0.084945143 15 0.146895143 0.139145143 16 0.160635657 0.146895143 17 0.170638051 0.160635657 18 0.158311810 0.170638051 19 0.116792838 0.158311810 20 0.055976172 0.116792838 21 -0.066075874 0.055976172 22 -0.122918746 -0.066075874 23 -0.078615980 -0.122918746 24 -0.037953185 -0.078615980 25 -0.062196004 -0.037953185 26 -0.090810366 -0.062196004 27 -0.091460366 -0.090810366 28 -0.043734213 -0.091460366 29 0.003268180 -0.043734213 30 0.007856301 0.003268180 31 0.032422967 0.007856301 32 0.061506301 0.032422967 33 0.069654255 0.061506301 34 0.081611383 0.069654255 35 0.087042872 0.081611383 36 0.083091306 0.087042872 37 0.045648486 0.083091306 38 0.010248486 0.045648486 39 -0.020701514 0.010248486 40 -0.103075361 -0.020701514 41 -0.128272967 -0.103075361 42 -0.106199208 -0.128272967 43 -0.087232542 -0.106199208 44 -0.070249208 -0.087232542 45 -0.004401254 -0.070249208 46 0.005470235 -0.004401254 47 -0.034612637 0.005470235 48 0.009635796 -0.034612637 49 0.028278616 0.009635796 50 0.039578616 0.028278616 51 0.069228616 0.039578616 52 0.093069130 0.069228616 53 0.075957162 0.093069130 54 0.092359644 0.075957162 55 0.075411949 0.092359644 56 0.049209644 0.075411949 57 0.025557599 0.049209644 58 0.012714726 0.025557599 59 -0.020968146 0.012714726 60 -0.018119713 -0.020968146 61 0.003523106 -0.018119713 62 0.008937468 0.003523106 63 -0.009612532 0.008937468 64 -0.045186379 -0.009612532 65 -0.061083986 -0.045186379 66 -0.087495865 -0.061083986 67 -0.101143560 -0.087495865 68 -0.055860227 -0.101143560 > 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/fisher/rcomp/tmp/7buu21356033783.ps",horizontal=F,onefile=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/fisher/rcomp/tmp/8rqn71356033783.ps",horizontal=F,onefile=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/fisher/rcomp/tmp/9jiwe1356033783.ps",horizontal=F,onefile=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/fisher/rcomp/tmp/10lv711356033783.ps",horizontal=F,onefile=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/fisher/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/fisher/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/fisher/rcomp/tmp/11ybmz1356033783.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/fisher/rcomp/tmp/12wiu21356033783.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/fisher/rcomp/tmp/139exl1356033784.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/fisher/rcomp/tmp/14ls4g1356033784.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/fisher/rcomp/tmp/15dzws1356033784.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/fisher/rcomp/tmp/16t5x31356033784.tab") + } > > try(system("convert tmp/1buy61356033783.ps tmp/1buy61356033783.png",intern=TRUE)) character(0) > try(system("convert tmp/2qrva1356033783.ps tmp/2qrva1356033783.png",intern=TRUE)) character(0) > try(system("convert tmp/3tryk1356033783.ps tmp/3tryk1356033783.png",intern=TRUE)) character(0) > try(system("convert tmp/42r3g1356033783.ps tmp/42r3g1356033783.png",intern=TRUE)) character(0) > try(system("convert tmp/5v5go1356033783.ps tmp/5v5go1356033783.png",intern=TRUE)) character(0) > try(system("convert tmp/6sf3g1356033783.ps tmp/6sf3g1356033783.png",intern=TRUE)) character(0) > try(system("convert tmp/7buu21356033783.ps tmp/7buu21356033783.png",intern=TRUE)) character(0) > try(system("convert tmp/8rqn71356033783.ps tmp/8rqn71356033783.png",intern=TRUE)) character(0) > try(system("convert tmp/9jiwe1356033783.ps tmp/9jiwe1356033783.png",intern=TRUE)) character(0) > try(system("convert tmp/10lv711356033783.ps tmp/10lv711356033783.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 6.789 1.841 8.651