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.2,0,9.1,0,9.1,0,9.1,0,9.1,0,9.2,0,9.3,0,9.3,0,9.3,0,9.3,0,9.3,0,9.4,0,9.4,0,9.4,0,9.5,0,9.5,0,9.4,0,9.4,0,9.3,0,9.4,0,9.4,0,9.2,0,9.1,0,9.1,0,9.1,0,9.1,0,9,0,8.9,0,8.8,0,8.7,0,8.5,0,8.3,0,8.1,0,7.8,0,7.6,0,7.5,0,7.4,0,7.3,0,7.1,0,6.9,0,6.8,0,6.8,0,6.8,0,6.9,0,6.7,0,6.6,0,6.5,0,6.4,0,6.3,0,6.3,0,6.3,0,6.5,0,6.6,0,6.5,0,6.4,0,6.5,0,6.7,0,7.1,0,7.1,0,7.2,1,7.2,1,7.3,1,7.3,1,7.3,1,7.4,1,7.4,1,7.6,1,7.6,1,7.6,1,7.7,1,7.8,1,7.9,1,8.1,1,8.1,1,8.1,1,8.2,1,8.2,1,8.2,1,8.2,1,8.2,1,8.2,1,8.3,1,8.3,1,8.4,1,8.4,1,8.4,1,8.3,1,8,1,8,1,8.2,1,8.6,1,8.7,1,8.7,1,8.5,1,8.4,1,8.4,1,8.4,1,8.5,1,8.5,1,8.5,1,8.5,1,8.5,1,8.4,1,8.4,1,8.4,1,8.5,1,8.5,1,8.6,1,8.6,1,8.6,1,8.5,1,8.4,1,8.4,1,8.3,1,8.2,1,8.1,1,8.2,1,8.1,1,8,1,7.9,1,7.8,1,7.7,1,7.7,1,7.9,1,7.8,1,7.6,1,7.4,1,7.3,1,7.1,1,7.1,1,7,1,7,1),dim=c(2,132),dimnames=list(c('Werkloosheid','SabenaFailliet'),1:132)) > y <- array(NA,dim=c(2,132),dimnames=list(c('Werkloosheid','SabenaFailliet'),1:132)) > 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 = '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 Werkloosheid SabenaFailliet t 1 9.2 0 1 2 9.1 0 2 3 9.1 0 3 4 9.1 0 4 5 9.1 0 5 6 9.2 0 6 7 9.3 0 7 8 9.3 0 8 9 9.3 0 9 10 9.3 0 10 11 9.3 0 11 12 9.4 0 12 13 9.4 0 13 14 9.4 0 14 15 9.5 0 15 16 9.5 0 16 17 9.4 0 17 18 9.4 0 18 19 9.3 0 19 20 9.4 0 20 21 9.4 0 21 22 9.2 0 22 23 9.1 0 23 24 9.1 0 24 25 9.1 0 25 26 9.1 0 26 27 9.0 0 27 28 8.9 0 28 29 8.8 0 29 30 8.7 0 30 31 8.5 0 31 32 8.3 0 32 33 8.1 0 33 34 7.8 0 34 35 7.6 0 35 36 7.5 0 36 37 7.4 0 37 38 7.3 0 38 39 7.1 0 39 40 6.9 0 40 41 6.8 0 41 42 6.8 0 42 43 6.8 0 43 44 6.9 0 44 45 6.7 0 45 46 6.6 0 46 47 6.5 0 47 48 6.4 0 48 49 6.3 0 49 50 6.3 0 50 51 6.3 0 51 52 6.5 0 52 53 6.6 0 53 54 6.5 0 54 55 6.4 0 55 56 6.5 0 56 57 6.7 0 57 58 7.1 0 58 59 7.1 0 59 60 7.2 1 60 61 7.2 1 61 62 7.3 1 62 63 7.3 1 63 64 7.3 1 64 65 7.4 1 65 66 7.4 1 66 67 7.6 1 67 68 7.6 1 68 69 7.6 1 69 70 7.7 1 70 71 7.8 1 71 72 7.9 1 72 73 8.1 1 73 74 8.1 1 74 75 8.1 1 75 76 8.2 1 76 77 8.2 1 77 78 8.2 1 78 79 8.2 1 79 80 8.2 1 80 81 8.2 1 81 82 8.3 1 82 83 8.3 1 83 84 8.4 1 84 85 8.4 1 85 86 8.4 1 86 87 8.3 1 87 88 8.0 1 88 89 8.0 1 89 90 8.2 1 90 91 8.6 1 91 92 8.7 1 92 93 8.7 1 93 94 8.5 1 94 95 8.4 1 95 96 8.4 1 96 97 8.4 1 97 98 8.5 1 98 99 8.5 1 99 100 8.5 1 100 101 8.5 1 101 102 8.5 1 102 103 8.4 1 103 104 8.4 1 104 105 8.4 1 105 106 8.5 1 106 107 8.5 1 107 108 8.6 1 108 109 8.6 1 109 110 8.6 1 110 111 8.5 1 111 112 8.4 1 112 113 8.4 1 113 114 8.3 1 114 115 8.2 1 115 116 8.1 1 116 117 8.2 1 117 118 8.1 1 118 119 8.0 1 119 120 7.9 1 120 121 7.8 1 121 122 7.7 1 122 123 7.7 1 123 124 7.9 1 124 125 7.8 1 125 126 7.6 1 126 127 7.4 1 127 128 7.3 1 128 129 7.1 1 129 130 7.1 1 130 131 7.0 1 131 132 7.0 1 132 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) SabenaFailliet t 8.76672 1.36176 -0.02177 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -1.6222 -0.5807 0.2289 0.6020 1.0905 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 8.766724 0.145792 60.132 < 2e-16 *** SabenaFailliet 1.361758 0.267915 5.083 1.28e-06 *** t -0.021772 0.003496 -6.228 6.15e-09 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 0.7779 on 129 degrees of freedom Multiple R-squared: 0.2326, Adjusted R-squared: 0.2207 F-statistic: 19.55 on 2 and 129 DF, p-value: 3.843e-08 > 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,] 8.327603e-04 1.665521e-03 9.991672e-01 [2,] 2.568006e-04 5.136013e-04 9.997432e-01 [3,] 3.031783e-05 6.063567e-05 9.999697e-01 [4,] 2.776969e-06 5.553937e-06 9.999972e-01 [5,] 2.391610e-07 4.783220e-07 9.999998e-01 [6,] 2.131175e-08 4.262351e-08 1.000000e+00 [7,] 2.261609e-09 4.523218e-09 1.000000e+00 [8,] 1.858924e-10 3.717848e-10 1.000000e+00 [9,] 1.520698e-11 3.041396e-11 1.000000e+00 [10,] 2.056265e-12 4.112530e-12 1.000000e+00 [11,] 1.883280e-13 3.766559e-13 1.000000e+00 [12,] 7.577357e-14 1.515471e-13 1.000000e+00 [13,] 3.011152e-14 6.022303e-14 1.000000e+00 [14,] 1.528131e-13 3.056261e-13 1.000000e+00 [15,] 4.086433e-14 8.172866e-14 1.000000e+00 [16,] 1.248939e-14 2.497877e-14 1.000000e+00 [17,] 2.468355e-13 4.936710e-13 1.000000e+00 [18,] 5.276152e-12 1.055230e-11 1.000000e+00 [19,] 2.001819e-11 4.003638e-11 1.000000e+00 [20,] 3.941354e-11 7.882707e-11 1.000000e+00 [21,] 5.940515e-11 1.188103e-10 1.000000e+00 [22,] 1.868807e-10 3.737613e-10 1.000000e+00 [23,] 1.045272e-09 2.090545e-09 1.000000e+00 [24,] 8.498647e-09 1.699729e-08 1.000000e+00 [25,] 8.477190e-08 1.695438e-07 9.999999e-01 [26,] 1.856204e-06 3.712408e-06 9.999981e-01 [27,] 4.696308e-05 9.392616e-05 9.999530e-01 [28,] 8.562499e-04 1.712500e-03 9.991438e-01 [29,] 1.256209e-02 2.512418e-02 9.874379e-01 [30,] 7.399233e-02 1.479847e-01 9.260077e-01 [31,] 1.977302e-01 3.954605e-01 8.022698e-01 [32,] 3.500027e-01 7.000054e-01 6.499973e-01 [33,] 4.923071e-01 9.846142e-01 5.076929e-01 [34,] 6.291608e-01 7.416785e-01 3.708392e-01 [35,] 7.446632e-01 5.106736e-01 2.553368e-01 [36,] 8.159845e-01 3.680309e-01 1.840155e-01 [37,] 8.472848e-01 3.054305e-01 1.527152e-01 [38,] 8.577521e-01 2.844958e-01 1.422479e-01 [39,] 8.505995e-01 2.988010e-01 1.494005e-01 [40,] 8.463353e-01 3.073295e-01 1.536647e-01 [41,] 8.394724e-01 3.210552e-01 1.605276e-01 [42,] 8.309841e-01 3.380318e-01 1.690159e-01 [43,] 8.222464e-01 3.555073e-01 1.777536e-01 [44,] 8.152778e-01 3.694444e-01 1.847222e-01 [45,] 8.005149e-01 3.989703e-01 1.994851e-01 [46,] 7.802677e-01 4.394645e-01 2.197323e-01 [47,] 7.427211e-01 5.145579e-01 2.572789e-01 [48,] 7.022002e-01 5.955996e-01 2.977998e-01 [49,] 6.618857e-01 6.762286e-01 3.381143e-01 [50,] 6.286060e-01 7.427880e-01 3.713940e-01 [51,] 6.000800e-01 7.998400e-01 3.999200e-01 [52,] 5.860361e-01 8.279277e-01 4.139639e-01 [53,] 6.265697e-01 7.468606e-01 3.734303e-01 [54,] 6.621869e-01 6.756261e-01 3.378131e-01 [55,] 6.790644e-01 6.418712e-01 3.209356e-01 [56,] 7.063055e-01 5.873891e-01 2.936945e-01 [57,] 7.298424e-01 5.403152e-01 2.701576e-01 [58,] 7.630510e-01 4.738980e-01 2.369490e-01 [59,] 8.059642e-01 3.880716e-01 1.940358e-01 [60,] 8.443125e-01 3.113750e-01 1.556875e-01 [61,] 8.870581e-01 2.258837e-01 1.129419e-01 [62,] 9.155030e-01 1.689939e-01 8.449696e-02 [63,] 9.424167e-01 1.151666e-01 5.758330e-02 [64,] 9.657698e-01 6.846042e-02 3.423021e-02 [65,] 9.809608e-01 3.807849e-02 1.903925e-02 [66,] 9.899918e-01 2.001634e-02 1.000817e-02 [67,] 9.949405e-01 1.011904e-02 5.059521e-03 [68,] 9.973180e-01 5.363976e-03 2.681988e-03 [69,] 9.986003e-01 2.799393e-03 1.399697e-03 [70,] 9.992923e-01 1.415462e-03 7.077312e-04 [71,] 9.996283e-01 7.434433e-04 3.717217e-04 [72,] 9.998046e-01 3.908083e-04 1.954042e-04 [73,] 9.998984e-01 2.032784e-04 1.016392e-04 [74,] 9.999483e-01 1.033660e-04 5.168299e-05 [75,] 9.999747e-01 5.069459e-05 2.534729e-05 [76,] 9.999882e-01 2.360304e-05 1.180152e-05 [77,] 9.999938e-01 1.239342e-05 6.196709e-06 [78,] 9.999968e-01 6.487177e-06 3.243588e-06 [79,] 9.999980e-01 3.943445e-06 1.971722e-06 [80,] 9.999987e-01 2.507782e-06 1.253891e-06 [81,] 9.999992e-01 1.660470e-06 8.302349e-07 [82,] 9.999995e-01 9.202862e-07 4.601431e-07 [83,] 9.999999e-01 1.192385e-07 5.961924e-08 [84,] 1.000000e+00 6.094416e-09 3.047208e-09 [85,] 1.000000e+00 5.555612e-10 2.777806e-10 [86,] 1.000000e+00 3.665141e-10 1.832570e-10 [87,] 1.000000e+00 3.453726e-10 1.726863e-10 [88,] 1.000000e+00 3.792389e-10 1.896195e-10 [89,] 1.000000e+00 2.859731e-10 1.429865e-10 [90,] 1.000000e+00 1.318496e-10 6.592480e-11 [91,] 1.000000e+00 5.454277e-11 2.727139e-11 [92,] 1.000000e+00 1.937940e-11 9.689702e-12 [93,] 1.000000e+00 1.299936e-11 6.499681e-12 [94,] 1.000000e+00 9.036249e-12 4.518125e-12 [95,] 1.000000e+00 6.552735e-12 3.276367e-12 [96,] 1.000000e+00 5.009777e-12 2.504888e-12 [97,] 1.000000e+00 4.101821e-12 2.050911e-12 [98,] 1.000000e+00 1.186436e-12 5.932181e-13 [99,] 1.000000e+00 2.303822e-13 1.151911e-13 [100,] 1.000000e+00 2.282320e-14 1.141160e-14 [101,] 1.000000e+00 9.056465e-15 4.528232e-15 [102,] 1.000000e+00 3.836486e-15 1.918243e-15 [103,] 1.000000e+00 1.133939e-14 5.669697e-15 [104,] 1.000000e+00 5.388631e-14 2.694316e-14 [105,] 1.000000e+00 3.268729e-13 1.634365e-13 [106,] 1.000000e+00 1.889052e-12 9.445261e-13 [107,] 1.000000e+00 9.166419e-12 4.583209e-12 [108,] 1.000000e+00 5.734954e-11 2.867477e-11 [109,] 1.000000e+00 3.237586e-10 1.618793e-10 [110,] 1.000000e+00 1.451499e-09 7.257494e-10 [111,] 1.000000e+00 4.095942e-09 2.047971e-09 [112,] 1.000000e+00 2.708970e-08 1.354485e-08 [113,] 9.999999e-01 1.708275e-07 8.541376e-08 [114,] 9.999995e-01 9.751863e-07 4.875931e-07 [115,] 9.999977e-01 4.637260e-06 2.318630e-06 [116,] 9.999922e-01 1.554817e-05 7.774083e-06 [117,] 9.999892e-01 2.163536e-05 1.081768e-05 [118,] 9.999875e-01 2.491925e-05 1.245963e-05 [119,] 9.999154e-01 1.692425e-04 8.462123e-05 [120,] 9.997486e-01 5.027794e-04 2.513897e-04 [121,] 9.990435e-01 1.913003e-03 9.565014e-04 > postscript(file="/var/www/html/rcomp/tmp/1xesm1229951896.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/2jasb1229951896.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/3bj6p1229951896.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/43i181229951896.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/5mw6l1229951896.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 = 132 Frequency = 1 1 2 3 4 5 6 0.45504857 0.37682071 0.39859285 0.42036499 0.44213714 0.56390928 7 8 9 10 11 12 0.68568142 0.70745356 0.72922570 0.75099784 0.77276999 0.89454213 13 14 15 16 17 18 0.91631427 0.93808641 1.05985855 1.08163069 1.00340284 1.02517498 19 20 21 22 23 24 0.94694712 1.06871926 1.09049140 0.91226354 0.83403569 0.85580783 25 26 27 28 29 30 0.87757997 0.89935211 0.82112425 0.74289639 0.66466854 0.58644068 31 32 33 34 35 36 0.40821282 0.22998496 0.05175710 -0.22647076 -0.40469861 -0.48292647 37 38 39 40 41 42 -0.56115433 -0.63938219 -0.81761005 -0.99583791 -1.07406576 -1.05229362 43 44 45 46 47 48 -1.03052148 -0.90874934 -1.08697720 -1.16520506 -1.24343291 -1.32166077 49 50 51 52 53 54 -1.39988863 -1.37811649 -1.35634435 -1.13457221 -1.01280006 -1.09102792 55 56 57 58 59 60 -1.16925578 -1.04748364 -0.82571150 -0.40393936 -0.38216721 -1.62215326 61 62 63 64 65 66 -1.60038112 -1.47860898 -1.45683684 -1.43506470 -1.31329256 -1.29152041 67 68 69 70 71 72 -1.06974827 -1.04797613 -1.02620399 -0.90443185 -0.78265971 -0.66088756 73 74 75 76 77 78 -0.43911542 -0.41734328 -0.39557114 -0.27379900 -0.25202686 -0.23025471 79 80 81 82 83 84 -0.20848257 -0.18671043 -0.16493829 -0.04316615 -0.02139401 0.10037814 85 86 87 88 89 90 0.12215028 0.14392242 0.06569456 -0.21253330 -0.19076116 0.03101099 91 92 93 94 95 96 0.45278313 0.57455527 0.59632741 0.41809955 0.33987169 0.36164384 97 98 99 100 101 102 0.38341598 0.50518812 0.52696026 0.54873240 0.57050454 0.59227669 103 104 105 106 107 108 0.51404883 0.53582097 0.55759311 0.67936525 0.70113739 0.82290954 109 110 111 112 113 114 0.84468168 0.86645382 0.78822596 0.70999810 0.73177024 0.65354239 115 116 117 118 119 120 0.57531453 0.49708667 0.61885881 0.54063095 0.46240309 0.38417524 121 122 123 124 125 126 0.30594738 0.22771952 0.24949166 0.47126380 0.39303594 0.21480809 127 128 129 130 131 132 0.03658023 -0.04164763 -0.21987549 -0.19810335 -0.27633121 -0.25455906 > postscript(file="/var/www/html/rcomp/tmp/6u6mt1229951896.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 = 132 Frequency = 1 lag(myerror, k = 1) myerror 0 0.45504857 NA 1 0.37682071 0.45504857 2 0.39859285 0.37682071 3 0.42036499 0.39859285 4 0.44213714 0.42036499 5 0.56390928 0.44213714 6 0.68568142 0.56390928 7 0.70745356 0.68568142 8 0.72922570 0.70745356 9 0.75099784 0.72922570 10 0.77276999 0.75099784 11 0.89454213 0.77276999 12 0.91631427 0.89454213 13 0.93808641 0.91631427 14 1.05985855 0.93808641 15 1.08163069 1.05985855 16 1.00340284 1.08163069 17 1.02517498 1.00340284 18 0.94694712 1.02517498 19 1.06871926 0.94694712 20 1.09049140 1.06871926 21 0.91226354 1.09049140 22 0.83403569 0.91226354 23 0.85580783 0.83403569 24 0.87757997 0.85580783 25 0.89935211 0.87757997 26 0.82112425 0.89935211 27 0.74289639 0.82112425 28 0.66466854 0.74289639 29 0.58644068 0.66466854 30 0.40821282 0.58644068 31 0.22998496 0.40821282 32 0.05175710 0.22998496 33 -0.22647076 0.05175710 34 -0.40469861 -0.22647076 35 -0.48292647 -0.40469861 36 -0.56115433 -0.48292647 37 -0.63938219 -0.56115433 38 -0.81761005 -0.63938219 39 -0.99583791 -0.81761005 40 -1.07406576 -0.99583791 41 -1.05229362 -1.07406576 42 -1.03052148 -1.05229362 43 -0.90874934 -1.03052148 44 -1.08697720 -0.90874934 45 -1.16520506 -1.08697720 46 -1.24343291 -1.16520506 47 -1.32166077 -1.24343291 48 -1.39988863 -1.32166077 49 -1.37811649 -1.39988863 50 -1.35634435 -1.37811649 51 -1.13457221 -1.35634435 52 -1.01280006 -1.13457221 53 -1.09102792 -1.01280006 54 -1.16925578 -1.09102792 55 -1.04748364 -1.16925578 56 -0.82571150 -1.04748364 57 -0.40393936 -0.82571150 58 -0.38216721 -0.40393936 59 -1.62215326 -0.38216721 60 -1.60038112 -1.62215326 61 -1.47860898 -1.60038112 62 -1.45683684 -1.47860898 63 -1.43506470 -1.45683684 64 -1.31329256 -1.43506470 65 -1.29152041 -1.31329256 66 -1.06974827 -1.29152041 67 -1.04797613 -1.06974827 68 -1.02620399 -1.04797613 69 -0.90443185 -1.02620399 70 -0.78265971 -0.90443185 71 -0.66088756 -0.78265971 72 -0.43911542 -0.66088756 73 -0.41734328 -0.43911542 74 -0.39557114 -0.41734328 75 -0.27379900 -0.39557114 76 -0.25202686 -0.27379900 77 -0.23025471 -0.25202686 78 -0.20848257 -0.23025471 79 -0.18671043 -0.20848257 80 -0.16493829 -0.18671043 81 -0.04316615 -0.16493829 82 -0.02139401 -0.04316615 83 0.10037814 -0.02139401 84 0.12215028 0.10037814 85 0.14392242 0.12215028 86 0.06569456 0.14392242 87 -0.21253330 0.06569456 88 -0.19076116 -0.21253330 89 0.03101099 -0.19076116 90 0.45278313 0.03101099 91 0.57455527 0.45278313 92 0.59632741 0.57455527 93 0.41809955 0.59632741 94 0.33987169 0.41809955 95 0.36164384 0.33987169 96 0.38341598 0.36164384 97 0.50518812 0.38341598 98 0.52696026 0.50518812 99 0.54873240 0.52696026 100 0.57050454 0.54873240 101 0.59227669 0.57050454 102 0.51404883 0.59227669 103 0.53582097 0.51404883 104 0.55759311 0.53582097 105 0.67936525 0.55759311 106 0.70113739 0.67936525 107 0.82290954 0.70113739 108 0.84468168 0.82290954 109 0.86645382 0.84468168 110 0.78822596 0.86645382 111 0.70999810 0.78822596 112 0.73177024 0.70999810 113 0.65354239 0.73177024 114 0.57531453 0.65354239 115 0.49708667 0.57531453 116 0.61885881 0.49708667 117 0.54063095 0.61885881 118 0.46240309 0.54063095 119 0.38417524 0.46240309 120 0.30594738 0.38417524 121 0.22771952 0.30594738 122 0.24949166 0.22771952 123 0.47126380 0.24949166 124 0.39303594 0.47126380 125 0.21480809 0.39303594 126 0.03658023 0.21480809 127 -0.04164763 0.03658023 128 -0.21987549 -0.04164763 129 -0.19810335 -0.21987549 130 -0.27633121 -0.19810335 131 -0.25455906 -0.27633121 132 NA -0.25455906 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] 0.37682071 0.45504857 [2,] 0.39859285 0.37682071 [3,] 0.42036499 0.39859285 [4,] 0.44213714 0.42036499 [5,] 0.56390928 0.44213714 [6,] 0.68568142 0.56390928 [7,] 0.70745356 0.68568142 [8,] 0.72922570 0.70745356 [9,] 0.75099784 0.72922570 [10,] 0.77276999 0.75099784 [11,] 0.89454213 0.77276999 [12,] 0.91631427 0.89454213 [13,] 0.93808641 0.91631427 [14,] 1.05985855 0.93808641 [15,] 1.08163069 1.05985855 [16,] 1.00340284 1.08163069 [17,] 1.02517498 1.00340284 [18,] 0.94694712 1.02517498 [19,] 1.06871926 0.94694712 [20,] 1.09049140 1.06871926 [21,] 0.91226354 1.09049140 [22,] 0.83403569 0.91226354 [23,] 0.85580783 0.83403569 [24,] 0.87757997 0.85580783 [25,] 0.89935211 0.87757997 [26,] 0.82112425 0.89935211 [27,] 0.74289639 0.82112425 [28,] 0.66466854 0.74289639 [29,] 0.58644068 0.66466854 [30,] 0.40821282 0.58644068 [31,] 0.22998496 0.40821282 [32,] 0.05175710 0.22998496 [33,] -0.22647076 0.05175710 [34,] -0.40469861 -0.22647076 [35,] -0.48292647 -0.40469861 [36,] -0.56115433 -0.48292647 [37,] -0.63938219 -0.56115433 [38,] -0.81761005 -0.63938219 [39,] -0.99583791 -0.81761005 [40,] -1.07406576 -0.99583791 [41,] -1.05229362 -1.07406576 [42,] -1.03052148 -1.05229362 [43,] -0.90874934 -1.03052148 [44,] -1.08697720 -0.90874934 [45,] -1.16520506 -1.08697720 [46,] -1.24343291 -1.16520506 [47,] -1.32166077 -1.24343291 [48,] -1.39988863 -1.32166077 [49,] -1.37811649 -1.39988863 [50,] -1.35634435 -1.37811649 [51,] -1.13457221 -1.35634435 [52,] -1.01280006 -1.13457221 [53,] -1.09102792 -1.01280006 [54,] -1.16925578 -1.09102792 [55,] -1.04748364 -1.16925578 [56,] -0.82571150 -1.04748364 [57,] -0.40393936 -0.82571150 [58,] -0.38216721 -0.40393936 [59,] -1.62215326 -0.38216721 [60,] -1.60038112 -1.62215326 [61,] -1.47860898 -1.60038112 [62,] -1.45683684 -1.47860898 [63,] -1.43506470 -1.45683684 [64,] -1.31329256 -1.43506470 [65,] -1.29152041 -1.31329256 [66,] -1.06974827 -1.29152041 [67,] -1.04797613 -1.06974827 [68,] -1.02620399 -1.04797613 [69,] -0.90443185 -1.02620399 [70,] -0.78265971 -0.90443185 [71,] -0.66088756 -0.78265971 [72,] -0.43911542 -0.66088756 [73,] -0.41734328 -0.43911542 [74,] -0.39557114 -0.41734328 [75,] -0.27379900 -0.39557114 [76,] -0.25202686 -0.27379900 [77,] -0.23025471 -0.25202686 [78,] -0.20848257 -0.23025471 [79,] -0.18671043 -0.20848257 [80,] -0.16493829 -0.18671043 [81,] -0.04316615 -0.16493829 [82,] -0.02139401 -0.04316615 [83,] 0.10037814 -0.02139401 [84,] 0.12215028 0.10037814 [85,] 0.14392242 0.12215028 [86,] 0.06569456 0.14392242 [87,] -0.21253330 0.06569456 [88,] -0.19076116 -0.21253330 [89,] 0.03101099 -0.19076116 [90,] 0.45278313 0.03101099 [91,] 0.57455527 0.45278313 [92,] 0.59632741 0.57455527 [93,] 0.41809955 0.59632741 [94,] 0.33987169 0.41809955 [95,] 0.36164384 0.33987169 [96,] 0.38341598 0.36164384 [97,] 0.50518812 0.38341598 [98,] 0.52696026 0.50518812 [99,] 0.54873240 0.52696026 [100,] 0.57050454 0.54873240 [101,] 0.59227669 0.57050454 [102,] 0.51404883 0.59227669 [103,] 0.53582097 0.51404883 [104,] 0.55759311 0.53582097 [105,] 0.67936525 0.55759311 [106,] 0.70113739 0.67936525 [107,] 0.82290954 0.70113739 [108,] 0.84468168 0.82290954 [109,] 0.86645382 0.84468168 [110,] 0.78822596 0.86645382 [111,] 0.70999810 0.78822596 [112,] 0.73177024 0.70999810 [113,] 0.65354239 0.73177024 [114,] 0.57531453 0.65354239 [115,] 0.49708667 0.57531453 [116,] 0.61885881 0.49708667 [117,] 0.54063095 0.61885881 [118,] 0.46240309 0.54063095 [119,] 0.38417524 0.46240309 [120,] 0.30594738 0.38417524 [121,] 0.22771952 0.30594738 [122,] 0.24949166 0.22771952 [123,] 0.47126380 0.24949166 [124,] 0.39303594 0.47126380 [125,] 0.21480809 0.39303594 [126,] 0.03658023 0.21480809 [127,] -0.04164763 0.03658023 [128,] -0.21987549 -0.04164763 [129,] -0.19810335 -0.21987549 [130,] -0.27633121 -0.19810335 [131,] -0.25455906 -0.27633121 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 0.37682071 0.45504857 2 0.39859285 0.37682071 3 0.42036499 0.39859285 4 0.44213714 0.42036499 5 0.56390928 0.44213714 6 0.68568142 0.56390928 7 0.70745356 0.68568142 8 0.72922570 0.70745356 9 0.75099784 0.72922570 10 0.77276999 0.75099784 11 0.89454213 0.77276999 12 0.91631427 0.89454213 13 0.93808641 0.91631427 14 1.05985855 0.93808641 15 1.08163069 1.05985855 16 1.00340284 1.08163069 17 1.02517498 1.00340284 18 0.94694712 1.02517498 19 1.06871926 0.94694712 20 1.09049140 1.06871926 21 0.91226354 1.09049140 22 0.83403569 0.91226354 23 0.85580783 0.83403569 24 0.87757997 0.85580783 25 0.89935211 0.87757997 26 0.82112425 0.89935211 27 0.74289639 0.82112425 28 0.66466854 0.74289639 29 0.58644068 0.66466854 30 0.40821282 0.58644068 31 0.22998496 0.40821282 32 0.05175710 0.22998496 33 -0.22647076 0.05175710 34 -0.40469861 -0.22647076 35 -0.48292647 -0.40469861 36 -0.56115433 -0.48292647 37 -0.63938219 -0.56115433 38 -0.81761005 -0.63938219 39 -0.99583791 -0.81761005 40 -1.07406576 -0.99583791 41 -1.05229362 -1.07406576 42 -1.03052148 -1.05229362 43 -0.90874934 -1.03052148 44 -1.08697720 -0.90874934 45 -1.16520506 -1.08697720 46 -1.24343291 -1.16520506 47 -1.32166077 -1.24343291 48 -1.39988863 -1.32166077 49 -1.37811649 -1.39988863 50 -1.35634435 -1.37811649 51 -1.13457221 -1.35634435 52 -1.01280006 -1.13457221 53 -1.09102792 -1.01280006 54 -1.16925578 -1.09102792 55 -1.04748364 -1.16925578 56 -0.82571150 -1.04748364 57 -0.40393936 -0.82571150 58 -0.38216721 -0.40393936 59 -1.62215326 -0.38216721 60 -1.60038112 -1.62215326 61 -1.47860898 -1.60038112 62 -1.45683684 -1.47860898 63 -1.43506470 -1.45683684 64 -1.31329256 -1.43506470 65 -1.29152041 -1.31329256 66 -1.06974827 -1.29152041 67 -1.04797613 -1.06974827 68 -1.02620399 -1.04797613 69 -0.90443185 -1.02620399 70 -0.78265971 -0.90443185 71 -0.66088756 -0.78265971 72 -0.43911542 -0.66088756 73 -0.41734328 -0.43911542 74 -0.39557114 -0.41734328 75 -0.27379900 -0.39557114 76 -0.25202686 -0.27379900 77 -0.23025471 -0.25202686 78 -0.20848257 -0.23025471 79 -0.18671043 -0.20848257 80 -0.16493829 -0.18671043 81 -0.04316615 -0.16493829 82 -0.02139401 -0.04316615 83 0.10037814 -0.02139401 84 0.12215028 0.10037814 85 0.14392242 0.12215028 86 0.06569456 0.14392242 87 -0.21253330 0.06569456 88 -0.19076116 -0.21253330 89 0.03101099 -0.19076116 90 0.45278313 0.03101099 91 0.57455527 0.45278313 92 0.59632741 0.57455527 93 0.41809955 0.59632741 94 0.33987169 0.41809955 95 0.36164384 0.33987169 96 0.38341598 0.36164384 97 0.50518812 0.38341598 98 0.52696026 0.50518812 99 0.54873240 0.52696026 100 0.57050454 0.54873240 101 0.59227669 0.57050454 102 0.51404883 0.59227669 103 0.53582097 0.51404883 104 0.55759311 0.53582097 105 0.67936525 0.55759311 106 0.70113739 0.67936525 107 0.82290954 0.70113739 108 0.84468168 0.82290954 109 0.86645382 0.84468168 110 0.78822596 0.86645382 111 0.70999810 0.78822596 112 0.73177024 0.70999810 113 0.65354239 0.73177024 114 0.57531453 0.65354239 115 0.49708667 0.57531453 116 0.61885881 0.49708667 117 0.54063095 0.61885881 118 0.46240309 0.54063095 119 0.38417524 0.46240309 120 0.30594738 0.38417524 121 0.22771952 0.30594738 122 0.24949166 0.22771952 123 0.47126380 0.24949166 124 0.39303594 0.47126380 125 0.21480809 0.39303594 126 0.03658023 0.21480809 127 -0.04164763 0.03658023 128 -0.21987549 -0.04164763 129 -0.19810335 -0.21987549 130 -0.27633121 -0.19810335 131 -0.25455906 -0.27633121 > 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/7dmro1229951896.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/8v91x1229951896.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/9r4js1229951896.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/101vui1229951896.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/116hwz1229951896.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/12x2571229951896.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/13dkwz1229951896.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/14qg831229951896.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/15w1np1229951897.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/16qory1229951897.tab") + } > > system("convert tmp/1xesm1229951896.ps tmp/1xesm1229951896.png") > system("convert tmp/2jasb1229951896.ps tmp/2jasb1229951896.png") > system("convert tmp/3bj6p1229951896.ps tmp/3bj6p1229951896.png") > system("convert tmp/43i181229951896.ps tmp/43i181229951896.png") > system("convert tmp/5mw6l1229951896.ps tmp/5mw6l1229951896.png") > system("convert tmp/6u6mt1229951896.ps tmp/6u6mt1229951896.png") > system("convert tmp/7dmro1229951896.ps tmp/7dmro1229951896.png") > system("convert tmp/8v91x1229951896.ps tmp/8v91x1229951896.png") > system("convert tmp/9r4js1229951896.ps tmp/9r4js1229951896.png") > system("convert tmp/101vui1229951896.ps tmp/101vui1229951896.png") > > > proc.time() user system elapsed 3.380 1.672 3.786