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 + ,1.4369 + ,153.2 + ,7.4583 + ,1.4975 + ,163.63 + ,7.4595 + ,1.577 + ,168.45 + ,7.4599 + ,1.5553 + ,166.26 + ,7.4586 + ,1.5557 + ,162.31 + ,7.4609 + ,1.575 + ,161.56 + ,7.4603 + ,1.5527 + ,156.59 + ,7.4561 + ,1.4748 + ,157.97 + ,7.454 + ,1.4718 + ,158.68 + ,7.4505 + ,1.457 + ,163.55 + ,7.4599 + ,1.4684 + ,162.89 + ,7.4543 + ,1.4227 + ,164.95 + ,7.4534 + ,1.3896 + ,159.82 + ,7.4506 + ,1.3622 + ,159.05 + ,7.4429 + ,1.3716 + ,166.76 + ,7.441 + ,1.3419 + ,164.55 + ,7.4452 + ,1.3511 + ,163.22 + ,7.4519 + ,1.3516 + ,160.68 + ,7.453 + ,1.3242 + ,155.24 + ,7.4494 + ,1.3074 + ,157.6 + ,7.4541 + ,1.2999 + ,156.56 + ,7.4539 + ,1.3213 + ,154.82 + ,7.4549 + ,1.2881 + ,151.11 + ,7.4564 + ,1.2611 + ,149.65 + ,7.4555 + ,1.2727 + ,148.99 + ,7.4601 + ,1.2811 + ,148.53 + ,7.4609 + ,1.2684 + ,146.7 + ,7.4602 + ,1.265 + ,145.11 + ,7.4566 + ,1.277 + ,142.7 + ,7.4565 + ,1.2271 + ,143.59 + ,7.4618 + ,1.202 + ,140.96 + ,7.4612 + ,1.1938 + ,140.77 + ,7.4641 + ,1.2103 + ,139.81 + ,7.4613 + ,1.1856 + ,140.58 + ,7.4541 + ,1.1786 + ,139.59 + ,7.4596 + ,1.2015 + ,138.05 + ,7.462 + ,1.2256 + ,136.06 + ,7.4584 + ,1.2292 + ,135.98 + ,7.4596 + ,1.2037 + ,134.75 + ,7.4584 + ,1.2165 + ,132.22 + ,7.4448 + ,1.2694 + ,135.37 + ,7.4443 + ,1.2938 + ,138.84 + ,7.4499 + ,1.3201 + ,138.83 + ,7.4466 + ,1.3014 + ,136.55 + ,7.4427 + ,1.3119 + ,135.63 + ,7.4405 + ,1.3408 + ,139.14 + ,7.4338 + ,1.2991 + ,136.09 + ,7.4313 + ,1.249 + ,135.97 + ,7.4379 + ,1.2218 + ,134.51 + ,7.4381 + ,1.2176 + ,134.54 + ,7.4365 + ,1.2266 + ,134.08 + ,7.4355 + ,1.2138 + ,132.86 + ,7.4342 + ,1.2007 + ,134.48 + ,7.4405 + ,1.1985 + ,129.08 + ,7.4436 + ,1.2262 + ,133.13 + ,7.4493 + ,1.2646 + ,134.78 + ,7.4511 + ,1.2613 + ,134.13 + ,7.4481 + ,1.2286 + ,132.43 + ,7.4419 + ,1.1702 + ,127.84 + ,7.437 + ,1.1692 + ,128.12 + ,7.4301 + ,1.1222 + ,128.94 + ,7.4273 + ,1.1139 + ,132.38 + ,7.4322 + ,1.1372 + ,134.99 + ,7.4332 + ,1.1663 + ,138.05 + ,7.425 + ,1.1582 + ,135.83 + ,7.4246 + ,1.0848 + ,130.12 + ,7.4255 + ,1.0807 + ,128.16 + ,7.4274 + ,1.0773 + ,128.6 + ,7.4317 + ,1.0622 + ,126.12 + ,7.4324 + ,1.0183 + ,124.2 + ,7.4264 + ,1.0014 + ,121.65 + ,7.428 + ,0.9811 + ,121.57 + ,7.4297 + ,0.9808 + ,118.38 + ,7.4271) + ,dim=c(3 + ,74) + ,dimnames=list(c('Dollar' + ,'Yen' + ,'DeenseKroon') + ,1:74)) > y <- array(NA,dim=c(3,74),dimnames=list(c('Dollar','Yen','DeenseKroon'),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 1 1.3322 133.52 7.4545 2 1.4369 153.20 7.4583 3 1.4975 163.63 7.4595 4 1.5770 168.45 7.4599 5 1.5553 166.26 7.4586 6 1.5557 162.31 7.4609 7 1.5750 161.56 7.4603 8 1.5527 156.59 7.4561 9 1.4748 157.97 7.4540 10 1.4718 158.68 7.4505 11 1.4570 163.55 7.4599 12 1.4684 162.89 7.4543 13 1.4227 164.95 7.4534 14 1.3896 159.82 7.4506 15 1.3622 159.05 7.4429 16 1.3716 166.76 7.4410 17 1.3419 164.55 7.4452 18 1.3511 163.22 7.4519 19 1.3516 160.68 7.4530 20 1.3242 155.24 7.4494 21 1.3074 157.60 7.4541 22 1.2999 156.56 7.4539 23 1.3213 154.82 7.4549 24 1.2881 151.11 7.4564 25 1.2611 149.65 7.4555 26 1.2727 148.99 7.4601 27 1.2811 148.53 7.4609 28 1.2684 146.70 7.4602 29 1.2650 145.11 7.4566 30 1.2770 142.70 7.4565 31 1.2271 143.59 7.4618 32 1.2020 140.96 7.4612 33 1.1938 140.77 7.4641 34 1.2103 139.81 7.4613 35 1.1856 140.58 7.4541 36 1.1786 139.59 7.4596 37 1.2015 138.05 7.4620 38 1.2256 136.06 7.4584 39 1.2292 135.98 7.4596 40 1.2037 134.75 7.4584 41 1.2165 132.22 7.4448 42 1.2694 135.37 7.4443 43 1.2938 138.84 7.4499 44 1.3201 138.83 7.4466 45 1.3014 136.55 7.4427 46 1.3119 135.63 7.4405 47 1.3408 139.14 7.4338 48 1.2991 136.09 7.4313 49 1.2490 135.97 7.4379 50 1.2218 134.51 7.4381 51 1.2176 134.54 7.4365 52 1.2266 134.08 7.4355 53 1.2138 132.86 7.4342 54 1.2007 134.48 7.4405 55 1.1985 129.08 7.4436 56 1.2262 133.13 7.4493 57 1.2646 134.78 7.4511 58 1.2613 134.13 7.4481 59 1.2286 132.43 7.4419 60 1.1702 127.84 7.4370 61 1.1692 128.12 7.4301 62 1.1222 128.94 7.4273 63 1.1139 132.38 7.4322 64 1.1372 134.99 7.4332 65 1.1663 138.05 7.4250 66 1.1582 135.83 7.4246 67 1.0848 130.12 7.4255 68 1.0807 128.16 7.4274 69 1.0773 128.60 7.4317 70 1.0622 126.12 7.4324 71 1.0183 124.20 7.4264 72 1.0014 121.65 7.4280 73 0.9811 121.57 7.4297 74 0.9808 118.38 7.4271 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) Yen DeenseKroon -10.701400 0.008205 1.449960 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -0.10202 -0.05618 -0.00945 0.05228 0.15828 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) -1.070e+01 6.290e+00 -1.701 0.0933 . Yen 8.205e-03 7.695e-04 10.663 <2e-16 *** DeenseKroon 1.450e+00 8.537e-01 1.699 0.0938 . --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 0.06881 on 71 degrees of freedom Multiple R-squared: 0.7594, Adjusted R-squared: 0.7526 F-statistic: 112 on 2 and 71 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.1176197 2.352394e-01 8.823803e-01 [2,] 0.1146405 2.292809e-01 8.853595e-01 [3,] 0.2314222 4.628443e-01 7.685778e-01 [4,] 0.1856434 3.712868e-01 8.143566e-01 [5,] 0.1266167 2.532334e-01 8.733833e-01 [6,] 0.2734952 5.469905e-01 7.265048e-01 [7,] 0.2557136 5.114272e-01 7.442864e-01 [8,] 0.3443875 6.887751e-01 6.556125e-01 [9,] 0.3146860 6.293720e-01 6.853140e-01 [10,] 0.2367913 4.735826e-01 7.632087e-01 [11,] 0.1706968 3.413936e-01 8.293032e-01 [12,] 0.1707151 3.414302e-01 8.292849e-01 [13,] 0.2904755 5.809509e-01 7.095245e-01 [14,] 0.3816431 7.632861e-01 6.183569e-01 [15,] 0.3595462 7.190923e-01 6.404538e-01 [16,] 0.5693315 8.613369e-01 4.306685e-01 [17,] 0.7166835 5.666330e-01 2.833165e-01 [18,] 0.7584921 4.830158e-01 2.415079e-01 [19,] 0.8262106 3.475787e-01 1.737894e-01 [20,] 0.8802098 2.395805e-01 1.197902e-01 [21,] 0.9247995 1.504009e-01 7.520046e-02 [22,] 0.9403778 1.192443e-01 5.962217e-02 [23,] 0.9441778 1.116444e-01 5.582220e-02 [24,] 0.9336274 1.327452e-01 6.637259e-02 [25,] 0.9092632 1.814737e-01 9.073683e-02 [26,] 0.9280083 1.439834e-01 7.199171e-02 [27,] 0.9378867 1.242266e-01 6.211331e-02 [28,] 0.9581763 8.364732e-02 4.182366e-02 [29,] 0.9590907 8.181851e-02 4.090925e-02 [30,] 0.9763816 4.723674e-02 2.361837e-02 [31,] 0.9924770 1.504594e-02 7.522968e-03 [32,] 0.9968689 6.262288e-03 3.131144e-03 [33,] 0.9972330 5.534050e-03 2.767025e-03 [34,] 0.9980638 3.872344e-03 1.936172e-03 [35,] 0.9994278 1.144457e-03 5.722286e-04 [36,] 0.9995233 9.533872e-04 4.766936e-04 [37,] 0.9995114 9.771046e-04 4.885523e-04 [38,] 0.9995296 9.407699e-04 4.703850e-04 [39,] 0.9994079 1.184167e-03 5.920836e-04 [40,] 0.9992545 1.490927e-03 7.454634e-04 [41,] 0.9994864 1.027110e-03 5.135549e-04 [42,] 0.9998008 3.983334e-04 1.991667e-04 [43,] 0.9999814 3.724650e-05 1.862325e-05 [44,] 0.9999625 7.508689e-05 3.754344e-05 [45,] 0.9999157 1.686709e-04 8.433544e-05 [46,] 0.9998252 3.495732e-04 1.747866e-04 [47,] 0.9997615 4.770252e-04 2.385126e-04 [48,] 0.9997710 4.579039e-04 2.289520e-04 [49,] 0.9995166 9.668183e-04 4.834092e-04 [50,] 0.9991197 1.760627e-03 8.803135e-04 [51,] 0.9983459 3.308241e-03 1.654120e-03 [52,] 0.9969124 6.175160e-03 3.087580e-03 [53,] 0.9937294 1.254113e-02 6.270567e-03 [54,] 0.9894409 2.111817e-02 1.055908e-02 [55,] 0.9943341 1.133173e-02 5.665863e-03 [56,] 0.9999669 6.610675e-05 3.305338e-05 [57,] 0.9999979 4.239112e-06 2.119556e-06 [58,] 0.9999887 2.257486e-05 1.128743e-05 [59,] 0.9999485 1.030792e-04 5.153962e-05 [60,] 0.9997854 4.291290e-04 2.145645e-04 [61,] 0.9989558 2.088407e-03 1.044203e-03 [62,] 0.9951870 9.625903e-03 4.812951e-03 [63,] 0.9821671 3.566572e-02 1.783286e-02 > postscript(file="/var/www/html/rcomp/tmp/12f5x1227534485.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/2gm2c1227534485.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/3ui861227534485.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/43tmk1227534485.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/5t6wx1227534485.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 1.293828e-01 6.710418e-02 4.038909e-02 7.976240e-02 7.791566e-02 6 7 8 9 10 1.073894e-01 1.337129e-01 1.582801e-01 7.210254e-02 6.835205e-02 11 12 13 14 15 -3.451766e-05 2.490037e-02 -3.639638e-02 -2.334632e-02 -3.326400e-02 16 17 18 19 20 -8.436741e-02 -1.020248e-01 -9.162729e-02 -7.188227e-02 -4.942879e-02 21 22 23 24 25 -9.240672e-02 -9.108383e-02 -5.685759e-02 -6.179305e-02 -7.550920e-02 26 27 28 29 30 -6.516391e-02 -5.414971e-02 -5.082011e-02 -3.595477e-02 -4.036417e-03 31 32 33 34 35 -6.892340e-02 -7.157503e-02 -8.242102e-02 -5.398461e-02 -7.456253e-02 36 37 38 39 40 -8.141464e-02 -4.935929e-02 -3.712055e-03 -1.195630e-03 -1.486388e-02 41 42 43 44 45 3.841349e-02 6.619363e-02 5.400350e-02 8.517042e-02 9.083200e-02 46 47 48 49 50 1.120702e-01 1.218864e-01 1.088357e-01 5.015054e-02 3.463943e-02 51 52 53 54 55 3.251322e-02 4.673735e-02 4.583204e-02 1.030567e-02 4.791623e-02 56 57 58 59 60 3.412238e-02 5.637468e-02 6.275762e-02 5.299538e-02 3.935981e-02 61 62 63 64 65 4.606721e-02 -3.600764e-03 -4.722977e-02 -4.679403e-02 -3.091078e-02 66 67 68 69 70 -2.021634e-02 -4.807240e-02 -3.884609e-02 -5.209098e-02 -4.785827e-02 71 72 73 74 -6.730547e-02 -6.560339e-02 -8.771194e-02 -5.806902e-02 > postscript(file="/var/www/html/rcomp/tmp/6h1aa1227534485.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 1.293828e-01 NA 1 6.710418e-02 1.293828e-01 2 4.038909e-02 6.710418e-02 3 7.976240e-02 4.038909e-02 4 7.791566e-02 7.976240e-02 5 1.073894e-01 7.791566e-02 6 1.337129e-01 1.073894e-01 7 1.582801e-01 1.337129e-01 8 7.210254e-02 1.582801e-01 9 6.835205e-02 7.210254e-02 10 -3.451766e-05 6.835205e-02 11 2.490037e-02 -3.451766e-05 12 -3.639638e-02 2.490037e-02 13 -2.334632e-02 -3.639638e-02 14 -3.326400e-02 -2.334632e-02 15 -8.436741e-02 -3.326400e-02 16 -1.020248e-01 -8.436741e-02 17 -9.162729e-02 -1.020248e-01 18 -7.188227e-02 -9.162729e-02 19 -4.942879e-02 -7.188227e-02 20 -9.240672e-02 -4.942879e-02 21 -9.108383e-02 -9.240672e-02 22 -5.685759e-02 -9.108383e-02 23 -6.179305e-02 -5.685759e-02 24 -7.550920e-02 -6.179305e-02 25 -6.516391e-02 -7.550920e-02 26 -5.414971e-02 -6.516391e-02 27 -5.082011e-02 -5.414971e-02 28 -3.595477e-02 -5.082011e-02 29 -4.036417e-03 -3.595477e-02 30 -6.892340e-02 -4.036417e-03 31 -7.157503e-02 -6.892340e-02 32 -8.242102e-02 -7.157503e-02 33 -5.398461e-02 -8.242102e-02 34 -7.456253e-02 -5.398461e-02 35 -8.141464e-02 -7.456253e-02 36 -4.935929e-02 -8.141464e-02 37 -3.712055e-03 -4.935929e-02 38 -1.195630e-03 -3.712055e-03 39 -1.486388e-02 -1.195630e-03 40 3.841349e-02 -1.486388e-02 41 6.619363e-02 3.841349e-02 42 5.400350e-02 6.619363e-02 43 8.517042e-02 5.400350e-02 44 9.083200e-02 8.517042e-02 45 1.120702e-01 9.083200e-02 46 1.218864e-01 1.120702e-01 47 1.088357e-01 1.218864e-01 48 5.015054e-02 1.088357e-01 49 3.463943e-02 5.015054e-02 50 3.251322e-02 3.463943e-02 51 4.673735e-02 3.251322e-02 52 4.583204e-02 4.673735e-02 53 1.030567e-02 4.583204e-02 54 4.791623e-02 1.030567e-02 55 3.412238e-02 4.791623e-02 56 5.637468e-02 3.412238e-02 57 6.275762e-02 5.637468e-02 58 5.299538e-02 6.275762e-02 59 3.935981e-02 5.299538e-02 60 4.606721e-02 3.935981e-02 61 -3.600764e-03 4.606721e-02 62 -4.722977e-02 -3.600764e-03 63 -4.679403e-02 -4.722977e-02 64 -3.091078e-02 -4.679403e-02 65 -2.021634e-02 -3.091078e-02 66 -4.807240e-02 -2.021634e-02 67 -3.884609e-02 -4.807240e-02 68 -5.209098e-02 -3.884609e-02 69 -4.785827e-02 -5.209098e-02 70 -6.730547e-02 -4.785827e-02 71 -6.560339e-02 -6.730547e-02 72 -8.771194e-02 -6.560339e-02 73 -5.806902e-02 -8.771194e-02 74 NA -5.806902e-02 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] 6.710418e-02 1.293828e-01 [2,] 4.038909e-02 6.710418e-02 [3,] 7.976240e-02 4.038909e-02 [4,] 7.791566e-02 7.976240e-02 [5,] 1.073894e-01 7.791566e-02 [6,] 1.337129e-01 1.073894e-01 [7,] 1.582801e-01 1.337129e-01 [8,] 7.210254e-02 1.582801e-01 [9,] 6.835205e-02 7.210254e-02 [10,] -3.451766e-05 6.835205e-02 [11,] 2.490037e-02 -3.451766e-05 [12,] -3.639638e-02 2.490037e-02 [13,] -2.334632e-02 -3.639638e-02 [14,] -3.326400e-02 -2.334632e-02 [15,] -8.436741e-02 -3.326400e-02 [16,] -1.020248e-01 -8.436741e-02 [17,] -9.162729e-02 -1.020248e-01 [18,] -7.188227e-02 -9.162729e-02 [19,] -4.942879e-02 -7.188227e-02 [20,] -9.240672e-02 -4.942879e-02 [21,] -9.108383e-02 -9.240672e-02 [22,] -5.685759e-02 -9.108383e-02 [23,] -6.179305e-02 -5.685759e-02 [24,] -7.550920e-02 -6.179305e-02 [25,] -6.516391e-02 -7.550920e-02 [26,] -5.414971e-02 -6.516391e-02 [27,] -5.082011e-02 -5.414971e-02 [28,] -3.595477e-02 -5.082011e-02 [29,] -4.036417e-03 -3.595477e-02 [30,] -6.892340e-02 -4.036417e-03 [31,] -7.157503e-02 -6.892340e-02 [32,] -8.242102e-02 -7.157503e-02 [33,] -5.398461e-02 -8.242102e-02 [34,] -7.456253e-02 -5.398461e-02 [35,] -8.141464e-02 -7.456253e-02 [36,] -4.935929e-02 -8.141464e-02 [37,] -3.712055e-03 -4.935929e-02 [38,] -1.195630e-03 -3.712055e-03 [39,] -1.486388e-02 -1.195630e-03 [40,] 3.841349e-02 -1.486388e-02 [41,] 6.619363e-02 3.841349e-02 [42,] 5.400350e-02 6.619363e-02 [43,] 8.517042e-02 5.400350e-02 [44,] 9.083200e-02 8.517042e-02 [45,] 1.120702e-01 9.083200e-02 [46,] 1.218864e-01 1.120702e-01 [47,] 1.088357e-01 1.218864e-01 [48,] 5.015054e-02 1.088357e-01 [49,] 3.463943e-02 5.015054e-02 [50,] 3.251322e-02 3.463943e-02 [51,] 4.673735e-02 3.251322e-02 [52,] 4.583204e-02 4.673735e-02 [53,] 1.030567e-02 4.583204e-02 [54,] 4.791623e-02 1.030567e-02 [55,] 3.412238e-02 4.791623e-02 [56,] 5.637468e-02 3.412238e-02 [57,] 6.275762e-02 5.637468e-02 [58,] 5.299538e-02 6.275762e-02 [59,] 3.935981e-02 5.299538e-02 [60,] 4.606721e-02 3.935981e-02 [61,] -3.600764e-03 4.606721e-02 [62,] -4.722977e-02 -3.600764e-03 [63,] -4.679403e-02 -4.722977e-02 [64,] -3.091078e-02 -4.679403e-02 [65,] -2.021634e-02 -3.091078e-02 [66,] -4.807240e-02 -2.021634e-02 [67,] -3.884609e-02 -4.807240e-02 [68,] -5.209098e-02 -3.884609e-02 [69,] -4.785827e-02 -5.209098e-02 [70,] -6.730547e-02 -4.785827e-02 [71,] -6.560339e-02 -6.730547e-02 [72,] -8.771194e-02 -6.560339e-02 [73,] -5.806902e-02 -8.771194e-02 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 6.710418e-02 1.293828e-01 2 4.038909e-02 6.710418e-02 3 7.976240e-02 4.038909e-02 4 7.791566e-02 7.976240e-02 5 1.073894e-01 7.791566e-02 6 1.337129e-01 1.073894e-01 7 1.582801e-01 1.337129e-01 8 7.210254e-02 1.582801e-01 9 6.835205e-02 7.210254e-02 10 -3.451766e-05 6.835205e-02 11 2.490037e-02 -3.451766e-05 12 -3.639638e-02 2.490037e-02 13 -2.334632e-02 -3.639638e-02 14 -3.326400e-02 -2.334632e-02 15 -8.436741e-02 -3.326400e-02 16 -1.020248e-01 -8.436741e-02 17 -9.162729e-02 -1.020248e-01 18 -7.188227e-02 -9.162729e-02 19 -4.942879e-02 -7.188227e-02 20 -9.240672e-02 -4.942879e-02 21 -9.108383e-02 -9.240672e-02 22 -5.685759e-02 -9.108383e-02 23 -6.179305e-02 -5.685759e-02 24 -7.550920e-02 -6.179305e-02 25 -6.516391e-02 -7.550920e-02 26 -5.414971e-02 -6.516391e-02 27 -5.082011e-02 -5.414971e-02 28 -3.595477e-02 -5.082011e-02 29 -4.036417e-03 -3.595477e-02 30 -6.892340e-02 -4.036417e-03 31 -7.157503e-02 -6.892340e-02 32 -8.242102e-02 -7.157503e-02 33 -5.398461e-02 -8.242102e-02 34 -7.456253e-02 -5.398461e-02 35 -8.141464e-02 -7.456253e-02 36 -4.935929e-02 -8.141464e-02 37 -3.712055e-03 -4.935929e-02 38 -1.195630e-03 -3.712055e-03 39 -1.486388e-02 -1.195630e-03 40 3.841349e-02 -1.486388e-02 41 6.619363e-02 3.841349e-02 42 5.400350e-02 6.619363e-02 43 8.517042e-02 5.400350e-02 44 9.083200e-02 8.517042e-02 45 1.120702e-01 9.083200e-02 46 1.218864e-01 1.120702e-01 47 1.088357e-01 1.218864e-01 48 5.015054e-02 1.088357e-01 49 3.463943e-02 5.015054e-02 50 3.251322e-02 3.463943e-02 51 4.673735e-02 3.251322e-02 52 4.583204e-02 4.673735e-02 53 1.030567e-02 4.583204e-02 54 4.791623e-02 1.030567e-02 55 3.412238e-02 4.791623e-02 56 5.637468e-02 3.412238e-02 57 6.275762e-02 5.637468e-02 58 5.299538e-02 6.275762e-02 59 3.935981e-02 5.299538e-02 60 4.606721e-02 3.935981e-02 61 -3.600764e-03 4.606721e-02 62 -4.722977e-02 -3.600764e-03 63 -4.679403e-02 -4.722977e-02 64 -3.091078e-02 -4.679403e-02 65 -2.021634e-02 -3.091078e-02 66 -4.807240e-02 -2.021634e-02 67 -3.884609e-02 -4.807240e-02 68 -5.209098e-02 -3.884609e-02 69 -4.785827e-02 -5.209098e-02 70 -6.730547e-02 -4.785827e-02 71 -6.560339e-02 -6.730547e-02 72 -8.771194e-02 -6.560339e-02 73 -5.806902e-02 -8.771194e-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/7risa1227534485.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/80nwp1227534485.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/9iw4i1227534485.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/1077mk1227534485.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/11gfs21227534485.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/128vvf1227534485.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/13o23s1227534485.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/14dwlh1227534485.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/15twbr1227534485.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/16fwe91227534485.tab") + } > > system("convert tmp/12f5x1227534485.ps tmp/12f5x1227534485.png") > system("convert tmp/2gm2c1227534485.ps tmp/2gm2c1227534485.png") > system("convert tmp/3ui861227534485.ps tmp/3ui861227534485.png") > system("convert tmp/43tmk1227534485.ps tmp/43tmk1227534485.png") > system("convert tmp/5t6wx1227534485.ps tmp/5t6wx1227534485.png") > system("convert tmp/6h1aa1227534485.ps tmp/6h1aa1227534485.png") > system("convert tmp/7risa1227534485.ps tmp/7risa1227534485.png") > system("convert tmp/80nwp1227534485.ps tmp/80nwp1227534485.png") > system("convert tmp/9iw4i1227534485.ps tmp/9iw4i1227534485.png") > system("convert tmp/1077mk1227534485.ps tmp/1077mk1227534485.png") > > > proc.time() user system elapsed 2.618 1.582 3.243