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(13 + ,13 + ,14 + ,13 + ,3 + ,1 + ,1 + ,0 + ,12 + ,12 + ,8 + ,13 + ,5 + ,1 + ,0 + ,0 + ,15 + ,10 + ,12 + ,16 + ,6 + ,0 + ,0 + ,0 + ,12 + ,9 + ,7 + ,12 + ,6 + ,2 + ,0 + ,1 + ,10 + ,10 + ,10 + ,11 + ,5 + ,0 + ,1 + ,2 + ,12 + ,12 + ,7 + ,12 + ,3 + ,0 + ,0 + ,1 + ,15 + ,13 + ,16 + ,18 + ,8 + ,1 + ,1 + ,1 + ,9 + ,12 + ,11 + ,11 + ,4 + ,1 + ,0 + ,0 + ,12 + ,12 + ,14 + ,14 + ,4 + ,4 + ,0 + ,0 + ,11 + ,6 + ,6 + ,9 + ,4 + ,0 + ,0 + ,0 + ,11 + ,5 + ,16 + ,14 + ,6 + ,0 + ,2 + ,1 + ,11 + ,12 + ,11 + ,12 + ,6 + ,2 + ,0 + ,0 + ,15 + ,11 + ,16 + ,11 + ,5 + ,0 + ,2 + ,2 + ,7 + ,14 + ,12 + ,12 + ,4 + ,1 + ,1 + ,1 + ,11 + ,14 + ,7 + ,13 + ,6 + ,0 + ,1 + ,0 + ,11 + ,12 + ,13 + ,11 + ,4 + ,0 + ,0 + ,1 + ,10 + ,12 + ,11 + ,12 + ,6 + ,1 + ,1 + ,0 + ,14 + ,11 + ,15 + ,16 + ,6 + ,2 + ,0 + ,1 + ,10 + ,11 + ,7 + ,9 + ,4 + ,1 + ,0 + ,0 + ,6 + ,7 + ,9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 + ,15 + ,6 + ,2 + ,2 + ,0 + ,15 + ,11 + ,16 + ,14 + ,6 + ,2 + ,0 + ,1 + ,16 + ,12 + ,12 + ,15 + ,8 + ,0 + ,0 + ,0 + ,13 + ,11 + ,12 + ,13 + ,7 + ,1 + ,1 + ,1 + ,16 + ,12 + ,15 + ,16 + ,7 + ,2 + ,1 + ,0 + ,9 + ,11 + ,9 + ,12 + ,4 + ,0 + ,0 + ,0 + ,14 + ,10 + ,12 + ,15 + ,6 + ,1 + ,0 + ,1 + ,14 + ,11 + ,14 + ,12 + ,6 + ,2 + ,1 + ,2 + ,12 + ,11 + ,11 + ,14 + ,2 + ,1 + ,1 + ,0) + ,dim=c(8 + ,156) + ,dimnames=list(c('Popularity' + ,'FindingFriends' + ,'KnowingPeople' + ,'Liked' + ,'Celebrity' + ,'bestfriend' + ,'secondbestfriend' + ,'thirdbestfriend') + ,1:156)) > y <- array(NA,dim=c(8,156),dimnames=list(c('Popularity','FindingFriends','KnowingPeople','Liked','Celebrity','bestfriend','secondbestfriend','thirdbestfriend'),1:156)) > 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' > 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 Popularity FindingFriends KnowingPeople Liked Celebrity bestfriend 1 13 13 14 13 3 1 2 12 12 8 13 5 1 3 15 10 12 16 6 0 4 12 9 7 12 6 2 5 10 10 10 11 5 0 6 12 12 7 12 3 0 7 15 13 16 18 8 1 8 9 12 11 11 4 1 9 12 12 14 14 4 4 10 11 6 6 9 4 0 11 11 5 16 14 6 0 12 11 12 11 12 6 2 13 15 11 16 11 5 0 14 7 14 12 12 4 1 15 11 14 7 13 6 0 16 11 12 13 11 4 0 17 10 12 11 12 6 1 18 14 11 15 16 6 2 19 10 11 7 9 4 1 20 6 7 9 11 4 1 21 11 9 7 13 2 0 22 15 11 14 15 7 1 23 11 11 15 10 5 1 24 12 12 7 11 4 2 25 14 12 15 13 6 1 26 15 11 17 16 6 1 27 9 11 15 15 7 1 28 13 8 14 14 5 2 29 13 9 14 14 6 0 30 16 12 8 14 4 1 31 13 10 8 8 4 0 32 12 10 14 13 7 1 33 14 12 14 15 7 1 34 11 8 8 13 4 0 35 9 12 11 11 4 1 36 16 11 16 15 6 2 37 12 12 10 15 6 1 38 10 7 8 9 5 1 39 13 11 14 13 6 1 40 16 11 16 16 7 1 41 14 12 13 13 6 0 42 15 9 5 11 3 1 43 5 15 8 12 3 1 44 8 11 10 12 4 1 45 11 11 8 12 6 0 46 16 11 13 14 7 2 47 17 11 15 14 5 1 48 9 15 6 8 4 0 49 9 11 12 13 5 0 50 13 12 16 16 6 1 51 10 12 5 13 6 1 52 6 9 15 11 6 0 53 12 12 12 14 5 0 54 8 12 8 13 4 0 55 14 13 13 13 5 0 56 12 11 14 13 5 1 57 11 9 12 12 4 0 58 16 9 16 16 6 0 59 8 11 10 15 2 1 60 15 11 15 15 8 0 61 7 12 8 12 3 0 62 16 12 16 14 6 2 63 14 9 19 12 6 0 64 16 11 14 15 6 0 65 9 9 6 12 5 1 66 14 12 13 13 5 2 67 11 12 15 12 6 3 68 13 12 7 12 5 1 69 15 12 13 13 6 1 70 5 14 4 5 2 2 71 15 11 14 13 5 1 72 13 12 13 13 5 1 73 11 11 11 14 5 2 74 11 6 14 17 6 1 75 12 10 12 13 6 0 76 12 12 15 13 6 1 77 12 13 14 12 5 1 78 12 8 13 13 5 0 79 14 12 8 14 4 2 80 6 12 6 11 2 1 81 7 12 7 12 4 0 82 14 6 13 12 6 3 83 14 11 13 16 6 1 84 10 10 11 12 5 1 85 13 12 5 12 3 3 86 12 13 12 12 6 2 87 9 11 8 10 4 1 88 12 7 11 15 5 0 89 16 11 14 15 8 1 90 10 11 9 12 4 2 91 14 11 10 16 6 1 92 10 11 13 15 6 1 93 16 12 16 16 7 0 94 15 10 16 13 6 2 95 12 11 11 12 5 1 96 10 12 8 11 4 0 97 8 7 4 13 6 0 98 8 13 7 10 3 1 99 11 8 14 15 5 1 100 13 12 11 13 6 1 101 16 11 17 16 7 1 102 16 12 15 15 7 1 103 14 14 17 18 6 0 104 11 10 5 13 3 0 105 4 10 4 10 2 1 106 14 13 10 16 8 2 107 9 10 11 13 3 1 108 14 11 15 15 8 1 109 8 10 10 14 3 0 110 8 7 9 15 4 0 111 11 10 12 14 5 1 112 12 8 15 13 7 1 113 11 12 7 13 6 0 114 14 12 13 15 6 0 115 15 12 12 16 7 2 116 16 11 14 14 6 2 117 16 12 14 14 6 0 118 11 12 8 16 6 1 119 14 12 15 14 6 0 120 14 11 12 12 4 2 121 12 12 12 13 4 1 122 14 11 16 12 5 0 123 8 11 9 12 4 1 124 13 13 15 14 6 1 125 16 12 15 14 6 2 126 12 12 6 14 5 0 127 16 12 14 16 8 2 128 12 12 15 13 6 0 129 11 8 10 14 5 1 130 4 8 6 4 4 0 131 16 12 14 16 8 3 132 15 11 12 13 6 1 133 10 12 8 16 4 0 134 13 13 11 15 6 0 135 15 12 13 14 6 0 136 12 12 9 13 4 0 137 14 11 15 14 6 0 138 7 12 13 12 3 1 139 19 12 15 15 6 1 140 12 10 14 14 5 2 141 12 11 16 13 4 1 142 13 12 14 14 6 0 143 15 12 14 16 4 0 144 8 10 10 6 4 2 145 12 12 10 13 4 1 146 10 13 4 13 6 0 147 8 12 8 14 5 1 148 10 15 15 15 6 2 149 15 11 16 14 6 2 150 16 12 12 15 8 0 151 13 11 12 13 7 1 152 16 12 15 16 7 2 153 9 11 9 12 4 0 154 14 10 12 15 6 1 155 14 11 14 12 6 2 156 12 11 11 14 2 1 secondbestfriend thirdbestfriend t 1 1 0 1 2 0 0 2 3 0 0 3 4 0 1 4 5 1 2 5 6 0 1 6 7 1 1 7 8 0 0 8 9 0 0 9 10 0 0 10 11 2 1 11 12 0 0 12 13 2 2 13 14 1 1 14 15 1 0 15 16 0 1 16 17 1 0 17 18 0 1 18 19 0 0 19 20 0 0 20 21 1 1 21 22 2 0 22 23 2 1 23 24 0 0 24 25 0 0 25 26 1 0 26 27 1 0 27 28 2 0 28 29 0 2 29 30 1 1 30 31 1 2 31 32 1 1 32 33 2 1 33 34 2 0 34 35 1 0 35 36 2 0 36 37 1 1 37 38 1 2 38 39 0 1 39 40 3 1 40 41 1 2 41 42 0 0 42 43 0 0 43 44 0 0 44 45 1 1 45 46 0 1 46 47 4 4 47 48 0 0 48 49 0 0 49 50 0 1 50 51 1 0 51 52 2 1 52 53 1 0 53 54 1 1 54 55 0 0 55 56 2 2 56 57 0 2 57 58 3 1 58 59 2 0 59 60 0 0 60 61 0 0 61 62 2 0 62 63 1 0 63 64 0 1 64 65 2 1 65 66 0 0 66 67 1 0 67 68 0 0 68 69 2 1 69 70 0 0 70 71 2 2 71 72 3 0 72 73 0 2 73 74 2 1 74 75 3 1 75 76 1 1 76 77 0 2 77 78 1 2 78 79 0 0 79 80 0 0 80 81 1 0 81 82 1 1 82 83 2 1 83 84 1 0 84 85 0 0 85 86 0 0 86 87 1 0 87 88 0 2 88 89 0 1 89 90 0 1 90 91 1 0 91 92 1 1 92 93 3 1 93 94 1 0 94 95 1 1 95 96 0 0 96 97 0 1 97 98 1 0 98 99 1 0 99 100 0 2 100 101 1 2 101 102 1 2 102 103 0 1 103 104 1 1 104 105 0 1 105 106 1 0 106 107 1 1 107 108 1 1 108 109 1 0 109 110 1 0 110 111 0 0 111 112 0 0 112 113 0 0 113 114 1 0 114 115 1 0 115 116 1 0 116 117 0 0 117 118 1 0 118 119 4 1 119 120 0 0 120 121 1 1 121 122 0 3 122 123 2 2 123 124 1 2 124 125 0 2 125 126 0 0 126 127 0 1 127 128 0 0 128 129 1 0 129 130 0 0 130 131 2 1 131 132 0 2 132 133 1 0 133 134 2 4 134 135 2 0 135 136 1 0 136 137 3 0 137 138 0 0 138 139 1 0 139 140 1 1 140 141 0 0 141 142 1 1 142 143 0 0 143 144 1 2 144 145 0 1 145 146 1 0 146 147 0 0 147 148 2 0 148 149 0 1 149 150 0 0 150 151 1 1 151 152 1 0 152 153 0 0 153 154 0 1 154 155 1 2 155 156 1 0 156 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) FindingFriends KnowingPeople Liked -0.169377 0.102589 0.211592 0.385987 Celebrity bestfriend secondbestfriend thirdbestfriend 0.592858 0.310772 -0.031552 0.410808 t -0.001014 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -6.0258 -1.2472 -0.0386 1.3696 6.8955 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) -0.169377 1.437657 -0.118 0.906375 FindingFriends 0.102589 0.097394 1.053 0.293912 KnowingPeople 0.211592 0.063836 3.315 0.001156 ** Liked 0.385987 0.098544 3.917 0.000137 *** Celebrity 0.592858 0.156043 3.799 0.000212 *** bestfriend 0.310772 0.210102 1.479 0.141241 secondbestfriend -0.031552 0.201592 -0.157 0.875845 thirdbestfriend 0.410808 0.213829 1.921 0.056642 . t -0.001014 0.003800 -0.267 0.789984 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 2.096 on 147 degrees of freedom Multiple R-squared: 0.517, Adjusted R-squared: 0.4908 F-statistic: 19.67 on 8 and 147 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.2559410 0.51188208 0.744058961 [2,] 0.7292894 0.54142126 0.270710629 [3,] 0.8391115 0.32177692 0.160888458 [4,] 0.8159234 0.36815327 0.184076635 [5,] 0.7322363 0.53552736 0.267763681 [6,] 0.6421454 0.71570915 0.357854577 [7,] 0.5820957 0.83580859 0.417904297 [8,] 0.5248761 0.95024771 0.475123853 [9,] 0.6323418 0.73531639 0.367658196 [10,] 0.6279704 0.74405924 0.372029618 [11,] 0.6884120 0.62317600 0.311588002 [12,] 0.6235818 0.75283637 0.376418186 [13,] 0.6530681 0.69386390 0.346931950 [14,] 0.6306220 0.73875595 0.369377973 [15,] 0.5710765 0.85784698 0.428923488 [16,] 0.7690074 0.46198521 0.230992607 [17,] 0.7317017 0.53659669 0.268298344 [18,] 0.6747998 0.65040046 0.325200232 [19,] 0.7874671 0.42506579 0.212532893 [20,] 0.8345826 0.33083476 0.165417380 [21,] 0.8019781 0.39604379 0.198021895 [22,] 0.7567824 0.48643518 0.243217590 [23,] 0.7221575 0.55568503 0.277842517 [24,] 0.7040282 0.59194362 0.295971809 [25,] 0.7261190 0.54776204 0.273881022 [26,] 0.7100151 0.57996974 0.289984872 [27,] 0.6642486 0.67150281 0.335751403 [28,] 0.6131344 0.77373124 0.386865621 [29,] 0.5685097 0.86298052 0.431490258 [30,] 0.5175084 0.96498316 0.482491582 [31,] 0.8040062 0.39198757 0.195993785 [32,] 0.9626591 0.07468175 0.037340873 [33,] 0.9653352 0.06932958 0.034664788 [34,] 0.9547856 0.09042880 0.045214401 [35,] 0.9593826 0.08123481 0.040617406 [36,] 0.9609061 0.07818779 0.039093897 [37,] 0.9528571 0.09428582 0.047142908 [38,] 0.9521576 0.09568488 0.047842442 [39,] 0.9455551 0.10888988 0.054444941 [40,] 0.9367443 0.12651141 0.063255703 [41,] 0.9881605 0.02367898 0.011839489 [42,] 0.9844433 0.03111336 0.015556679 [43,] 0.9882169 0.02356618 0.011783092 [44,] 0.9921206 0.01575871 0.007879357 [45,] 0.9895777 0.02084454 0.010422272 [46,] 0.9858210 0.02835806 0.014179028 [47,] 0.9858710 0.02825809 0.014129047 [48,] 0.9886678 0.02266430 0.011332152 [49,] 0.9875718 0.02485647 0.012428237 [50,] 0.9873345 0.02533104 0.012665518 [51,] 0.9897385 0.02052297 0.010261483 [52,] 0.9889609 0.02207818 0.011039088 [53,] 0.9903618 0.01927646 0.009638231 [54,] 0.9886021 0.02279588 0.011397942 [55,] 0.9874775 0.02504495 0.012522476 [56,] 0.9885440 0.02291207 0.011456036 [57,] 0.9906279 0.01874426 0.009372128 [58,] 0.9907689 0.01846225 0.009231125 [59,] 0.9877830 0.02443398 0.012216989 [60,] 0.9886470 0.02270609 0.011353044 [61,] 0.9861893 0.02762131 0.013810655 [62,] 0.9858306 0.02833879 0.014169393 [63,] 0.9896797 0.02064059 0.010320295 [64,] 0.9861522 0.02769551 0.013847755 [65,] 0.9833077 0.03338457 0.016692286 [66,] 0.9781803 0.04363939 0.021819695 [67,] 0.9715199 0.05696023 0.028480115 [68,] 0.9795196 0.04096070 0.020480351 [69,] 0.9780895 0.04382098 0.021910492 [70,] 0.9786997 0.04260053 0.021300267 [71,] 0.9768692 0.04626167 0.023130837 [72,] 0.9694181 0.06116371 0.030581853 [73,] 0.9613423 0.07731536 0.038657680 [74,] 0.9848009 0.03039828 0.015199138 [75,] 0.9796444 0.04071117 0.020355583 [76,] 0.9733356 0.05332887 0.026664433 [77,] 0.9655839 0.06883219 0.034416093 [78,] 0.9579387 0.08412264 0.042061318 [79,] 0.9471118 0.10577647 0.052888235 [80,] 0.9401073 0.11978537 0.059892686 [81,] 0.9620340 0.07593192 0.037965959 [82,] 0.9536639 0.09267222 0.046336110 [83,] 0.9514450 0.09710997 0.048554984 [84,] 0.9413241 0.11735172 0.058675860 [85,] 0.9302814 0.13943725 0.069718624 [86,] 0.9245492 0.15090154 0.075450770 [87,] 0.9084677 0.18306466 0.091532328 [88,] 0.8954608 0.20907848 0.104539241 [89,] 0.8721677 0.25566460 0.127832301 [90,] 0.8439056 0.31218873 0.156094366 [91,] 0.8192026 0.36159487 0.180797436 [92,] 0.8316550 0.33668992 0.168344959 [93,] 0.8828964 0.23420726 0.117103630 [94,] 0.8830688 0.23386230 0.116931152 [95,] 0.8548018 0.29039643 0.145198215 [96,] 0.8270985 0.34580297 0.172901485 [97,] 0.8154003 0.36919936 0.184599680 [98,] 0.8003430 0.39931393 0.199656966 [99,] 0.8204454 0.35910917 0.179554585 [100,] 0.8071834 0.38563316 0.192816581 [101,] 0.8657168 0.26856639 0.134283195 [102,] 0.8331083 0.33378334 0.166891671 [103,] 0.8041186 0.39176288 0.195881442 [104,] 0.7637904 0.47241927 0.236209637 [105,] 0.7690478 0.46190439 0.230952195 [106,] 0.7785118 0.44297639 0.221488197 [107,] 0.7626740 0.47465206 0.237326032 [108,] 0.7159169 0.56816629 0.284083145 [109,] 0.8041242 0.39175155 0.195875776 [110,] 0.7768136 0.44637285 0.223186424 [111,] 0.7281007 0.54379853 0.271899266 [112,] 0.7176802 0.56463964 0.282319822 [113,] 0.6788157 0.64236852 0.321184262 [114,] 0.6609098 0.67818032 0.339090161 [115,] 0.6623548 0.67529034 0.337645172 [116,] 0.5992345 0.80153106 0.400765531 [117,] 0.5606050 0.87879005 0.439395023 [118,] 0.5409545 0.91809098 0.459045488 [119,] 0.5260752 0.94784957 0.473924784 [120,] 0.4546111 0.90922224 0.545388878 [121,] 0.4341566 0.86831314 0.565843432 [122,] 0.3887323 0.77746463 0.611267683 [123,] 0.3438531 0.68770621 0.656146894 [124,] 0.2971714 0.59434284 0.702828579 [125,] 0.2791937 0.55838737 0.720806314 [126,] 0.2421386 0.48427717 0.757861413 [127,] 0.2636575 0.52731510 0.736342451 [128,] 0.7119260 0.57614808 0.288074038 [129,] 0.6362846 0.72743074 0.363715369 [130,] 0.5259463 0.94810738 0.474053691 [131,] 0.5377001 0.92459982 0.462299909 [132,] 0.4206675 0.84133498 0.579332512 [133,] 0.2742596 0.54851923 0.725740383 > postscript(file="/var/wessaorg/rcomp/tmp/14qpx1321815556.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/25tu41321815556.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/3gyju1321815556.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/47oac1321815556.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/5sl1d1321815556.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 = 156 Frequency = 1 1 2 3 4 5 6 1.798817640 0.954701850 1.874479813 0.547638010 -0.967579078 2.642017026 7 8 9 10 11 12 -1.923318605 -1.309155951 -1.033194475 3.449112193 -2.026558622 -1.187576187 13 14 15 16 17 18 2.699945550 -4.485086456 -0.276238722 0.175736317 -1.840182932 -0.880026910 19 20 21 22 23 24 1.422927737 -3.360858801 2.203416904 0.913432661 -0.592299687 2.242661575 25 26 27 28 29 30 0.904023701 0.458033393 -5.324640617 0.488216529 -0.469392888 4.810706963 31 32 33 34 35 36 4.232787302 -1.644223544 -0.588811383 1.364239128 -1.250227585 1.786531425 37 38 39 40 41 42 -1.177082534 0.258035278 -0.178408298 0.743256736 0.864137052 6.895494166 43 44 45 46 47 48 -4.739789741 -2.344459982 -0.174464508 1.750663265 2.718764196 0.950326051 49 50 51 52 53 54 -2.430647060 -1.850989194 -0.922146498 -6.025790082 0.116383632 -2.468198778 55 56 57 58 59 60 2.158666508 -0.916017846 -0.060127548 1.870316932 -2.238392829 0.395182001 61 62 63 64 65 66 -2.102998617 2.096292335 1.132266678 2.385737889 -1.212185686 1.650865464 67 68 69 70 71 72 -2.257395123 2.619201902 2.024115685 -0.779459582 2.099191511 1.062375724 73 74 75 76 77 78 -2.023868293 -3.110819536 -0.210706929 -1.423521217 -0.777019087 -0.095130878 79 80 81 82 83 84 2.928875648 -1.992476567 -2.432434799 1.385724961 -0.017061626 -0.974210783 85 86 87 88 89 90 3.623795137 -0.426724217 -0.074150538 -0.362745120 0.914598096 -0.807806615 91 92 93 94 95 96 1.005081380 -3.653500193 1.005179091 1.688353416 0.523545173 0.725618837 97 98 99 100 101 102 -2.282554179 -0.463725717 -1.546559438 0.004820131 0.119605278 0.827200339 103 104 105 106 107 108 -1.675222381 2.015310718 -3.363586838 -0.681376619 -1.561968591 -1.246176734 109 110 111 112 113 114 -2.012756281 -2.471228563 -0.961951690 -1.190263149 -0.003243814 0.987797746 115 116 117 118 119 120 0.600013622 2.645266891 3.133683897 -1.646948017 0.639518113 2.998645736 121 122 123 124 125 126 0.442598247 0.950568229 -2.811279292 -1.274236191 1.487043615 1.428400213 127 128 129 130 131 132 0.153779862 -0.680766771 -0.283787225 -1.704454874 -0.089833207 1.928264537 133 134 135 136 137 138 -1.135249940 -1.283010847 2.426629712 1.814162421 1.139615389 -3.393653560 139 140 141 142 143 144 5.279191650 -1.045758688 0.098357280 -0.220223906 2.573788872 -0.925387827 145 146 147 148 149 150 0.858564772 -0.406046405 -3.284261711 -4.298671108 0.813184618 2.018623441 151 152 153 154 155 156 -0.202968887 1.002755417 -0.711575172 0.691994480 0.635169394 2.002805290 > postscript(file="/var/wessaorg/rcomp/tmp/6xm241321815556.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 = 156 Frequency = 1 lag(myerror, k = 1) myerror 0 1.798817640 NA 1 0.954701850 1.798817640 2 1.874479813 0.954701850 3 0.547638010 1.874479813 4 -0.967579078 0.547638010 5 2.642017026 -0.967579078 6 -1.923318605 2.642017026 7 -1.309155951 -1.923318605 8 -1.033194475 -1.309155951 9 3.449112193 -1.033194475 10 -2.026558622 3.449112193 11 -1.187576187 -2.026558622 12 2.699945550 -1.187576187 13 -4.485086456 2.699945550 14 -0.276238722 -4.485086456 15 0.175736317 -0.276238722 16 -1.840182932 0.175736317 17 -0.880026910 -1.840182932 18 1.422927737 -0.880026910 19 -3.360858801 1.422927737 20 2.203416904 -3.360858801 21 0.913432661 2.203416904 22 -0.592299687 0.913432661 23 2.242661575 -0.592299687 24 0.904023701 2.242661575 25 0.458033393 0.904023701 26 -5.324640617 0.458033393 27 0.488216529 -5.324640617 28 -0.469392888 0.488216529 29 4.810706963 -0.469392888 30 4.232787302 4.810706963 31 -1.644223544 4.232787302 32 -0.588811383 -1.644223544 33 1.364239128 -0.588811383 34 -1.250227585 1.364239128 35 1.786531425 -1.250227585 36 -1.177082534 1.786531425 37 0.258035278 -1.177082534 38 -0.178408298 0.258035278 39 0.743256736 -0.178408298 40 0.864137052 0.743256736 41 6.895494166 0.864137052 42 -4.739789741 6.895494166 43 -2.344459982 -4.739789741 44 -0.174464508 -2.344459982 45 1.750663265 -0.174464508 46 2.718764196 1.750663265 47 0.950326051 2.718764196 48 -2.430647060 0.950326051 49 -1.850989194 -2.430647060 50 -0.922146498 -1.850989194 51 -6.025790082 -0.922146498 52 0.116383632 -6.025790082 53 -2.468198778 0.116383632 54 2.158666508 -2.468198778 55 -0.916017846 2.158666508 56 -0.060127548 -0.916017846 57 1.870316932 -0.060127548 58 -2.238392829 1.870316932 59 0.395182001 -2.238392829 60 -2.102998617 0.395182001 61 2.096292335 -2.102998617 62 1.132266678 2.096292335 63 2.385737889 1.132266678 64 -1.212185686 2.385737889 65 1.650865464 -1.212185686 66 -2.257395123 1.650865464 67 2.619201902 -2.257395123 68 2.024115685 2.619201902 69 -0.779459582 2.024115685 70 2.099191511 -0.779459582 71 1.062375724 2.099191511 72 -2.023868293 1.062375724 73 -3.110819536 -2.023868293 74 -0.210706929 -3.110819536 75 -1.423521217 -0.210706929 76 -0.777019087 -1.423521217 77 -0.095130878 -0.777019087 78 2.928875648 -0.095130878 79 -1.992476567 2.928875648 80 -2.432434799 -1.992476567 81 1.385724961 -2.432434799 82 -0.017061626 1.385724961 83 -0.974210783 -0.017061626 84 3.623795137 -0.974210783 85 -0.426724217 3.623795137 86 -0.074150538 -0.426724217 87 -0.362745120 -0.074150538 88 0.914598096 -0.362745120 89 -0.807806615 0.914598096 90 1.005081380 -0.807806615 91 -3.653500193 1.005081380 92 1.005179091 -3.653500193 93 1.688353416 1.005179091 94 0.523545173 1.688353416 95 0.725618837 0.523545173 96 -2.282554179 0.725618837 97 -0.463725717 -2.282554179 98 -1.546559438 -0.463725717 99 0.004820131 -1.546559438 100 0.119605278 0.004820131 101 0.827200339 0.119605278 102 -1.675222381 0.827200339 103 2.015310718 -1.675222381 104 -3.363586838 2.015310718 105 -0.681376619 -3.363586838 106 -1.561968591 -0.681376619 107 -1.246176734 -1.561968591 108 -2.012756281 -1.246176734 109 -2.471228563 -2.012756281 110 -0.961951690 -2.471228563 111 -1.190263149 -0.961951690 112 -0.003243814 -1.190263149 113 0.987797746 -0.003243814 114 0.600013622 0.987797746 115 2.645266891 0.600013622 116 3.133683897 2.645266891 117 -1.646948017 3.133683897 118 0.639518113 -1.646948017 119 2.998645736 0.639518113 120 0.442598247 2.998645736 121 0.950568229 0.442598247 122 -2.811279292 0.950568229 123 -1.274236191 -2.811279292 124 1.487043615 -1.274236191 125 1.428400213 1.487043615 126 0.153779862 1.428400213 127 -0.680766771 0.153779862 128 -0.283787225 -0.680766771 129 -1.704454874 -0.283787225 130 -0.089833207 -1.704454874 131 1.928264537 -0.089833207 132 -1.135249940 1.928264537 133 -1.283010847 -1.135249940 134 2.426629712 -1.283010847 135 1.814162421 2.426629712 136 1.139615389 1.814162421 137 -3.393653560 1.139615389 138 5.279191650 -3.393653560 139 -1.045758688 5.279191650 140 0.098357280 -1.045758688 141 -0.220223906 0.098357280 142 2.573788872 -0.220223906 143 -0.925387827 2.573788872 144 0.858564772 -0.925387827 145 -0.406046405 0.858564772 146 -3.284261711 -0.406046405 147 -4.298671108 -3.284261711 148 0.813184618 -4.298671108 149 2.018623441 0.813184618 150 -0.202968887 2.018623441 151 1.002755417 -0.202968887 152 -0.711575172 1.002755417 153 0.691994480 -0.711575172 154 0.635169394 0.691994480 155 2.002805290 0.635169394 156 NA 2.002805290 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] 0.954701850 1.798817640 [2,] 1.874479813 0.954701850 [3,] 0.547638010 1.874479813 [4,] -0.967579078 0.547638010 [5,] 2.642017026 -0.967579078 [6,] -1.923318605 2.642017026 [7,] -1.309155951 -1.923318605 [8,] -1.033194475 -1.309155951 [9,] 3.449112193 -1.033194475 [10,] -2.026558622 3.449112193 [11,] -1.187576187 -2.026558622 [12,] 2.699945550 -1.187576187 [13,] -4.485086456 2.699945550 [14,] -0.276238722 -4.485086456 [15,] 0.175736317 -0.276238722 [16,] -1.840182932 0.175736317 [17,] -0.880026910 -1.840182932 [18,] 1.422927737 -0.880026910 [19,] -3.360858801 1.422927737 [20,] 2.203416904 -3.360858801 [21,] 0.913432661 2.203416904 [22,] -0.592299687 0.913432661 [23,] 2.242661575 -0.592299687 [24,] 0.904023701 2.242661575 [25,] 0.458033393 0.904023701 [26,] -5.324640617 0.458033393 [27,] 0.488216529 -5.324640617 [28,] -0.469392888 0.488216529 [29,] 4.810706963 -0.469392888 [30,] 4.232787302 4.810706963 [31,] -1.644223544 4.232787302 [32,] -0.588811383 -1.644223544 [33,] 1.364239128 -0.588811383 [34,] -1.250227585 1.364239128 [35,] 1.786531425 -1.250227585 [36,] -1.177082534 1.786531425 [37,] 0.258035278 -1.177082534 [38,] -0.178408298 0.258035278 [39,] 0.743256736 -0.178408298 [40,] 0.864137052 0.743256736 [41,] 6.895494166 0.864137052 [42,] -4.739789741 6.895494166 [43,] -2.344459982 -4.739789741 [44,] -0.174464508 -2.344459982 [45,] 1.750663265 -0.174464508 [46,] 2.718764196 1.750663265 [47,] 0.950326051 2.718764196 [48,] -2.430647060 0.950326051 [49,] -1.850989194 -2.430647060 [50,] -0.922146498 -1.850989194 [51,] -6.025790082 -0.922146498 [52,] 0.116383632 -6.025790082 [53,] -2.468198778 0.116383632 [54,] 2.158666508 -2.468198778 [55,] -0.916017846 2.158666508 [56,] -0.060127548 -0.916017846 [57,] 1.870316932 -0.060127548 [58,] -2.238392829 1.870316932 [59,] 0.395182001 -2.238392829 [60,] -2.102998617 0.395182001 [61,] 2.096292335 -2.102998617 [62,] 1.132266678 2.096292335 [63,] 2.385737889 1.132266678 [64,] -1.212185686 2.385737889 [65,] 1.650865464 -1.212185686 [66,] -2.257395123 1.650865464 [67,] 2.619201902 -2.257395123 [68,] 2.024115685 2.619201902 [69,] -0.779459582 2.024115685 [70,] 2.099191511 -0.779459582 [71,] 1.062375724 2.099191511 [72,] -2.023868293 1.062375724 [73,] -3.110819536 -2.023868293 [74,] -0.210706929 -3.110819536 [75,] -1.423521217 -0.210706929 [76,] -0.777019087 -1.423521217 [77,] -0.095130878 -0.777019087 [78,] 2.928875648 -0.095130878 [79,] -1.992476567 2.928875648 [80,] -2.432434799 -1.992476567 [81,] 1.385724961 -2.432434799 [82,] -0.017061626 1.385724961 [83,] -0.974210783 -0.017061626 [84,] 3.623795137 -0.974210783 [85,] -0.426724217 3.623795137 [86,] -0.074150538 -0.426724217 [87,] -0.362745120 -0.074150538 [88,] 0.914598096 -0.362745120 [89,] -0.807806615 0.914598096 [90,] 1.005081380 -0.807806615 [91,] -3.653500193 1.005081380 [92,] 1.005179091 -3.653500193 [93,] 1.688353416 1.005179091 [94,] 0.523545173 1.688353416 [95,] 0.725618837 0.523545173 [96,] -2.282554179 0.725618837 [97,] -0.463725717 -2.282554179 [98,] -1.546559438 -0.463725717 [99,] 0.004820131 -1.546559438 [100,] 0.119605278 0.004820131 [101,] 0.827200339 0.119605278 [102,] -1.675222381 0.827200339 [103,] 2.015310718 -1.675222381 [104,] -3.363586838 2.015310718 [105,] -0.681376619 -3.363586838 [106,] -1.561968591 -0.681376619 [107,] -1.246176734 -1.561968591 [108,] -2.012756281 -1.246176734 [109,] -2.471228563 -2.012756281 [110,] -0.961951690 -2.471228563 [111,] -1.190263149 -0.961951690 [112,] -0.003243814 -1.190263149 [113,] 0.987797746 -0.003243814 [114,] 0.600013622 0.987797746 [115,] 2.645266891 0.600013622 [116,] 3.133683897 2.645266891 [117,] -1.646948017 3.133683897 [118,] 0.639518113 -1.646948017 [119,] 2.998645736 0.639518113 [120,] 0.442598247 2.998645736 [121,] 0.950568229 0.442598247 [122,] -2.811279292 0.950568229 [123,] -1.274236191 -2.811279292 [124,] 1.487043615 -1.274236191 [125,] 1.428400213 1.487043615 [126,] 0.153779862 1.428400213 [127,] -0.680766771 0.153779862 [128,] -0.283787225 -0.680766771 [129,] -1.704454874 -0.283787225 [130,] -0.089833207 -1.704454874 [131,] 1.928264537 -0.089833207 [132,] -1.135249940 1.928264537 [133,] -1.283010847 -1.135249940 [134,] 2.426629712 -1.283010847 [135,] 1.814162421 2.426629712 [136,] 1.139615389 1.814162421 [137,] -3.393653560 1.139615389 [138,] 5.279191650 -3.393653560 [139,] -1.045758688 5.279191650 [140,] 0.098357280 -1.045758688 [141,] -0.220223906 0.098357280 [142,] 2.573788872 -0.220223906 [143,] -0.925387827 2.573788872 [144,] 0.858564772 -0.925387827 [145,] -0.406046405 0.858564772 [146,] -3.284261711 -0.406046405 [147,] -4.298671108 -3.284261711 [148,] 0.813184618 -4.298671108 [149,] 2.018623441 0.813184618 [150,] -0.202968887 2.018623441 [151,] 1.002755417 -0.202968887 [152,] -0.711575172 1.002755417 [153,] 0.691994480 -0.711575172 [154,] 0.635169394 0.691994480 [155,] 2.002805290 0.635169394 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 0.954701850 1.798817640 2 1.874479813 0.954701850 3 0.547638010 1.874479813 4 -0.967579078 0.547638010 5 2.642017026 -0.967579078 6 -1.923318605 2.642017026 7 -1.309155951 -1.923318605 8 -1.033194475 -1.309155951 9 3.449112193 -1.033194475 10 -2.026558622 3.449112193 11 -1.187576187 -2.026558622 12 2.699945550 -1.187576187 13 -4.485086456 2.699945550 14 -0.276238722 -4.485086456 15 0.175736317 -0.276238722 16 -1.840182932 0.175736317 17 -0.880026910 -1.840182932 18 1.422927737 -0.880026910 19 -3.360858801 1.422927737 20 2.203416904 -3.360858801 21 0.913432661 2.203416904 22 -0.592299687 0.913432661 23 2.242661575 -0.592299687 24 0.904023701 2.242661575 25 0.458033393 0.904023701 26 -5.324640617 0.458033393 27 0.488216529 -5.324640617 28 -0.469392888 0.488216529 29 4.810706963 -0.469392888 30 4.232787302 4.810706963 31 -1.644223544 4.232787302 32 -0.588811383 -1.644223544 33 1.364239128 -0.588811383 34 -1.250227585 1.364239128 35 1.786531425 -1.250227585 36 -1.177082534 1.786531425 37 0.258035278 -1.177082534 38 -0.178408298 0.258035278 39 0.743256736 -0.178408298 40 0.864137052 0.743256736 41 6.895494166 0.864137052 42 -4.739789741 6.895494166 43 -2.344459982 -4.739789741 44 -0.174464508 -2.344459982 45 1.750663265 -0.174464508 46 2.718764196 1.750663265 47 0.950326051 2.718764196 48 -2.430647060 0.950326051 49 -1.850989194 -2.430647060 50 -0.922146498 -1.850989194 51 -6.025790082 -0.922146498 52 0.116383632 -6.025790082 53 -2.468198778 0.116383632 54 2.158666508 -2.468198778 55 -0.916017846 2.158666508 56 -0.060127548 -0.916017846 57 1.870316932 -0.060127548 58 -2.238392829 1.870316932 59 0.395182001 -2.238392829 60 -2.102998617 0.395182001 61 2.096292335 -2.102998617 62 1.132266678 2.096292335 63 2.385737889 1.132266678 64 -1.212185686 2.385737889 65 1.650865464 -1.212185686 66 -2.257395123 1.650865464 67 2.619201902 -2.257395123 68 2.024115685 2.619201902 69 -0.779459582 2.024115685 70 2.099191511 -0.779459582 71 1.062375724 2.099191511 72 -2.023868293 1.062375724 73 -3.110819536 -2.023868293 74 -0.210706929 -3.110819536 75 -1.423521217 -0.210706929 76 -0.777019087 -1.423521217 77 -0.095130878 -0.777019087 78 2.928875648 -0.095130878 79 -1.992476567 2.928875648 80 -2.432434799 -1.992476567 81 1.385724961 -2.432434799 82 -0.017061626 1.385724961 83 -0.974210783 -0.017061626 84 3.623795137 -0.974210783 85 -0.426724217 3.623795137 86 -0.074150538 -0.426724217 87 -0.362745120 -0.074150538 88 0.914598096 -0.362745120 89 -0.807806615 0.914598096 90 1.005081380 -0.807806615 91 -3.653500193 1.005081380 92 1.005179091 -3.653500193 93 1.688353416 1.005179091 94 0.523545173 1.688353416 95 0.725618837 0.523545173 96 -2.282554179 0.725618837 97 -0.463725717 -2.282554179 98 -1.546559438 -0.463725717 99 0.004820131 -1.546559438 100 0.119605278 0.004820131 101 0.827200339 0.119605278 102 -1.675222381 0.827200339 103 2.015310718 -1.675222381 104 -3.363586838 2.015310718 105 -0.681376619 -3.363586838 106 -1.561968591 -0.681376619 107 -1.246176734 -1.561968591 108 -2.012756281 -1.246176734 109 -2.471228563 -2.012756281 110 -0.961951690 -2.471228563 111 -1.190263149 -0.961951690 112 -0.003243814 -1.190263149 113 0.987797746 -0.003243814 114 0.600013622 0.987797746 115 2.645266891 0.600013622 116 3.133683897 2.645266891 117 -1.646948017 3.133683897 118 0.639518113 -1.646948017 119 2.998645736 0.639518113 120 0.442598247 2.998645736 121 0.950568229 0.442598247 122 -2.811279292 0.950568229 123 -1.274236191 -2.811279292 124 1.487043615 -1.274236191 125 1.428400213 1.487043615 126 0.153779862 1.428400213 127 -0.680766771 0.153779862 128 -0.283787225 -0.680766771 129 -1.704454874 -0.283787225 130 -0.089833207 -1.704454874 131 1.928264537 -0.089833207 132 -1.135249940 1.928264537 133 -1.283010847 -1.135249940 134 2.426629712 -1.283010847 135 1.814162421 2.426629712 136 1.139615389 1.814162421 137 -3.393653560 1.139615389 138 5.279191650 -3.393653560 139 -1.045758688 5.279191650 140 0.098357280 -1.045758688 141 -0.220223906 0.098357280 142 2.573788872 -0.220223906 143 -0.925387827 2.573788872 144 0.858564772 -0.925387827 145 -0.406046405 0.858564772 146 -3.284261711 -0.406046405 147 -4.298671108 -3.284261711 148 0.813184618 -4.298671108 149 2.018623441 0.813184618 150 -0.202968887 2.018623441 151 1.002755417 -0.202968887 152 -0.711575172 1.002755417 153 0.691994480 -0.711575172 154 0.635169394 0.691994480 155 2.002805290 0.635169394 > 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/7kvi41321815556.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/8srsw1321815556.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/9hhum1321815556.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/10bprs1321815556.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/11obmv1321815556.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/120x8s1321815556.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/13ja5g1321815556.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/14x8kh1321815556.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/1533mw1321815556.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/16uetc1321815556.tab") + } > > try(system("convert tmp/14qpx1321815556.ps tmp/14qpx1321815556.png",intern=TRUE)) character(0) > try(system("convert tmp/25tu41321815556.ps tmp/25tu41321815556.png",intern=TRUE)) character(0) > try(system("convert tmp/3gyju1321815556.ps tmp/3gyju1321815556.png",intern=TRUE)) character(0) > try(system("convert tmp/47oac1321815556.ps tmp/47oac1321815556.png",intern=TRUE)) character(0) > try(system("convert tmp/5sl1d1321815556.ps tmp/5sl1d1321815556.png",intern=TRUE)) character(0) > try(system("convert tmp/6xm241321815556.ps tmp/6xm241321815556.png",intern=TRUE)) character(0) > try(system("convert tmp/7kvi41321815556.ps tmp/7kvi41321815556.png",intern=TRUE)) character(0) > try(system("convert tmp/8srsw1321815556.ps tmp/8srsw1321815556.png",intern=TRUE)) character(0) > try(system("convert tmp/9hhum1321815556.ps tmp/9hhum1321815556.png",intern=TRUE)) character(0) > try(system("convert tmp/10bprs1321815556.ps tmp/10bprs1321815556.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 5.010 0.602 5.697