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(9.103,0,9.155,0,9.308,0,9.394,0,9.948,0,10.177,0,10.002,0,9.728,0,10.002,0,10.063,0,10.018,0,9.96,0,10.236,0,10.893,0,10.756,0,10.94,0,10.997,0,10.827,0,10.166,0,10.186,0,10.457,0,10.368,0,10.244,0,10.511,0,10.812,0,10.738,0,10.171,0,9.721,0,9.897,0,9.828,0,9.924,0,10.371,0,10.846,0,10.413,0,10.709,0,10.662,0,10.57,0,10.297,0,10.635,0,10.872,0,10.296,0,10.383,0,10.431,0,10.574,0,10.653,0,10.805,0,10.872,0,10.625,0,10.407,0,10.463,0,10.556,0,10.646,0,10.702,0,11.353,0,11.346,1,11.451,1,11.964,1,12.574,1,13.031,1,13.812,1,14.544,1,14.931,1,14.886,1,16.005,1,17.064,1,15.168,1,16.05,1,15.839,1,15.137,1,14.954,1,15.648,1,15.305,1,15.579,1,16.348,1,15.928,1,16.171,1,15.937,1,15.713,1,15.594,1,15.683,1,16.438,1,17.032,1,17.696,1,17.745,1,19.394,1,20.148,1,20.108,1,18.584,1,18.441,1,18.391,1,19.178,1,18.079,1,18.483,1,19.644,1),dim=c(2,94),dimnames=list(c('goudprijs','dummy'),1:94)) > y <- array(NA,dim=c(2,94),dimnames=list(c('goudprijs','dummy'),1:94)) > 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 goudprijs dummy M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 1 9.103 0 1 0 0 0 0 0 0 0 0 0 0 2 9.155 0 0 1 0 0 0 0 0 0 0 0 0 3 9.308 0 0 0 1 0 0 0 0 0 0 0 0 4 9.394 0 0 0 0 1 0 0 0 0 0 0 0 5 9.948 0 0 0 0 0 1 0 0 0 0 0 0 6 10.177 0 0 0 0 0 0 1 0 0 0 0 0 7 10.002 0 0 0 0 0 0 0 1 0 0 0 0 8 9.728 0 0 0 0 0 0 0 0 1 0 0 0 9 10.002 0 0 0 0 0 0 0 0 0 1 0 0 10 10.063 0 0 0 0 0 0 0 0 0 0 1 0 11 10.018 0 0 0 0 0 0 0 0 0 0 0 1 12 9.960 0 0 0 0 0 0 0 0 0 0 0 0 13 10.236 0 1 0 0 0 0 0 0 0 0 0 0 14 10.893 0 0 1 0 0 0 0 0 0 0 0 0 15 10.756 0 0 0 1 0 0 0 0 0 0 0 0 16 10.940 0 0 0 0 1 0 0 0 0 0 0 0 17 10.997 0 0 0 0 0 1 0 0 0 0 0 0 18 10.827 0 0 0 0 0 0 1 0 0 0 0 0 19 10.166 0 0 0 0 0 0 0 1 0 0 0 0 20 10.186 0 0 0 0 0 0 0 0 1 0 0 0 21 10.457 0 0 0 0 0 0 0 0 0 1 0 0 22 10.368 0 0 0 0 0 0 0 0 0 0 1 0 23 10.244 0 0 0 0 0 0 0 0 0 0 0 1 24 10.511 0 0 0 0 0 0 0 0 0 0 0 0 25 10.812 0 1 0 0 0 0 0 0 0 0 0 0 26 10.738 0 0 1 0 0 0 0 0 0 0 0 0 27 10.171 0 0 0 1 0 0 0 0 0 0 0 0 28 9.721 0 0 0 0 1 0 0 0 0 0 0 0 29 9.897 0 0 0 0 0 1 0 0 0 0 0 0 30 9.828 0 0 0 0 0 0 1 0 0 0 0 0 31 9.924 0 0 0 0 0 0 0 1 0 0 0 0 32 10.371 0 0 0 0 0 0 0 0 1 0 0 0 33 10.846 0 0 0 0 0 0 0 0 0 1 0 0 34 10.413 0 0 0 0 0 0 0 0 0 0 1 0 35 10.709 0 0 0 0 0 0 0 0 0 0 0 1 36 10.662 0 0 0 0 0 0 0 0 0 0 0 0 37 10.570 0 1 0 0 0 0 0 0 0 0 0 0 38 10.297 0 0 1 0 0 0 0 0 0 0 0 0 39 10.635 0 0 0 1 0 0 0 0 0 0 0 0 40 10.872 0 0 0 0 1 0 0 0 0 0 0 0 41 10.296 0 0 0 0 0 1 0 0 0 0 0 0 42 10.383 0 0 0 0 0 0 1 0 0 0 0 0 43 10.431 0 0 0 0 0 0 0 1 0 0 0 0 44 10.574 0 0 0 0 0 0 0 0 1 0 0 0 45 10.653 0 0 0 0 0 0 0 0 0 1 0 0 46 10.805 0 0 0 0 0 0 0 0 0 0 1 0 47 10.872 0 0 0 0 0 0 0 0 0 0 0 1 48 10.625 0 0 0 0 0 0 0 0 0 0 0 0 49 10.407 0 1 0 0 0 0 0 0 0 0 0 0 50 10.463 0 0 1 0 0 0 0 0 0 0 0 0 51 10.556 0 0 0 1 0 0 0 0 0 0 0 0 52 10.646 0 0 0 0 1 0 0 0 0 0 0 0 53 10.702 0 0 0 0 0 1 0 0 0 0 0 0 54 11.353 0 0 0 0 0 0 1 0 0 0 0 0 55 11.346 1 0 0 0 0 0 0 1 0 0 0 0 56 11.451 1 0 0 0 0 0 0 0 1 0 0 0 57 11.964 1 0 0 0 0 0 0 0 0 1 0 0 58 12.574 1 0 0 0 0 0 0 0 0 0 1 0 59 13.031 1 0 0 0 0 0 0 0 0 0 0 1 60 13.812 1 0 0 0 0 0 0 0 0 0 0 0 61 14.544 1 1 0 0 0 0 0 0 0 0 0 0 62 14.931 1 0 1 0 0 0 0 0 0 0 0 0 63 14.886 1 0 0 1 0 0 0 0 0 0 0 0 64 16.005 1 0 0 0 1 0 0 0 0 0 0 0 65 17.064 1 0 0 0 0 1 0 0 0 0 0 0 66 15.168 1 0 0 0 0 0 1 0 0 0 0 0 67 16.050 1 0 0 0 0 0 0 1 0 0 0 0 68 15.839 1 0 0 0 0 0 0 0 1 0 0 0 69 15.137 1 0 0 0 0 0 0 0 0 1 0 0 70 14.954 1 0 0 0 0 0 0 0 0 0 1 0 71 15.648 1 0 0 0 0 0 0 0 0 0 0 1 72 15.305 1 0 0 0 0 0 0 0 0 0 0 0 73 15.579 1 1 0 0 0 0 0 0 0 0 0 0 74 16.348 1 0 1 0 0 0 0 0 0 0 0 0 75 15.928 1 0 0 1 0 0 0 0 0 0 0 0 76 16.171 1 0 0 0 1 0 0 0 0 0 0 0 77 15.937 1 0 0 0 0 1 0 0 0 0 0 0 78 15.713 1 0 0 0 0 0 1 0 0 0 0 0 79 15.594 1 0 0 0 0 0 0 1 0 0 0 0 80 15.683 1 0 0 0 0 0 0 0 1 0 0 0 81 16.438 1 0 0 0 0 0 0 0 0 1 0 0 82 17.032 1 0 0 0 0 0 0 0 0 0 1 0 83 17.696 1 0 0 0 0 0 0 0 0 0 0 1 84 17.745 1 0 0 0 0 0 0 0 0 0 0 0 85 19.394 1 1 0 0 0 0 0 0 0 0 0 0 86 20.148 1 0 1 0 0 0 0 0 0 0 0 0 87 20.108 1 0 0 1 0 0 0 0 0 0 0 0 88 18.584 1 0 0 0 1 0 0 0 0 0 0 0 89 18.441 1 0 0 0 0 1 0 0 0 0 0 0 90 18.391 1 0 0 0 0 0 1 0 0 0 0 0 91 19.178 1 0 0 0 0 0 0 1 0 0 0 0 92 18.079 1 0 0 0 0 0 0 0 1 0 0 0 93 18.483 1 0 0 0 0 0 0 0 0 1 0 0 94 19.644 1 0 0 0 0 0 0 0 0 0 1 0 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) dummy M1 M2 M3 M4 10.14690 5.86390 0.23476 0.52576 0.44764 0.44576 M5 M6 M7 M8 M9 M10 0.56439 0.38414 -0.24248 -0.33998 -0.08135 0.15277 M11 -0.05743 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -4.4223 -0.6113 0.0329 0.5012 3.6496 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 10.14690 0.61247 16.567 <2e-16 *** dummy 5.86390 0.33102 17.715 <2e-16 *** M1 0.23476 0.81605 0.288 0.774 M2 0.52576 0.81605 0.644 0.521 M3 0.44764 0.81605 0.549 0.585 M4 0.44576 0.81605 0.546 0.586 M5 0.56439 0.81605 0.692 0.491 M6 0.38414 0.81605 0.471 0.639 M7 -0.24248 0.81620 -0.297 0.767 M8 -0.33998 0.81620 -0.417 0.678 M9 -0.08135 0.81620 -0.100 0.921 M10 0.15277 0.81620 0.187 0.852 M11 -0.05743 0.84261 -0.068 0.946 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 1.576 on 81 degrees of freedom Multiple R-squared: 0.7954, Adjusted R-squared: 0.7651 F-statistic: 26.24 on 12 and 81 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,] 3.143277e-01 6.286553e-01 0.6856723 [2,] 2.013194e-01 4.026388e-01 0.7986806 [3,] 1.127092e-01 2.254183e-01 0.8872908 [4,] 5.518612e-02 1.103722e-01 0.9448139 [5,] 2.651887e-02 5.303775e-02 0.9734811 [6,] 1.214998e-02 2.429996e-02 0.9878500 [7,] 5.120664e-03 1.024133e-02 0.9948793 [8,] 2.025353e-03 4.050706e-03 0.9979746 [9,] 8.523488e-04 1.704698e-03 0.9991477 [10,] 6.367814e-04 1.273563e-03 0.9993632 [11,] 3.090160e-04 6.180320e-04 0.9996910 [12,] 1.140119e-04 2.280239e-04 0.9998860 [13,] 4.675610e-05 9.351219e-05 0.9999532 [14,] 2.035902e-05 4.071804e-05 0.9999796 [15,] 9.389312e-06 1.877862e-05 0.9999906 [16,] 3.103075e-06 6.206150e-06 0.9999969 [17,] 1.114935e-06 2.229869e-06 0.9999989 [18,] 4.660084e-07 9.320168e-07 0.9999995 [19,] 1.443080e-07 2.886161e-07 0.9999999 [20,] 5.605350e-08 1.121070e-07 0.9999999 [21,] 1.891290e-08 3.782580e-08 1.0000000 [22,] 6.846003e-09 1.369201e-08 1.0000000 [23,] 1.952660e-09 3.905320e-09 1.0000000 [24,] 7.209198e-10 1.441840e-09 1.0000000 [25,] 3.953093e-10 7.906185e-10 1.0000000 [26,] 1.098112e-10 2.196224e-10 1.0000000 [27,] 2.891639e-11 5.783279e-11 1.0000000 [28,] 8.620363e-12 1.724073e-11 1.0000000 [29,] 2.834629e-12 5.669258e-12 1.0000000 [30,] 7.445096e-13 1.489019e-12 1.0000000 [31,] 2.413874e-13 4.827747e-13 1.0000000 [32,] 8.709280e-14 1.741856e-13 1.0000000 [33,] 2.268360e-14 4.536720e-14 1.0000000 [34,] 5.307887e-15 1.061577e-14 1.0000000 [35,] 1.213521e-15 2.427042e-15 1.0000000 [36,] 2.975828e-16 5.951656e-16 1.0000000 [37,] 7.722737e-17 1.544547e-16 1.0000000 [38,] 2.091412e-17 4.182824e-17 1.0000000 [39,] 1.818844e-17 3.637689e-17 1.0000000 [40,] 5.105089e-17 1.021018e-16 1.0000000 [41,] 1.330233e-16 2.660466e-16 1.0000000 [42,] 3.745204e-16 7.490409e-16 1.0000000 [43,] 2.843615e-15 5.687229e-15 1.0000000 [44,] 1.147257e-14 2.294515e-14 1.0000000 [45,] 1.030242e-13 2.060485e-13 1.0000000 [46,] 7.806935e-12 1.561387e-11 1.0000000 [47,] 3.421280e-10 6.842559e-10 1.0000000 [48,] 4.015801e-09 8.031601e-09 1.0000000 [49,] 6.006724e-08 1.201345e-07 0.9999999 [50,] 1.208605e-06 2.417211e-06 0.9999988 [51,] 1.130616e-06 2.261231e-06 0.9999989 [52,] 3.964498e-06 7.928996e-06 0.9999960 [53,] 6.032365e-06 1.206473e-05 0.9999940 [54,] 6.893199e-06 1.378640e-05 0.9999931 [55,] 1.749949e-05 3.499897e-05 0.9999825 [56,] 1.661472e-05 3.322945e-05 0.9999834 [57,] 1.541487e-05 3.082975e-05 0.9999846 [58,] 4.894136e-05 9.788272e-05 0.9999511 [59,] 2.212257e-04 4.424514e-04 0.9997788 [60,] 1.492579e-03 2.985157e-03 0.9985074 [61,] 1.852827e-03 3.705655e-03 0.9981472 [62,] 2.256222e-03 4.512443e-03 0.9977438 [63,] 3.264543e-03 6.529085e-03 0.9967355 > postscript(file="/var/www/html/rcomp/tmp/1mlkz1227791816.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/2t7481227791816.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/352pz1227791816.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/4v1mz1227791816.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/5dcao1227791816.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 = 94 Frequency = 1 1 2 3 4 5 6 -1.27866191 -1.51766191 -1.28653691 -1.19866191 -0.76328691 -0.35403691 7 8 9 10 11 12 0.09757579 -0.07892421 -0.06354921 -0.23667421 -0.07147075 -0.18689933 13 14 15 16 17 18 -0.14566191 0.22033809 0.16146309 0.34733809 0.28571309 0.29596309 19 20 21 22 23 24 0.26157579 0.37907579 0.39145079 0.06832579 0.15452925 0.36410067 25 26 27 28 29 30 0.43033809 0.06533809 -0.42353691 -0.87166191 -0.81428691 -0.70303691 31 32 33 34 35 36 0.01957579 0.56407579 0.78045079 0.11332579 0.61952925 0.51510067 37 38 39 40 41 42 0.18833809 -0.37566191 0.04046309 0.27933809 -0.41528691 -0.14803691 43 44 45 46 47 48 0.52657579 0.76707579 0.58745079 0.50532579 0.78252925 0.47810067 49 50 51 52 53 54 0.02533809 -0.20966191 -0.03853691 0.05333809 -0.00928691 0.82196309 55 56 57 58 59 60 -4.42232579 -4.21982579 -3.96545079 -3.58957579 -2.92237233 -2.19880090 61 62 63 64 65 66 -1.70156348 -1.60556348 -1.57243848 -0.45156348 0.48881152 -1.22693848 67 68 69 70 71 72 0.28167421 0.16817421 -0.79245079 -1.20957579 -0.30537233 -0.70580090 73 74 75 76 77 78 -0.66656348 -0.18856348 -0.53043848 -0.28556348 -0.63818848 -0.68193848 79 80 81 82 83 84 -0.17432579 0.01217421 0.50854921 0.86842421 1.74262767 1.73419910 85 86 87 88 89 90 3.14843652 3.61143652 3.64956152 2.12743652 1.86581152 1.99606152 91 92 93 94 3.40967421 2.40817421 2.55354921 3.48042421 > postscript(file="/var/www/html/rcomp/tmp/6soty1227791816.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 = 94 Frequency = 1 lag(myerror, k = 1) myerror 0 -1.27866191 NA 1 -1.51766191 -1.27866191 2 -1.28653691 -1.51766191 3 -1.19866191 -1.28653691 4 -0.76328691 -1.19866191 5 -0.35403691 -0.76328691 6 0.09757579 -0.35403691 7 -0.07892421 0.09757579 8 -0.06354921 -0.07892421 9 -0.23667421 -0.06354921 10 -0.07147075 -0.23667421 11 -0.18689933 -0.07147075 12 -0.14566191 -0.18689933 13 0.22033809 -0.14566191 14 0.16146309 0.22033809 15 0.34733809 0.16146309 16 0.28571309 0.34733809 17 0.29596309 0.28571309 18 0.26157579 0.29596309 19 0.37907579 0.26157579 20 0.39145079 0.37907579 21 0.06832579 0.39145079 22 0.15452925 0.06832579 23 0.36410067 0.15452925 24 0.43033809 0.36410067 25 0.06533809 0.43033809 26 -0.42353691 0.06533809 27 -0.87166191 -0.42353691 28 -0.81428691 -0.87166191 29 -0.70303691 -0.81428691 30 0.01957579 -0.70303691 31 0.56407579 0.01957579 32 0.78045079 0.56407579 33 0.11332579 0.78045079 34 0.61952925 0.11332579 35 0.51510067 0.61952925 36 0.18833809 0.51510067 37 -0.37566191 0.18833809 38 0.04046309 -0.37566191 39 0.27933809 0.04046309 40 -0.41528691 0.27933809 41 -0.14803691 -0.41528691 42 0.52657579 -0.14803691 43 0.76707579 0.52657579 44 0.58745079 0.76707579 45 0.50532579 0.58745079 46 0.78252925 0.50532579 47 0.47810067 0.78252925 48 0.02533809 0.47810067 49 -0.20966191 0.02533809 50 -0.03853691 -0.20966191 51 0.05333809 -0.03853691 52 -0.00928691 0.05333809 53 0.82196309 -0.00928691 54 -4.42232579 0.82196309 55 -4.21982579 -4.42232579 56 -3.96545079 -4.21982579 57 -3.58957579 -3.96545079 58 -2.92237233 -3.58957579 59 -2.19880090 -2.92237233 60 -1.70156348 -2.19880090 61 -1.60556348 -1.70156348 62 -1.57243848 -1.60556348 63 -0.45156348 -1.57243848 64 0.48881152 -0.45156348 65 -1.22693848 0.48881152 66 0.28167421 -1.22693848 67 0.16817421 0.28167421 68 -0.79245079 0.16817421 69 -1.20957579 -0.79245079 70 -0.30537233 -1.20957579 71 -0.70580090 -0.30537233 72 -0.66656348 -0.70580090 73 -0.18856348 -0.66656348 74 -0.53043848 -0.18856348 75 -0.28556348 -0.53043848 76 -0.63818848 -0.28556348 77 -0.68193848 -0.63818848 78 -0.17432579 -0.68193848 79 0.01217421 -0.17432579 80 0.50854921 0.01217421 81 0.86842421 0.50854921 82 1.74262767 0.86842421 83 1.73419910 1.74262767 84 3.14843652 1.73419910 85 3.61143652 3.14843652 86 3.64956152 3.61143652 87 2.12743652 3.64956152 88 1.86581152 2.12743652 89 1.99606152 1.86581152 90 3.40967421 1.99606152 91 2.40817421 3.40967421 92 2.55354921 2.40817421 93 3.48042421 2.55354921 94 NA 3.48042421 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -1.51766191 -1.27866191 [2,] -1.28653691 -1.51766191 [3,] -1.19866191 -1.28653691 [4,] -0.76328691 -1.19866191 [5,] -0.35403691 -0.76328691 [6,] 0.09757579 -0.35403691 [7,] -0.07892421 0.09757579 [8,] -0.06354921 -0.07892421 [9,] -0.23667421 -0.06354921 [10,] -0.07147075 -0.23667421 [11,] -0.18689933 -0.07147075 [12,] -0.14566191 -0.18689933 [13,] 0.22033809 -0.14566191 [14,] 0.16146309 0.22033809 [15,] 0.34733809 0.16146309 [16,] 0.28571309 0.34733809 [17,] 0.29596309 0.28571309 [18,] 0.26157579 0.29596309 [19,] 0.37907579 0.26157579 [20,] 0.39145079 0.37907579 [21,] 0.06832579 0.39145079 [22,] 0.15452925 0.06832579 [23,] 0.36410067 0.15452925 [24,] 0.43033809 0.36410067 [25,] 0.06533809 0.43033809 [26,] -0.42353691 0.06533809 [27,] -0.87166191 -0.42353691 [28,] -0.81428691 -0.87166191 [29,] -0.70303691 -0.81428691 [30,] 0.01957579 -0.70303691 [31,] 0.56407579 0.01957579 [32,] 0.78045079 0.56407579 [33,] 0.11332579 0.78045079 [34,] 0.61952925 0.11332579 [35,] 0.51510067 0.61952925 [36,] 0.18833809 0.51510067 [37,] -0.37566191 0.18833809 [38,] 0.04046309 -0.37566191 [39,] 0.27933809 0.04046309 [40,] -0.41528691 0.27933809 [41,] -0.14803691 -0.41528691 [42,] 0.52657579 -0.14803691 [43,] 0.76707579 0.52657579 [44,] 0.58745079 0.76707579 [45,] 0.50532579 0.58745079 [46,] 0.78252925 0.50532579 [47,] 0.47810067 0.78252925 [48,] 0.02533809 0.47810067 [49,] -0.20966191 0.02533809 [50,] -0.03853691 -0.20966191 [51,] 0.05333809 -0.03853691 [52,] -0.00928691 0.05333809 [53,] 0.82196309 -0.00928691 [54,] -4.42232579 0.82196309 [55,] -4.21982579 -4.42232579 [56,] -3.96545079 -4.21982579 [57,] -3.58957579 -3.96545079 [58,] -2.92237233 -3.58957579 [59,] -2.19880090 -2.92237233 [60,] -1.70156348 -2.19880090 [61,] -1.60556348 -1.70156348 [62,] -1.57243848 -1.60556348 [63,] -0.45156348 -1.57243848 [64,] 0.48881152 -0.45156348 [65,] -1.22693848 0.48881152 [66,] 0.28167421 -1.22693848 [67,] 0.16817421 0.28167421 [68,] -0.79245079 0.16817421 [69,] -1.20957579 -0.79245079 [70,] -0.30537233 -1.20957579 [71,] -0.70580090 -0.30537233 [72,] -0.66656348 -0.70580090 [73,] -0.18856348 -0.66656348 [74,] -0.53043848 -0.18856348 [75,] -0.28556348 -0.53043848 [76,] -0.63818848 -0.28556348 [77,] -0.68193848 -0.63818848 [78,] -0.17432579 -0.68193848 [79,] 0.01217421 -0.17432579 [80,] 0.50854921 0.01217421 [81,] 0.86842421 0.50854921 [82,] 1.74262767 0.86842421 [83,] 1.73419910 1.74262767 [84,] 3.14843652 1.73419910 [85,] 3.61143652 3.14843652 [86,] 3.64956152 3.61143652 [87,] 2.12743652 3.64956152 [88,] 1.86581152 2.12743652 [89,] 1.99606152 1.86581152 [90,] 3.40967421 1.99606152 [91,] 2.40817421 3.40967421 [92,] 2.55354921 2.40817421 [93,] 3.48042421 2.55354921 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -1.51766191 -1.27866191 2 -1.28653691 -1.51766191 3 -1.19866191 -1.28653691 4 -0.76328691 -1.19866191 5 -0.35403691 -0.76328691 6 0.09757579 -0.35403691 7 -0.07892421 0.09757579 8 -0.06354921 -0.07892421 9 -0.23667421 -0.06354921 10 -0.07147075 -0.23667421 11 -0.18689933 -0.07147075 12 -0.14566191 -0.18689933 13 0.22033809 -0.14566191 14 0.16146309 0.22033809 15 0.34733809 0.16146309 16 0.28571309 0.34733809 17 0.29596309 0.28571309 18 0.26157579 0.29596309 19 0.37907579 0.26157579 20 0.39145079 0.37907579 21 0.06832579 0.39145079 22 0.15452925 0.06832579 23 0.36410067 0.15452925 24 0.43033809 0.36410067 25 0.06533809 0.43033809 26 -0.42353691 0.06533809 27 -0.87166191 -0.42353691 28 -0.81428691 -0.87166191 29 -0.70303691 -0.81428691 30 0.01957579 -0.70303691 31 0.56407579 0.01957579 32 0.78045079 0.56407579 33 0.11332579 0.78045079 34 0.61952925 0.11332579 35 0.51510067 0.61952925 36 0.18833809 0.51510067 37 -0.37566191 0.18833809 38 0.04046309 -0.37566191 39 0.27933809 0.04046309 40 -0.41528691 0.27933809 41 -0.14803691 -0.41528691 42 0.52657579 -0.14803691 43 0.76707579 0.52657579 44 0.58745079 0.76707579 45 0.50532579 0.58745079 46 0.78252925 0.50532579 47 0.47810067 0.78252925 48 0.02533809 0.47810067 49 -0.20966191 0.02533809 50 -0.03853691 -0.20966191 51 0.05333809 -0.03853691 52 -0.00928691 0.05333809 53 0.82196309 -0.00928691 54 -4.42232579 0.82196309 55 -4.21982579 -4.42232579 56 -3.96545079 -4.21982579 57 -3.58957579 -3.96545079 58 -2.92237233 -3.58957579 59 -2.19880090 -2.92237233 60 -1.70156348 -2.19880090 61 -1.60556348 -1.70156348 62 -1.57243848 -1.60556348 63 -0.45156348 -1.57243848 64 0.48881152 -0.45156348 65 -1.22693848 0.48881152 66 0.28167421 -1.22693848 67 0.16817421 0.28167421 68 -0.79245079 0.16817421 69 -1.20957579 -0.79245079 70 -0.30537233 -1.20957579 71 -0.70580090 -0.30537233 72 -0.66656348 -0.70580090 73 -0.18856348 -0.66656348 74 -0.53043848 -0.18856348 75 -0.28556348 -0.53043848 76 -0.63818848 -0.28556348 77 -0.68193848 -0.63818848 78 -0.17432579 -0.68193848 79 0.01217421 -0.17432579 80 0.50854921 0.01217421 81 0.86842421 0.50854921 82 1.74262767 0.86842421 83 1.73419910 1.74262767 84 3.14843652 1.73419910 85 3.61143652 3.14843652 86 3.64956152 3.61143652 87 2.12743652 3.64956152 88 1.86581152 2.12743652 89 1.99606152 1.86581152 90 3.40967421 1.99606152 91 2.40817421 3.40967421 92 2.55354921 2.40817421 93 3.48042421 2.55354921 > 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/7w5ty1227791816.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/8a3h41227791816.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/9yxm81227791816.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/10thjl1227791816.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/11ziry1227791816.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/12r1jf1227791816.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/131x2y1227791816.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/14qtjc1227791816.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/1566841227791816.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/16zjb71227791817.tab") + } > > system("convert tmp/1mlkz1227791816.ps tmp/1mlkz1227791816.png") > system("convert tmp/2t7481227791816.ps tmp/2t7481227791816.png") > system("convert tmp/352pz1227791816.ps tmp/352pz1227791816.png") > system("convert tmp/4v1mz1227791816.ps tmp/4v1mz1227791816.png") > system("convert tmp/5dcao1227791816.ps tmp/5dcao1227791816.png") > system("convert tmp/6soty1227791816.ps tmp/6soty1227791816.png") > system("convert tmp/7w5ty1227791816.ps tmp/7w5ty1227791816.png") > system("convert tmp/8a3h41227791816.ps tmp/8a3h41227791816.png") > system("convert tmp/9yxm81227791816.ps tmp/9yxm81227791816.png") > system("convert tmp/10thjl1227791816.ps tmp/10thjl1227791816.png") > > > proc.time() user system elapsed 2.801 1.530 3.213