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(210907 + ,56 + ,79 + ,94 + ,0 + ,2 + ,179321 + ,89 + ,108 + ,103 + ,0 + ,4 + ,149061 + ,44 + ,43 + ,93 + ,0 + ,0 + ,237213 + ,84 + ,78 + ,123 + ,0 + ,0 + ,173326 + ,88 + ,86 + ,148 + ,0 + ,-4 + ,133131 + ,55 + ,44 + ,90 + ,0 + ,4 + ,258873 + ,60 + ,104 + ,124 + ,0 + ,4 + ,324799 + ,154 + ,158 + ,168 + ,0 + ,0 + ,230964 + ,53 + ,102 + ,115 + ,0 + ,-1 + ,236785 + ,119 + ,77 + ,71 + ,0 + ,0 + ,344297 + ,75 + ,80 + ,108 + ,0 + ,1 + ,174724 + ,92 + ,123 + ,120 + ,0 + ,0 + ,174415 + ,100 + ,73 + ,114 + ,0 + ,3 + ,223632 + ,73 + ,105 + ,120 + ,0 + ,-1 + ,294424 + ,77 + ,107 + ,124 + ,0 + ,4 + ,325107 + ,99 + ,84 + ,126 + ,0 + ,3 + ,106408 + ,30 + ,33 + ,37 + ,0 + ,1 + ,96560 + ,76 + ,42 + ,38 + ,1 + ,0 + ,265769 + ,146 + ,96 + ,120 + ,0 + ,-2 + ,269651 + ,67 + ,106 + ,93 + ,0 + ,-3 + ,149112 + ,56 + ,56 + ,95 + ,0 + ,-4 + ,152871 + ,58 + ,59 + ,90 + ,0 + ,2 + ,362301 + ,119 + ,76 + ,110 + ,0 + ,2 + ,183167 + ,66 + ,91 + ,138 + ,0 + ,-4 + ,277965 + ,89 + ,115 + ,133 + ,0 + ,3 + ,218946 + ,41 + ,76 + ,96 + ,0 + ,2 + ,244052 + ,68 + ,101 + ,164 + ,0 + ,2 + ,341570 + ,168 + ,94 + ,78 + ,1 + ,0 + ,233328 + ,132 + ,92 + ,102 + ,0 + ,5 + ,206161 + ,71 + ,75 + ,99 + ,0 + ,-2 + ,311473 + ,112 + ,128 + ,129 + ,0 + ,0 + ,207176 + ,70 + ,56 + ,114 + ,0 + ,-2 + ,196553 + ,57 + ,41 + ,99 + ,0 + ,-3 + ,143246 + ,103 + ,67 + ,104 + ,0 + ,2 + ,182192 + ,52 + ,77 + ,138 + ,0 + ,2 + ,194979 + ,62 + ,66 + ,151 + ,0 + ,2 + ,167488 + ,45 + ,69 + ,72 + ,0 + ,0 + ,143756 + ,46 + ,105 + ,120 + ,0 + ,4 + ,275541 + ,63 + ,116 + ,115 + ,0 + ,4 + ,152299 + ,53 + ,62 + ,98 + ,0 + ,2 + ,193339 + ,78 + ,100 + ,71 + ,0 + ,2 + ,130585 + ,46 + ,67 + ,107 + ,0 + ,-4 + ,112611 + ,41 + ,46 + ,73 + ,1 + ,3 + ,148446 + ,91 + ,135 + ,129 + ,0 + ,3 + ,182079 + ,63 + ,124 + ,118 + ,0 + ,2 + ,243060 + ,63 + ,58 + ,104 + ,0 + ,-1 + ,162765 + ,32 + ,68 + ,107 + ,0 + ,-3 + ,85574 + ,34 + ,37 + ,36 + ,1 + ,0 + ,225060 + ,93 + ,93 + ,139 + ,0 + ,1 + ,133328 + ,55 + ,56 + ,56 + ,1 + ,-3 + ,100750 + ,72 + ,83 + ,93 + ,0 + ,3 + ,101523 + ,42 + ,59 + ,87 + ,1 + ,0 + ,243511 + ,71 + ,133 + ,110 + ,0 + ,0 + ,152474 + ,65 + ,106 + ,83 + ,0 + ,0 + ,132487 + ,41 + ,71 + ,98 + ,0 + ,3 + ,317394 + ,86 + ,116 + ,82 + ,0 + ,-3 + ,244749 + ,95 + ,98 + ,115 + ,0 + ,0 + ,184510 + ,49 + ,64 + ,140 + ,0 + ,-4 + ,128423 + ,64 + ,32 + ,120 + ,0 + ,2 + ,97839 + ,38 + ,25 + ,66 + ,0 + ,-1 + ,172494 + ,52 + ,46 + ,139 + ,0 + ,3 + ,229242 + ,247 + ,63 + ,119 + ,0 + ,2 + ,351619 + ,139 + ,95 + ,141 + ,0 + ,5 + ,324598 + ,110 + ,113 + ,133 + ,0 + ,2 + ,195838 + ,67 + ,111 + ,98 + ,0 + ,-2 + ,254488 + ,83 + ,120 + ,117 + ,0 + ,0 + ,199476 + ,70 + ,87 + ,105 + ,0 + ,3 + ,92499 + ,32 + ,25 + ,55 + ,1 + ,-2 + ,224330 + ,83 + ,131 + ,132 + ,0 + ,0 + ,181633 + ,70 + ,47 + ,73 + ,0 + ,6 + ,271856 + ,103 + ,109 + ,86 + ,0 + ,-3 + ,95227 + ,34 + ,37 + ,48 + ,0 + ,3 + ,98146 + ,40 + ,15 + ,48 + ,1 + ,0 + ,118612 + ,46 + ,54 + ,43 + ,1 + ,-2 + ,65475 + ,18 + ,16 + ,46 + ,1 + ,1 + ,108446 + ,60 + ,22 + ,65 + ,1 + ,0 + ,121848 + ,39 + ,37 + ,52 + ,1 + ,2 + ,76302 + ,31 + ,29 + ,68 + ,1 + ,2 + ,98104 + ,54 + ,55 + ,47 + ,1 + ,-3 + ,30989 + ,14 + ,5 + ,41 + ,1 + ,-2 + ,31774 + ,23 + ,0 + ,47 + ,1 + ,1 + ,150580 + ,77 + ,27 + ,71 + ,1 + ,-4 + ,54157 + ,19 + ,37 + ,30 + ,1 + ,0 + ,59382 + ,49 + ,29 + ,24 + ,1 + ,1 + ,84105 + ,20 + ,17 + ,63 + ,1 + ,0) + ,dim=c(6 + ,85) + ,dimnames=list(c('time' + ,'logins' + ,'BC' + ,'LFM' + ,'Course' + ,'Totaal') + ,1:85)) > y <- array(NA,dim=c(6,85),dimnames=list(c('time','logins','BC','LFM','Course','Totaal'),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 = '6' > 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 Totaal time logins BC LFM Course 1 2 210907 56 79 94 0 2 4 179321 89 108 103 0 3 0 149061 44 43 93 0 4 0 237213 84 78 123 0 5 -4 173326 88 86 148 0 6 4 133131 55 44 90 0 7 4 258873 60 104 124 0 8 0 324799 154 158 168 0 9 -1 230964 53 102 115 0 10 0 236785 119 77 71 0 11 1 344297 75 80 108 0 12 0 174724 92 123 120 0 13 3 174415 100 73 114 0 14 -1 223632 73 105 120 0 15 4 294424 77 107 124 0 16 3 325107 99 84 126 0 17 1 106408 30 33 37 0 18 0 96560 76 42 38 1 19 -2 265769 146 96 120 0 20 -3 269651 67 106 93 0 21 -4 149112 56 56 95 0 22 2 152871 58 59 90 0 23 2 362301 119 76 110 0 24 -4 183167 66 91 138 0 25 3 277965 89 115 133 0 26 2 218946 41 76 96 0 27 2 244052 68 101 164 0 28 0 341570 168 94 78 1 29 5 233328 132 92 102 0 30 -2 206161 71 75 99 0 31 0 311473 112 128 129 0 32 -2 207176 70 56 114 0 33 -3 196553 57 41 99 0 34 2 143246 103 67 104 0 35 2 182192 52 77 138 0 36 2 194979 62 66 151 0 37 0 167488 45 69 72 0 38 4 143756 46 105 120 0 39 4 275541 63 116 115 0 40 2 152299 53 62 98 0 41 2 193339 78 100 71 0 42 -4 130585 46 67 107 0 43 3 112611 41 46 73 1 44 3 148446 91 135 129 0 45 2 182079 63 124 118 0 46 -1 243060 63 58 104 0 47 -3 162765 32 68 107 0 48 0 85574 34 37 36 1 49 1 225060 93 93 139 0 50 -3 133328 55 56 56 1 51 3 100750 72 83 93 0 52 0 101523 42 59 87 1 53 0 243511 71 133 110 0 54 0 152474 65 106 83 0 55 3 132487 41 71 98 0 56 -3 317394 86 116 82 0 57 0 244749 95 98 115 0 58 -4 184510 49 64 140 0 59 2 128423 64 32 120 0 60 -1 97839 38 25 66 0 61 3 172494 52 46 139 0 62 2 229242 247 63 119 0 63 5 351619 139 95 141 0 64 2 324598 110 113 133 0 65 -2 195838 67 111 98 0 66 0 254488 83 120 117 0 67 3 199476 70 87 105 0 68 -2 92499 32 25 55 1 69 0 224330 83 131 132 0 70 6 181633 70 47 73 0 71 -3 271856 103 109 86 0 72 3 95227 34 37 48 0 73 0 98146 40 15 48 1 74 -2 118612 46 54 43 1 75 1 65475 18 16 46 1 76 0 108446 60 22 65 1 77 2 121848 39 37 52 1 78 2 76302 31 29 68 1 79 -3 98104 54 55 47 1 80 -2 30989 14 5 41 1 81 1 31774 23 0 47 1 82 -4 150580 77 27 71 1 83 0 54157 19 37 30 1 84 1 59382 49 29 24 1 85 0 84105 20 17 63 1 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) time logins BC LFM Course 6.884e-01 -2.077e-06 8.019e-03 -2.244e-03 9.579e-04 -1.123e+00 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -4.9829 -1.6267 0.3306 1.5161 5.1630 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 6.884e-01 1.370e+00 0.503 0.617 time -2.077e-06 5.940e-06 -0.350 0.728 logins 8.019e-03 1.005e-02 0.798 0.427 BC -2.244e-03 1.250e-02 -0.180 0.858 LFM 9.579e-04 1.327e-02 0.072 0.943 Course -1.123e+00 9.505e-01 -1.181 0.241 Residual standard error: 2.483 on 79 degrees of freedom Multiple R-squared: 0.04337, Adjusted R-squared: -0.01717 F-statistic: 0.7164 on 5 and 79 DF, p-value: 0.613 > 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.7468501 0.5062997 0.2531499 [2,] 0.8291350 0.3417301 0.1708650 [3,] 0.7319801 0.5360399 0.2680199 [4,] 0.6641674 0.6716652 0.3358326 [5,] 0.6902497 0.6195006 0.3097503 [6,] 0.6463258 0.7073484 0.3536742 [7,] 0.6769021 0.6461957 0.3230979 [8,] 0.6451582 0.7096835 0.3548418 [9,] 0.5886091 0.8227819 0.4113909 [10,] 0.4964269 0.9928537 0.5035731 [11,] 0.4940920 0.9881840 0.5059080 [12,] 0.6675142 0.6649715 0.3324858 [13,] 0.8087898 0.3824204 0.1912102 [14,] 0.7670271 0.4659457 0.2329729 [15,] 0.7135680 0.5728639 0.2864320 [16,] 0.8079002 0.3841997 0.1920998 [17,] 0.8001034 0.3997932 0.1998966 [18,] 0.7611421 0.4777157 0.2388579 [19,] 0.7301917 0.5396167 0.2698083 [20,] 0.6712079 0.6575842 0.3287921 [21,] 0.7683191 0.4633617 0.2316809 [22,] 0.7741513 0.4516973 0.2258487 [23,] 0.7253939 0.5492122 0.2746061 [24,] 0.7217713 0.5564573 0.2782287 [25,] 0.7620391 0.4759218 0.2379609 [26,] 0.7266606 0.5466787 0.2733394 [27,] 0.7004295 0.5991410 0.2995705 [28,] 0.6683683 0.6632635 0.3316317 [29,] 0.6090553 0.7818894 0.3909447 [30,] 0.6454986 0.7090027 0.3545014 [31,] 0.6924045 0.6151911 0.3075955 [32,] 0.6474580 0.7050840 0.3525420 [33,] 0.5987892 0.8024215 0.4012108 [34,] 0.7544772 0.4910456 0.2455228 [35,] 0.7892540 0.4214921 0.2107460 [36,] 0.7651700 0.4696601 0.2348300 [37,] 0.7321273 0.5357454 0.2678727 [38,] 0.7018394 0.5963212 0.2981606 [39,] 0.7788302 0.4423397 0.2211698 [40,] 0.7317830 0.5364340 0.2682170 [41,] 0.6737843 0.6524313 0.3262157 [42,] 0.6759712 0.6480575 0.3240288 [43,] 0.6596724 0.6806552 0.3403276 [44,] 0.6055911 0.7888177 0.3944089 [45,] 0.5570870 0.8858261 0.4429130 [46,] 0.4964705 0.9929409 0.5035295 [47,] 0.4935145 0.9870290 0.5064855 [48,] 0.5961851 0.8076297 0.4038149 [49,] 0.5304157 0.9391687 0.4695843 [50,] 0.7665359 0.4669282 0.2334641 [51,] 0.7254023 0.5491954 0.2745977 [52,] 0.8303867 0.3392266 0.1696133 [53,] 0.8233909 0.3532181 0.1766091 [54,] 0.7671096 0.4657807 0.2328904 [55,] 0.8214444 0.3571113 0.1785556 [56,] 0.8032480 0.3935039 0.1967520 [57,] 0.8216017 0.3567966 0.1783983 [58,] 0.7577106 0.4845788 0.2422894 [59,] 0.7114151 0.5771699 0.2885849 [60,] 0.6786441 0.6427118 0.3213559 [61,] 0.6063490 0.7873020 0.3936510 [62,] 0.8156140 0.3687720 0.1843860 [63,] 0.7702048 0.4595904 0.2297952 [64,] 0.6784369 0.6431263 0.3215631 [65,] 0.5604797 0.8790406 0.4395203 [66,] 0.4628577 0.9257153 0.5371423 [67,] 0.3279246 0.6558492 0.6720754 [68,] 0.2316542 0.4633084 0.7683458 > postscript(file="/var/wessaorg/rcomp/tmp/1px321324635218.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/2kvg11324635218.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/3kv5n1324635218.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/4aulh1324635218.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/5rcoz1324635218.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.38776528 3.11399432 -0.72427872 -0.81214518 -4.98290667 3.15954739 7 8 9 10 11 12 3.48267041 -1.05514681 -1.51503046 -1.04612175 0.50128615 -0.90223711 13 14 15 16 17 18 1.92653015 -1.68869077 3.42692110 2.26071380 0.33059990 0.08334938 19 20 21 22 23 24 -3.20673391 -3.51689287 -4.79314393 1.21014670 1.17496563 -4.76525823 25 26 27 28 29 30 2.30584146 1.51609519 1.34269125 -0.06713973 3.84641696 -2.75613698 31 32 33 34 35 36 -0.77599391 -2.80301037 -3.74011875 0.83385424 1.31356572 1.22280234 37 38 39 40 41 42 -0.61557166 3.36191653 3.52877912 1.24812034 1.24401710 -4.73824963 43 44 45 46 47 48 3.37278956 2.06950800 1.34974069 -1.65828404 -3.55690812 0.38801448 49 50 51 52 53 54 0.10877573 -2.65772229 2.04060961 0.35750026 -0.55896121 -0.73464605 55 56 57 58 59 60 2.32339039 -3.53711424 -0.83216039 -4.68864870 1.02193862 -1.79707623 61 62 63 64 65 66 2.22290864 -0.16557377 4.00534264 1.22981512 -2.66376863 -0.66826141 67 68 69 70 71 72 2.25917529 -1.62669066 -0.72058470 5.16301818 -3.78754985 2.27374106 73 74 75 76 77 78 0.30515574 -1.60815310 1.41787104 0.16559637 2.40793353 2.34421028 79 80 81 82 83 84 -2.71648441 -1.64157153 1.27092430 -3.87774028 0.44879117 1.20687934 85 0.42648654 > postscript(file="/var/wessaorg/rcomp/tmp/6dj4o1324635218.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.38776528 NA 1 3.11399432 1.38776528 2 -0.72427872 3.11399432 3 -0.81214518 -0.72427872 4 -4.98290667 -0.81214518 5 3.15954739 -4.98290667 6 3.48267041 3.15954739 7 -1.05514681 3.48267041 8 -1.51503046 -1.05514681 9 -1.04612175 -1.51503046 10 0.50128615 -1.04612175 11 -0.90223711 0.50128615 12 1.92653015 -0.90223711 13 -1.68869077 1.92653015 14 3.42692110 -1.68869077 15 2.26071380 3.42692110 16 0.33059990 2.26071380 17 0.08334938 0.33059990 18 -3.20673391 0.08334938 19 -3.51689287 -3.20673391 20 -4.79314393 -3.51689287 21 1.21014670 -4.79314393 22 1.17496563 1.21014670 23 -4.76525823 1.17496563 24 2.30584146 -4.76525823 25 1.51609519 2.30584146 26 1.34269125 1.51609519 27 -0.06713973 1.34269125 28 3.84641696 -0.06713973 29 -2.75613698 3.84641696 30 -0.77599391 -2.75613698 31 -2.80301037 -0.77599391 32 -3.74011875 -2.80301037 33 0.83385424 -3.74011875 34 1.31356572 0.83385424 35 1.22280234 1.31356572 36 -0.61557166 1.22280234 37 3.36191653 -0.61557166 38 3.52877912 3.36191653 39 1.24812034 3.52877912 40 1.24401710 1.24812034 41 -4.73824963 1.24401710 42 3.37278956 -4.73824963 43 2.06950800 3.37278956 44 1.34974069 2.06950800 45 -1.65828404 1.34974069 46 -3.55690812 -1.65828404 47 0.38801448 -3.55690812 48 0.10877573 0.38801448 49 -2.65772229 0.10877573 50 2.04060961 -2.65772229 51 0.35750026 2.04060961 52 -0.55896121 0.35750026 53 -0.73464605 -0.55896121 54 2.32339039 -0.73464605 55 -3.53711424 2.32339039 56 -0.83216039 -3.53711424 57 -4.68864870 -0.83216039 58 1.02193862 -4.68864870 59 -1.79707623 1.02193862 60 2.22290864 -1.79707623 61 -0.16557377 2.22290864 62 4.00534264 -0.16557377 63 1.22981512 4.00534264 64 -2.66376863 1.22981512 65 -0.66826141 -2.66376863 66 2.25917529 -0.66826141 67 -1.62669066 2.25917529 68 -0.72058470 -1.62669066 69 5.16301818 -0.72058470 70 -3.78754985 5.16301818 71 2.27374106 -3.78754985 72 0.30515574 2.27374106 73 -1.60815310 0.30515574 74 1.41787104 -1.60815310 75 0.16559637 1.41787104 76 2.40793353 0.16559637 77 2.34421028 2.40793353 78 -2.71648441 2.34421028 79 -1.64157153 -2.71648441 80 1.27092430 -1.64157153 81 -3.87774028 1.27092430 82 0.44879117 -3.87774028 83 1.20687934 0.44879117 84 0.42648654 1.20687934 85 NA 0.42648654 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] 3.11399432 1.38776528 [2,] -0.72427872 3.11399432 [3,] -0.81214518 -0.72427872 [4,] -4.98290667 -0.81214518 [5,] 3.15954739 -4.98290667 [6,] 3.48267041 3.15954739 [7,] -1.05514681 3.48267041 [8,] -1.51503046 -1.05514681 [9,] -1.04612175 -1.51503046 [10,] 0.50128615 -1.04612175 [11,] -0.90223711 0.50128615 [12,] 1.92653015 -0.90223711 [13,] -1.68869077 1.92653015 [14,] 3.42692110 -1.68869077 [15,] 2.26071380 3.42692110 [16,] 0.33059990 2.26071380 [17,] 0.08334938 0.33059990 [18,] -3.20673391 0.08334938 [19,] -3.51689287 -3.20673391 [20,] -4.79314393 -3.51689287 [21,] 1.21014670 -4.79314393 [22,] 1.17496563 1.21014670 [23,] -4.76525823 1.17496563 [24,] 2.30584146 -4.76525823 [25,] 1.51609519 2.30584146 [26,] 1.34269125 1.51609519 [27,] -0.06713973 1.34269125 [28,] 3.84641696 -0.06713973 [29,] -2.75613698 3.84641696 [30,] -0.77599391 -2.75613698 [31,] -2.80301037 -0.77599391 [32,] -3.74011875 -2.80301037 [33,] 0.83385424 -3.74011875 [34,] 1.31356572 0.83385424 [35,] 1.22280234 1.31356572 [36,] -0.61557166 1.22280234 [37,] 3.36191653 -0.61557166 [38,] 3.52877912 3.36191653 [39,] 1.24812034 3.52877912 [40,] 1.24401710 1.24812034 [41,] -4.73824963 1.24401710 [42,] 3.37278956 -4.73824963 [43,] 2.06950800 3.37278956 [44,] 1.34974069 2.06950800 [45,] -1.65828404 1.34974069 [46,] -3.55690812 -1.65828404 [47,] 0.38801448 -3.55690812 [48,] 0.10877573 0.38801448 [49,] -2.65772229 0.10877573 [50,] 2.04060961 -2.65772229 [51,] 0.35750026 2.04060961 [52,] -0.55896121 0.35750026 [53,] -0.73464605 -0.55896121 [54,] 2.32339039 -0.73464605 [55,] -3.53711424 2.32339039 [56,] -0.83216039 -3.53711424 [57,] -4.68864870 -0.83216039 [58,] 1.02193862 -4.68864870 [59,] -1.79707623 1.02193862 [60,] 2.22290864 -1.79707623 [61,] -0.16557377 2.22290864 [62,] 4.00534264 -0.16557377 [63,] 1.22981512 4.00534264 [64,] -2.66376863 1.22981512 [65,] -0.66826141 -2.66376863 [66,] 2.25917529 -0.66826141 [67,] -1.62669066 2.25917529 [68,] -0.72058470 -1.62669066 [69,] 5.16301818 -0.72058470 [70,] -3.78754985 5.16301818 [71,] 2.27374106 -3.78754985 [72,] 0.30515574 2.27374106 [73,] -1.60815310 0.30515574 [74,] 1.41787104 -1.60815310 [75,] 0.16559637 1.41787104 [76,] 2.40793353 0.16559637 [77,] 2.34421028 2.40793353 [78,] -2.71648441 2.34421028 [79,] -1.64157153 -2.71648441 [80,] 1.27092430 -1.64157153 [81,] -3.87774028 1.27092430 [82,] 0.44879117 -3.87774028 [83,] 1.20687934 0.44879117 [84,] 0.42648654 1.20687934 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 3.11399432 1.38776528 2 -0.72427872 3.11399432 3 -0.81214518 -0.72427872 4 -4.98290667 -0.81214518 5 3.15954739 -4.98290667 6 3.48267041 3.15954739 7 -1.05514681 3.48267041 8 -1.51503046 -1.05514681 9 -1.04612175 -1.51503046 10 0.50128615 -1.04612175 11 -0.90223711 0.50128615 12 1.92653015 -0.90223711 13 -1.68869077 1.92653015 14 3.42692110 -1.68869077 15 2.26071380 3.42692110 16 0.33059990 2.26071380 17 0.08334938 0.33059990 18 -3.20673391 0.08334938 19 -3.51689287 -3.20673391 20 -4.79314393 -3.51689287 21 1.21014670 -4.79314393 22 1.17496563 1.21014670 23 -4.76525823 1.17496563 24 2.30584146 -4.76525823 25 1.51609519 2.30584146 26 1.34269125 1.51609519 27 -0.06713973 1.34269125 28 3.84641696 -0.06713973 29 -2.75613698 3.84641696 30 -0.77599391 -2.75613698 31 -2.80301037 -0.77599391 32 -3.74011875 -2.80301037 33 0.83385424 -3.74011875 34 1.31356572 0.83385424 35 1.22280234 1.31356572 36 -0.61557166 1.22280234 37 3.36191653 -0.61557166 38 3.52877912 3.36191653 39 1.24812034 3.52877912 40 1.24401710 1.24812034 41 -4.73824963 1.24401710 42 3.37278956 -4.73824963 43 2.06950800 3.37278956 44 1.34974069 2.06950800 45 -1.65828404 1.34974069 46 -3.55690812 -1.65828404 47 0.38801448 -3.55690812 48 0.10877573 0.38801448 49 -2.65772229 0.10877573 50 2.04060961 -2.65772229 51 0.35750026 2.04060961 52 -0.55896121 0.35750026 53 -0.73464605 -0.55896121 54 2.32339039 -0.73464605 55 -3.53711424 2.32339039 56 -0.83216039 -3.53711424 57 -4.68864870 -0.83216039 58 1.02193862 -4.68864870 59 -1.79707623 1.02193862 60 2.22290864 -1.79707623 61 -0.16557377 2.22290864 62 4.00534264 -0.16557377 63 1.22981512 4.00534264 64 -2.66376863 1.22981512 65 -0.66826141 -2.66376863 66 2.25917529 -0.66826141 67 -1.62669066 2.25917529 68 -0.72058470 -1.62669066 69 5.16301818 -0.72058470 70 -3.78754985 5.16301818 71 2.27374106 -3.78754985 72 0.30515574 2.27374106 73 -1.60815310 0.30515574 74 1.41787104 -1.60815310 75 0.16559637 1.41787104 76 2.40793353 0.16559637 77 2.34421028 2.40793353 78 -2.71648441 2.34421028 79 -1.64157153 -2.71648441 80 1.27092430 -1.64157153 81 -3.87774028 1.27092430 82 0.44879117 -3.87774028 83 1.20687934 0.44879117 84 0.42648654 1.20687934 > 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/75yjw1324635218.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/8hy761324635218.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/9va8g1324635218.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/106phr1324635218.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/11kneu1324635218.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/12hzb81324635218.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/13c08q1324635218.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/14jceo1324635218.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/15byls1324635219.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/16xszs1324635219.tab") + } > > try(system("convert tmp/1px321324635218.ps tmp/1px321324635218.png",intern=TRUE)) character(0) > try(system("convert tmp/2kvg11324635218.ps tmp/2kvg11324635218.png",intern=TRUE)) character(0) > try(system("convert tmp/3kv5n1324635218.ps tmp/3kv5n1324635218.png",intern=TRUE)) character(0) > try(system("convert tmp/4aulh1324635218.ps tmp/4aulh1324635218.png",intern=TRUE)) character(0) > try(system("convert tmp/5rcoz1324635218.ps tmp/5rcoz1324635218.png",intern=TRUE)) character(0) > try(system("convert tmp/6dj4o1324635218.ps tmp/6dj4o1324635218.png",intern=TRUE)) character(0) > try(system("convert tmp/75yjw1324635218.ps tmp/75yjw1324635218.png",intern=TRUE)) character(0) > try(system("convert tmp/8hy761324635218.ps tmp/8hy761324635218.png",intern=TRUE)) character(0) > try(system("convert tmp/9va8g1324635218.ps tmp/9va8g1324635218.png",intern=TRUE)) character(0) > try(system("convert tmp/106phr1324635218.ps tmp/106phr1324635218.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 3.445 0.556 4.040