R version 2.13.0 (2011-04-13) Copyright (C) 2011 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 + ,41456 + ,2151 + ,5.46 + ,2 + ,8424 + ,2951 + ,5.31 + ,3 + ,8696 + ,1714 + ,4.86 + ,4 + ,5732 + ,2435 + ,4.33 + ,5 + ,4047 + ,1095 + ,4.29 + ,6 + ,4195 + ,1616 + ,3.8 + ,7 + ,7444 + ,2090 + ,3.78 + ,8 + ,7617 + ,2985 + ,3.58 + ,9 + ,5641 + ,2328 + ,3.44 + ,10 + ,6528 + ,1911 + ,3.39 + ,11 + ,4797 + ,1250 + ,3.23 + ,12 + ,3608 + ,660 + ,3.21 + ,13 + ,5230 + ,1180 + ,3.04 + ,14 + ,4226 + ,1275 + ,3.03 + ,15 + ,7013 + ,2141 + ,2.97 + ,16 + ,3915 + ,1309 + ,2.92 + ,17 + ,5365 + ,2666 + ,2.92 + ,18 + ,5817 + ,2383 + ,2.84 + ,19 + ,4376 + ,980 + ,2.78 + ,20 + ,4648 + ,1047 + ,2.77 + ,21 + ,3062 + ,940 + ,2.73 + ,22 + ,11652 + ,987 + ,2.62 + ,23 + ,1920 + ,456 + ,2.58 + ,24 + ,7031 + ,2259 + ,2.58 + ,25 + ,14377 + ,2245 + ,2.43 + ,26 + ,26468 + ,1187 + ,2.42 + ,27 + ,2343 + ,381 + ,2.42 + ,28 + ,2615 + ,504 + ,2.38 + ,29 + ,944 + ,488 + ,2.38 + ,30 + ,6892 + ,1571 + ,2.3 + ,31 + ,5334 + ,1655 + ,2.29 + ,32 + ,13525 + ,1398 + ,2.29 + ,33 + ,2709 + ,1029 + ,2.28 + ,34 + ,6008 + ,1559 + ,2.2 + ,35 + ,4285 + ,968 + ,2.17 + ,36 + ,2461 + ,856 + ,2.16 + ,37 + ,1314 + ,667 + ,2.14 + ,38 + ,8969 + ,1350 + ,2.07 + ,39 + ,2981 + ,1232 + ,2.06 + ,40 + ,6774 + ,650 + ,2.02 + ,41 + ,3956 + ,1195 + ,2 + ,42 + ,3683 + ,1173 + ,1.99 + ,43 + ,4361 + ,1657 + ,1.94 + ,44 + ,3193 + ,1263 + ,1.93 + ,45 + ,6924 + ,1651 + ,1.91 + ,46 + ,2338 + ,753 + ,1.87 + ,47 + ,4369 + ,332 + ,1.87 + ,48 + ,4897 + ,1305 + ,1.85 + ,49 + ,4050 + ,1562 + ,1.81 + ,50 + ,4090 + ,1190 + ,1.8 + ,51 + ,2014 + ,470 + ,1.8 + ,52 + ,3578 + ,1179 + ,1.8 + ,53 + ,2487 + ,660 + ,1.78 + ,54 + ,7438 + ,385 + ,1.76 + ,55 + ,9972 + ,665 + ,1.74 + ,56 + ,3790 + ,988 + ,1.74 + ,57 + ,5264 + ,247 + ,1.74 + ,58 + ,825 + ,657 + ,1.7 + ,59 + ,8468 + ,1240 + ,1.65 + ,60 + ,1855 + ,905 + ,1.65 + ,61 + ,3069 + ,1528 + ,1.62 + ,62 + ,2645 + ,1226 + ,1.58 + ,63 + ,2476 + ,1195 + ,1.57 + ,64 + ,3136 + ,989 + ,1.56 + ,65 + ,1890 + ,630 + ,1.55 + ,66 + ,2860 + ,1180 + ,1.51 + ,67 + ,3239 + ,1343 + ,1.31 + ,68 + ,2080 + ,700 + ,1.26 + ,69 + ,1716 + ,1000 + ,1.24 + ,70 + ,711 + ,511 + ,1.17 + ,71 + ,2002 + ,493 + ,1.1 + ,72 + ,56688 + ,785 + ,1.03 + ,73 + ,5655 + ,493 + ,1.02 + ,74 + ,2083 + ,1191 + ,0.92 + ,75 + ,2034 + ,214 + ,0.87 + ,76 + ,1120 + ,223 + ,0.84 + ,77 + ,1053 + ,534 + ,0.82 + ,78 + ,2148 + ,208 + ,0.82 + ,79 + ,2439 + ,226 + ,0.78 + ,80 + ,2654 + ,1075 + ,0.74 + ,81 + ,692 + ,388 + ,0.72 + ,82 + ,3882 + ,836 + ,0.72 + ,83 + ,694 + ,142 + ,0.71 + ,84 + ,3797 + ,1055 + ,0.7 + ,85 + ,2258 + ,948 + ,0.57 + ,86 + ,2059 + ,738 + ,0.57 + ,87 + ,942 + ,482 + ,0.54 + ,88 + ,1423 + ,603 + ,0.54 + ,89 + ,832 + ,228 + ,0.5 + ,90 + ,1197 + ,568 + ,0.49 + ,91 + ,2452 + ,509 + ,0.48 + ,92 + ,2624 + ,585 + ,0.44 + ,93 + ,1295 + ,670 + ,0.43 + ,94 + ,2048 + ,533 + ,0.39 + ,95 + ,1620 + ,537 + ,0.37 + ,96 + ,783 + ,495 + ,0.32 + ,97 + ,1556 + ,425 + ,0.24 + ,98 + ,1150 + ,610 + ,0.24 + ,99 + ,285 + ,171 + ,0.18 + ,100 + ,768 + ,163 + ,0.1 + ,101 + ,3696 + ,9 + ,0.07 + ,102 + ,1801 + ,147 + ,0.07 + ,103 + ,54 + ,13 + ,0.05 + ,104 + ,1452 + ,11 + ,0.04 + ,105 + ,8725 + ,2 + ,0.01 + ,106 + ,1118 + ,1 + ,0 + ,107 + ,6040 + ,1 + ,0 + ,108 + ,3 + ,3 + ,0 + ,109 + ,5095 + ,1 + ,0) + ,dim=c(4 + ,109) + ,dimnames=list(c('ranking' + ,'characters' + ,'revisions' + ,'hours') + ,1:109)) > y <- array(NA,dim=c(4,109),dimnames=list(c('ranking','characters','revisions','hours'),1:109)) > 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 > 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 ranking characters revisions hours 1 1 41456 2151 5.46 2 2 8424 2951 5.31 3 3 8696 1714 4.86 4 4 5732 2435 4.33 5 5 4047 1095 4.29 6 6 4195 1616 3.80 7 7 7444 2090 3.78 8 8 7617 2985 3.58 9 9 5641 2328 3.44 10 10 6528 1911 3.39 11 11 4797 1250 3.23 12 12 3608 660 3.21 13 13 5230 1180 3.04 14 14 4226 1275 3.03 15 15 7013 2141 2.97 16 16 3915 1309 2.92 17 17 5365 2666 2.92 18 18 5817 2383 2.84 19 19 4376 980 2.78 20 20 4648 1047 2.77 21 21 3062 940 2.73 22 22 11652 987 2.62 23 23 1920 456 2.58 24 24 7031 2259 2.58 25 25 14377 2245 2.43 26 26 26468 1187 2.42 27 27 2343 381 2.42 28 28 2615 504 2.38 29 29 944 488 2.38 30 30 6892 1571 2.30 31 31 5334 1655 2.29 32 32 13525 1398 2.29 33 33 2709 1029 2.28 34 34 6008 1559 2.20 35 35 4285 968 2.17 36 36 2461 856 2.16 37 37 1314 667 2.14 38 38 8969 1350 2.07 39 39 2981 1232 2.06 40 40 6774 650 2.02 41 41 3956 1195 2.00 42 42 3683 1173 1.99 43 43 4361 1657 1.94 44 44 3193 1263 1.93 45 45 6924 1651 1.91 46 46 2338 753 1.87 47 47 4369 332 1.87 48 48 4897 1305 1.85 49 49 4050 1562 1.81 50 50 4090 1190 1.80 51 51 2014 470 1.80 52 52 3578 1179 1.80 53 53 2487 660 1.78 54 54 7438 385 1.76 55 55 9972 665 1.74 56 56 3790 988 1.74 57 57 5264 247 1.74 58 58 825 657 1.70 59 59 8468 1240 1.65 60 60 1855 905 1.65 61 61 3069 1528 1.62 62 62 2645 1226 1.58 63 63 2476 1195 1.57 64 64 3136 989 1.56 65 65 1890 630 1.55 66 66 2860 1180 1.51 67 67 3239 1343 1.31 68 68 2080 700 1.26 69 69 1716 1000 1.24 70 70 711 511 1.17 71 71 2002 493 1.10 72 72 56688 785 1.03 73 73 5655 493 1.02 74 74 2083 1191 0.92 75 75 2034 214 0.87 76 76 1120 223 0.84 77 77 1053 534 0.82 78 78 2148 208 0.82 79 79 2439 226 0.78 80 80 2654 1075 0.74 81 81 692 388 0.72 82 82 3882 836 0.72 83 83 694 142 0.71 84 84 3797 1055 0.70 85 85 2258 948 0.57 86 86 2059 738 0.57 87 87 942 482 0.54 88 88 1423 603 0.54 89 89 832 228 0.50 90 90 1197 568 0.49 91 91 2452 509 0.48 92 92 2624 585 0.44 93 93 1295 670 0.43 94 94 2048 533 0.39 95 95 1620 537 0.37 96 96 783 495 0.32 97 97 1556 425 0.24 98 98 1150 610 0.24 99 99 285 171 0.18 100 100 768 163 0.10 101 101 3696 9 0.07 102 102 1801 147 0.07 103 103 54 13 0.05 104 104 1452 11 0.04 105 105 8725 2 0.01 106 106 1118 1 0.00 107 107 6040 1 0.00 108 108 3 3 0.00 109 109 5095 1 0.00 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) characters revisions hours 9.822e+01 1.855e-04 -1.232e-03 -2.495e+01 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -15.290 -6.860 0.094 4.480 38.339 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 9.822e+01 1.505e+00 65.260 <2e-16 *** characters 1.855e-04 1.236e-04 1.501 0.136 revisions -1.232e-03 1.859e-03 -0.663 0.509 hours -2.495e+01 1.056e+00 -23.635 <2e-16 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 8.591 on 105 degrees of freedom Multiple R-squared: 0.9282, Adjusted R-squared: 0.9261 F-statistic: 452.4 on 3 and 105 DF, p-value: < 2.2e-16 > if (n > n25) { + kp3 <- k + 3 + nmkm3 <- n - k - 3 + gqarr <- array(NA, dim=c(nmkm3-kp3+1,3)) + numgqtests <- 0 + numsignificant1 <- 0 + numsignificant5 <- 0 + numsignificant10 <- 0 + for (mypoint in kp3:nmkm3) { + j <- 0 + numgqtests <- numgqtests + 1 + for (myalt in c('greater', 'two.sided', 'less')) { + j <- j + 1 + gqarr[mypoint-kp3+1,j] <- gqtest(mylm, point=mypoint, alternative=myalt)$p.value + } + if (gqarr[mypoint-kp3+1,2] < 0.01) numsignificant1 <- numsignificant1 + 1 + if (gqarr[mypoint-kp3+1,2] < 0.05) numsignificant5 <- numsignificant5 + 1 + if (gqarr[mypoint-kp3+1,2] < 0.10) numsignificant10 <- numsignificant10 + 1 + } + gqarr + } [,1] [,2] [,3] [1,] 0.008052661 1.610532e-02 9.919473e-01 [2,] 0.002559977 5.119955e-03 9.974400e-01 [3,] 0.001455944 2.911889e-03 9.985441e-01 [4,] 0.002386789 4.773578e-03 9.976132e-01 [5,] 0.002489190 4.978380e-03 9.975108e-01 [6,] 0.002990386 5.980773e-03 9.970096e-01 [7,] 0.002454922 4.909844e-03 9.975451e-01 [8,] 0.003834911 7.669822e-03 9.961651e-01 [9,] 0.008279684 1.655937e-02 9.917203e-01 [10,] 0.013967001 2.793400e-02 9.860330e-01 [11,] 0.030939788 6.187958e-02 9.690602e-01 [12,] 0.042873252 8.574650e-02 9.571267e-01 [13,] 0.075380117 1.507602e-01 9.246199e-01 [14,] 0.122096473 2.441929e-01 8.779035e-01 [15,] 0.185671946 3.713439e-01 8.143281e-01 [16,] 0.182897267 3.657945e-01 8.171027e-01 [17,] 0.229647448 4.592949e-01 7.703526e-01 [18,] 0.337406372 6.748127e-01 6.625936e-01 [19,] 0.346128055 6.922561e-01 6.538719e-01 [20,] 0.299390092 5.987802e-01 7.006099e-01 [21,] 0.441536353 8.830727e-01 5.584636e-01 [22,] 0.571111681 8.577766e-01 4.288883e-01 [23,] 0.704244563 5.915109e-01 2.957554e-01 [24,] 0.817360272 3.652795e-01 1.826397e-01 [25,] 0.905742320 1.885154e-01 9.425768e-02 [26,] 0.929854499 1.402910e-01 7.014550e-02 [27,] 0.969527991 6.094402e-02 3.047201e-02 [28,] 0.986827453 2.634509e-02 1.317255e-02 [29,] 0.994521720 1.095656e-02 5.478280e-03 [30,] 0.998010248 3.979503e-03 1.989752e-03 [31,] 0.999308302 1.383396e-03 6.916981e-04 [32,] 0.999731914 5.361720e-04 2.680860e-04 [33,] 0.999929825 1.403508e-04 7.017540e-05 [34,] 0.999975382 4.923634e-05 2.461817e-05 [35,] 0.999994201 1.159710e-05 5.798550e-06 [36,] 0.999998585 2.830490e-06 1.415245e-06 [37,] 0.999999719 5.618058e-07 2.809029e-07 [38,] 0.999999940 1.203594e-07 6.017970e-08 [39,] 0.999999984 3.255899e-08 1.627950e-08 [40,] 0.999999997 6.653768e-09 3.326884e-09 [41,] 0.999999999 2.152286e-09 1.076143e-09 [42,] 1.000000000 6.554858e-10 3.277429e-10 [43,] 1.000000000 1.649762e-10 8.248809e-11 [44,] 1.000000000 5.449151e-11 2.724576e-11 [45,] 1.000000000 2.447017e-11 1.223509e-11 [46,] 1.000000000 1.319686e-11 6.598429e-12 [47,] 1.000000000 8.591027e-12 4.295514e-12 [48,] 1.000000000 8.872397e-12 4.436199e-12 [49,] 1.000000000 1.070620e-11 5.353098e-12 [50,] 1.000000000 8.284408e-12 4.142204e-12 [51,] 1.000000000 7.551545e-12 3.775772e-12 [52,] 1.000000000 5.441720e-12 2.720860e-12 [53,] 1.000000000 5.639075e-12 2.819537e-12 [54,] 1.000000000 3.602996e-12 1.801498e-12 [55,] 1.000000000 2.180670e-12 1.090335e-12 [56,] 1.000000000 1.455865e-12 7.279326e-13 [57,] 1.000000000 5.850137e-13 2.925069e-13 [58,] 1.000000000 9.348945e-14 4.674473e-14 [59,] 1.000000000 1.485256e-15 7.426279e-16 [60,] 1.000000000 1.363208e-18 6.816042e-19 [61,] 1.000000000 7.915778e-19 3.957889e-19 [62,] 1.000000000 4.400253e-19 2.200126e-19 [63,] 1.000000000 6.304539e-20 3.152269e-20 [64,] 1.000000000 2.038791e-20 1.019396e-20 [65,] 1.000000000 2.166943e-20 1.083472e-20 [66,] 1.000000000 8.340068e-20 4.170034e-20 [67,] 1.000000000 2.321289e-19 1.160645e-19 [68,] 1.000000000 9.548767e-19 4.774384e-19 [69,] 1.000000000 4.285308e-18 2.142654e-18 [70,] 1.000000000 1.742666e-17 8.713332e-18 [71,] 1.000000000 6.735012e-17 3.367506e-17 [72,] 1.000000000 3.633292e-16 1.816646e-16 [73,] 1.000000000 1.684576e-15 8.422880e-16 [74,] 1.000000000 5.295137e-15 2.647568e-15 [75,] 1.000000000 2.292602e-14 1.146301e-14 [76,] 1.000000000 1.140174e-13 5.700872e-14 [77,] 1.000000000 5.113438e-13 2.556719e-13 [78,] 1.000000000 2.151642e-12 1.075821e-12 [79,] 1.000000000 3.016128e-12 1.508064e-12 [80,] 1.000000000 9.560094e-12 4.780047e-12 [81,] 1.000000000 4.172084e-11 2.086042e-11 [82,] 1.000000000 2.146168e-10 1.073084e-10 [83,] 0.999999999 1.154469e-09 5.772346e-10 [84,] 0.999999997 5.984051e-09 2.992025e-09 [85,] 0.999999985 2.917721e-08 1.458861e-08 [86,] 0.999999927 1.457317e-07 7.286585e-08 [87,] 0.999999690 6.202430e-07 3.101215e-07 [88,] 0.999998759 2.481123e-06 1.240562e-06 [89,] 0.999997202 5.595115e-06 2.797557e-06 [90,] 0.999996002 7.995523e-06 3.997761e-06 [91,] 0.999981163 3.767303e-05 1.883652e-05 [92,] 0.999924139 1.517222e-04 7.586108e-05 [93,] 0.999983550 3.290098e-05 1.645049e-05 [94,] 0.999869087 2.618258e-04 1.309129e-04 [95,] 0.998990802 2.018395e-03 1.009198e-03 [96,] 0.996335568 7.328863e-03 3.664432e-03 > postscript(file="/var/wessaorg/rcomp/tmp/1ta4b1322143548.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/wessaorg/rcomp/tmp/2p0of1322143548.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/wessaorg/rcomp/tmp/38qzq1322143548.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/wessaorg/rcomp/tmp/4xdm91322143548.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/wessaorg/rcomp/tmp/5sbdl1322143548.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 = 109 Frequency = 1 1 2 3 4 5 6 33.96842518 38.33855762 26.53612255 15.75029839 14.41381111 3.80235966 7 8 9 10 11 12 4.28469880 1.36516023 -1.57091649 -2.49677057 -5.98223766 -5.98764187 13 14 15 16 17 18 -8.88946338 -7.83569182 -7.78271081 -8.48070749 -6.07771882 -7.50631036 19 20 21 22 23 24 -9.46469593 -8.68210746 -8.51778919 -11.79782922 -10.64492080 -8.37149611 25 26 27 28 29 30 -12.49397904 -15.28979341 -10.80792644 -10.70486648 -9.41462709 -10.17963142 31 32 33 34 35 36 -9.03665171 -9.87264330 -7.57053984 -8.52552931 -8.68262280 -7.73179287 37 38 39 40 41 42 -7.25091889 -8.57588181 -6.86006638 -8.27873936 -6.58355725 -5.80953320 43 44 45 46 47 48 -5.58650542 -5.10480640 -4.81783305 -5.07163094 -4.96707059 -3.36520093 49 50 51 52 53 54 -2.88947801 -2.60474422 -2.10677412 -0.52332663 -0.45943031 -1.21563084 55 56 57 58 59 60 -0.83969252 1.70496882 1.51857747 2.84908850 1.90215938 3.71605037 61 62 63 64 65 66 4.50993365 4.21845531 4.96209964 5.33635718 5.87564758 6.37533904 67 68 69 70 71 72 2.51569856 1.69090316 2.62903172 1.46639597 0.45819163 -10.07227316 73 74 75 76 77 78 -0.21546968 -0.18798688 -1.63019416 -1.19809363 -0.30150242 0.09372476 79 80 81 82 83 84 0.06389080 1.07202219 1.09048842 2.05075416 2.53751435 3.83733174 85 86 87 88 89 90 1.74735508 2.52552824 2.66877885 3.72864151 3.37819722 4.47989619 91 92 93 94 95 96 4.92490498 4.98860558 6.09034030 5.78383600 6.36913676 6.22510084 97 98 99 100 101 102 4.99940272 6.30264839 5.42515725 4.32964074 3.84825990 5.36979104 103 104 105 106 107 108 6.02972373 6.51843676 5.40975757 7.57003513 7.65705609 9.77932004 109 9.83234361 > postscript(file="/var/wessaorg/rcomp/tmp/65gcn1322143548.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 = 109 Frequency = 1 lag(myerror, k = 1) myerror 0 33.96842518 NA 1 38.33855762 33.96842518 2 26.53612255 38.33855762 3 15.75029839 26.53612255 4 14.41381111 15.75029839 5 3.80235966 14.41381111 6 4.28469880 3.80235966 7 1.36516023 4.28469880 8 -1.57091649 1.36516023 9 -2.49677057 -1.57091649 10 -5.98223766 -2.49677057 11 -5.98764187 -5.98223766 12 -8.88946338 -5.98764187 13 -7.83569182 -8.88946338 14 -7.78271081 -7.83569182 15 -8.48070749 -7.78271081 16 -6.07771882 -8.48070749 17 -7.50631036 -6.07771882 18 -9.46469593 -7.50631036 19 -8.68210746 -9.46469593 20 -8.51778919 -8.68210746 21 -11.79782922 -8.51778919 22 -10.64492080 -11.79782922 23 -8.37149611 -10.64492080 24 -12.49397904 -8.37149611 25 -15.28979341 -12.49397904 26 -10.80792644 -15.28979341 27 -10.70486648 -10.80792644 28 -9.41462709 -10.70486648 29 -10.17963142 -9.41462709 30 -9.03665171 -10.17963142 31 -9.87264330 -9.03665171 32 -7.57053984 -9.87264330 33 -8.52552931 -7.57053984 34 -8.68262280 -8.52552931 35 -7.73179287 -8.68262280 36 -7.25091889 -7.73179287 37 -8.57588181 -7.25091889 38 -6.86006638 -8.57588181 39 -8.27873936 -6.86006638 40 -6.58355725 -8.27873936 41 -5.80953320 -6.58355725 42 -5.58650542 -5.80953320 43 -5.10480640 -5.58650542 44 -4.81783305 -5.10480640 45 -5.07163094 -4.81783305 46 -4.96707059 -5.07163094 47 -3.36520093 -4.96707059 48 -2.88947801 -3.36520093 49 -2.60474422 -2.88947801 50 -2.10677412 -2.60474422 51 -0.52332663 -2.10677412 52 -0.45943031 -0.52332663 53 -1.21563084 -0.45943031 54 -0.83969252 -1.21563084 55 1.70496882 -0.83969252 56 1.51857747 1.70496882 57 2.84908850 1.51857747 58 1.90215938 2.84908850 59 3.71605037 1.90215938 60 4.50993365 3.71605037 61 4.21845531 4.50993365 62 4.96209964 4.21845531 63 5.33635718 4.96209964 64 5.87564758 5.33635718 65 6.37533904 5.87564758 66 2.51569856 6.37533904 67 1.69090316 2.51569856 68 2.62903172 1.69090316 69 1.46639597 2.62903172 70 0.45819163 1.46639597 71 -10.07227316 0.45819163 72 -0.21546968 -10.07227316 73 -0.18798688 -0.21546968 74 -1.63019416 -0.18798688 75 -1.19809363 -1.63019416 76 -0.30150242 -1.19809363 77 0.09372476 -0.30150242 78 0.06389080 0.09372476 79 1.07202219 0.06389080 80 1.09048842 1.07202219 81 2.05075416 1.09048842 82 2.53751435 2.05075416 83 3.83733174 2.53751435 84 1.74735508 3.83733174 85 2.52552824 1.74735508 86 2.66877885 2.52552824 87 3.72864151 2.66877885 88 3.37819722 3.72864151 89 4.47989619 3.37819722 90 4.92490498 4.47989619 91 4.98860558 4.92490498 92 6.09034030 4.98860558 93 5.78383600 6.09034030 94 6.36913676 5.78383600 95 6.22510084 6.36913676 96 4.99940272 6.22510084 97 6.30264839 4.99940272 98 5.42515725 6.30264839 99 4.32964074 5.42515725 100 3.84825990 4.32964074 101 5.36979104 3.84825990 102 6.02972373 5.36979104 103 6.51843676 6.02972373 104 5.40975757 6.51843676 105 7.57003513 5.40975757 106 7.65705609 7.57003513 107 9.77932004 7.65705609 108 9.83234361 9.77932004 109 NA 9.83234361 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] 38.33855762 33.96842518 [2,] 26.53612255 38.33855762 [3,] 15.75029839 26.53612255 [4,] 14.41381111 15.75029839 [5,] 3.80235966 14.41381111 [6,] 4.28469880 3.80235966 [7,] 1.36516023 4.28469880 [8,] -1.57091649 1.36516023 [9,] -2.49677057 -1.57091649 [10,] -5.98223766 -2.49677057 [11,] -5.98764187 -5.98223766 [12,] -8.88946338 -5.98764187 [13,] -7.83569182 -8.88946338 [14,] -7.78271081 -7.83569182 [15,] -8.48070749 -7.78271081 [16,] -6.07771882 -8.48070749 [17,] -7.50631036 -6.07771882 [18,] -9.46469593 -7.50631036 [19,] -8.68210746 -9.46469593 [20,] -8.51778919 -8.68210746 [21,] -11.79782922 -8.51778919 [22,] -10.64492080 -11.79782922 [23,] -8.37149611 -10.64492080 [24,] -12.49397904 -8.37149611 [25,] -15.28979341 -12.49397904 [26,] -10.80792644 -15.28979341 [27,] -10.70486648 -10.80792644 [28,] -9.41462709 -10.70486648 [29,] -10.17963142 -9.41462709 [30,] -9.03665171 -10.17963142 [31,] -9.87264330 -9.03665171 [32,] -7.57053984 -9.87264330 [33,] -8.52552931 -7.57053984 [34,] -8.68262280 -8.52552931 [35,] -7.73179287 -8.68262280 [36,] -7.25091889 -7.73179287 [37,] -8.57588181 -7.25091889 [38,] -6.86006638 -8.57588181 [39,] -8.27873936 -6.86006638 [40,] -6.58355725 -8.27873936 [41,] -5.80953320 -6.58355725 [42,] -5.58650542 -5.80953320 [43,] -5.10480640 -5.58650542 [44,] -4.81783305 -5.10480640 [45,] -5.07163094 -4.81783305 [46,] -4.96707059 -5.07163094 [47,] -3.36520093 -4.96707059 [48,] -2.88947801 -3.36520093 [49,] -2.60474422 -2.88947801 [50,] -2.10677412 -2.60474422 [51,] -0.52332663 -2.10677412 [52,] -0.45943031 -0.52332663 [53,] -1.21563084 -0.45943031 [54,] -0.83969252 -1.21563084 [55,] 1.70496882 -0.83969252 [56,] 1.51857747 1.70496882 [57,] 2.84908850 1.51857747 [58,] 1.90215938 2.84908850 [59,] 3.71605037 1.90215938 [60,] 4.50993365 3.71605037 [61,] 4.21845531 4.50993365 [62,] 4.96209964 4.21845531 [63,] 5.33635718 4.96209964 [64,] 5.87564758 5.33635718 [65,] 6.37533904 5.87564758 [66,] 2.51569856 6.37533904 [67,] 1.69090316 2.51569856 [68,] 2.62903172 1.69090316 [69,] 1.46639597 2.62903172 [70,] 0.45819163 1.46639597 [71,] -10.07227316 0.45819163 [72,] -0.21546968 -10.07227316 [73,] -0.18798688 -0.21546968 [74,] -1.63019416 -0.18798688 [75,] -1.19809363 -1.63019416 [76,] -0.30150242 -1.19809363 [77,] 0.09372476 -0.30150242 [78,] 0.06389080 0.09372476 [79,] 1.07202219 0.06389080 [80,] 1.09048842 1.07202219 [81,] 2.05075416 1.09048842 [82,] 2.53751435 2.05075416 [83,] 3.83733174 2.53751435 [84,] 1.74735508 3.83733174 [85,] 2.52552824 1.74735508 [86,] 2.66877885 2.52552824 [87,] 3.72864151 2.66877885 [88,] 3.37819722 3.72864151 [89,] 4.47989619 3.37819722 [90,] 4.92490498 4.47989619 [91,] 4.98860558 4.92490498 [92,] 6.09034030 4.98860558 [93,] 5.78383600 6.09034030 [94,] 6.36913676 5.78383600 [95,] 6.22510084 6.36913676 [96,] 4.99940272 6.22510084 [97,] 6.30264839 4.99940272 [98,] 5.42515725 6.30264839 [99,] 4.32964074 5.42515725 [100,] 3.84825990 4.32964074 [101,] 5.36979104 3.84825990 [102,] 6.02972373 5.36979104 [103,] 6.51843676 6.02972373 [104,] 5.40975757 6.51843676 [105,] 7.57003513 5.40975757 [106,] 7.65705609 7.57003513 [107,] 9.77932004 7.65705609 [108,] 9.83234361 9.77932004 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 38.33855762 33.96842518 2 26.53612255 38.33855762 3 15.75029839 26.53612255 4 14.41381111 15.75029839 5 3.80235966 14.41381111 6 4.28469880 3.80235966 7 1.36516023 4.28469880 8 -1.57091649 1.36516023 9 -2.49677057 -1.57091649 10 -5.98223766 -2.49677057 11 -5.98764187 -5.98223766 12 -8.88946338 -5.98764187 13 -7.83569182 -8.88946338 14 -7.78271081 -7.83569182 15 -8.48070749 -7.78271081 16 -6.07771882 -8.48070749 17 -7.50631036 -6.07771882 18 -9.46469593 -7.50631036 19 -8.68210746 -9.46469593 20 -8.51778919 -8.68210746 21 -11.79782922 -8.51778919 22 -10.64492080 -11.79782922 23 -8.37149611 -10.64492080 24 -12.49397904 -8.37149611 25 -15.28979341 -12.49397904 26 -10.80792644 -15.28979341 27 -10.70486648 -10.80792644 28 -9.41462709 -10.70486648 29 -10.17963142 -9.41462709 30 -9.03665171 -10.17963142 31 -9.87264330 -9.03665171 32 -7.57053984 -9.87264330 33 -8.52552931 -7.57053984 34 -8.68262280 -8.52552931 35 -7.73179287 -8.68262280 36 -7.25091889 -7.73179287 37 -8.57588181 -7.25091889 38 -6.86006638 -8.57588181 39 -8.27873936 -6.86006638 40 -6.58355725 -8.27873936 41 -5.80953320 -6.58355725 42 -5.58650542 -5.80953320 43 -5.10480640 -5.58650542 44 -4.81783305 -5.10480640 45 -5.07163094 -4.81783305 46 -4.96707059 -5.07163094 47 -3.36520093 -4.96707059 48 -2.88947801 -3.36520093 49 -2.60474422 -2.88947801 50 -2.10677412 -2.60474422 51 -0.52332663 -2.10677412 52 -0.45943031 -0.52332663 53 -1.21563084 -0.45943031 54 -0.83969252 -1.21563084 55 1.70496882 -0.83969252 56 1.51857747 1.70496882 57 2.84908850 1.51857747 58 1.90215938 2.84908850 59 3.71605037 1.90215938 60 4.50993365 3.71605037 61 4.21845531 4.50993365 62 4.96209964 4.21845531 63 5.33635718 4.96209964 64 5.87564758 5.33635718 65 6.37533904 5.87564758 66 2.51569856 6.37533904 67 1.69090316 2.51569856 68 2.62903172 1.69090316 69 1.46639597 2.62903172 70 0.45819163 1.46639597 71 -10.07227316 0.45819163 72 -0.21546968 -10.07227316 73 -0.18798688 -0.21546968 74 -1.63019416 -0.18798688 75 -1.19809363 -1.63019416 76 -0.30150242 -1.19809363 77 0.09372476 -0.30150242 78 0.06389080 0.09372476 79 1.07202219 0.06389080 80 1.09048842 1.07202219 81 2.05075416 1.09048842 82 2.53751435 2.05075416 83 3.83733174 2.53751435 84 1.74735508 3.83733174 85 2.52552824 1.74735508 86 2.66877885 2.52552824 87 3.72864151 2.66877885 88 3.37819722 3.72864151 89 4.47989619 3.37819722 90 4.92490498 4.47989619 91 4.98860558 4.92490498 92 6.09034030 4.98860558 93 5.78383600 6.09034030 94 6.36913676 5.78383600 95 6.22510084 6.36913676 96 4.99940272 6.22510084 97 6.30264839 4.99940272 98 5.42515725 6.30264839 99 4.32964074 5.42515725 100 3.84825990 4.32964074 101 5.36979104 3.84825990 102 6.02972373 5.36979104 103 6.51843676 6.02972373 104 5.40975757 6.51843676 105 7.57003513 5.40975757 106 7.65705609 7.57003513 107 9.77932004 7.65705609 108 9.83234361 9.77932004 > 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/wessaorg/rcomp/tmp/7slme1322143548.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/wessaorg/rcomp/tmp/8n0rh1322143548.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/wessaorg/rcomp/tmp/9bws01322143548.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/wessaorg/rcomp/tmp/10xgg51322143548.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/wessaorg/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/wessaorg/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/wessaorg/rcomp/tmp/117gv41322143548.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/wessaorg/rcomp/tmp/12thdl1322143548.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/wessaorg/rcomp/tmp/13sr6y1322143548.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/wessaorg/rcomp/tmp/147im01322143548.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/wessaorg/rcomp/tmp/1549fs1322143548.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/wessaorg/rcomp/tmp/16a69l1322143548.tab") + } > > try(system("convert tmp/1ta4b1322143548.ps tmp/1ta4b1322143548.png",intern=TRUE)) character(0) > try(system("convert tmp/2p0of1322143548.ps tmp/2p0of1322143548.png",intern=TRUE)) character(0) > try(system("convert tmp/38qzq1322143548.ps tmp/38qzq1322143548.png",intern=TRUE)) character(0) > try(system("convert tmp/4xdm91322143548.ps tmp/4xdm91322143548.png",intern=TRUE)) character(0) > try(system("convert tmp/5sbdl1322143548.ps tmp/5sbdl1322143548.png",intern=TRUE)) character(0) > try(system("convert tmp/65gcn1322143548.ps tmp/65gcn1322143548.png",intern=TRUE)) character(0) > try(system("convert tmp/7slme1322143548.ps tmp/7slme1322143548.png",intern=TRUE)) character(0) > try(system("convert tmp/8n0rh1322143548.ps tmp/8n0rh1322143548.png",intern=TRUE)) character(0) > try(system("convert tmp/9bws01322143548.ps tmp/9bws01322143548.png",intern=TRUE)) character(0) > try(system("convert tmp/10xgg51322143548.ps tmp/10xgg51322143548.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 4.267 0.581 4.947