R version 2.9.0 (2009-04-17) Copyright (C) 2009 The R Foundation for Statistical Computing ISBN 3-900051-07-0 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > x <- array(list(6.7,0,6.7,0,6.5,0,6.3,0,6.3,0,6.3,0,6.5,0,6.6,0,6.5,0,6.3,0,6.3,0,6.5,0,7,0,7.1,0,7.3,0,7.3,0,7.4,0,7.4,0,7.3,0,7.4,0,7.5,0,7.7,0,7.7,0,7.7,0,7.7,0,7.7,0,7.8,0,8,0,8.1,0,8.1,0,8.2,0,8.2,0,8.2,0,8.1,0,8.1,0,8.2,0,8.3,0,8.3,0,8.4,0,8.5,0,8.5,0,8.4,0,8,0,7.9,0,8.1,0,8.5,0,8.8,0,8.8,0,8.6,0,8.3,0,8.3,0,8.3,0,8.4,0,8.4,0,8.5,0,8.6,0,8.6,0,8.6,0,8.6,0,8.6,0,8.5,0,8.4,0,8.4,0,8.4,0,8.5,0,8.5,0,8.6,0,8.6,0,8.4,0,8.2,0,8,0,8,0,8,0,8,0,7.9,0,7.9,0,7.8,0,7.8,0,8,0,7.8,0,7.4,0,7.2,0,7,0,7,0,7.2,0,7.2,0,7.2,0,7,0,6.9,0,6.8,0,6.8,0,6.8,0,6.9,0,7.2,0,7.2,0,7.2,0,7.1,0,7.2,1,7.3,1,7.5,1,7.6,1,7.7,1,7.7,1,7.7,1,7.8,1,8,1,8.1,1,8.1,1,8,1,8.1,1,8.2,1,8.3,1,8.4,1,8.4,1,8.4,1,8.5,1,8.5,1,8.6,1,8.6,1,8.5,1,8.5,1),dim=c(2,121),dimnames=list(c('werkloosheid','X'),1:121)) > y <- array(NA,dim=c(2,121),dimnames=list(c('werkloosheid','X'),1:121)) > 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 werkloosheid X 1 6.7 0 2 6.7 0 3 6.5 0 4 6.3 0 5 6.3 0 6 6.3 0 7 6.5 0 8 6.6 0 9 6.5 0 10 6.3 0 11 6.3 0 12 6.5 0 13 7.0 0 14 7.1 0 15 7.3 0 16 7.3 0 17 7.4 0 18 7.4 0 19 7.3 0 20 7.4 0 21 7.5 0 22 7.7 0 23 7.7 0 24 7.7 0 25 7.7 0 26 7.7 0 27 7.8 0 28 8.0 0 29 8.1 0 30 8.1 0 31 8.2 0 32 8.2 0 33 8.2 0 34 8.1 0 35 8.1 0 36 8.2 0 37 8.3 0 38 8.3 0 39 8.4 0 40 8.5 0 41 8.5 0 42 8.4 0 43 8.0 0 44 7.9 0 45 8.1 0 46 8.5 0 47 8.8 0 48 8.8 0 49 8.6 0 50 8.3 0 51 8.3 0 52 8.3 0 53 8.4 0 54 8.4 0 55 8.5 0 56 8.6 0 57 8.6 0 58 8.6 0 59 8.6 0 60 8.6 0 61 8.5 0 62 8.4 0 63 8.4 0 64 8.4 0 65 8.5 0 66 8.5 0 67 8.6 0 68 8.6 0 69 8.4 0 70 8.2 0 71 8.0 0 72 8.0 0 73 8.0 0 74 8.0 0 75 7.9 0 76 7.9 0 77 7.8 0 78 7.8 0 79 8.0 0 80 7.8 0 81 7.4 0 82 7.2 0 83 7.0 0 84 7.0 0 85 7.2 0 86 7.2 0 87 7.2 0 88 7.0 0 89 6.9 0 90 6.8 0 91 6.8 0 92 6.8 0 93 6.9 0 94 7.2 0 95 7.2 0 96 7.2 0 97 7.1 0 98 7.2 1 99 7.3 1 100 7.5 1 101 7.6 1 102 7.7 1 103 7.7 1 104 7.7 1 105 7.8 1 106 8.0 1 107 8.1 1 108 8.1 1 109 8.0 1 110 8.1 1 111 8.2 1 112 8.3 1 113 8.4 1 114 8.4 1 115 8.4 1 116 8.5 1 117 8.5 1 118 8.6 1 119 8.6 1 120 8.5 1 121 8.5 1 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) X 7.7196 0.3512 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -1.4196 -0.5196 0.1292 0.5292 1.0804 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 7.71959 0.06826 113.092 <2e-16 *** X 0.35125 0.15327 2.292 0.0237 * --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 0.6723 on 119 degrees of freedom Multiple R-squared: 0.04227, Adjusted R-squared: 0.03422 F-statistic: 5.252 on 1 and 119 DF, p-value: 0.02368 > 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.0596459032 1.192918e-01 9.403541e-01 [2,] 0.0269830598 5.396612e-02 9.730169e-01 [3,] 0.0088538913 1.770778e-02 9.911461e-01 [4,] 0.0033262358 6.652472e-03 9.966738e-01 [5,] 0.0010522396 2.104479e-03 9.989478e-01 [6,] 0.0005948409 1.189682e-03 9.994052e-01 [7,] 0.0003346703 6.693406e-04 9.996653e-01 [8,] 0.0001277954 2.555908e-04 9.998722e-01 [9,] 0.0012199214 2.439843e-03 9.987801e-01 [10,] 0.0054621767 1.092435e-02 9.945378e-01 [11,] 0.0258130772 5.162615e-02 9.741869e-01 [12,] 0.0552300173 1.104600e-01 9.447700e-01 [13,] 0.1049072165 2.098144e-01 8.950928e-01 [14,] 0.1525654941 3.051310e-01 8.474345e-01 [15,] 0.1721294495 3.442589e-01 8.278706e-01 [16,] 0.2047449979 4.094900e-01 7.952550e-01 [17,] 0.2519832773 5.039666e-01 7.480167e-01 [18,] 0.3455533726 6.911067e-01 6.544466e-01 [19,] 0.4206407061 8.412814e-01 5.793593e-01 [20,] 0.4776625239 9.553250e-01 5.223375e-01 [21,] 0.5194003801 9.611992e-01 4.805996e-01 [22,] 0.5488487267 9.023025e-01 4.511513e-01 [23,] 0.5894944571 8.210111e-01 4.105055e-01 [24,] 0.6637599521 6.724801e-01 3.362400e-01 [25,] 0.7385091447 5.229817e-01 2.614909e-01 [26,] 0.7897060307 4.205879e-01 2.102940e-01 [27,] 0.8401445705 3.197109e-01 1.598554e-01 [28,] 0.8736363093 2.527274e-01 1.263637e-01 [29,] 0.8961296060 2.077408e-01 1.038704e-01 [30,] 0.9034493620 1.931013e-01 9.655064e-02 [31,] 0.9077446448 1.845107e-01 9.225536e-02 [32,] 0.9164579195 1.670842e-01 8.354208e-02 [33,] 0.9288042799 1.423914e-01 7.119572e-02 [34,] 0.9374365148 1.251270e-01 6.256349e-02 [35,] 0.9487671196 1.024658e-01 5.123288e-02 [36,] 0.9613984258 7.720315e-02 3.860157e-02 [37,] 0.9700939455 5.981211e-02 2.990605e-02 [38,] 0.9733920937 5.321581e-02 2.660791e-02 [39,] 0.9675840300 6.483194e-02 3.241597e-02 [40,] 0.9591808664 8.163827e-02 4.081913e-02 [41,] 0.9528102876 9.437942e-02 4.718971e-02 [42,] 0.9596250320 8.074994e-02 4.037497e-02 [43,] 0.9760655620 4.786888e-02 2.393444e-02 [44,] 0.9860011876 2.799762e-02 1.399881e-02 [45,] 0.9890795418 2.184092e-02 1.092046e-02 [46,] 0.9880566935 2.388661e-02 1.194331e-02 [47,] 0.9868954789 2.620904e-02 1.310452e-02 [48,] 0.9855909935 2.881801e-02 1.440901e-02 [49,] 0.9855040632 2.899187e-02 1.449594e-02 [50,] 0.9853993355 2.920133e-02 1.460066e-02 [51,] 0.9867867468 2.642651e-02 1.321325e-02 [52,] 0.9895194562 2.096109e-02 1.048054e-02 [53,] 0.9918326943 1.633461e-02 8.167306e-03 [54,] 0.9937844191 1.243116e-02 6.215581e-03 [55,] 0.9954142034 9.171593e-03 4.585797e-03 [56,] 0.9967496235 6.500753e-03 3.250377e-03 [57,] 0.9974024928 5.195014e-03 2.597507e-03 [58,] 0.9976642052 4.671590e-03 2.335795e-03 [59,] 0.9979634553 4.073089e-03 2.036545e-03 [60,] 0.9982903812 3.419238e-03 1.709619e-03 [61,] 0.9988650704 2.269859e-03 1.134930e-03 [62,] 0.9993140411 1.371918e-03 6.859589e-04 [63,] 0.9997201322 5.597356e-04 2.798678e-04 [64,] 0.9999116455 1.767089e-04 8.835445e-05 [65,] 0.9999600790 7.984208e-05 3.992104e-05 [66,] 0.9999731528 5.369437e-05 2.684719e-05 [67,] 0.9999736653 5.266942e-05 2.633471e-05 [68,] 0.9999758995 4.820107e-05 2.410054e-05 [69,] 0.9999797435 4.051298e-05 2.025649e-05 [70,] 0.9999847038 3.059246e-05 1.529623e-05 [71,] 0.9999866331 2.673389e-05 1.336695e-05 [72,] 0.9999895431 2.091373e-05 1.045687e-05 [73,] 0.9999905111 1.897788e-05 9.488939e-06 [74,] 0.9999923189 1.536224e-05 7.681121e-06 [75,] 0.9999976479 4.704185e-06 2.352092e-06 [76,] 0.9999988375 2.325017e-06 1.162508e-06 [77,] 0.9999983745 3.250943e-06 1.625471e-06 [78,] 0.9999972025 5.595057e-06 2.797529e-06 [79,] 0.9999952782 9.443551e-06 4.721775e-06 [80,] 0.9999919964 1.600728e-05 8.003641e-06 [81,] 0.9999862871 2.742573e-05 1.371286e-05 [82,] 0.9999768847 4.623058e-05 2.311529e-05 [83,] 0.9999617996 7.640084e-05 3.820042e-05 [84,] 0.9999350651 1.298698e-04 6.493491e-05 [85,] 0.9998961246 2.077509e-04 1.038754e-04 [86,] 0.9998527145 2.945710e-04 1.472855e-04 [87,] 0.9997956610 4.086780e-04 2.043390e-04 [88,] 0.9997280219 5.439563e-04 2.719781e-04 [89,] 0.9996000648 7.998704e-04 3.999352e-04 [90,] 0.9992817865 1.436427e-03 7.182135e-04 [91,] 0.9987330124 2.533975e-03 1.266988e-03 [92,] 0.9978156647 4.368671e-03 2.184335e-03 [93,] 0.9963254242 7.349152e-03 3.674576e-03 [94,] 0.9985590301 2.881940e-03 1.440970e-03 [95,] 0.9994808420 1.038316e-03 5.191580e-04 [96,] 0.9997132690 5.734620e-04 2.867310e-04 [97,] 0.9998182575 3.634850e-04 1.817425e-04 [98,] 0.9998601658 2.796685e-04 1.398342e-04 [99,] 0.9999177166 1.645668e-04 8.228340e-05 [100,] 0.9999704769 5.904620e-05 2.952310e-05 [101,] 0.9999889103 2.217932e-05 1.108966e-05 [102,] 0.9999879813 2.403742e-05 1.201871e-05 [103,] 0.9999795326 4.093484e-05 2.046742e-05 [104,] 0.9999694007 6.119853e-05 3.059926e-05 [105,] 0.9999885544 2.289127e-05 1.144563e-05 [106,] 0.9999954353 9.129463e-06 4.564732e-06 [107,] 0.9999975753 4.849313e-06 2.424657e-06 [108,] 0.9999970487 5.902667e-06 2.951334e-06 [109,] 0.9999864158 2.716839e-05 1.358419e-05 [110,] 0.9999490603 1.018794e-04 5.093971e-05 [111,] 0.9998944988 2.110024e-04 1.055012e-04 [112,] 0.9988791458 2.241708e-03 1.120854e-03 > postscript(file="/var/www/html/rcomp/tmp/16vvf1292936137.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > plot(x[,1], type='l', main='Actuals and Interpolation', ylab='value of Actuals and Interpolation (dots)', xlab='time or index') > points(x[,1]-mysum$resid) > grid() > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/26vvf1292936137.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > plot(mysum$resid, type='b', pch=19, main='Residuals', ylab='value of Residuals', xlab='time or index') > grid() > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/36vvf1292936137.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > hist(mysum$resid, main='Residual Histogram', xlab='values of Residuals') > grid() > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/4hmu01292936137.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > densityplot(~mysum$resid,col='black',main='Residual Density Plot', xlab='values of Residuals') > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/5hmu01292936137.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > qqnorm(mysum$resid, main='Residual Normal Q-Q Plot') > qqline(mysum$resid) > grid() > dev.off() null device 1 > (myerror <- as.ts(mysum$resid)) Time Series: Start = 1 End = 121 Frequency = 1 1 2 3 4 5 6 -1.01958763 -1.01958763 -1.21958763 -1.41958763 -1.41958763 -1.41958763 7 8 9 10 11 12 -1.21958763 -1.11958763 -1.21958763 -1.41958763 -1.41958763 -1.21958763 13 14 15 16 17 18 -0.71958763 -0.61958763 -0.41958763 -0.41958763 -0.31958763 -0.31958763 19 20 21 22 23 24 -0.41958763 -0.31958763 -0.21958763 -0.01958763 -0.01958763 -0.01958763 25 26 27 28 29 30 -0.01958763 -0.01958763 0.08041237 0.28041237 0.38041237 0.38041237 31 32 33 34 35 36 0.48041237 0.48041237 0.48041237 0.38041237 0.38041237 0.48041237 37 38 39 40 41 42 0.58041237 0.58041237 0.68041237 0.78041237 0.78041237 0.68041237 43 44 45 46 47 48 0.28041237 0.18041237 0.38041237 0.78041237 1.08041237 1.08041237 49 50 51 52 53 54 0.88041237 0.58041237 0.58041237 0.58041237 0.68041237 0.68041237 55 56 57 58 59 60 0.78041237 0.88041237 0.88041237 0.88041237 0.88041237 0.88041237 61 62 63 64 65 66 0.78041237 0.68041237 0.68041237 0.68041237 0.78041237 0.78041237 67 68 69 70 71 72 0.88041237 0.88041237 0.68041237 0.48041237 0.28041237 0.28041237 73 74 75 76 77 78 0.28041237 0.28041237 0.18041237 0.18041237 0.08041237 0.08041237 79 80 81 82 83 84 0.28041237 0.08041237 -0.31958763 -0.51958763 -0.71958763 -0.71958763 85 86 87 88 89 90 -0.51958763 -0.51958763 -0.51958763 -0.71958763 -0.81958763 -0.91958763 91 92 93 94 95 96 -0.91958763 -0.91958763 -0.81958763 -0.51958763 -0.51958763 -0.51958763 97 98 99 100 101 102 -0.61958763 -0.87083333 -0.77083333 -0.57083333 -0.47083333 -0.37083333 103 104 105 106 107 108 -0.37083333 -0.37083333 -0.27083333 -0.07083333 0.02916667 0.02916667 109 110 111 112 113 114 -0.07083333 0.02916667 0.12916667 0.22916667 0.32916667 0.32916667 115 116 117 118 119 120 0.32916667 0.42916667 0.42916667 0.52916667 0.52916667 0.42916667 121 0.42916667 > postscript(file="/var/www/html/rcomp/tmp/6hmu01292936137.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > dum <- cbind(lag(myerror,k=1),myerror) > dum Time Series: Start = 0 End = 121 Frequency = 1 lag(myerror, k = 1) myerror 0 -1.01958763 NA 1 -1.01958763 -1.01958763 2 -1.21958763 -1.01958763 3 -1.41958763 -1.21958763 4 -1.41958763 -1.41958763 5 -1.41958763 -1.41958763 6 -1.21958763 -1.41958763 7 -1.11958763 -1.21958763 8 -1.21958763 -1.11958763 9 -1.41958763 -1.21958763 10 -1.41958763 -1.41958763 11 -1.21958763 -1.41958763 12 -0.71958763 -1.21958763 13 -0.61958763 -0.71958763 14 -0.41958763 -0.61958763 15 -0.41958763 -0.41958763 16 -0.31958763 -0.41958763 17 -0.31958763 -0.31958763 18 -0.41958763 -0.31958763 19 -0.31958763 -0.41958763 20 -0.21958763 -0.31958763 21 -0.01958763 -0.21958763 22 -0.01958763 -0.01958763 23 -0.01958763 -0.01958763 24 -0.01958763 -0.01958763 25 -0.01958763 -0.01958763 26 0.08041237 -0.01958763 27 0.28041237 0.08041237 28 0.38041237 0.28041237 29 0.38041237 0.38041237 30 0.48041237 0.38041237 31 0.48041237 0.48041237 32 0.48041237 0.48041237 33 0.38041237 0.48041237 34 0.38041237 0.38041237 35 0.48041237 0.38041237 36 0.58041237 0.48041237 37 0.58041237 0.58041237 38 0.68041237 0.58041237 39 0.78041237 0.68041237 40 0.78041237 0.78041237 41 0.68041237 0.78041237 42 0.28041237 0.68041237 43 0.18041237 0.28041237 44 0.38041237 0.18041237 45 0.78041237 0.38041237 46 1.08041237 0.78041237 47 1.08041237 1.08041237 48 0.88041237 1.08041237 49 0.58041237 0.88041237 50 0.58041237 0.58041237 51 0.58041237 0.58041237 52 0.68041237 0.58041237 53 0.68041237 0.68041237 54 0.78041237 0.68041237 55 0.88041237 0.78041237 56 0.88041237 0.88041237 57 0.88041237 0.88041237 58 0.88041237 0.88041237 59 0.88041237 0.88041237 60 0.78041237 0.88041237 61 0.68041237 0.78041237 62 0.68041237 0.68041237 63 0.68041237 0.68041237 64 0.78041237 0.68041237 65 0.78041237 0.78041237 66 0.88041237 0.78041237 67 0.88041237 0.88041237 68 0.68041237 0.88041237 69 0.48041237 0.68041237 70 0.28041237 0.48041237 71 0.28041237 0.28041237 72 0.28041237 0.28041237 73 0.28041237 0.28041237 74 0.18041237 0.28041237 75 0.18041237 0.18041237 76 0.08041237 0.18041237 77 0.08041237 0.08041237 78 0.28041237 0.08041237 79 0.08041237 0.28041237 80 -0.31958763 0.08041237 81 -0.51958763 -0.31958763 82 -0.71958763 -0.51958763 83 -0.71958763 -0.71958763 84 -0.51958763 -0.71958763 85 -0.51958763 -0.51958763 86 -0.51958763 -0.51958763 87 -0.71958763 -0.51958763 88 -0.81958763 -0.71958763 89 -0.91958763 -0.81958763 90 -0.91958763 -0.91958763 91 -0.91958763 -0.91958763 92 -0.81958763 -0.91958763 93 -0.51958763 -0.81958763 94 -0.51958763 -0.51958763 95 -0.51958763 -0.51958763 96 -0.61958763 -0.51958763 97 -0.87083333 -0.61958763 98 -0.77083333 -0.87083333 99 -0.57083333 -0.77083333 100 -0.47083333 -0.57083333 101 -0.37083333 -0.47083333 102 -0.37083333 -0.37083333 103 -0.37083333 -0.37083333 104 -0.27083333 -0.37083333 105 -0.07083333 -0.27083333 106 0.02916667 -0.07083333 107 0.02916667 0.02916667 108 -0.07083333 0.02916667 109 0.02916667 -0.07083333 110 0.12916667 0.02916667 111 0.22916667 0.12916667 112 0.32916667 0.22916667 113 0.32916667 0.32916667 114 0.32916667 0.32916667 115 0.42916667 0.32916667 116 0.42916667 0.42916667 117 0.52916667 0.42916667 118 0.52916667 0.52916667 119 0.42916667 0.52916667 120 0.42916667 0.42916667 121 NA 0.42916667 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -1.01958763 -1.01958763 [2,] -1.21958763 -1.01958763 [3,] -1.41958763 -1.21958763 [4,] -1.41958763 -1.41958763 [5,] -1.41958763 -1.41958763 [6,] -1.21958763 -1.41958763 [7,] -1.11958763 -1.21958763 [8,] -1.21958763 -1.11958763 [9,] -1.41958763 -1.21958763 [10,] -1.41958763 -1.41958763 [11,] -1.21958763 -1.41958763 [12,] -0.71958763 -1.21958763 [13,] -0.61958763 -0.71958763 [14,] -0.41958763 -0.61958763 [15,] -0.41958763 -0.41958763 [16,] -0.31958763 -0.41958763 [17,] -0.31958763 -0.31958763 [18,] -0.41958763 -0.31958763 [19,] -0.31958763 -0.41958763 [20,] -0.21958763 -0.31958763 [21,] -0.01958763 -0.21958763 [22,] -0.01958763 -0.01958763 [23,] -0.01958763 -0.01958763 [24,] -0.01958763 -0.01958763 [25,] -0.01958763 -0.01958763 [26,] 0.08041237 -0.01958763 [27,] 0.28041237 0.08041237 [28,] 0.38041237 0.28041237 [29,] 0.38041237 0.38041237 [30,] 0.48041237 0.38041237 [31,] 0.48041237 0.48041237 [32,] 0.48041237 0.48041237 [33,] 0.38041237 0.48041237 [34,] 0.38041237 0.38041237 [35,] 0.48041237 0.38041237 [36,] 0.58041237 0.48041237 [37,] 0.58041237 0.58041237 [38,] 0.68041237 0.58041237 [39,] 0.78041237 0.68041237 [40,] 0.78041237 0.78041237 [41,] 0.68041237 0.78041237 [42,] 0.28041237 0.68041237 [43,] 0.18041237 0.28041237 [44,] 0.38041237 0.18041237 [45,] 0.78041237 0.38041237 [46,] 1.08041237 0.78041237 [47,] 1.08041237 1.08041237 [48,] 0.88041237 1.08041237 [49,] 0.58041237 0.88041237 [50,] 0.58041237 0.58041237 [51,] 0.58041237 0.58041237 [52,] 0.68041237 0.58041237 [53,] 0.68041237 0.68041237 [54,] 0.78041237 0.68041237 [55,] 0.88041237 0.78041237 [56,] 0.88041237 0.88041237 [57,] 0.88041237 0.88041237 [58,] 0.88041237 0.88041237 [59,] 0.88041237 0.88041237 [60,] 0.78041237 0.88041237 [61,] 0.68041237 0.78041237 [62,] 0.68041237 0.68041237 [63,] 0.68041237 0.68041237 [64,] 0.78041237 0.68041237 [65,] 0.78041237 0.78041237 [66,] 0.88041237 0.78041237 [67,] 0.88041237 0.88041237 [68,] 0.68041237 0.88041237 [69,] 0.48041237 0.68041237 [70,] 0.28041237 0.48041237 [71,] 0.28041237 0.28041237 [72,] 0.28041237 0.28041237 [73,] 0.28041237 0.28041237 [74,] 0.18041237 0.28041237 [75,] 0.18041237 0.18041237 [76,] 0.08041237 0.18041237 [77,] 0.08041237 0.08041237 [78,] 0.28041237 0.08041237 [79,] 0.08041237 0.28041237 [80,] -0.31958763 0.08041237 [81,] -0.51958763 -0.31958763 [82,] -0.71958763 -0.51958763 [83,] -0.71958763 -0.71958763 [84,] -0.51958763 -0.71958763 [85,] -0.51958763 -0.51958763 [86,] -0.51958763 -0.51958763 [87,] -0.71958763 -0.51958763 [88,] -0.81958763 -0.71958763 [89,] -0.91958763 -0.81958763 [90,] -0.91958763 -0.91958763 [91,] -0.91958763 -0.91958763 [92,] -0.81958763 -0.91958763 [93,] -0.51958763 -0.81958763 [94,] -0.51958763 -0.51958763 [95,] -0.51958763 -0.51958763 [96,] -0.61958763 -0.51958763 [97,] -0.87083333 -0.61958763 [98,] -0.77083333 -0.87083333 [99,] -0.57083333 -0.77083333 [100,] -0.47083333 -0.57083333 [101,] -0.37083333 -0.47083333 [102,] -0.37083333 -0.37083333 [103,] -0.37083333 -0.37083333 [104,] -0.27083333 -0.37083333 [105,] -0.07083333 -0.27083333 [106,] 0.02916667 -0.07083333 [107,] 0.02916667 0.02916667 [108,] -0.07083333 0.02916667 [109,] 0.02916667 -0.07083333 [110,] 0.12916667 0.02916667 [111,] 0.22916667 0.12916667 [112,] 0.32916667 0.22916667 [113,] 0.32916667 0.32916667 [114,] 0.32916667 0.32916667 [115,] 0.42916667 0.32916667 [116,] 0.42916667 0.42916667 [117,] 0.52916667 0.42916667 [118,] 0.52916667 0.52916667 [119,] 0.42916667 0.52916667 [120,] 0.42916667 0.42916667 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -1.01958763 -1.01958763 2 -1.21958763 -1.01958763 3 -1.41958763 -1.21958763 4 -1.41958763 -1.41958763 5 -1.41958763 -1.41958763 6 -1.21958763 -1.41958763 7 -1.11958763 -1.21958763 8 -1.21958763 -1.11958763 9 -1.41958763 -1.21958763 10 -1.41958763 -1.41958763 11 -1.21958763 -1.41958763 12 -0.71958763 -1.21958763 13 -0.61958763 -0.71958763 14 -0.41958763 -0.61958763 15 -0.41958763 -0.41958763 16 -0.31958763 -0.41958763 17 -0.31958763 -0.31958763 18 -0.41958763 -0.31958763 19 -0.31958763 -0.41958763 20 -0.21958763 -0.31958763 21 -0.01958763 -0.21958763 22 -0.01958763 -0.01958763 23 -0.01958763 -0.01958763 24 -0.01958763 -0.01958763 25 -0.01958763 -0.01958763 26 0.08041237 -0.01958763 27 0.28041237 0.08041237 28 0.38041237 0.28041237 29 0.38041237 0.38041237 30 0.48041237 0.38041237 31 0.48041237 0.48041237 32 0.48041237 0.48041237 33 0.38041237 0.48041237 34 0.38041237 0.38041237 35 0.48041237 0.38041237 36 0.58041237 0.48041237 37 0.58041237 0.58041237 38 0.68041237 0.58041237 39 0.78041237 0.68041237 40 0.78041237 0.78041237 41 0.68041237 0.78041237 42 0.28041237 0.68041237 43 0.18041237 0.28041237 44 0.38041237 0.18041237 45 0.78041237 0.38041237 46 1.08041237 0.78041237 47 1.08041237 1.08041237 48 0.88041237 1.08041237 49 0.58041237 0.88041237 50 0.58041237 0.58041237 51 0.58041237 0.58041237 52 0.68041237 0.58041237 53 0.68041237 0.68041237 54 0.78041237 0.68041237 55 0.88041237 0.78041237 56 0.88041237 0.88041237 57 0.88041237 0.88041237 58 0.88041237 0.88041237 59 0.88041237 0.88041237 60 0.78041237 0.88041237 61 0.68041237 0.78041237 62 0.68041237 0.68041237 63 0.68041237 0.68041237 64 0.78041237 0.68041237 65 0.78041237 0.78041237 66 0.88041237 0.78041237 67 0.88041237 0.88041237 68 0.68041237 0.88041237 69 0.48041237 0.68041237 70 0.28041237 0.48041237 71 0.28041237 0.28041237 72 0.28041237 0.28041237 73 0.28041237 0.28041237 74 0.18041237 0.28041237 75 0.18041237 0.18041237 76 0.08041237 0.18041237 77 0.08041237 0.08041237 78 0.28041237 0.08041237 79 0.08041237 0.28041237 80 -0.31958763 0.08041237 81 -0.51958763 -0.31958763 82 -0.71958763 -0.51958763 83 -0.71958763 -0.71958763 84 -0.51958763 -0.71958763 85 -0.51958763 -0.51958763 86 -0.51958763 -0.51958763 87 -0.71958763 -0.51958763 88 -0.81958763 -0.71958763 89 -0.91958763 -0.81958763 90 -0.91958763 -0.91958763 91 -0.91958763 -0.91958763 92 -0.81958763 -0.91958763 93 -0.51958763 -0.81958763 94 -0.51958763 -0.51958763 95 -0.51958763 -0.51958763 96 -0.61958763 -0.51958763 97 -0.87083333 -0.61958763 98 -0.77083333 -0.87083333 99 -0.57083333 -0.77083333 100 -0.47083333 -0.57083333 101 -0.37083333 -0.47083333 102 -0.37083333 -0.37083333 103 -0.37083333 -0.37083333 104 -0.27083333 -0.37083333 105 -0.07083333 -0.27083333 106 0.02916667 -0.07083333 107 0.02916667 0.02916667 108 -0.07083333 0.02916667 109 0.02916667 -0.07083333 110 0.12916667 0.02916667 111 0.22916667 0.12916667 112 0.32916667 0.22916667 113 0.32916667 0.32916667 114 0.32916667 0.32916667 115 0.42916667 0.32916667 116 0.42916667 0.42916667 117 0.52916667 0.42916667 118 0.52916667 0.52916667 119 0.42916667 0.52916667 120 0.42916667 0.42916667 > 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/7aet31292936137.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > acf(mysum$resid, lag.max=length(mysum$resid)/2, main='Residual Autocorrelation Function') > grid() > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/8l5bo1292936137.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > pacf(mysum$resid, lag.max=length(mysum$resid)/2, main='Residual Partial Autocorrelation Function') > grid() > dev.off() null device 1 > postscript(file="/var/www/html/rcomp/tmp/9l5bo1292936137.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > opar <- par(mfrow = c(2,2), oma = c(0, 0, 1.1, 0)) > plot(mylm, las = 1, sub='Residual Diagnostics') > par(opar) > dev.off() null device 1 > if (n > n25) { + postscript(file="/var/www/html/rcomp/tmp/10vwsr1292936137.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) + plot(kp3:nmkm3,gqarr[,2], main='Goldfeld-Quandt test',ylab='2-sided p-value',xlab='breakpoint') + grid() + dev.off() + } null device 1 > > #Note: the /var/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/11zx9f1292936137.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/129oqz1292936137.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/13g75b1292936137.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/1428lh1292936137.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/15nq251292936137.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/168r0t1292936137.tab") + } > > try(system("convert tmp/16vvf1292936137.ps tmp/16vvf1292936137.png",intern=TRUE)) character(0) > try(system("convert tmp/26vvf1292936137.ps tmp/26vvf1292936137.png",intern=TRUE)) character(0) > try(system("convert tmp/36vvf1292936137.ps tmp/36vvf1292936137.png",intern=TRUE)) character(0) > try(system("convert tmp/4hmu01292936137.ps tmp/4hmu01292936137.png",intern=TRUE)) character(0) > try(system("convert tmp/5hmu01292936137.ps tmp/5hmu01292936137.png",intern=TRUE)) character(0) > try(system("convert tmp/6hmu01292936137.ps tmp/6hmu01292936137.png",intern=TRUE)) character(0) > try(system("convert tmp/7aet31292936137.ps tmp/7aet31292936137.png",intern=TRUE)) character(0) > try(system("convert tmp/8l5bo1292936137.ps tmp/8l5bo1292936137.png",intern=TRUE)) character(0) > try(system("convert tmp/9l5bo1292936137.ps tmp/9l5bo1292936137.png",intern=TRUE)) character(0) > try(system("convert tmp/10vwsr1292936137.ps tmp/10vwsr1292936137.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 3.202 1.756 7.754