R version 2.12.1 (2010-12-16) Copyright (C) 2010 The R Foundation for Statistical Computing ISBN 3-900051-07-0 Platform: i486-pc-linux-gnu (32-bit) R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > x <- array(list(1 + ,8 + ,1 + ,14 + ,4 + ,2 + ,8 + ,3 + ,82 + ,1 + ,3 + ,8 + ,2 + ,14 + ,3 + ,4 + ,8 + ,1 + ,16 + ,5 + ,5 + ,8 + ,5 + ,140 + ,7 + ,6 + ,8 + ,8 + ,173 + ,2 + ,7 + ,8 + ,3 + ,9 + ,8 + ,8 + ,8 + ,8 + ,13 + ,6 + ,1 + ,12 + ,12 + ,17 + ,4 + ,2 + ,12 + ,3 + ,16 + ,9 + ,3 + ,12 + ,8 + ,21 + ,7 + ,4 + ,12 + ,3 + ,14 + ,2 + ,5 + ,12 + ,3 + ,15 + ,12 + ,6 + ,12 + ,3 + ,10 + ,8 + ,7 + ,12 + ,3 + ,14 + ,1 + ,8 + ,12 + ,1 + ,16 + ,6 + ,9 + ,12 + ,2 + ,14 + ,10 + ,10 + ,12 + ,20 + ,17 + ,3 + ,11 + ,12 + ,2 + ,10 + ,5 + ,12 + ,12 + ,1 + ,23 + ,11 + ,1 + ,9 + ,1 + ,21 + ,2 + ,2 + ,9 + ,6 + ,14 + ,4 + ,3 + ,9 + ,8 + ,14 + ,7 + ,4 + ,9 + ,5 + ,14 + ,11 + ,5 + ,9 + ,1 + ,16 + ,5 + ,6 + ,9 + ,7 + ,14 + ,1 + ,7 + ,9 + ,7 + ,14 + ,9 + ,8 + ,9 + ,5 + ,7 + ,3 + ,9 + ,9 + ,8 + ,17 + ,10 + ,1 + ,14 + ,2 + ,14 + ,3 + ,2 + ,14 + ,5 + ,21 + ,4 + ,3 + ,14 + ,2 + ,24 + ,7 + ,4 + ,14 + ,5 + ,7 + ,6 + ,5 + ,14 + ,1 + ,30 + ,13 + ,6 + ,14 + ,2 + ,93 + ,16 + ,7 + ,14 + ,6 + ,14 + ,9 + ,8 + ,14 + ,3 + ,14 + ,1 + ,9 + ,14 + ,6 + ,107 + ,10 + ,10 + ,14 + ,6 + ,231 + ,5 + ,11 + ,14 + ,1 + ,385 + ,2 + ,12 + ,14 + ,2 + ,14 + ,11 + ,13 + ,14 + ,10 + ,29 + ,14 + ,14 + ,14 + ,1 + ,16 + ,15 + ,1 + ,13 + ,2 + ,7 + ,10 + ,2 + ,13 + ,1 + ,21 + ,3 + ,3 + ,13 + ,1 + ,14 + ,2 + ,4 + ,13 + ,1 + ,17 + ,13 + ,5 + ,13 + ,6 + ,14 + ,4 + ,6 + ,13 + ,4 + ,21 + ,1 + ,7 + ,13 + ,9 + ,15 + ,9 + ,8 + ,13 + ,10 + ,10 + ,5 + ,9 + ,13 + ,6 + ,15 + ,8 + ,10 + ,13 + ,1 + ,7 + ,7 + ,11 + ,13 + ,6 + ,12 + ,12 + ,12 + ,13 + ,18 + ,84 + ,6 + ,13 + ,13 + ,3 + ,17 + ,11 + ,1 + ,19 + ,4 + ,14 + ,4 + ,2 + ,19 + ,1 + ,10 + ,9 + ,3 + ,19 + ,3 + ,17 + ,15 + ,4 + ,19 + ,5 + ,91 + ,14 + ,5 + ,19 + ,4 + ,21 + ,17 + ,6 + ,19 + ,4 + ,21 + ,3 + ,7 + ,19 + ,1 + ,16 + ,7 + ,8 + ,19 + ,17 + ,35 + ,1 + ,9 + ,19 + ,2 + ,17 + ,16 + ,10 + ,19 + ,1 + ,15 + ,13 + ,11 + ,19 + ,6 + ,14 + ,5 + ,12 + ,19 + ,10 + ,28 + ,18 + ,13 + ,19 + ,9 + ,14 + ,6 + ,14 + ,19 + ,5 + ,14 + ,10 + ,15 + ,19 + ,1 + ,20 + ,12 + ,16 + ,19 + ,13 + ,35 + ,20 + ,17 + ,19 + ,11 + ,28 + ,8 + ,18 + ,19 + ,9 + ,17 + ,11 + ,19 + ,19 + ,4 + ,14 + ,19 + ,1 + ,13 + ,4 + ,10 + ,4 + ,2 + ,13 + ,5 + ,10 + ,1 + ,3 + ,13 + ,2 + ,14 + ,3 + ,4 + ,13 + ,1 + ,7 + ,9 + ,5 + ,13 + ,2 + ,14 + ,11 + ,6 + ,13 + ,4 + ,14 + ,12 + ,7 + ,13 + ,12 + ,10 + ,2 + ,8 + ,13 + ,14 + ,10 + ,7 + ,9 + ,13 + ,2 + ,21 + ,6 + ,10 + ,13 + ,7 + ,10 + ,5 + ,11 + ,13 + ,4 + ,17 + ,8 + ,12 + ,13 + ,1 + ,17 + ,10 + ,13 + ,13 + ,6 + ,24 + ,13 + ,1 + ,14 + ,2 + ,16 + ,2 + ,2 + ,14 + ,1 + ,63 + ,9 + ,3 + ,14 + ,4 + ,17 + ,4 + ,4 + ,14 + ,6 + ,21 + ,1 + ,5 + ,14 + ,7 + ,7 + ,14 + ,6 + ,14 + ,9 + ,49 + ,7 + ,7 + ,14 + ,1 + ,7 + ,10 + ,8 + ,14 + ,3 + ,14 + ,6 + ,9 + ,14 + ,6 + ,210 + ,11 + ,10 + ,14 + ,8 + ,35 + ,5 + ,11 + ,14 + ,8 + ,14 + ,3 + ,12 + ,14 + ,4 + ,28 + ,13 + ,13 + ,14 + ,8 + ,56 + ,12 + ,14 + ,14 + ,7 + ,31 + ,15) + ,dim=c(5 + ,102) + ,dimnames=list(c('Postition' + ,'starters' + ,'last' + ,'since' + ,'number') + ,1:102)) > y <- array(NA,dim=c(5,102),dimnames=list(c('Postition','starters','last','since','number'),1:102)) > 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 > 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 Postition starters last since number t 1 1 8 1 14 4 1 2 2 8 3 82 1 2 3 3 8 2 14 3 3 4 4 8 1 16 5 4 5 5 8 5 140 7 5 6 6 8 8 173 2 6 7 7 8 3 9 8 7 8 8 8 8 13 6 8 9 1 12 12 17 4 9 10 2 12 3 16 9 10 11 3 12 8 21 7 11 12 4 12 3 14 2 12 13 5 12 3 15 12 13 14 6 12 3 10 8 14 15 7 12 3 14 1 15 16 8 12 1 16 6 16 17 9 12 2 14 10 17 18 10 12 20 17 3 18 19 11 12 2 10 5 19 20 12 12 1 23 11 20 21 1 9 1 21 2 21 22 2 9 6 14 4 22 23 3 9 8 14 7 23 24 4 9 5 14 11 24 25 5 9 1 16 5 25 26 6 9 7 14 1 26 27 7 9 7 14 9 27 28 8 9 5 7 3 28 29 9 9 8 17 10 29 30 1 14 2 14 3 30 31 2 14 5 21 4 31 32 3 14 2 24 7 32 33 4 14 5 7 6 33 34 5 14 1 30 13 34 35 6 14 2 93 16 35 36 7 14 6 14 9 36 37 8 14 3 14 1 37 38 9 14 6 107 10 38 39 10 14 6 231 5 39 40 11 14 1 385 2 40 41 12 14 2 14 11 41 42 13 14 10 29 14 42 43 14 14 1 16 15 43 44 1 13 2 7 10 44 45 2 13 1 21 3 45 46 3 13 1 14 2 46 47 4 13 1 17 13 47 48 5 13 6 14 4 48 49 6 13 4 21 1 49 50 7 13 9 15 9 50 51 8 13 10 10 5 51 52 9 13 6 15 8 52 53 10 13 1 7 7 53 54 11 13 6 12 12 54 55 12 13 18 84 6 55 56 13 13 3 17 11 56 57 1 19 4 14 4 57 58 2 19 1 10 9 58 59 3 19 3 17 15 59 60 4 19 5 91 14 60 61 5 19 4 21 17 61 62 6 19 4 21 3 62 63 7 19 1 16 7 63 64 8 19 17 35 1 64 65 9 19 2 17 16 65 66 10 19 1 15 13 66 67 11 19 6 14 5 67 68 12 19 10 28 18 68 69 13 19 9 14 6 69 70 14 19 5 14 10 70 71 15 19 1 20 12 71 72 16 19 13 35 20 72 73 17 19 11 28 8 73 74 18 19 9 17 11 74 75 19 19 4 14 19 75 76 1 13 4 10 4 76 77 2 13 5 10 1 77 78 3 13 2 14 3 78 79 4 13 1 7 9 79 80 5 13 2 14 11 80 81 6 13 4 14 12 81 82 7 13 12 10 2 82 83 8 13 14 10 7 83 84 9 13 2 21 6 84 85 10 13 7 10 5 85 86 11 13 4 17 8 86 87 12 13 1 17 10 87 88 13 13 6 24 13 88 89 1 14 2 16 2 89 90 2 14 1 63 9 90 91 3 14 4 17 4 91 92 4 14 6 21 1 92 93 5 14 7 7 14 93 94 6 14 9 49 7 94 95 7 14 1 7 10 95 96 8 14 3 14 6 96 97 9 14 6 210 11 97 98 10 14 8 35 5 98 99 11 14 8 14 3 99 100 12 14 4 28 13 100 101 13 14 8 56 12 101 102 14 14 7 31 15 102 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) starters last since number t -0.60370 0.16268 0.31046 0.01037 0.35292 0.02100 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -7.1840 -2.7183 0.1351 2.3977 7.1066 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) -0.603704 1.615450 -0.374 0.709447 starters 0.162679 0.140570 1.157 0.250030 last 0.310458 0.091308 3.400 0.000983 *** since 0.010373 0.006851 1.514 0.133291 number 0.352921 0.083241 4.240 5.15e-05 *** t 0.020995 0.014521 1.446 0.151469 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 3.566 on 96 degrees of freedom Multiple R-squared: 0.3553, Adjusted R-squared: 0.3217 F-statistic: 10.58 on 5 and 96 DF, p-value: 4.122e-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,] 1.571807e-47 3.143615e-47 1.000000e+00 [2,] 3.938704e-63 7.877407e-63 1.000000e+00 [3,] 1.143805e-78 2.287609e-78 1.000000e+00 [4,] 3.984841e-95 7.969681e-95 1.000000e+00 [5,] 1.884319e-107 3.768637e-107 1.000000e+00 [6,] 6.894248e-121 1.378850e-120 1.000000e+00 [7,] 1.497617e-138 2.995235e-138 1.000000e+00 [8,] 2.436095e-155 4.872190e-155 1.000000e+00 [9,] 2.763597e-164 5.527194e-164 1.000000e+00 [10,] 6.088112e-183 1.217622e-182 1.000000e+00 [11,] 4.384234e-201 8.768469e-201 1.000000e+00 [12,] 9.870022e-217 1.974004e-216 1.000000e+00 [13,] 1.748691e-01 3.497382e-01 8.251309e-01 [14,] 2.879958e-01 5.759916e-01 7.120042e-01 [15,] 3.065391e-01 6.130782e-01 6.934609e-01 [16,] 2.806677e-01 5.613354e-01 7.193323e-01 [17,] 2.217282e-01 4.434564e-01 7.782718e-01 [18,] 1.779943e-01 3.559887e-01 8.220057e-01 [19,] 1.345851e-01 2.691702e-01 8.654149e-01 [20,] 1.227033e-01 2.454065e-01 8.772967e-01 [21,] 9.651805e-02 1.930361e-01 9.034820e-01 [22,] 1.572618e-01 3.145236e-01 8.427382e-01 [23,] 1.681878e-01 3.363756e-01 8.318122e-01 [24,] 1.521585e-01 3.043169e-01 8.478415e-01 [25,] 1.232477e-01 2.464955e-01 8.767523e-01 [26,] 1.011218e-01 2.022435e-01 8.988782e-01 [27,] 8.407769e-02 1.681554e-01 9.159223e-01 [28,] 6.296069e-02 1.259214e-01 9.370393e-01 [29,] 6.949828e-02 1.389966e-01 9.305017e-01 [30,] 5.552946e-02 1.110589e-01 9.444705e-01 [31,] 4.570176e-02 9.140353e-02 9.542982e-01 [32,] 4.935933e-02 9.871866e-02 9.506407e-01 [33,] 6.917937e-02 1.383587e-01 9.308206e-01 [34,] 6.470120e-02 1.294024e-01 9.352988e-01 [35,] 9.895686e-02 1.979137e-01 9.010431e-01 [36,] 1.773302e-01 3.546603e-01 8.226698e-01 [37,] 1.638298e-01 3.276597e-01 8.361702e-01 [38,] 1.345108e-01 2.690217e-01 8.654892e-01 [39,] 1.332694e-01 2.665388e-01 8.667306e-01 [40,] 1.043688e-01 2.087376e-01 8.956312e-01 [41,] 8.762094e-02 1.752419e-01 9.123791e-01 [42,] 6.873673e-02 1.374735e-01 9.312633e-01 [43,] 5.173470e-02 1.034694e-01 9.482653e-01 [44,] 4.096529e-02 8.193058e-02 9.590347e-01 [45,] 5.547250e-02 1.109450e-01 9.445275e-01 [46,] 5.074585e-02 1.014917e-01 9.492541e-01 [47,] 4.730959e-02 9.461919e-02 9.526904e-01 [48,] 1.914620e-01 3.829239e-01 8.085380e-01 [49,] 2.290520e-01 4.581041e-01 7.709480e-01 [50,] 2.575642e-01 5.151284e-01 7.424358e-01 [51,] 3.639454e-01 7.278907e-01 6.360546e-01 [52,] 4.210591e-01 8.421181e-01 5.789409e-01 [53,] 5.505994e-01 8.988011e-01 4.494006e-01 [54,] 5.064109e-01 9.871782e-01 4.935891e-01 [55,] 4.667109e-01 9.334218e-01 5.332891e-01 [56,] 4.511024e-01 9.022048e-01 5.488976e-01 [57,] 4.555680e-01 9.111360e-01 5.444320e-01 [58,] 4.369551e-01 8.739102e-01 5.630449e-01 [59,] 4.196356e-01 8.392713e-01 5.803644e-01 [60,] 4.827147e-01 9.654295e-01 5.172853e-01 [61,] 4.699485e-01 9.398971e-01 5.300515e-01 [62,] 4.624432e-01 9.248864e-01 5.375568e-01 [63,] 4.808545e-01 9.617089e-01 5.191455e-01 [64,] 5.375018e-01 9.249963e-01 4.624982e-01 [65,] 5.417755e-01 9.164490e-01 4.582245e-01 [66,] 5.708882e-01 8.582237e-01 4.291118e-01 [67,] 1.000000e+00 1.220270e-301 6.101351e-302 [68,] 1.000000e+00 3.210082e-280 1.605041e-280 [69,] 1.000000e+00 8.017815e-268 4.008907e-268 [70,] 1.000000e+00 5.713010e-273 2.856505e-273 [71,] 1.000000e+00 2.834131e-259 1.417066e-259 [72,] 1.000000e+00 2.986524e-232 1.493262e-232 [73,] 1.000000e+00 3.229084e-217 1.614542e-217 [74,] 1.000000e+00 8.060746e-207 4.030373e-207 [75,] 1.000000e+00 4.409414e-186 2.204707e-186 [76,] 1.000000e+00 1.875497e-177 9.377485e-178 [77,] 1.000000e+00 3.066997e-155 1.533498e-155 [78,] 1.000000e+00 1.629516e-145 8.147578e-146 [79,] 1.000000e+00 4.444104e-139 2.222052e-139 [80,] 1.000000e+00 1.259651e-117 6.298254e-118 [81,] 1.000000e+00 3.948377e-105 1.974189e-105 [82,] 1.000000e+00 1.293666e-87 6.468330e-88 [83,] 1.000000e+00 5.331253e-73 2.665627e-73 [84,] 1.000000e+00 3.071422e-61 1.535711e-61 [85,] 1.000000e+00 1.797525e-46 8.987625e-47 > postscript(file="/var/www/rcomp/tmp/1f6mo1322129659.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/rcomp/tmp/20cgx1322129659.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/rcomp/tmp/334le1322129659.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/rcomp/tmp/4nuf21322129659.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/rcomp/tmp/5qubp1322129659.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 = 102 Frequency = 1 1 2 3 4 5 6 -1.58608660 -0.87459789 0.41438652 0.97726059 -1.27766208 0.19226658 7 8 9 10 11 12 2.30720594 2.39827145 -5.85091974 -3.83202664 -3.75133413 0.61717897 13 14 15 16 17 18 -1.94340326 0.49915227 3.90711498 3.72168285 2.99929006 0.82938123 19 20 21 22 23 24 6.76339886 5.80048424 -1.53543615 -2.74195322 -3.44262864 -2.94393531 25 26 27 28 29 30 1.37368412 1.92237245 0.07800605 3.86806646 1.34151733 -3.12855417 31 32 33 34 35 36 -3.50645583 -2.68596011 -2.10906685 -2.59725883 -3.64097552 -0.61388554 37 38 39 40 41 42 4.11986469 0.02651334 1.48387266 3.47648917 4.81712810 2.09810943 43 44 45 46 47 48 5.65316422 -5.65764617 -2.04295547 -0.63841816 -3.57266781 -0.93854140 49 50 51 52 53 54 1.64753272 -1.68688580 0.44521169 1.55541943 4.52261990 2.13286255 55 56 57 58 59 60 0.75704316 5.32330276 -5.48265364 -5.29538970 -7.12744038 -7.18403252 61 62 63 64 65 66 -6.22722351 -0.30731892 0.24323942 -1.82464283 -1.29587456 1.07309858 67 68 69 70 71 72 3.33355757 -1.66247007 4.00727180 4.81642316 6.26917930 0.54372146 73 74 75 76 77 78 6.45131033 7.10657008 6.84561285 -4.86399703 -3.13668596 -1.97364184 79 80 81 82 83 84 -2.72909636 -2.83900338 -2.83383598 -0.76778925 -2.17430749 2.76901210 85 86 87 88 89 90 2.66275128 3.44175498 4.64629112 2.94163057 -4.03509159 -5.70360977 91 92 93 94 95 96 -3.41421373 -2.03885272 -5.81306213 -3.42018966 -0.58061858 1.11654483 97 98 99 100 101 102 -2.63354038 1.65735272 3.56003351 2.10643434 1.90608436 2.39610815 > postscript(file="/var/www/rcomp/tmp/6rxnk1322129659.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 = 102 Frequency = 1 lag(myerror, k = 1) myerror 0 -1.58608660 NA 1 -0.87459789 -1.58608660 2 0.41438652 -0.87459789 3 0.97726059 0.41438652 4 -1.27766208 0.97726059 5 0.19226658 -1.27766208 6 2.30720594 0.19226658 7 2.39827145 2.30720594 8 -5.85091974 2.39827145 9 -3.83202664 -5.85091974 10 -3.75133413 -3.83202664 11 0.61717897 -3.75133413 12 -1.94340326 0.61717897 13 0.49915227 -1.94340326 14 3.90711498 0.49915227 15 3.72168285 3.90711498 16 2.99929006 3.72168285 17 0.82938123 2.99929006 18 6.76339886 0.82938123 19 5.80048424 6.76339886 20 -1.53543615 5.80048424 21 -2.74195322 -1.53543615 22 -3.44262864 -2.74195322 23 -2.94393531 -3.44262864 24 1.37368412 -2.94393531 25 1.92237245 1.37368412 26 0.07800605 1.92237245 27 3.86806646 0.07800605 28 1.34151733 3.86806646 29 -3.12855417 1.34151733 30 -3.50645583 -3.12855417 31 -2.68596011 -3.50645583 32 -2.10906685 -2.68596011 33 -2.59725883 -2.10906685 34 -3.64097552 -2.59725883 35 -0.61388554 -3.64097552 36 4.11986469 -0.61388554 37 0.02651334 4.11986469 38 1.48387266 0.02651334 39 3.47648917 1.48387266 40 4.81712810 3.47648917 41 2.09810943 4.81712810 42 5.65316422 2.09810943 43 -5.65764617 5.65316422 44 -2.04295547 -5.65764617 45 -0.63841816 -2.04295547 46 -3.57266781 -0.63841816 47 -0.93854140 -3.57266781 48 1.64753272 -0.93854140 49 -1.68688580 1.64753272 50 0.44521169 -1.68688580 51 1.55541943 0.44521169 52 4.52261990 1.55541943 53 2.13286255 4.52261990 54 0.75704316 2.13286255 55 5.32330276 0.75704316 56 -5.48265364 5.32330276 57 -5.29538970 -5.48265364 58 -7.12744038 -5.29538970 59 -7.18403252 -7.12744038 60 -6.22722351 -7.18403252 61 -0.30731892 -6.22722351 62 0.24323942 -0.30731892 63 -1.82464283 0.24323942 64 -1.29587456 -1.82464283 65 1.07309858 -1.29587456 66 3.33355757 1.07309858 67 -1.66247007 3.33355757 68 4.00727180 -1.66247007 69 4.81642316 4.00727180 70 6.26917930 4.81642316 71 0.54372146 6.26917930 72 6.45131033 0.54372146 73 7.10657008 6.45131033 74 6.84561285 7.10657008 75 -4.86399703 6.84561285 76 -3.13668596 -4.86399703 77 -1.97364184 -3.13668596 78 -2.72909636 -1.97364184 79 -2.83900338 -2.72909636 80 -2.83383598 -2.83900338 81 -0.76778925 -2.83383598 82 -2.17430749 -0.76778925 83 2.76901210 -2.17430749 84 2.66275128 2.76901210 85 3.44175498 2.66275128 86 4.64629112 3.44175498 87 2.94163057 4.64629112 88 -4.03509159 2.94163057 89 -5.70360977 -4.03509159 90 -3.41421373 -5.70360977 91 -2.03885272 -3.41421373 92 -5.81306213 -2.03885272 93 -3.42018966 -5.81306213 94 -0.58061858 -3.42018966 95 1.11654483 -0.58061858 96 -2.63354038 1.11654483 97 1.65735272 -2.63354038 98 3.56003351 1.65735272 99 2.10643434 3.56003351 100 1.90608436 2.10643434 101 2.39610815 1.90608436 102 NA 2.39610815 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -0.87459789 -1.58608660 [2,] 0.41438652 -0.87459789 [3,] 0.97726059 0.41438652 [4,] -1.27766208 0.97726059 [5,] 0.19226658 -1.27766208 [6,] 2.30720594 0.19226658 [7,] 2.39827145 2.30720594 [8,] -5.85091974 2.39827145 [9,] -3.83202664 -5.85091974 [10,] -3.75133413 -3.83202664 [11,] 0.61717897 -3.75133413 [12,] -1.94340326 0.61717897 [13,] 0.49915227 -1.94340326 [14,] 3.90711498 0.49915227 [15,] 3.72168285 3.90711498 [16,] 2.99929006 3.72168285 [17,] 0.82938123 2.99929006 [18,] 6.76339886 0.82938123 [19,] 5.80048424 6.76339886 [20,] -1.53543615 5.80048424 [21,] -2.74195322 -1.53543615 [22,] -3.44262864 -2.74195322 [23,] -2.94393531 -3.44262864 [24,] 1.37368412 -2.94393531 [25,] 1.92237245 1.37368412 [26,] 0.07800605 1.92237245 [27,] 3.86806646 0.07800605 [28,] 1.34151733 3.86806646 [29,] -3.12855417 1.34151733 [30,] -3.50645583 -3.12855417 [31,] -2.68596011 -3.50645583 [32,] -2.10906685 -2.68596011 [33,] -2.59725883 -2.10906685 [34,] -3.64097552 -2.59725883 [35,] -0.61388554 -3.64097552 [36,] 4.11986469 -0.61388554 [37,] 0.02651334 4.11986469 [38,] 1.48387266 0.02651334 [39,] 3.47648917 1.48387266 [40,] 4.81712810 3.47648917 [41,] 2.09810943 4.81712810 [42,] 5.65316422 2.09810943 [43,] -5.65764617 5.65316422 [44,] -2.04295547 -5.65764617 [45,] -0.63841816 -2.04295547 [46,] -3.57266781 -0.63841816 [47,] -0.93854140 -3.57266781 [48,] 1.64753272 -0.93854140 [49,] -1.68688580 1.64753272 [50,] 0.44521169 -1.68688580 [51,] 1.55541943 0.44521169 [52,] 4.52261990 1.55541943 [53,] 2.13286255 4.52261990 [54,] 0.75704316 2.13286255 [55,] 5.32330276 0.75704316 [56,] -5.48265364 5.32330276 [57,] -5.29538970 -5.48265364 [58,] -7.12744038 -5.29538970 [59,] -7.18403252 -7.12744038 [60,] -6.22722351 -7.18403252 [61,] -0.30731892 -6.22722351 [62,] 0.24323942 -0.30731892 [63,] -1.82464283 0.24323942 [64,] -1.29587456 -1.82464283 [65,] 1.07309858 -1.29587456 [66,] 3.33355757 1.07309858 [67,] -1.66247007 3.33355757 [68,] 4.00727180 -1.66247007 [69,] 4.81642316 4.00727180 [70,] 6.26917930 4.81642316 [71,] 0.54372146 6.26917930 [72,] 6.45131033 0.54372146 [73,] 7.10657008 6.45131033 [74,] 6.84561285 7.10657008 [75,] -4.86399703 6.84561285 [76,] -3.13668596 -4.86399703 [77,] -1.97364184 -3.13668596 [78,] -2.72909636 -1.97364184 [79,] -2.83900338 -2.72909636 [80,] -2.83383598 -2.83900338 [81,] -0.76778925 -2.83383598 [82,] -2.17430749 -0.76778925 [83,] 2.76901210 -2.17430749 [84,] 2.66275128 2.76901210 [85,] 3.44175498 2.66275128 [86,] 4.64629112 3.44175498 [87,] 2.94163057 4.64629112 [88,] -4.03509159 2.94163057 [89,] -5.70360977 -4.03509159 [90,] -3.41421373 -5.70360977 [91,] -2.03885272 -3.41421373 [92,] -5.81306213 -2.03885272 [93,] -3.42018966 -5.81306213 [94,] -0.58061858 -3.42018966 [95,] 1.11654483 -0.58061858 [96,] -2.63354038 1.11654483 [97,] 1.65735272 -2.63354038 [98,] 3.56003351 1.65735272 [99,] 2.10643434 3.56003351 [100,] 1.90608436 2.10643434 [101,] 2.39610815 1.90608436 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -0.87459789 -1.58608660 2 0.41438652 -0.87459789 3 0.97726059 0.41438652 4 -1.27766208 0.97726059 5 0.19226658 -1.27766208 6 2.30720594 0.19226658 7 2.39827145 2.30720594 8 -5.85091974 2.39827145 9 -3.83202664 -5.85091974 10 -3.75133413 -3.83202664 11 0.61717897 -3.75133413 12 -1.94340326 0.61717897 13 0.49915227 -1.94340326 14 3.90711498 0.49915227 15 3.72168285 3.90711498 16 2.99929006 3.72168285 17 0.82938123 2.99929006 18 6.76339886 0.82938123 19 5.80048424 6.76339886 20 -1.53543615 5.80048424 21 -2.74195322 -1.53543615 22 -3.44262864 -2.74195322 23 -2.94393531 -3.44262864 24 1.37368412 -2.94393531 25 1.92237245 1.37368412 26 0.07800605 1.92237245 27 3.86806646 0.07800605 28 1.34151733 3.86806646 29 -3.12855417 1.34151733 30 -3.50645583 -3.12855417 31 -2.68596011 -3.50645583 32 -2.10906685 -2.68596011 33 -2.59725883 -2.10906685 34 -3.64097552 -2.59725883 35 -0.61388554 -3.64097552 36 4.11986469 -0.61388554 37 0.02651334 4.11986469 38 1.48387266 0.02651334 39 3.47648917 1.48387266 40 4.81712810 3.47648917 41 2.09810943 4.81712810 42 5.65316422 2.09810943 43 -5.65764617 5.65316422 44 -2.04295547 -5.65764617 45 -0.63841816 -2.04295547 46 -3.57266781 -0.63841816 47 -0.93854140 -3.57266781 48 1.64753272 -0.93854140 49 -1.68688580 1.64753272 50 0.44521169 -1.68688580 51 1.55541943 0.44521169 52 4.52261990 1.55541943 53 2.13286255 4.52261990 54 0.75704316 2.13286255 55 5.32330276 0.75704316 56 -5.48265364 5.32330276 57 -5.29538970 -5.48265364 58 -7.12744038 -5.29538970 59 -7.18403252 -7.12744038 60 -6.22722351 -7.18403252 61 -0.30731892 -6.22722351 62 0.24323942 -0.30731892 63 -1.82464283 0.24323942 64 -1.29587456 -1.82464283 65 1.07309858 -1.29587456 66 3.33355757 1.07309858 67 -1.66247007 3.33355757 68 4.00727180 -1.66247007 69 4.81642316 4.00727180 70 6.26917930 4.81642316 71 0.54372146 6.26917930 72 6.45131033 0.54372146 73 7.10657008 6.45131033 74 6.84561285 7.10657008 75 -4.86399703 6.84561285 76 -3.13668596 -4.86399703 77 -1.97364184 -3.13668596 78 -2.72909636 -1.97364184 79 -2.83900338 -2.72909636 80 -2.83383598 -2.83900338 81 -0.76778925 -2.83383598 82 -2.17430749 -0.76778925 83 2.76901210 -2.17430749 84 2.66275128 2.76901210 85 3.44175498 2.66275128 86 4.64629112 3.44175498 87 2.94163057 4.64629112 88 -4.03509159 2.94163057 89 -5.70360977 -4.03509159 90 -3.41421373 -5.70360977 91 -2.03885272 -3.41421373 92 -5.81306213 -2.03885272 93 -3.42018966 -5.81306213 94 -0.58061858 -3.42018966 95 1.11654483 -0.58061858 96 -2.63354038 1.11654483 97 1.65735272 -2.63354038 98 3.56003351 1.65735272 99 2.10643434 3.56003351 100 1.90608436 2.10643434 101 2.39610815 1.90608436 > 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/rcomp/tmp/7uiat1322129659.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/rcomp/tmp/8t1h81322129659.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/rcomp/tmp/973x71322129659.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/rcomp/tmp/10fe5i1322129659.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/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/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/rcomp/tmp/11irx61322129659.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/rcomp/tmp/12lc9c1322129660.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/rcomp/tmp/137k1z1322129660.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/rcomp/tmp/14ipjc1322129660.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/rcomp/tmp/157t611322129660.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/rcomp/tmp/16vna31322129660.tab") + } > > try(system("convert tmp/1f6mo1322129659.ps tmp/1f6mo1322129659.png",intern=TRUE)) character(0) > try(system("convert tmp/20cgx1322129659.ps tmp/20cgx1322129659.png",intern=TRUE)) character(0) > try(system("convert tmp/334le1322129659.ps tmp/334le1322129659.png",intern=TRUE)) character(0) > try(system("convert tmp/4nuf21322129659.ps tmp/4nuf21322129659.png",intern=TRUE)) character(0) > try(system("convert tmp/5qubp1322129659.ps tmp/5qubp1322129659.png",intern=TRUE)) character(0) > try(system("convert tmp/6rxnk1322129659.ps tmp/6rxnk1322129659.png",intern=TRUE)) character(0) > try(system("convert tmp/7uiat1322129659.ps tmp/7uiat1322129659.png",intern=TRUE)) character(0) > try(system("convert tmp/8t1h81322129659.ps tmp/8t1h81322129659.png",intern=TRUE)) character(0) > try(system("convert tmp/973x71322129659.ps tmp/973x71322129659.png",intern=TRUE)) character(0) > try(system("convert tmp/10fe5i1322129659.ps tmp/10fe5i1322129659.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 4.976 0.744 5.742