R version 2.15.2 (2012-10-26) -- "Trick or Treat" Copyright (C) 2012 The R Foundation for Statistical Computing ISBN 3-900051-07-0 Platform: i686-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(4 + ,1 + ,1 + ,0 + ,0 + ,0 + ,0 + ,1 + ,4 + ,0 + ,2 + ,0 + ,0 + ,0 + ,0 + ,0 + ,4 + ,0 + ,2 + ,0 + ,0 + ,0 + ,0 + ,0 + ,4 + ,0 + ,2 + ,0 + ,0 + ,0 + ,0 + ,0 + ,4 + ,0 + ,2 + ,0 + ,0 + ,0 + ,0 + ,0 + ,4 + ,1 + ,2 + ,0 + ,0 + ,0 + ,1 + ,1 + ,4 + ,0 + ,2 + ,0 + ,0 + ,0 + ,0 + ,0 + ,4 + ,0 + ,1 + ,0 + ,0 + ,0 + ,0 + ,0 + ,4 + ,0 + ,2 + ,0 + ,0 + ,0 + ,0 + ,1 + ,4 + ,1 + ,2 + ,0 + ,0 + ,0 + ,0 + ,0 + ,4 + ,1 + ,1 + ,0 + ,0 + ,0 + ,0 + ,0 + ,4 + ,0 + ,2 + ,0 + ,0 + ,0 + ,0 + ,0 + ,4 + ,0 + ,2 + ,0 + ,1 + ,0 + ,1 + ,0 + ,4 + ,1 + ,1 + ,0 + ,0 + ,0 + ,0 + ,0 + ,4 + ,0 + ,2 + ,0 + ,1 + ,0 + ,1 + ,1 + ,4 + ,0 + ,1 + ,0 + ,1 + ,0 + ,1 + ,1 + ,4 + ,1 + ,1 + ,0 + ,1 + ,1 + ,1 + ,0 + ,4 + ,1 + ,1 + ,0 + ,0 + ,0 + ,0 + ,0 + ,4 + ,0 + ,2 + ,0 + ,0 + ,0 + ,0 + ,1 + ,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2 + ,0 + ,0 + ,1 + ,0 + ,0 + ,0 + ,0 + ,2 + ,1 + ,0 + ,2 + ,0 + ,0 + ,0 + ,0 + ,2 + ,0 + ,0 + ,2 + ,0 + ,0 + ,1 + ,1 + ,2 + ,0 + ,0 + ,2 + ,0 + ,0 + ,0 + ,1 + ,2 + ,1 + ,0 + ,2 + ,1 + ,1 + ,0 + ,0 + ,2 + ,1 + ,0 + ,2 + ,1 + ,1 + ,1 + ,0 + ,2 + ,1 + ,0 + ,2 + ,1 + ,0 + ,0 + ,0) + ,dim=c(8 + ,154) + ,dimnames=list(c('Weeks' + ,'uselimit' + ,'T40' + ,'T20' + ,'used' + ,'CorrectAnalysis_1' + ,'useful' + ,'outcome') + ,1:154)) > y <- array(NA,dim=c(8,154),dimnames=list(c('Weeks','uselimit','T40','T20','used','CorrectAnalysis_1','useful','outcome'),1:154)) > 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 = '6' > library(lattice) > library(lmtest) Loading required package: zoo Attaching package: 'zoo' The following object(s) are masked from 'package:base': as.Date, 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 CorrectAnalysis_1 Weeks uselimit T40 T20 used useful outcome t 1 0 4 1 1 0 0 0 1 1 2 0 4 0 2 0 0 0 0 2 3 0 4 0 2 0 0 0 0 3 4 0 4 0 2 0 0 0 0 4 5 0 4 0 2 0 0 0 0 5 6 0 4 1 2 0 0 1 1 6 7 0 4 0 2 0 0 0 0 7 8 0 4 0 1 0 0 0 0 8 9 0 4 0 2 0 0 0 1 9 10 0 4 1 2 0 0 0 0 10 11 0 4 1 1 0 0 0 0 11 12 0 4 0 2 0 0 0 0 12 13 0 4 0 2 0 1 1 0 13 14 0 4 1 1 0 0 0 0 14 15 0 4 0 2 0 1 1 1 15 16 0 4 0 1 0 1 1 1 16 17 1 4 1 1 0 1 1 0 17 18 0 4 1 1 0 0 0 0 18 19 0 4 0 2 0 0 0 1 19 20 1 4 0 1 0 1 1 1 20 21 0 4 1 2 0 0 1 0 21 22 0 4 1 2 0 1 1 1 22 23 0 4 0 2 0 0 1 1 23 24 0 4 1 2 0 0 1 1 24 25 0 4 0 1 0 1 0 1 25 26 0 4 0 2 0 1 1 0 26 27 0 4 1 2 0 0 0 1 27 28 0 4 0 2 0 1 0 0 28 29 0 4 0 2 0 0 0 1 29 30 0 4 0 2 0 0 1 0 30 31 0 4 0 2 0 0 0 0 31 32 0 4 1 2 0 0 0 0 32 33 0 4 1 2 0 0 1 0 33 34 0 4 0 1 0 0 0 1 34 35 0 4 0 2 0 0 0 0 35 36 0 4 0 2 0 0 0 0 36 37 0 4 1 1 0 1 1 0 37 38 0 4 0 2 0 1 0 1 38 39 0 4 0 2 0 0 1 1 39 40 0 4 0 1 0 0 1 0 40 41 1 4 0 2 0 1 1 1 41 42 0 4 0 2 0 1 0 1 42 43 0 4 1 2 0 0 1 1 43 44 0 4 1 1 0 0 0 0 44 45 0 4 0 2 0 0 1 0 45 46 0 4 0 2 0 0 1 1 46 47 0 4 0 2 0 0 0 0 47 48 0 4 0 2 0 0 0 1 48 49 0 4 0 2 0 0 1 1 49 50 0 4 0 2 0 0 0 0 50 51 0 4 0 1 0 1 0 0 51 52 1 4 1 1 0 1 1 0 52 53 0 4 0 2 0 0 0 1 53 54 1 4 0 2 0 1 0 0 54 55 0 4 0 2 0 0 0 0 55 56 0 4 0 1 0 1 0 1 56 57 0 4 0 2 0 1 1 1 57 58 0 4 0 2 0 0 0 1 58 59 0 4 0 2 0 0 0 1 59 60 1 4 1 1 0 1 1 1 60 61 0 4 1 1 0 0 0 1 61 62 0 4 0 2 0 1 1 0 62 63 0 4 0 2 0 0 0 0 63 64 0 4 1 1 0 0 0 1 64 65 0 4 0 2 0 0 0 0 65 66 0 4 0 2 0 0 0 0 66 67 1 4 0 1 0 1 1 0 67 68 0 4 1 2 0 0 0 0 68 69 0 4 0 2 0 0 0 1 69 70 0 4 0 2 0 1 0 0 70 71 0 4 0 2 0 0 0 0 71 72 0 4 0 2 0 0 0 1 72 73 0 4 0 2 0 1 0 1 73 74 0 4 1 2 0 1 0 0 74 75 0 4 0 2 0 0 0 1 75 76 0 4 0 1 0 0 1 1 76 77 0 4 0 2 0 0 0 1 77 78 0 4 0 2 0 1 1 1 78 79 1 4 0 1 0 1 0 1 79 80 0 4 0 1 0 0 1 0 80 81 0 4 0 2 0 0 0 0 81 82 0 4 1 2 0 1 0 1 82 83 0 4 0 2 0 0 0 0 83 84 1 4 0 2 0 1 0 0 84 85 0 4 0 2 0 0 1 1 85 86 0 4 1 2 0 0 0 0 86 87 0 2 1 0 2 0 0 1 87 88 0 2 1 0 1 1 0 1 88 89 0 2 0 0 2 0 0 0 89 90 0 2 0 0 2 0 0 1 90 91 0 2 0 0 2 0 1 0 91 92 0 2 1 0 1 0 0 0 92 93 0 2 1 0 2 0 1 0 93 94 0 2 0 0 2 0 0 0 94 95 0 2 0 0 1 0 0 0 95 96 0 2 0 0 2 0 0 1 96 97 0 2 1 0 1 0 0 0 97 98 0 2 0 0 2 0 0 0 98 99 0 2 1 0 2 0 0 0 99 100 0 2 0 0 2 0 0 1 100 101 0 2 1 0 2 0 0 1 101 102 0 2 0 0 2 0 0 0 102 103 0 2 0 0 2 0 0 0 103 104 0 2 0 0 2 0 0 0 104 105 0 2 0 0 1 1 0 0 105 106 0 2 0 0 2 0 0 0 106 107 0 2 0 0 2 0 0 0 107 108 0 2 1 0 1 1 0 0 108 109 0 2 0 0 2 0 0 0 109 110 0 2 1 0 2 0 0 0 110 111 0 2 1 0 1 1 1 0 111 112 0 2 0 0 1 0 0 0 112 113 0 2 0 0 2 1 0 0 113 114 0 2 1 0 1 1 0 0 114 115 0 2 1 0 2 0 0 0 115 116 0 2 0 0 2 0 0 0 116 117 0 2 1 0 2 0 0 1 117 118 0 2 1 0 2 0 0 0 118 119 0 2 0 0 2 0 0 0 119 120 0 2 0 0 2 0 0 1 120 121 0 2 1 0 2 0 0 0 121 122 0 2 0 0 2 0 0 0 122 123 0 2 1 0 1 1 0 0 123 124 0 2 0 0 2 1 1 1 124 125 0 2 0 0 2 0 0 1 125 126 0 2 0 0 1 0 0 0 126 127 0 2 0 0 2 0 1 0 127 128 0 2 0 0 2 0 0 1 128 129 0 2 0 0 2 0 0 0 129 130 0 2 0 0 2 0 0 1 130 131 0 2 1 0 2 0 0 0 131 132 0 2 1 0 2 0 0 1 132 133 0 2 1 0 2 1 0 0 133 134 0 2 0 0 2 0 0 0 134 135 0 2 0 0 2 0 0 0 135 136 0 2 0 0 2 0 0 0 136 137 0 2 1 0 2 1 1 1 137 138 0 2 1 0 1 1 1 1 138 139 0 2 0 0 1 0 0 0 139 140 0 2 0 0 2 0 0 0 140 141 1 2 0 0 2 1 0 1 141 142 0 2 0 0 1 1 0 1 142 143 0 2 1 0 2 0 0 0 143 144 0 2 0 0 2 0 1 1 144 145 0 2 0 0 2 0 1 0 145 146 0 2 0 0 1 0 0 1 146 147 0 2 0 0 1 1 0 0 147 148 0 2 0 0 1 0 0 0 148 149 0 2 1 0 2 0 0 0 149 150 0 2 0 0 2 0 1 1 150 151 0 2 0 0 2 0 0 1 151 152 1 2 1 0 2 1 0 0 152 153 1 2 1 0 2 1 1 0 153 154 0 2 1 0 2 1 0 0 154 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) Weeks uselimit T40 T20 used -1.157981 0.351152 -0.001993 -0.163698 0.150676 0.248752 useful outcome t 0.044040 -0.041408 0.001497 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -0.42910 -0.10302 -0.00974 0.04409 0.76802 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) -1.1579815 0.3068667 -3.774 0.000234 *** Weeks 0.3511516 0.0853216 4.116 6.45e-05 *** uselimit -0.0019933 0.0413661 -0.048 0.961633 T40 -0.1636975 0.0581942 -2.813 0.005590 ** T20 0.1506761 0.0674098 2.235 0.026931 * used 0.2487521 0.0452857 5.493 1.73e-07 *** useful 0.0440401 0.0452789 0.973 0.332352 outcome -0.0414081 0.0393837 -1.051 0.294823 t 0.0014967 0.0008449 1.771 0.078586 . --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 0.2313 on 145 degrees of freedom Multiple R-squared: 0.2992, Adjusted R-squared: 0.2605 F-statistic: 7.738 on 8 and 145 DF, p-value: 1.301e-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,] 0.0000000000 0.000000000 1.000000000 [2,] 0.0000000000 0.000000000 1.000000000 [3,] 0.0000000000 0.000000000 1.000000000 [4,] 0.0000000000 0.000000000 1.000000000 [5,] 0.0000000000 0.000000000 1.000000000 [6,] 0.6453969236 0.709206153 0.354603076 [7,] 0.5641523425 0.871695315 0.435847657 [8,] 0.5546027813 0.890794437 0.445397219 [9,] 0.9305898745 0.138820251 0.069410126 [10,] 0.9023780835 0.195243833 0.097621916 [11,] 0.8937590022 0.212481996 0.106240998 [12,] 0.8539579739 0.292084052 0.146042026 [13,] 0.8065197531 0.386960494 0.193480247 [14,] 0.8016856651 0.396628670 0.198314335 [15,] 0.7889446898 0.422110620 0.211055310 [16,] 0.7652047788 0.469590442 0.234795221 [17,] 0.7162643459 0.567471308 0.283735654 [18,] 0.6712743134 0.657451373 0.328725687 [19,] 0.6129369998 0.774126000 0.387063000 [20,] 0.5538722376 0.892255525 0.446127762 [21,] 0.4931882057 0.986376411 0.506811794 [22,] 0.4330064178 0.866012836 0.566993582 [23,] 0.3789491565 0.757898313 0.621050844 [24,] 0.3250163676 0.650032735 0.674983632 [25,] 0.2737475796 0.547495159 0.726252420 [26,] 0.3453587229 0.690717446 0.654641277 [27,] 0.2997810411 0.599562082 0.700218959 [28,] 0.2495828504 0.499165701 0.750417150 [29,] 0.2301126874 0.460225375 0.769887313 [30,] 0.7965195367 0.406960927 0.203480463 [31,] 0.7695899656 0.460820069 0.230410034 [32,] 0.7274780897 0.545043821 0.272521910 [33,] 0.6911257345 0.617748531 0.308874266 [34,] 0.6420109252 0.715978150 0.357989075 [35,] 0.5925277585 0.814944483 0.407472241 [36,] 0.5428848892 0.914230222 0.457115111 [37,] 0.4929615972 0.985923194 0.507038403 [38,] 0.4428871861 0.885774372 0.557112814 [39,] 0.3933576130 0.786715226 0.606642387 [40,] 0.4627870779 0.925574156 0.537212922 [41,] 0.7359729414 0.528054117 0.264027059 [42,] 0.6955723221 0.608855356 0.304427678 [43,] 0.9551372423 0.089725515 0.044862758 [44,] 0.9422609874 0.115478025 0.057739013 [45,] 0.9677715596 0.064456881 0.032228440 [46,] 0.9678404821 0.064319036 0.032159518 [47,] 0.9586382346 0.082723531 0.041361765 [48,] 0.9474820727 0.105035855 0.052517927 [49,] 0.9847310756 0.030537849 0.015268924 [50,] 0.9828484613 0.034303077 0.017151539 [51,] 0.9849361032 0.030127794 0.015063897 [52,] 0.9796067244 0.040786551 0.020393276 [53,] 0.9792986150 0.041402770 0.020701385 [54,] 0.9723910124 0.055217975 0.027608988 [55,] 0.9636714946 0.072657011 0.036328505 [56,] 0.9864585046 0.027082991 0.013541495 [57,] 0.9819078320 0.036184336 0.018092168 [58,] 0.9759499688 0.048100062 0.024050031 [59,] 0.9771524853 0.045695029 0.022847515 [60,] 0.9696879734 0.060624053 0.030312027 [61,] 0.9605134227 0.078973155 0.039486577 [62,] 0.9598694567 0.080261087 0.040130543 [63,] 0.9631691034 0.073661793 0.036830897 [64,] 0.9523454110 0.095309178 0.047654589 [65,] 0.9528694523 0.094261095 0.047130548 [66,] 0.9398857149 0.120228570 0.060114285 [67,] 0.9442545065 0.111490987 0.055745494 [68,] 0.9863933624 0.027213275 0.013606638 [69,] 0.9838680592 0.032263882 0.016131941 [70,] 0.9792646131 0.041470774 0.020735387 [71,] 0.9842875837 0.031424833 0.015712416 [72,] 0.9828921746 0.034215651 0.017107825 [73,] 0.9986192722 0.002761456 0.001380728 [74,] 0.9979623742 0.004075252 0.002037626 [75,] 0.9969939356 0.006012129 0.003006064 [76,] 0.9956883422 0.008623316 0.004311658 [77,] 0.9937967848 0.012406430 0.006203215 [78,] 0.9912768661 0.017446268 0.008723134 [79,] 0.9880338601 0.023932280 0.011966140 [80,] 0.9840070950 0.031985810 0.015992905 [81,] 0.9816237520 0.036752496 0.018376248 [82,] 0.9759264188 0.048147162 0.024073581 [83,] 0.9679431293 0.064113741 0.032056871 [84,] 0.9644404821 0.071119036 0.035559518 [85,] 0.9544045287 0.091190943 0.045595471 [86,] 0.9520798329 0.095840334 0.047920167 [87,] 0.9385105079 0.122978984 0.061489492 [88,] 0.9224551602 0.155089680 0.077544840 [89,] 0.9046415824 0.190716835 0.095358418 [90,] 0.8860855125 0.227828975 0.113914487 [91,] 0.8605122415 0.278975517 0.139487758 [92,] 0.8312719230 0.337456154 0.168728077 [93,] 0.7983773320 0.403245336 0.201622668 [94,] 0.7659387399 0.468122520 0.234061260 [95,] 0.7257014686 0.548597063 0.274298531 [96,] 0.6823912426 0.635217515 0.317608757 [97,] 0.6380187292 0.723962542 0.361981271 [98,] 0.5891992831 0.821601434 0.410800717 [99,] 0.5395331543 0.920933691 0.460466846 [100,] 0.4951050472 0.990210094 0.504894953 [101,] 0.4976657216 0.995331443 0.502334278 [102,] 0.4891600716 0.978320143 0.510839928 [103,] 0.4349575904 0.869915181 0.565042410 [104,] 0.3834764402 0.766952880 0.616523560 [105,] 0.3305746133 0.661149227 0.669425387 [106,] 0.2896322899 0.579264580 0.710367710 [107,] 0.2472610342 0.494522068 0.752738966 [108,] 0.2034630852 0.406926170 0.796536915 [109,] 0.1674587698 0.334917540 0.832541230 [110,] 0.1375480884 0.275096177 0.862451912 [111,] 0.1072834272 0.214566854 0.892716573 [112,] 0.0819892593 0.163978519 0.918010741 [113,] 0.0780340512 0.156068102 0.921965949 [114,] 0.0576190565 0.115238113 0.942380943 [115,] 0.0576832010 0.115366402 0.942316799 [116,] 0.0427274308 0.085454862 0.957272569 [117,] 0.0298705582 0.059741116 0.970129442 [118,] 0.0201122206 0.040224441 0.979887779 [119,] 0.0131906391 0.026381278 0.986809361 [120,] 0.0091041157 0.018208231 0.990895884 [121,] 0.0071715953 0.014343191 0.992828405 [122,] 0.0068647451 0.013729490 0.993135255 [123,] 0.0039098339 0.007819668 0.996090166 [124,] 0.0021239933 0.004247987 0.997876007 [125,] 0.0011081984 0.002216397 0.998891802 [126,] 0.0015392273 0.003078455 0.998460773 [127,] 0.0014351694 0.002870339 0.998564831 [128,] 0.0009033461 0.001806692 0.999096654 [129,] 0.0003728800 0.000745760 0.999627120 [130,] 0.0108282722 0.021656544 0.989171728 [131,] 0.0047226969 0.009445394 0.995277303 > postscript(file="/var/wessaorg/rcomp/tmp/1anzw1355317761.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/252hc1355317761.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/3grlt1355317762.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/47fzr1355317762.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/5kqy01355317762.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 = 154 Frequency = 1 1 2 3 4 5 -0.0410225600 0.0777768967 0.0762802116 0.0747835265 0.0732868413 6 7 8 9 10 0.0711514065 0.0702934710 -0.0949007296 0.1087081657 0.0677967242 11 12 13 14 15 -0.0973974765 0.0628100453 -0.2314788806 -0.1018875319 -0.1930641858 16 17 18 19 20 -0.3582583865 0.6008301720 -0.1078742725 0.0937413143 0.6357548729 21 22 23 24 25 0.0072930643 -0.2015476732 0.0437144504 0.0442110739 -0.3276884295 26 27 28 29 30 -0.2509357874 0.0837611417 -0.2098890344 0.0787744628 -0.0081704106 31 32 33 34 35 0.0343730275 0.0348696510 -0.0106671574 -0.0924064784 0.0283862869 36 37 38 39 40 0.0268896018 -0.4291035309 -0.1834478209 0.0197674881 -0.1868347776 41 42 43 44 45 0.7680220004 -0.1894345615 0.0157740561 -0.1467880863 -0.0306206878 46 47 48 49 50 0.0092906921 0.0104260652 0.0503374451 0.0048006366 0.0059360098 51 52 53 54 55 -0.4080103083 0.5484461919 0.0428540193 0.7511971518 -0.0015474160 56 57 58 59 60 -0.3740856690 -0.2559249620 0.0353705936 0.0338739085 0.5778807757 61 62 63 64 65 -0.1308236687 -0.3048164527 -0.0135208971 -0.1353137242 -0.0165142674 66 67 68 69 70 -0.0180109526 0.5240026061 -0.0190110142 0.0189070570 -0.2727498106 71 72 73 74 75 -0.0254943783 0.0144170016 -0.2358318010 -0.2767432425 0.0099269461 76 77 78 79 80 -0.1993073778 0.0069335758 -0.2873553500 0.5914905726 -0.2467021834 81 82 83 84 85 -0.0404612298 -0.2473086587 -0.0434546000 0.7062965974 -0.0490800286 86 87 88 89 90 -0.0459513468 0.0675158825 -0.0320567951 0.0211211385 0.0610325184 91 92 93 94 95 -0.0259123551 0.1693005167 -0.0269124167 0.0136377128 0.1628171526 96 97 98 99 100 0.0520524075 0.1618170910 0.0076509722 0.0081475957 0.0460656669 101 102 103 104 105 0.0465622904 0.0016642316 0.0001675465 -0.0013291387 -0.1009018162 106 107 108 109 110 -0.0043225089 -0.0058191941 -0.1033985630 -0.0088125644 -0.0083159409 111 112 113 114 115 -0.1519287418 0.1373735052 -0.2635514224 -0.1123786739 -0.0157993666 116 117 118 119 120 -0.0192893604 0.0226153281 -0.0202894221 -0.0237794158 0.0161319640 121 122 123 124 125 -0.0247794775 -0.0282694713 -0.1258488402 -0.2826470173 0.0086485383 126 127 128 129 130 0.1164199131 -0.0797930203 0.0041584829 -0.0387462673 0.0011651126 131 132 133 134 135 -0.0397463290 0.0001650509 -0.2914918167 -0.0462296930 -0.0477263782 136 137 138 139 140 -0.0492230633 -0.3001106155 -0.1509311757 0.0969630062 -0.0552098039 141 142 143 144 145 0.7359494586 -0.1148711016 -0.0577065507 -0.0638286028 -0.1067333529 146 147 148 149 150 0.1278942752 -0.1637625923 0.0834928399 -0.0666866616 -0.0728087136 151 152 153 154 -0.0302652755 0.6800711656 0.6345343571 -0.3229222047 > postscript(file="/var/wessaorg/rcomp/tmp/6z1kr1355317762.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 = 154 Frequency = 1 lag(myerror, k = 1) myerror 0 -0.0410225600 NA 1 0.0777768967 -0.0410225600 2 0.0762802116 0.0777768967 3 0.0747835265 0.0762802116 4 0.0732868413 0.0747835265 5 0.0711514065 0.0732868413 6 0.0702934710 0.0711514065 7 -0.0949007296 0.0702934710 8 0.1087081657 -0.0949007296 9 0.0677967242 0.1087081657 10 -0.0973974765 0.0677967242 11 0.0628100453 -0.0973974765 12 -0.2314788806 0.0628100453 13 -0.1018875319 -0.2314788806 14 -0.1930641858 -0.1018875319 15 -0.3582583865 -0.1930641858 16 0.6008301720 -0.3582583865 17 -0.1078742725 0.6008301720 18 0.0937413143 -0.1078742725 19 0.6357548729 0.0937413143 20 0.0072930643 0.6357548729 21 -0.2015476732 0.0072930643 22 0.0437144504 -0.2015476732 23 0.0442110739 0.0437144504 24 -0.3276884295 0.0442110739 25 -0.2509357874 -0.3276884295 26 0.0837611417 -0.2509357874 27 -0.2098890344 0.0837611417 28 0.0787744628 -0.2098890344 29 -0.0081704106 0.0787744628 30 0.0343730275 -0.0081704106 31 0.0348696510 0.0343730275 32 -0.0106671574 0.0348696510 33 -0.0924064784 -0.0106671574 34 0.0283862869 -0.0924064784 35 0.0268896018 0.0283862869 36 -0.4291035309 0.0268896018 37 -0.1834478209 -0.4291035309 38 0.0197674881 -0.1834478209 39 -0.1868347776 0.0197674881 40 0.7680220004 -0.1868347776 41 -0.1894345615 0.7680220004 42 0.0157740561 -0.1894345615 43 -0.1467880863 0.0157740561 44 -0.0306206878 -0.1467880863 45 0.0092906921 -0.0306206878 46 0.0104260652 0.0092906921 47 0.0503374451 0.0104260652 48 0.0048006366 0.0503374451 49 0.0059360098 0.0048006366 50 -0.4080103083 0.0059360098 51 0.5484461919 -0.4080103083 52 0.0428540193 0.5484461919 53 0.7511971518 0.0428540193 54 -0.0015474160 0.7511971518 55 -0.3740856690 -0.0015474160 56 -0.2559249620 -0.3740856690 57 0.0353705936 -0.2559249620 58 0.0338739085 0.0353705936 59 0.5778807757 0.0338739085 60 -0.1308236687 0.5778807757 61 -0.3048164527 -0.1308236687 62 -0.0135208971 -0.3048164527 63 -0.1353137242 -0.0135208971 64 -0.0165142674 -0.1353137242 65 -0.0180109526 -0.0165142674 66 0.5240026061 -0.0180109526 67 -0.0190110142 0.5240026061 68 0.0189070570 -0.0190110142 69 -0.2727498106 0.0189070570 70 -0.0254943783 -0.2727498106 71 0.0144170016 -0.0254943783 72 -0.2358318010 0.0144170016 73 -0.2767432425 -0.2358318010 74 0.0099269461 -0.2767432425 75 -0.1993073778 0.0099269461 76 0.0069335758 -0.1993073778 77 -0.2873553500 0.0069335758 78 0.5914905726 -0.2873553500 79 -0.2467021834 0.5914905726 80 -0.0404612298 -0.2467021834 81 -0.2473086587 -0.0404612298 82 -0.0434546000 -0.2473086587 83 0.7062965974 -0.0434546000 84 -0.0490800286 0.7062965974 85 -0.0459513468 -0.0490800286 86 0.0675158825 -0.0459513468 87 -0.0320567951 0.0675158825 88 0.0211211385 -0.0320567951 89 0.0610325184 0.0211211385 90 -0.0259123551 0.0610325184 91 0.1693005167 -0.0259123551 92 -0.0269124167 0.1693005167 93 0.0136377128 -0.0269124167 94 0.1628171526 0.0136377128 95 0.0520524075 0.1628171526 96 0.1618170910 0.0520524075 97 0.0076509722 0.1618170910 98 0.0081475957 0.0076509722 99 0.0460656669 0.0081475957 100 0.0465622904 0.0460656669 101 0.0016642316 0.0465622904 102 0.0001675465 0.0016642316 103 -0.0013291387 0.0001675465 104 -0.1009018162 -0.0013291387 105 -0.0043225089 -0.1009018162 106 -0.0058191941 -0.0043225089 107 -0.1033985630 -0.0058191941 108 -0.0088125644 -0.1033985630 109 -0.0083159409 -0.0088125644 110 -0.1519287418 -0.0083159409 111 0.1373735052 -0.1519287418 112 -0.2635514224 0.1373735052 113 -0.1123786739 -0.2635514224 114 -0.0157993666 -0.1123786739 115 -0.0192893604 -0.0157993666 116 0.0226153281 -0.0192893604 117 -0.0202894221 0.0226153281 118 -0.0237794158 -0.0202894221 119 0.0161319640 -0.0237794158 120 -0.0247794775 0.0161319640 121 -0.0282694713 -0.0247794775 122 -0.1258488402 -0.0282694713 123 -0.2826470173 -0.1258488402 124 0.0086485383 -0.2826470173 125 0.1164199131 0.0086485383 126 -0.0797930203 0.1164199131 127 0.0041584829 -0.0797930203 128 -0.0387462673 0.0041584829 129 0.0011651126 -0.0387462673 130 -0.0397463290 0.0011651126 131 0.0001650509 -0.0397463290 132 -0.2914918167 0.0001650509 133 -0.0462296930 -0.2914918167 134 -0.0477263782 -0.0462296930 135 -0.0492230633 -0.0477263782 136 -0.3001106155 -0.0492230633 137 -0.1509311757 -0.3001106155 138 0.0969630062 -0.1509311757 139 -0.0552098039 0.0969630062 140 0.7359494586 -0.0552098039 141 -0.1148711016 0.7359494586 142 -0.0577065507 -0.1148711016 143 -0.0638286028 -0.0577065507 144 -0.1067333529 -0.0638286028 145 0.1278942752 -0.1067333529 146 -0.1637625923 0.1278942752 147 0.0834928399 -0.1637625923 148 -0.0666866616 0.0834928399 149 -0.0728087136 -0.0666866616 150 -0.0302652755 -0.0728087136 151 0.6800711656 -0.0302652755 152 0.6345343571 0.6800711656 153 -0.3229222047 0.6345343571 154 NA -0.3229222047 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] 0.0777768967 -0.0410225600 [2,] 0.0762802116 0.0777768967 [3,] 0.0747835265 0.0762802116 [4,] 0.0732868413 0.0747835265 [5,] 0.0711514065 0.0732868413 [6,] 0.0702934710 0.0711514065 [7,] -0.0949007296 0.0702934710 [8,] 0.1087081657 -0.0949007296 [9,] 0.0677967242 0.1087081657 [10,] -0.0973974765 0.0677967242 [11,] 0.0628100453 -0.0973974765 [12,] -0.2314788806 0.0628100453 [13,] -0.1018875319 -0.2314788806 [14,] -0.1930641858 -0.1018875319 [15,] -0.3582583865 -0.1930641858 [16,] 0.6008301720 -0.3582583865 [17,] -0.1078742725 0.6008301720 [18,] 0.0937413143 -0.1078742725 [19,] 0.6357548729 0.0937413143 [20,] 0.0072930643 0.6357548729 [21,] -0.2015476732 0.0072930643 [22,] 0.0437144504 -0.2015476732 [23,] 0.0442110739 0.0437144504 [24,] -0.3276884295 0.0442110739 [25,] -0.2509357874 -0.3276884295 [26,] 0.0837611417 -0.2509357874 [27,] -0.2098890344 0.0837611417 [28,] 0.0787744628 -0.2098890344 [29,] -0.0081704106 0.0787744628 [30,] 0.0343730275 -0.0081704106 [31,] 0.0348696510 0.0343730275 [32,] -0.0106671574 0.0348696510 [33,] -0.0924064784 -0.0106671574 [34,] 0.0283862869 -0.0924064784 [35,] 0.0268896018 0.0283862869 [36,] -0.4291035309 0.0268896018 [37,] -0.1834478209 -0.4291035309 [38,] 0.0197674881 -0.1834478209 [39,] -0.1868347776 0.0197674881 [40,] 0.7680220004 -0.1868347776 [41,] -0.1894345615 0.7680220004 [42,] 0.0157740561 -0.1894345615 [43,] -0.1467880863 0.0157740561 [44,] -0.0306206878 -0.1467880863 [45,] 0.0092906921 -0.0306206878 [46,] 0.0104260652 0.0092906921 [47,] 0.0503374451 0.0104260652 [48,] 0.0048006366 0.0503374451 [49,] 0.0059360098 0.0048006366 [50,] -0.4080103083 0.0059360098 [51,] 0.5484461919 -0.4080103083 [52,] 0.0428540193 0.5484461919 [53,] 0.7511971518 0.0428540193 [54,] -0.0015474160 0.7511971518 [55,] -0.3740856690 -0.0015474160 [56,] -0.2559249620 -0.3740856690 [57,] 0.0353705936 -0.2559249620 [58,] 0.0338739085 0.0353705936 [59,] 0.5778807757 0.0338739085 [60,] -0.1308236687 0.5778807757 [61,] -0.3048164527 -0.1308236687 [62,] -0.0135208971 -0.3048164527 [63,] -0.1353137242 -0.0135208971 [64,] -0.0165142674 -0.1353137242 [65,] -0.0180109526 -0.0165142674 [66,] 0.5240026061 -0.0180109526 [67,] -0.0190110142 0.5240026061 [68,] 0.0189070570 -0.0190110142 [69,] -0.2727498106 0.0189070570 [70,] -0.0254943783 -0.2727498106 [71,] 0.0144170016 -0.0254943783 [72,] -0.2358318010 0.0144170016 [73,] -0.2767432425 -0.2358318010 [74,] 0.0099269461 -0.2767432425 [75,] -0.1993073778 0.0099269461 [76,] 0.0069335758 -0.1993073778 [77,] -0.2873553500 0.0069335758 [78,] 0.5914905726 -0.2873553500 [79,] -0.2467021834 0.5914905726 [80,] -0.0404612298 -0.2467021834 [81,] -0.2473086587 -0.0404612298 [82,] -0.0434546000 -0.2473086587 [83,] 0.7062965974 -0.0434546000 [84,] -0.0490800286 0.7062965974 [85,] -0.0459513468 -0.0490800286 [86,] 0.0675158825 -0.0459513468 [87,] -0.0320567951 0.0675158825 [88,] 0.0211211385 -0.0320567951 [89,] 0.0610325184 0.0211211385 [90,] -0.0259123551 0.0610325184 [91,] 0.1693005167 -0.0259123551 [92,] -0.0269124167 0.1693005167 [93,] 0.0136377128 -0.0269124167 [94,] 0.1628171526 0.0136377128 [95,] 0.0520524075 0.1628171526 [96,] 0.1618170910 0.0520524075 [97,] 0.0076509722 0.1618170910 [98,] 0.0081475957 0.0076509722 [99,] 0.0460656669 0.0081475957 [100,] 0.0465622904 0.0460656669 [101,] 0.0016642316 0.0465622904 [102,] 0.0001675465 0.0016642316 [103,] -0.0013291387 0.0001675465 [104,] -0.1009018162 -0.0013291387 [105,] -0.0043225089 -0.1009018162 [106,] -0.0058191941 -0.0043225089 [107,] -0.1033985630 -0.0058191941 [108,] -0.0088125644 -0.1033985630 [109,] -0.0083159409 -0.0088125644 [110,] -0.1519287418 -0.0083159409 [111,] 0.1373735052 -0.1519287418 [112,] -0.2635514224 0.1373735052 [113,] -0.1123786739 -0.2635514224 [114,] -0.0157993666 -0.1123786739 [115,] -0.0192893604 -0.0157993666 [116,] 0.0226153281 -0.0192893604 [117,] -0.0202894221 0.0226153281 [118,] -0.0237794158 -0.0202894221 [119,] 0.0161319640 -0.0237794158 [120,] -0.0247794775 0.0161319640 [121,] -0.0282694713 -0.0247794775 [122,] -0.1258488402 -0.0282694713 [123,] -0.2826470173 -0.1258488402 [124,] 0.0086485383 -0.2826470173 [125,] 0.1164199131 0.0086485383 [126,] -0.0797930203 0.1164199131 [127,] 0.0041584829 -0.0797930203 [128,] -0.0387462673 0.0041584829 [129,] 0.0011651126 -0.0387462673 [130,] -0.0397463290 0.0011651126 [131,] 0.0001650509 -0.0397463290 [132,] -0.2914918167 0.0001650509 [133,] -0.0462296930 -0.2914918167 [134,] -0.0477263782 -0.0462296930 [135,] -0.0492230633 -0.0477263782 [136,] -0.3001106155 -0.0492230633 [137,] -0.1509311757 -0.3001106155 [138,] 0.0969630062 -0.1509311757 [139,] -0.0552098039 0.0969630062 [140,] 0.7359494586 -0.0552098039 [141,] -0.1148711016 0.7359494586 [142,] -0.0577065507 -0.1148711016 [143,] -0.0638286028 -0.0577065507 [144,] -0.1067333529 -0.0638286028 [145,] 0.1278942752 -0.1067333529 [146,] -0.1637625923 0.1278942752 [147,] 0.0834928399 -0.1637625923 [148,] -0.0666866616 0.0834928399 [149,] -0.0728087136 -0.0666866616 [150,] -0.0302652755 -0.0728087136 [151,] 0.6800711656 -0.0302652755 [152,] 0.6345343571 0.6800711656 [153,] -0.3229222047 0.6345343571 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 0.0777768967 -0.0410225600 2 0.0762802116 0.0777768967 3 0.0747835265 0.0762802116 4 0.0732868413 0.0747835265 5 0.0711514065 0.0732868413 6 0.0702934710 0.0711514065 7 -0.0949007296 0.0702934710 8 0.1087081657 -0.0949007296 9 0.0677967242 0.1087081657 10 -0.0973974765 0.0677967242 11 0.0628100453 -0.0973974765 12 -0.2314788806 0.0628100453 13 -0.1018875319 -0.2314788806 14 -0.1930641858 -0.1018875319 15 -0.3582583865 -0.1930641858 16 0.6008301720 -0.3582583865 17 -0.1078742725 0.6008301720 18 0.0937413143 -0.1078742725 19 0.6357548729 0.0937413143 20 0.0072930643 0.6357548729 21 -0.2015476732 0.0072930643 22 0.0437144504 -0.2015476732 23 0.0442110739 0.0437144504 24 -0.3276884295 0.0442110739 25 -0.2509357874 -0.3276884295 26 0.0837611417 -0.2509357874 27 -0.2098890344 0.0837611417 28 0.0787744628 -0.2098890344 29 -0.0081704106 0.0787744628 30 0.0343730275 -0.0081704106 31 0.0348696510 0.0343730275 32 -0.0106671574 0.0348696510 33 -0.0924064784 -0.0106671574 34 0.0283862869 -0.0924064784 35 0.0268896018 0.0283862869 36 -0.4291035309 0.0268896018 37 -0.1834478209 -0.4291035309 38 0.0197674881 -0.1834478209 39 -0.1868347776 0.0197674881 40 0.7680220004 -0.1868347776 41 -0.1894345615 0.7680220004 42 0.0157740561 -0.1894345615 43 -0.1467880863 0.0157740561 44 -0.0306206878 -0.1467880863 45 0.0092906921 -0.0306206878 46 0.0104260652 0.0092906921 47 0.0503374451 0.0104260652 48 0.0048006366 0.0503374451 49 0.0059360098 0.0048006366 50 -0.4080103083 0.0059360098 51 0.5484461919 -0.4080103083 52 0.0428540193 0.5484461919 53 0.7511971518 0.0428540193 54 -0.0015474160 0.7511971518 55 -0.3740856690 -0.0015474160 56 -0.2559249620 -0.3740856690 57 0.0353705936 -0.2559249620 58 0.0338739085 0.0353705936 59 0.5778807757 0.0338739085 60 -0.1308236687 0.5778807757 61 -0.3048164527 -0.1308236687 62 -0.0135208971 -0.3048164527 63 -0.1353137242 -0.0135208971 64 -0.0165142674 -0.1353137242 65 -0.0180109526 -0.0165142674 66 0.5240026061 -0.0180109526 67 -0.0190110142 0.5240026061 68 0.0189070570 -0.0190110142 69 -0.2727498106 0.0189070570 70 -0.0254943783 -0.2727498106 71 0.0144170016 -0.0254943783 72 -0.2358318010 0.0144170016 73 -0.2767432425 -0.2358318010 74 0.0099269461 -0.2767432425 75 -0.1993073778 0.0099269461 76 0.0069335758 -0.1993073778 77 -0.2873553500 0.0069335758 78 0.5914905726 -0.2873553500 79 -0.2467021834 0.5914905726 80 -0.0404612298 -0.2467021834 81 -0.2473086587 -0.0404612298 82 -0.0434546000 -0.2473086587 83 0.7062965974 -0.0434546000 84 -0.0490800286 0.7062965974 85 -0.0459513468 -0.0490800286 86 0.0675158825 -0.0459513468 87 -0.0320567951 0.0675158825 88 0.0211211385 -0.0320567951 89 0.0610325184 0.0211211385 90 -0.0259123551 0.0610325184 91 0.1693005167 -0.0259123551 92 -0.0269124167 0.1693005167 93 0.0136377128 -0.0269124167 94 0.1628171526 0.0136377128 95 0.0520524075 0.1628171526 96 0.1618170910 0.0520524075 97 0.0076509722 0.1618170910 98 0.0081475957 0.0076509722 99 0.0460656669 0.0081475957 100 0.0465622904 0.0460656669 101 0.0016642316 0.0465622904 102 0.0001675465 0.0016642316 103 -0.0013291387 0.0001675465 104 -0.1009018162 -0.0013291387 105 -0.0043225089 -0.1009018162 106 -0.0058191941 -0.0043225089 107 -0.1033985630 -0.0058191941 108 -0.0088125644 -0.1033985630 109 -0.0083159409 -0.0088125644 110 -0.1519287418 -0.0083159409 111 0.1373735052 -0.1519287418 112 -0.2635514224 0.1373735052 113 -0.1123786739 -0.2635514224 114 -0.0157993666 -0.1123786739 115 -0.0192893604 -0.0157993666 116 0.0226153281 -0.0192893604 117 -0.0202894221 0.0226153281 118 -0.0237794158 -0.0202894221 119 0.0161319640 -0.0237794158 120 -0.0247794775 0.0161319640 121 -0.0282694713 -0.0247794775 122 -0.1258488402 -0.0282694713 123 -0.2826470173 -0.1258488402 124 0.0086485383 -0.2826470173 125 0.1164199131 0.0086485383 126 -0.0797930203 0.1164199131 127 0.0041584829 -0.0797930203 128 -0.0387462673 0.0041584829 129 0.0011651126 -0.0387462673 130 -0.0397463290 0.0011651126 131 0.0001650509 -0.0397463290 132 -0.2914918167 0.0001650509 133 -0.0462296930 -0.2914918167 134 -0.0477263782 -0.0462296930 135 -0.0492230633 -0.0477263782 136 -0.3001106155 -0.0492230633 137 -0.1509311757 -0.3001106155 138 0.0969630062 -0.1509311757 139 -0.0552098039 0.0969630062 140 0.7359494586 -0.0552098039 141 -0.1148711016 0.7359494586 142 -0.0577065507 -0.1148711016 143 -0.0638286028 -0.0577065507 144 -0.1067333529 -0.0638286028 145 0.1278942752 -0.1067333529 146 -0.1637625923 0.1278942752 147 0.0834928399 -0.1637625923 148 -0.0666866616 0.0834928399 149 -0.0728087136 -0.0666866616 150 -0.0302652755 -0.0728087136 151 0.6800711656 -0.0302652755 152 0.6345343571 0.6800711656 153 -0.3229222047 0.6345343571 > 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/7aqab1355317762.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/863nz1355317762.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/9uh6e1355317762.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/10kpiv1355317762.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/11bxp61355317762.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/12t5rg1355317762.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/13sfxh1355317762.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/14sv5l1355317762.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/1505py1355317762.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/16a3wb1355317762.tab") + } > > try(system("convert tmp/1anzw1355317761.ps tmp/1anzw1355317761.png",intern=TRUE)) character(0) > try(system("convert tmp/252hc1355317761.ps tmp/252hc1355317761.png",intern=TRUE)) character(0) > try(system("convert tmp/3grlt1355317762.ps tmp/3grlt1355317762.png",intern=TRUE)) character(0) > try(system("convert tmp/47fzr1355317762.ps tmp/47fzr1355317762.png",intern=TRUE)) character(0) > try(system("convert tmp/5kqy01355317762.ps tmp/5kqy01355317762.png",intern=TRUE)) character(0) > try(system("convert tmp/6z1kr1355317762.ps tmp/6z1kr1355317762.png",intern=TRUE)) character(0) > try(system("convert tmp/7aqab1355317762.ps tmp/7aqab1355317762.png",intern=TRUE)) character(0) > try(system("convert tmp/863nz1355317762.ps tmp/863nz1355317762.png",intern=TRUE)) character(0) > try(system("convert tmp/9uh6e1355317762.ps tmp/9uh6e1355317762.png",intern=TRUE)) character(0) > try(system("convert tmp/10kpiv1355317762.ps tmp/10kpiv1355317762.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 8.216 1.011 9.235