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(2 + ,210907 + ,79 + ,30 + ,94 + ,112285 + ,4 + ,179321 + ,108 + ,30 + ,103 + ,101193 + ,0 + ,149061 + ,43 + ,26 + ,93 + ,116174 + ,0 + ,237213 + ,78 + ,38 + ,123 + ,66198 + ,-4 + ,173326 + ,86 + ,44 + ,148 + ,71701 + ,4 + ,133131 + ,44 + ,30 + ,90 + ,57793 + ,4 + ,258873 + ,104 + ,40 + ,124 + ,80444 + ,0 + ,324799 + ,158 + ,47 + ,168 + ,97668 + ,-1 + ,230964 + ,102 + ,30 + ,115 + ,133824 + ,0 + ,236785 + ,77 + ,31 + ,71 + ,101481 + ,1 + ,344297 + ,80 + ,30 + ,108 + ,67654 + ,0 + ,174724 + ,123 + ,34 + ,120 + ,69112 + ,3 + ,174415 + ,73 + ,31 + ,114 + ,82753 + ,-1 + ,223632 + ,105 + ,33 + ,120 + ,72654 + ,4 + ,294424 + ,107 + ,33 + ,124 + ,101494 + ,3 + ,325107 + ,84 + ,36 + ,126 + ,79215 + ,1 + ,106408 + ,33 + ,14 + ,37 + ,31081 + ,0 + ,96560 + ,42 + ,17 + ,38 + ,22996 + ,-2 + ,265769 + ,96 + ,32 + ,120 + ,83122 + ,-3 + ,269651 + ,106 + ,30 + ,93 + ,70106 + ,-4 + ,149112 + ,56 + ,35 + ,95 + ,60578 + ,2 + ,152871 + ,59 + ,28 + ,90 + ,79892 + ,2 + ,362301 + ,76 + ,34 + ,110 + ,100708 + ,-4 + ,183167 + ,91 + ,39 + ,138 + ,82875 + ,3 + ,277965 + ,115 + ,39 + ,133 + ,139077 + ,2 + ,218946 + ,76 + ,29 + ,96 + ,80670 + ,2 + ,244052 + ,101 + ,44 + ,164 + ,143558 + ,0 + ,341570 + ,94 + ,21 + ,78 + ,117105 + ,5 + ,233328 + ,92 + ,28 + ,102 + ,120733 + ,-2 + ,206161 + ,75 + ,28 + ,99 + ,73107 + ,0 + ,311473 + ,128 + ,38 + ,129 + ,132068 + ,-2 + ,207176 + ,56 + ,32 + ,114 + ,87011 + ,-3 + ,196553 + ,41 + ,29 + ,99 + ,95260 + ,2 + ,143246 + ,67 + ,27 + ,104 + ,106671 + ,2 + ,182192 + ,77 + ,40 + ,138 + ,70054 + ,2 + ,194979 + ,66 + ,40 + ,151 + ,74011 + ,0 + ,167488 + ,69 + ,28 + ,72 + ,83737 + ,4 + ,143756 + ,105 + ,34 + ,120 + ,69094 + ,4 + ,275541 + ,116 + ,33 + ,115 + ,93133 + ,2 + ,152299 + ,62 + ,33 + ,98 + ,61370 + ,2 + ,193339 + ,100 + ,35 + ,71 + ,84651 + ,-4 + ,130585 + ,67 + ,29 + ,107 + ,95364 + ,3 + ,112611 + ,46 + ,20 + ,73 + ,26706 + ,3 + ,148446 + ,135 + ,37 + ,129 + ,126846 + ,2 + ,182079 + ,124 + ,33 + ,118 + ,102860 + ,-1 + ,243060 + ,58 + ,29 + ,104 + ,111813 + ,-3 + ,162765 + ,68 + ,28 + ,107 + ,120293 + ,0 + ,85574 + ,37 + ,21 + ,36 + ,24266 + ,1 + ,225060 + ,93 + ,41 + ,139 + ,109825 + ,-3 + ,133328 + ,56 + ,20 + ,56 + ,40909 + ,3 + ,100750 + ,83 + ,30 + ,93 + ,140867 + ,0 + ,101523 + ,59 + ,22 + ,87 + ,61056 + ,0 + ,243511 + ,133 + ,42 + ,110 + ,101338 + ,0 + ,152474 + ,106 + ,32 + ,83 + ,65567 + ,3 + ,132487 + ,71 + ,36 + ,98 + ,40735 + ,-3 + ,317394 + ,116 + ,31 + ,82 + ,91413 + ,0 + ,244749 + ,98 + ,33 + ,115 + ,76643 + ,-4 + ,184510 + ,64 + ,40 + ,140 + ,110681 + ,2 + ,128423 + ,32 + ,38 + ,120 + ,92696 + ,-1 + ,97839 + ,25 + ,24 + ,66 + ,94785 + ,3 + ,172494 + ,46 + ,43 + ,139 + ,86687 + ,2 + ,229242 + ,63 + ,31 + ,119 + ,91721 + ,5 + ,351619 + ,95 + ,40 + ,141 + ,115168 + ,2 + ,324598 + ,113 + ,37 + ,133 + ,135777 + ,-2 + ,195838 + ,111 + ,31 + ,98 + ,102372 + ,0 + ,254488 + ,120 + ,39 + ,117 + ,103772 + ,3 + ,199476 + ,87 + ,32 + ,105 + ,135400 + ,-2 + ,92499 + ,25 + ,18 + ,55 + ,21399 + ,0 + ,224330 + ,131 + ,39 + ,132 + ,130115 + ,6 + ,181633 + ,47 + ,30 + ,73 + ,64466 + ,-3 + ,271856 + ,109 + ,37 + ,86 + ,54990 + ,3 + ,95227 + ,37 + ,32 + ,48 + ,34777 + ,0 + ,98146 + ,15 + ,17 + ,48 + ,27114 + ,-2 + ,118612 + ,54 + ,12 + ,43 + ,30080 + ,1 + ,65475 + ,16 + ,13 + ,46 + ,69008 + ,0 + ,108446 + ,22 + ,17 + ,65 + ,46300 + ,2 + ,121848 + ,37 + ,17 + ,52 + ,30594 + ,2 + ,76302 + ,29 + ,20 + ,68 + ,30976 + ,-3 + ,98104 + ,55 + ,17 + ,47 + ,25568 + ,-2 + ,30989 + ,5 + ,17 + ,41 + ,4154 + ,1 + ,31774 + ,0 + ,17 + ,47 + ,4143 + ,-4 + ,150580 + ,27 + ,22 + ,71 + ,45588 + ,0 + ,54157 + ,37 + ,15 + ,30 + ,18625 + ,1 + ,59382 + ,29 + ,12 + ,24 + ,26263 + ,0 + ,84105 + ,17 + ,17 + ,63 + ,20055) + ,dim=c(6 + ,85) + ,dimnames=list(c('SCORE' + ,'time_in_rfc' + ,'blogged_computations' + ,'compendiums_reviewed' + ,'feedback_messages_p120' + ,'totsize') + ,1:85)) > y <- array(NA,dim=c(6,85),dimnames=list(c('SCORE','time_in_rfc','blogged_computations','compendiums_reviewed','feedback_messages_p120','totsize'),1:85)) > 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' > 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 SCORE time_in_rfc blogged_computations compendiums_reviewed 1 2 210907 79 30 2 4 179321 108 30 3 0 149061 43 26 4 0 237213 78 38 5 -4 173326 86 44 6 4 133131 44 30 7 4 258873 104 40 8 0 324799 158 47 9 -1 230964 102 30 10 0 236785 77 31 11 1 344297 80 30 12 0 174724 123 34 13 3 174415 73 31 14 -1 223632 105 33 15 4 294424 107 33 16 3 325107 84 36 17 1 106408 33 14 18 0 96560 42 17 19 -2 265769 96 32 20 -3 269651 106 30 21 -4 149112 56 35 22 2 152871 59 28 23 2 362301 76 34 24 -4 183167 91 39 25 3 277965 115 39 26 2 218946 76 29 27 2 244052 101 44 28 0 341570 94 21 29 5 233328 92 28 30 -2 206161 75 28 31 0 311473 128 38 32 -2 207176 56 32 33 -3 196553 41 29 34 2 143246 67 27 35 2 182192 77 40 36 2 194979 66 40 37 0 167488 69 28 38 4 143756 105 34 39 4 275541 116 33 40 2 152299 62 33 41 2 193339 100 35 42 -4 130585 67 29 43 3 112611 46 20 44 3 148446 135 37 45 2 182079 124 33 46 -1 243060 58 29 47 -3 162765 68 28 48 0 85574 37 21 49 1 225060 93 41 50 -3 133328 56 20 51 3 100750 83 30 52 0 101523 59 22 53 0 243511 133 42 54 0 152474 106 32 55 3 132487 71 36 56 -3 317394 116 31 57 0 244749 98 33 58 -4 184510 64 40 59 2 128423 32 38 60 -1 97839 25 24 61 3 172494 46 43 62 2 229242 63 31 63 5 351619 95 40 64 2 324598 113 37 65 -2 195838 111 31 66 0 254488 120 39 67 3 199476 87 32 68 -2 92499 25 18 69 0 224330 131 39 70 6 181633 47 30 71 -3 271856 109 37 72 3 95227 37 32 73 0 98146 15 17 74 -2 118612 54 12 75 1 65475 16 13 76 0 108446 22 17 77 2 121848 37 17 78 2 76302 29 20 79 -3 98104 55 17 80 -2 30989 5 17 81 1 31774 0 17 82 -4 150580 27 22 83 0 54157 37 15 84 1 59382 29 12 85 0 84105 17 17 feedback_messages_p120 totsize 1 94 112285 2 103 101193 3 93 116174 4 123 66198 5 148 71701 6 90 57793 7 124 80444 8 168 97668 9 115 133824 10 71 101481 11 108 67654 12 120 69112 13 114 82753 14 120 72654 15 124 101494 16 126 79215 17 37 31081 18 38 22996 19 120 83122 20 93 70106 21 95 60578 22 90 79892 23 110 100708 24 138 82875 25 133 139077 26 96 80670 27 164 143558 28 78 117105 29 102 120733 30 99 73107 31 129 132068 32 114 87011 33 99 95260 34 104 106671 35 138 70054 36 151 74011 37 72 83737 38 120 69094 39 115 93133 40 98 61370 41 71 84651 42 107 95364 43 73 26706 44 129 126846 45 118 102860 46 104 111813 47 107 120293 48 36 24266 49 139 109825 50 56 40909 51 93 140867 52 87 61056 53 110 101338 54 83 65567 55 98 40735 56 82 91413 57 115 76643 58 140 110681 59 120 92696 60 66 94785 61 139 86687 62 119 91721 63 141 115168 64 133 135777 65 98 102372 66 117 103772 67 105 135400 68 55 21399 69 132 130115 70 73 64466 71 86 54990 72 48 34777 73 48 27114 74 43 30080 75 46 69008 76 65 46300 77 52 30594 78 68 30976 79 47 25568 80 41 4154 81 47 4143 82 71 45588 83 30 18625 84 24 26263 85 63 20055 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) time_in_rfc blogged_computations -9.092e-01 -1.664e-07 -3.879e-03 compendiums_reviewed feedback_messages_p120 totsize 4.874e-02 -5.932e-03 1.111e-05 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -5.1612 -1.6979 0.2294 1.4998 5.3760 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) -9.092e-01 1.024e+00 -0.887 0.378 time_in_rfc -1.664e-07 5.294e-06 -0.031 0.975 blogged_computations -3.879e-03 1.315e-02 -0.295 0.769 compendiums_reviewed 4.874e-02 7.591e-02 0.642 0.523 feedback_messages_p120 -5.932e-03 2.016e-02 -0.294 0.769 totsize 1.111e-05 1.176e-05 0.945 0.348 Residual standard error: 2.493 on 79 degrees of freedom Multiple R-squared: 0.03555, Adjusted R-squared: -0.02549 F-statistic: 0.5824 on 5 and 79 DF, p-value: 0.7133 > 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.2491655 0.4983311 0.7508345 [2,] 0.4576801 0.9153602 0.5423199 [3,] 0.4807010 0.9614019 0.5192990 [4,] 0.6429567 0.7140866 0.3570433 [5,] 0.6035073 0.7929854 0.3964927 [6,] 0.5990328 0.8019345 0.4009672 [7,] 0.6428209 0.7143582 0.3571791 [8,] 0.5984752 0.8030495 0.4015248 [9,] 0.5820645 0.8358709 0.4179355 [10,] 0.5206013 0.9587974 0.4793987 [11,] 0.5591562 0.8816877 0.4408438 [12,] 0.6581056 0.6837888 0.3418944 [13,] 0.7591580 0.4816840 0.2408420 [14,] 0.7114229 0.5771543 0.2885771 [15,] 0.6479742 0.7040516 0.3520258 [16,] 0.7499549 0.5000901 0.2500451 [17,] 0.7185209 0.5629583 0.2814791 [18,] 0.6688918 0.6622164 0.3311082 [19,] 0.6090960 0.7818079 0.3909040 [20,] 0.6166845 0.7666310 0.3833155 [21,] 0.7088800 0.5822400 0.2911200 [22,] 0.7050612 0.5898777 0.2949388 [23,] 0.6563533 0.6872934 0.3436467 [24,] 0.6622439 0.6755122 0.3377561 [25,] 0.7193809 0.5612383 0.2806191 [26,] 0.6758316 0.6483368 0.3241684 [27,] 0.6550150 0.6899700 0.3449850 [28,] 0.6189839 0.7620322 0.3810161 [29,] 0.5540651 0.8918698 0.4459349 [30,] 0.6008279 0.7983441 0.3991721 [31,] 0.6550382 0.6899237 0.3449618 [32,] 0.6185780 0.7628440 0.3814220 [33,] 0.5698751 0.8602498 0.4301249 [34,] 0.7197869 0.5604262 0.2802131 [35,] 0.7506729 0.4986543 0.2493271 [36,] 0.7312088 0.5375823 0.2687912 [37,] 0.7137916 0.5724168 0.2862084 [38,] 0.6845836 0.6308327 0.3154164 [39,] 0.7526407 0.4947186 0.2473593 [40,] 0.6965276 0.6069447 0.3034724 [41,] 0.6360828 0.7278345 0.3639172 [42,] 0.6569712 0.6860575 0.3430288 [43,] 0.6326178 0.7347645 0.3673822 [44,] 0.5710036 0.8579928 0.4289964 [45,] 0.5125341 0.9749317 0.4874659 [46,] 0.4528201 0.9056401 0.5471799 [47,] 0.4926563 0.9853127 0.5073437 [48,] 0.6009917 0.7980165 0.3990083 [49,] 0.5333817 0.9332366 0.4666183 [50,] 0.7627431 0.4745138 0.2372569 [51,] 0.7258308 0.5483384 0.2741692 [52,] 0.8389730 0.3220541 0.1610270 [53,] 0.8066651 0.3866698 0.1933349 [54,] 0.7523603 0.4952793 0.2476397 [55,] 0.8142743 0.3714515 0.1857257 [56,] 0.7782801 0.4434398 0.2217199 [57,] 0.7565317 0.4869366 0.2434683 [58,] 0.6836271 0.6327459 0.3163729 [59,] 0.6074450 0.7851099 0.3925550 [60,] 0.5433393 0.9133214 0.4566607 [61,] 0.4569334 0.9138667 0.5430666 [62,] 0.7686082 0.4627837 0.2313918 [63,] 0.6967483 0.6065035 0.3032517 [64,] 0.7001696 0.5996609 0.2998304 [65,] 0.6016726 0.7966547 0.3983274 [66,] 0.5840265 0.8319469 0.4159735 [67,] 0.4554425 0.9108850 0.5445575 [68,] 0.3635389 0.7270777 0.6364611 > postscript(file="/var/wessaorg/rcomp/tmp/1hjxy1323691255.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/2pwb71323691255.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/39cx11323691255.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/4frzi1323691255.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/5stbo1323691255.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 = 85 Frequency = 1 1 2 3 4 5 6 1.09806245 3.38197202 -0.90605285 -0.60712235 -4.79203731 3.53127296 7 8 9 10 11 12 3.24744443 -0.80373610 -1.92419528 -0.97049951 0.70323768 -0.29817099 13 14 15 16 17 18 2.46685195 -1.35047911 3.37224742 2.40138541 1.24653452 0.22936725 19 20 21 22 23 24 -2.44598103 -3.32456638 -4.66453213 1.44461364 1.14022896 -4.71080057 25 26 27 28 29 30 1.74375428 1.49975456 0.57418548 -0.53180398 4.20327356 -2.35565186 31 32 33 34 35 36 -1.09732744 -2.68971010 -3.78409981 1.30820933 1.32848457 1.32108446 37 38 39 40 41 42 -0.66368249 3.62705376 3.44355279 1.46575539 1.10356851 -4.64791759 43 44 45 46 47 48 3.26772173 2.00948403 1.36872149 -1.86473306 -3.86701159 -0.01281280 49 50 51 52 53 54 -0.08716184 -2.94875026 1.77164497 -0.07991073 -1.05538669 -0.45042729 55 56 57 58 59 60 2.58048388 -3.62864816 -0.44811633 -5.16123819 0.88403345 -1.80935868 61 62 63 64 65 66 1.88145441 1.36717200 3.94287861 0.87792131 -2.69515287 -0.94328071 67 68 69 70 71 72 1.83805105 -1.76739534 -1.10943022 5.37596240 -3.52729303 2.40697252 73 74 75 76 77 78 0.13845218 -1.52576668 0.85437934 0.05492900 2.21278615 2.11861608 79 80 81 82 83 84 -2.69514289 -1.69785192 1.31860030 -4.11887826 0.30152695 1.29711009 85 0.31131709 > postscript(file="/var/wessaorg/rcomp/tmp/6shha1323691255.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 = 85 Frequency = 1 lag(myerror, k = 1) myerror 0 1.09806245 NA 1 3.38197202 1.09806245 2 -0.90605285 3.38197202 3 -0.60712235 -0.90605285 4 -4.79203731 -0.60712235 5 3.53127296 -4.79203731 6 3.24744443 3.53127296 7 -0.80373610 3.24744443 8 -1.92419528 -0.80373610 9 -0.97049951 -1.92419528 10 0.70323768 -0.97049951 11 -0.29817099 0.70323768 12 2.46685195 -0.29817099 13 -1.35047911 2.46685195 14 3.37224742 -1.35047911 15 2.40138541 3.37224742 16 1.24653452 2.40138541 17 0.22936725 1.24653452 18 -2.44598103 0.22936725 19 -3.32456638 -2.44598103 20 -4.66453213 -3.32456638 21 1.44461364 -4.66453213 22 1.14022896 1.44461364 23 -4.71080057 1.14022896 24 1.74375428 -4.71080057 25 1.49975456 1.74375428 26 0.57418548 1.49975456 27 -0.53180398 0.57418548 28 4.20327356 -0.53180398 29 -2.35565186 4.20327356 30 -1.09732744 -2.35565186 31 -2.68971010 -1.09732744 32 -3.78409981 -2.68971010 33 1.30820933 -3.78409981 34 1.32848457 1.30820933 35 1.32108446 1.32848457 36 -0.66368249 1.32108446 37 3.62705376 -0.66368249 38 3.44355279 3.62705376 39 1.46575539 3.44355279 40 1.10356851 1.46575539 41 -4.64791759 1.10356851 42 3.26772173 -4.64791759 43 2.00948403 3.26772173 44 1.36872149 2.00948403 45 -1.86473306 1.36872149 46 -3.86701159 -1.86473306 47 -0.01281280 -3.86701159 48 -0.08716184 -0.01281280 49 -2.94875026 -0.08716184 50 1.77164497 -2.94875026 51 -0.07991073 1.77164497 52 -1.05538669 -0.07991073 53 -0.45042729 -1.05538669 54 2.58048388 -0.45042729 55 -3.62864816 2.58048388 56 -0.44811633 -3.62864816 57 -5.16123819 -0.44811633 58 0.88403345 -5.16123819 59 -1.80935868 0.88403345 60 1.88145441 -1.80935868 61 1.36717200 1.88145441 62 3.94287861 1.36717200 63 0.87792131 3.94287861 64 -2.69515287 0.87792131 65 -0.94328071 -2.69515287 66 1.83805105 -0.94328071 67 -1.76739534 1.83805105 68 -1.10943022 -1.76739534 69 5.37596240 -1.10943022 70 -3.52729303 5.37596240 71 2.40697252 -3.52729303 72 0.13845218 2.40697252 73 -1.52576668 0.13845218 74 0.85437934 -1.52576668 75 0.05492900 0.85437934 76 2.21278615 0.05492900 77 2.11861608 2.21278615 78 -2.69514289 2.11861608 79 -1.69785192 -2.69514289 80 1.31860030 -1.69785192 81 -4.11887826 1.31860030 82 0.30152695 -4.11887826 83 1.29711009 0.30152695 84 0.31131709 1.29711009 85 NA 0.31131709 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] 3.38197202 1.09806245 [2,] -0.90605285 3.38197202 [3,] -0.60712235 -0.90605285 [4,] -4.79203731 -0.60712235 [5,] 3.53127296 -4.79203731 [6,] 3.24744443 3.53127296 [7,] -0.80373610 3.24744443 [8,] -1.92419528 -0.80373610 [9,] -0.97049951 -1.92419528 [10,] 0.70323768 -0.97049951 [11,] -0.29817099 0.70323768 [12,] 2.46685195 -0.29817099 [13,] -1.35047911 2.46685195 [14,] 3.37224742 -1.35047911 [15,] 2.40138541 3.37224742 [16,] 1.24653452 2.40138541 [17,] 0.22936725 1.24653452 [18,] -2.44598103 0.22936725 [19,] -3.32456638 -2.44598103 [20,] -4.66453213 -3.32456638 [21,] 1.44461364 -4.66453213 [22,] 1.14022896 1.44461364 [23,] -4.71080057 1.14022896 [24,] 1.74375428 -4.71080057 [25,] 1.49975456 1.74375428 [26,] 0.57418548 1.49975456 [27,] -0.53180398 0.57418548 [28,] 4.20327356 -0.53180398 [29,] -2.35565186 4.20327356 [30,] -1.09732744 -2.35565186 [31,] -2.68971010 -1.09732744 [32,] -3.78409981 -2.68971010 [33,] 1.30820933 -3.78409981 [34,] 1.32848457 1.30820933 [35,] 1.32108446 1.32848457 [36,] -0.66368249 1.32108446 [37,] 3.62705376 -0.66368249 [38,] 3.44355279 3.62705376 [39,] 1.46575539 3.44355279 [40,] 1.10356851 1.46575539 [41,] -4.64791759 1.10356851 [42,] 3.26772173 -4.64791759 [43,] 2.00948403 3.26772173 [44,] 1.36872149 2.00948403 [45,] -1.86473306 1.36872149 [46,] -3.86701159 -1.86473306 [47,] -0.01281280 -3.86701159 [48,] -0.08716184 -0.01281280 [49,] -2.94875026 -0.08716184 [50,] 1.77164497 -2.94875026 [51,] -0.07991073 1.77164497 [52,] -1.05538669 -0.07991073 [53,] -0.45042729 -1.05538669 [54,] 2.58048388 -0.45042729 [55,] -3.62864816 2.58048388 [56,] -0.44811633 -3.62864816 [57,] -5.16123819 -0.44811633 [58,] 0.88403345 -5.16123819 [59,] -1.80935868 0.88403345 [60,] 1.88145441 -1.80935868 [61,] 1.36717200 1.88145441 [62,] 3.94287861 1.36717200 [63,] 0.87792131 3.94287861 [64,] -2.69515287 0.87792131 [65,] -0.94328071 -2.69515287 [66,] 1.83805105 -0.94328071 [67,] -1.76739534 1.83805105 [68,] -1.10943022 -1.76739534 [69,] 5.37596240 -1.10943022 [70,] -3.52729303 5.37596240 [71,] 2.40697252 -3.52729303 [72,] 0.13845218 2.40697252 [73,] -1.52576668 0.13845218 [74,] 0.85437934 -1.52576668 [75,] 0.05492900 0.85437934 [76,] 2.21278615 0.05492900 [77,] 2.11861608 2.21278615 [78,] -2.69514289 2.11861608 [79,] -1.69785192 -2.69514289 [80,] 1.31860030 -1.69785192 [81,] -4.11887826 1.31860030 [82,] 0.30152695 -4.11887826 [83,] 1.29711009 0.30152695 [84,] 0.31131709 1.29711009 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 3.38197202 1.09806245 2 -0.90605285 3.38197202 3 -0.60712235 -0.90605285 4 -4.79203731 -0.60712235 5 3.53127296 -4.79203731 6 3.24744443 3.53127296 7 -0.80373610 3.24744443 8 -1.92419528 -0.80373610 9 -0.97049951 -1.92419528 10 0.70323768 -0.97049951 11 -0.29817099 0.70323768 12 2.46685195 -0.29817099 13 -1.35047911 2.46685195 14 3.37224742 -1.35047911 15 2.40138541 3.37224742 16 1.24653452 2.40138541 17 0.22936725 1.24653452 18 -2.44598103 0.22936725 19 -3.32456638 -2.44598103 20 -4.66453213 -3.32456638 21 1.44461364 -4.66453213 22 1.14022896 1.44461364 23 -4.71080057 1.14022896 24 1.74375428 -4.71080057 25 1.49975456 1.74375428 26 0.57418548 1.49975456 27 -0.53180398 0.57418548 28 4.20327356 -0.53180398 29 -2.35565186 4.20327356 30 -1.09732744 -2.35565186 31 -2.68971010 -1.09732744 32 -3.78409981 -2.68971010 33 1.30820933 -3.78409981 34 1.32848457 1.30820933 35 1.32108446 1.32848457 36 -0.66368249 1.32108446 37 3.62705376 -0.66368249 38 3.44355279 3.62705376 39 1.46575539 3.44355279 40 1.10356851 1.46575539 41 -4.64791759 1.10356851 42 3.26772173 -4.64791759 43 2.00948403 3.26772173 44 1.36872149 2.00948403 45 -1.86473306 1.36872149 46 -3.86701159 -1.86473306 47 -0.01281280 -3.86701159 48 -0.08716184 -0.01281280 49 -2.94875026 -0.08716184 50 1.77164497 -2.94875026 51 -0.07991073 1.77164497 52 -1.05538669 -0.07991073 53 -0.45042729 -1.05538669 54 2.58048388 -0.45042729 55 -3.62864816 2.58048388 56 -0.44811633 -3.62864816 57 -5.16123819 -0.44811633 58 0.88403345 -5.16123819 59 -1.80935868 0.88403345 60 1.88145441 -1.80935868 61 1.36717200 1.88145441 62 3.94287861 1.36717200 63 0.87792131 3.94287861 64 -2.69515287 0.87792131 65 -0.94328071 -2.69515287 66 1.83805105 -0.94328071 67 -1.76739534 1.83805105 68 -1.10943022 -1.76739534 69 5.37596240 -1.10943022 70 -3.52729303 5.37596240 71 2.40697252 -3.52729303 72 0.13845218 2.40697252 73 -1.52576668 0.13845218 74 0.85437934 -1.52576668 75 0.05492900 0.85437934 76 2.21278615 0.05492900 77 2.11861608 2.21278615 78 -2.69514289 2.11861608 79 -1.69785192 -2.69514289 80 1.31860030 -1.69785192 81 -4.11887826 1.31860030 82 0.30152695 -4.11887826 83 1.29711009 0.30152695 84 0.31131709 1.29711009 > 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/7812f1323691255.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/89voq1323691255.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/9fmp41323691255.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/10i1cs1323691255.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/11datt1323691255.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/121sbu1323691255.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/13mnjf1323691255.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/1440pd1323691255.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/152rtb1323691255.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/16nh221323691255.tab") + } > > try(system("convert tmp/1hjxy1323691255.ps tmp/1hjxy1323691255.png",intern=TRUE)) character(0) > try(system("convert tmp/2pwb71323691255.ps tmp/2pwb71323691255.png",intern=TRUE)) character(0) > try(system("convert tmp/39cx11323691255.ps tmp/39cx11323691255.png",intern=TRUE)) character(0) > try(system("convert tmp/4frzi1323691255.ps tmp/4frzi1323691255.png",intern=TRUE)) character(0) > try(system("convert tmp/5stbo1323691255.ps tmp/5stbo1323691255.png",intern=TRUE)) character(0) > try(system("convert tmp/6shha1323691255.ps tmp/6shha1323691255.png",intern=TRUE)) character(0) > try(system("convert tmp/7812f1323691255.ps tmp/7812f1323691255.png",intern=TRUE)) character(0) > try(system("convert tmp/89voq1323691255.ps tmp/89voq1323691255.png",intern=TRUE)) character(0) > try(system("convert tmp/9fmp41323691255.ps tmp/9fmp41323691255.png",intern=TRUE)) character(0) > try(system("convert tmp/10i1cs1323691255.ps tmp/10i1cs1323691255.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 3.630 0.469 4.149