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(56 + ,79 + ,30 + ,115 + ,146283 + ,9.5457 + ,89 + ,108 + ,30 + ,116 + ,96933 + ,15.8949 + ,44 + ,43 + ,26 + ,100 + ,95757 + ,0 + ,84 + ,78 + ,38 + ,140 + ,143983 + ,0 + ,88 + ,86 + ,44 + ,166 + ,75851 + ,0 + ,55 + ,44 + ,30 + ,99 + ,59238 + ,12.0989 + ,60 + ,104 + ,40 + ,139 + ,93163 + ,15.8949 + ,154 + ,158 + ,47 + ,181 + ,151511 + ,2.6529 + ,53 + ,102 + ,30 + ,116 + ,136368 + ,1.0579 + ,119 + ,77 + ,31 + ,116 + ,112642 + ,0 + ,75 + ,80 + ,30 + ,108 + ,127766 + ,0 + ,92 + ,123 + ,34 + ,129 + ,85646 + ,0 + ,100 + ,73 + ,31 + ,118 + ,98579 + ,0.8401 + ,73 + ,105 + ,33 + ,125 + ,131741 + ,0 + ,77 + ,107 + ,33 + ,127 + ,171975 + ,4.2325 + ,99 + ,84 + ,36 + ,136 + ,159676 + ,5.5091 + ,30 + ,33 + ,14 + ,46 + ,58391 + ,0 + ,76 + ,42 + ,17 + ,54 + ,31580 + ,2.9596 + ,146 + ,96 + ,32 + ,124 + ,136815 + ,0 + ,67 + ,106 + ,30 + ,115 + ,120642 + ,0 + ,56 + ,56 + ,35 + ,128 + ,69107 + ,0 + ,58 + ,59 + ,28 + ,97 + ,108016 + ,4.2325 + ,119 + ,76 + ,34 + ,125 + ,79336 + ,4.2325 + ,66 + ,91 + ,39 + ,149 + ,93176 + ,6.9999 + ,89 + ,115 + ,39 + ,149 + ,161632 + ,0 + ,41 + ,76 + ,29 + ,108 + ,102996 + ,4.2325 + ,68 + ,101 + ,44 + ,166 + ,160604 + ,12.7203 + ,168 + ,94 + ,21 + ,80 + ,158051 + ,4.2325 + ,132 + ,92 + ,28 + ,107 + ,162647 + ,12.0989 + ,71 + ,75 + ,28 + ,107 + ,60622 + ,0 + ,112 + ,128 + ,38 + ,146 + ,179566 + ,2.1093 + ,70 + ,56 + ,32 + ,123 + ,96144 + ,6.9999 + ,57 + ,41 + ,29 + ,111 + ,129847 + ,0 + ,103 + ,67 + ,27 + ,105 + ,71180 + ,9.5457 + ,52 + ,77 + ,40 + ,155 + ,86767 + ,9.5531 + ,62 + ,66 + ,40 + ,155 + ,93487 + ,15.9023 + ,45 + ,69 + ,28 + ,104 + ,82981 + ,0 + ,46 + ,105 + ,34 + ,132 + ,73815 + ,13.9969 + ,63 + ,116 + ,33 + ,127 + ,94552 + ,15.8949 + ,53 + ,62 + ,33 + ,122 + ,67808 + ,0 + ,78 + ,100 + ,35 + ,87 + ,106175 + ,15.8949 + ,46 + ,67 + ,29 + ,109 + ,76669 + ,0 + ,41 + ,46 + ,20 + ,78 + ,57283 + ,14.622 + ,91 + ,135 + ,37 + ,141 + ,72413 + ,12.7203 + ,63 + ,124 + ,33 + ,124 + ,96971 + ,10.1745 + ,63 + ,58 + ,29 + ,112 + ,120336 + ,0 + ,32 + ,68 + ,28 + ,108 + ,93913 + ,0 + ,34 + ,37 + ,21 + ,78 + ,32036 + ,0 + ,93 + ,93 + ,41 + ,158 + ,102255 + ,4.2325 + ,55 + ,56 + ,20 + ,78 + ,63506 + ,0 + ,72 + ,83 + ,30 + ,119 + ,68370 + ,11.4474 + ,42 + ,59 + ,22 + ,88 + ,50517 + ,4.2325 + ,71 + ,133 + ,42 + ,155 + ,103950 + ,2.9596 + ,65 + ,106 + ,32 + ,123 + ,84396 + ,0 + ,41 + ,71 + ,36 + ,136 + ,55515 + ,1.0579 + ,86 + ,116 + ,31 + ,117 + ,209056 + ,1.6867 + ,95 + ,98 + ,33 + ,124 + ,142775 + ,4.2325 + ,49 + ,64 + ,40 + ,151 + ,68847 + ,0 + ,64 + ,32 + ,38 + ,145 + ,20112 + ,4.2325 + ,38 + ,25 + ,24 + ,87 + ,61023 + ,0 + ,52 + ,46 + ,43 + ,165 + ,112494 + ,5.6162 + ,247 + ,63 + ,31 + ,120 + ,78876 + ,6.7857 + ,139 + ,95 + ,40 + ,150 + ,170745 + ,12.0989 + ,110 + ,113 + ,37 + ,136 + ,122037 + ,15.8949 + ,67 + ,111 + ,31 + ,116 + ,112283 + ,0 + ,83 + ,120 + ,39 + ,150 + ,120691 + ,1.0579 + ,70 + ,87 + ,32 + ,118 + ,122422 + ,3.7145 + ,32 + ,25 + ,18 + ,71 + ,25899 + ,8.2765 + ,83 + ,131 + ,39 + ,144 + ,139296 + ,2.9596 + ,70 + ,47 + ,30 + ,110 + ,89455 + ,15.8949 + ,103 + ,109 + ,37 + ,147 + ,147866 + ,1.6867 + ,34 + ,37 + ,32 + ,111 + ,14336 + ,10.0674 + ,40 + ,15 + ,17 + ,68 + ,30059 + ,2.4416 + ,46 + ,54 + ,12 + ,48 + ,41907 + ,0 + ,18 + ,16 + ,13 + ,51 + ,35885 + ,8.7908 + ,60 + ,22 + ,17 + ,68 + ,55764 + ,0 + ,39 + ,37 + ,17 + ,64 + ,35619 + ,5.5091 + ,31 + ,29 + ,20 + ,76 + ,40557 + ,7.5179 + ,54 + ,55 + ,17 + ,66 + ,44197 + ,0 + ,14 + ,5 + ,17 + ,68 + ,4103 + ,8.2728 + ,23 + ,0 + ,17 + ,66 + ,4694 + ,8.2728 + ,77 + ,27 + ,22 + ,83 + ,62991 + ,1.1687 + ,19 + ,37 + ,15 + ,55 + ,24261 + ,0 + ,49 + ,29 + ,12 + ,41 + ,21425 + ,0 + ,20 + ,17 + ,17 + ,66 + ,27184 + ,4.2325) + ,dim=c(6 + ,85) + ,dimnames=list(c('login' + ,'blog' + ,'review' + ,'fdb' + ,'sec' + ,'examen') + ,1:85)) > y <- array(NA,dim=c(6,85),dimnames=list(c('login','blog','review','fdb','sec','examen'),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' > #'GNU S' R Code compiled by R2WASP v. 1.0.44 () > #Author: Prof. Dr. P. Wessa > #To cite this work: AUTHOR(S), (YEAR), YOUR SOFTWARE TITLE (vNUMBER) in Free Statistics Software (v$_version), Office for Research Development and Education, URL http://www.wessa.net/rwasp_YOURPAGE.wasp/ > #Source of accompanying publication: Office for Research, Development, and Education > #Technical description: Write here your technical program description (don't use hard returns!) > library(lattice) > library(lmtest) Loading required package: zoo > n25 <- 25 #minimum number of obs. for Goldfeld-Quandt test > par1 <- as.numeric(par1) > x <- t(y) > k <- length(x[1,]) > n <- length(x[,1]) > x1 <- cbind(x[,par1], x[,1:k!=par1]) > mycolnames <- c(colnames(x)[par1], colnames(x)[1:k!=par1]) > colnames(x1) <- mycolnames #colnames(x)[par1] > x <- x1 > if (par3 == 'First Differences'){ + x2 <- array(0, dim=c(n-1,k), dimnames=list(1:(n-1), paste('(1-B)',colnames(x),sep=''))) + for (i in 1:n-1) { + for (j in 1:k) { + x2[i,j] <- x[i+1,j] - x[i,j] + } + } + x <- x2 + } > if (par2 == 'Include Monthly Dummies'){ + x2 <- array(0, dim=c(n,11), dimnames=list(1:n, paste('M', seq(1:11), sep =''))) + for (i in 1:11){ + x2[seq(i,n,12),i] <- 1 + } + x <- cbind(x, x2) + } > if (par2 == 'Include Quarterly Dummies'){ + x2 <- array(0, dim=c(n,3), dimnames=list(1:n, paste('Q', seq(1:3), sep =''))) + for (i in 1:3){ + x2[seq(i,n,4),i] <- 1 + } + x <- cbind(x, x2) + } > k <- length(x[1,]) > if (par3 == 'Linear Trend'){ + x <- cbind(x, c(1:n)) + colnames(x)[k+1] <- 't' + } > x examen login blog review fdb sec 1 9.5457 56 79 30 115 146283 2 15.8949 89 108 30 116 96933 3 0.0000 44 43 26 100 95757 4 0.0000 84 78 38 140 143983 5 0.0000 88 86 44 166 75851 6 12.0989 55 44 30 99 59238 7 15.8949 60 104 40 139 93163 8 2.6529 154 158 47 181 151511 9 1.0579 53 102 30 116 136368 10 0.0000 119 77 31 116 112642 11 0.0000 75 80 30 108 127766 12 0.0000 92 123 34 129 85646 13 0.8401 100 73 31 118 98579 14 0.0000 73 105 33 125 131741 15 4.2325 77 107 33 127 171975 16 5.5091 99 84 36 136 159676 17 0.0000 30 33 14 46 58391 18 2.9596 76 42 17 54 31580 19 0.0000 146 96 32 124 136815 20 0.0000 67 106 30 115 120642 21 0.0000 56 56 35 128 69107 22 4.2325 58 59 28 97 108016 23 4.2325 119 76 34 125 79336 24 6.9999 66 91 39 149 93176 25 0.0000 89 115 39 149 161632 26 4.2325 41 76 29 108 102996 27 12.7203 68 101 44 166 160604 28 4.2325 168 94 21 80 158051 29 12.0989 132 92 28 107 162647 30 0.0000 71 75 28 107 60622 31 2.1093 112 128 38 146 179566 32 6.9999 70 56 32 123 96144 33 0.0000 57 41 29 111 129847 34 9.5457 103 67 27 105 71180 35 9.5531 52 77 40 155 86767 36 15.9023 62 66 40 155 93487 37 0.0000 45 69 28 104 82981 38 13.9969 46 105 34 132 73815 39 15.8949 63 116 33 127 94552 40 0.0000 53 62 33 122 67808 41 15.8949 78 100 35 87 106175 42 0.0000 46 67 29 109 76669 43 14.6220 41 46 20 78 57283 44 12.7203 91 135 37 141 72413 45 10.1745 63 124 33 124 96971 46 0.0000 63 58 29 112 120336 47 0.0000 32 68 28 108 93913 48 0.0000 34 37 21 78 32036 49 4.2325 93 93 41 158 102255 50 0.0000 55 56 20 78 63506 51 11.4474 72 83 30 119 68370 52 4.2325 42 59 22 88 50517 53 2.9596 71 133 42 155 103950 54 0.0000 65 106 32 123 84396 55 1.0579 41 71 36 136 55515 56 1.6867 86 116 31 117 209056 57 4.2325 95 98 33 124 142775 58 0.0000 49 64 40 151 68847 59 4.2325 64 32 38 145 20112 60 0.0000 38 25 24 87 61023 61 5.6162 52 46 43 165 112494 62 6.7857 247 63 31 120 78876 63 12.0989 139 95 40 150 170745 64 15.8949 110 113 37 136 122037 65 0.0000 67 111 31 116 112283 66 1.0579 83 120 39 150 120691 67 3.7145 70 87 32 118 122422 68 8.2765 32 25 18 71 25899 69 2.9596 83 131 39 144 139296 70 15.8949 70 47 30 110 89455 71 1.6867 103 109 37 147 147866 72 10.0674 34 37 32 111 14336 73 2.4416 40 15 17 68 30059 74 0.0000 46 54 12 48 41907 75 8.7908 18 16 13 51 35885 76 0.0000 60 22 17 68 55764 77 5.5091 39 37 17 64 35619 78 7.5179 31 29 20 76 40557 79 0.0000 54 55 17 66 44197 80 8.2728 14 5 17 68 4103 81 8.2728 23 0 17 66 4694 82 1.1687 77 27 22 83 62991 83 0.0000 19 37 15 55 24261 84 0.0000 49 29 12 41 21425 85 4.2325 20 17 17 66 27184 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) login blog review fdb sec 1.677e+00 8.083e-03 1.209e-02 7.367e-01 -1.600e-01 -2.555e-05 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -7.337 -4.155 -2.061 4.081 11.271 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 1.677e+00 2.143e+00 0.783 0.4362 login 8.083e-03 1.918e-02 0.421 0.6747 blog 1.209e-02 2.799e-02 0.432 0.6670 review 7.367e-01 3.554e-01 2.073 0.0414 * fdb -1.600e-01 9.252e-02 -1.730 0.0876 . sec -2.555e-05 1.944e-05 -1.314 0.1925 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 5.249 on 79 degrees of freedom Multiple R-squared: 0.08713, Adjusted R-squared: 0.02936 F-statistic: 1.508 on 5 and 79 DF, p-value: 0.1968 > 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.7817038 0.43659232 0.218296159 [2,] 0.7259355 0.54812895 0.274064475 [3,] 0.7760626 0.44787475 0.223937375 [4,] 0.9139539 0.17209226 0.086046132 [5,] 0.8663043 0.26739135 0.133695673 [6,] 0.8506365 0.29872703 0.149363513 [7,] 0.7920957 0.41580852 0.207904261 [8,] 0.7706854 0.45862922 0.229314612 [9,] 0.7736728 0.45265448 0.226327240 [10,] 0.7065756 0.58684878 0.293424388 [11,] 0.6460755 0.70784897 0.353924483 [12,] 0.6125179 0.77496420 0.387482102 [13,] 0.5825058 0.83498850 0.417494249 [14,] 0.5081790 0.98364200 0.491821000 [15,] 0.4477296 0.89545917 0.552270416 [16,] 0.4055615 0.81112303 0.594438483 [17,] 0.3827077 0.76541534 0.617292332 [18,] 0.3119024 0.62380480 0.688097598 [19,] 0.3746923 0.74938460 0.625307700 [20,] 0.3517736 0.70354718 0.648226409 [21,] 0.4872961 0.97459220 0.512703898 [22,] 0.4453220 0.89064409 0.554677956 [23,] 0.4012120 0.80242392 0.598788038 [24,] 0.3971559 0.79431187 0.602844065 [25,] 0.3422996 0.68459930 0.657700351 [26,] 0.4016942 0.80338844 0.598305780 [27,] 0.4026516 0.80530321 0.597348396 [28,] 0.6078199 0.78436027 0.392180134 [29,] 0.5853495 0.82930105 0.414650526 [30,] 0.6864198 0.62716035 0.313580173 [31,] 0.8303921 0.33921589 0.169607943 [32,] 0.8360778 0.32784448 0.163922240 [33,] 0.8046003 0.39079946 0.195399730 [34,] 0.7924463 0.41510741 0.207553704 [35,] 0.9212852 0.15742967 0.078714835 [36,] 0.9350158 0.12996837 0.064984184 [37,] 0.9444409 0.11111819 0.055559093 [38,] 0.9360338 0.12793245 0.063966226 [39,] 0.9252174 0.14956520 0.074782598 [40,] 0.9176500 0.16469996 0.082349978 [41,] 0.8891369 0.22172611 0.110863055 [42,] 0.8669614 0.26607730 0.133038650 [43,] 0.9289322 0.14213557 0.071067787 [44,] 0.9113663 0.17726734 0.088633668 [45,] 0.8962994 0.20740122 0.103700612 [46,] 0.8773058 0.24538835 0.122694173 [47,] 0.8565681 0.28686370 0.143431852 [48,] 0.8241527 0.35169453 0.175847267 [49,] 0.7745588 0.45088239 0.225441195 [50,] 0.7899166 0.42016687 0.210083436 [51,] 0.7646765 0.47064706 0.235323531 [52,] 0.8301669 0.33966620 0.169833098 [53,] 0.8704634 0.25907311 0.129536553 [54,] 0.8267499 0.34650025 0.173250127 [55,] 0.8011716 0.39765683 0.198828417 [56,] 0.9891979 0.02160428 0.010802141 [57,] 0.9832398 0.03352045 0.016760227 [58,] 0.9730832 0.05383365 0.026916825 [59,] 0.9669483 0.06610334 0.033051669 [60,] 0.9663545 0.06729093 0.033645467 [61,] 0.9553691 0.08926188 0.044630938 [62,] 0.9933503 0.01329947 0.006649737 [63,] 0.9847661 0.03046776 0.015233881 [64,] 0.9684755 0.06304901 0.031524507 [65,] 0.9461671 0.10766580 0.053832898 [66,] 0.8930587 0.21388265 0.106941327 [67,] 0.9319278 0.13614434 0.068072171 [68,] 0.8441811 0.31163779 0.155818895 > postscript(file="/var/wessaorg/rcomp/tmp/1iozp1324322917.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/2yv7t1324322917.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/3mlr11324322917.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/4hq6d1324322917.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/52tay1324322917.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 7 6.5026582 11.1338016 -3.2556089 -5.2083422 -7.3369867 4.7026638 7.6345404 8 9 10 11 12 13 14 -3.9644100 -2.3322125 -4.9641372 -4.8020228 -6.1211808 -3.9613194 -4.4758734 15 16 17 18 19 20 21 1.0480832 1.3410686 -3.7783053 -2.9139368 -4.2508525 -4.1134262 -6.3394692 22 23 24 25 26 27 28 -0.9699126 -2.3400777 1.1855498 -4.5414817 -0.1425271 7.5288865 1.4321315 29 30 31 32 33 34 35 8.8955074 -5.1113629 -2.0605184 2.6477900 -2.9151380 4.9587221 4.0809803 36 37 38 39 40 41 42 10.6540155 -4.7375664 8.6429714 10.7368462 -5.9078539 3.2312197 -4.8192008 43 44 45 46 47 48 49 11.2705640 5.8345346 4.5014256 -3.2520962 -3.7009701 -4.5677165 -1.6252882 50 51 52 53 54 55 56 -3.4264977 6.8763160 0.6700238 -4.3773909 -5.2162847 -5.1452757 -0.8589775 57 58 59 60 61 62 63 -0.2147077 -6.3886772 -2.6225531 -4.4840555 0.5665132 0.7337376 7.0512717 64 65 66 67 68 69 70 9.5891301 -4.9640426 -4.3814500 -1.1412044 4.8029350 -3.0976288 10.8735364 71 72 73 74 75 76 77 -2.0938617 2.2254999 -0.6129119 -2.7892482 6.2768529 -2.6440787 1.6986132 78 79 80 81 82 83 84 3.7054172 -3.6101057 4.8862047 4.5689331 -2.7713142 -3.9060284 -4.1547951 85 0.9219386 > postscript(file="/var/wessaorg/rcomp/tmp/6sxat1324322917.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 6.5026582 NA 1 11.1338016 6.5026582 2 -3.2556089 11.1338016 3 -5.2083422 -3.2556089 4 -7.3369867 -5.2083422 5 4.7026638 -7.3369867 6 7.6345404 4.7026638 7 -3.9644100 7.6345404 8 -2.3322125 -3.9644100 9 -4.9641372 -2.3322125 10 -4.8020228 -4.9641372 11 -6.1211808 -4.8020228 12 -3.9613194 -6.1211808 13 -4.4758734 -3.9613194 14 1.0480832 -4.4758734 15 1.3410686 1.0480832 16 -3.7783053 1.3410686 17 -2.9139368 -3.7783053 18 -4.2508525 -2.9139368 19 -4.1134262 -4.2508525 20 -6.3394692 -4.1134262 21 -0.9699126 -6.3394692 22 -2.3400777 -0.9699126 23 1.1855498 -2.3400777 24 -4.5414817 1.1855498 25 -0.1425271 -4.5414817 26 7.5288865 -0.1425271 27 1.4321315 7.5288865 28 8.8955074 1.4321315 29 -5.1113629 8.8955074 30 -2.0605184 -5.1113629 31 2.6477900 -2.0605184 32 -2.9151380 2.6477900 33 4.9587221 -2.9151380 34 4.0809803 4.9587221 35 10.6540155 4.0809803 36 -4.7375664 10.6540155 37 8.6429714 -4.7375664 38 10.7368462 8.6429714 39 -5.9078539 10.7368462 40 3.2312197 -5.9078539 41 -4.8192008 3.2312197 42 11.2705640 -4.8192008 43 5.8345346 11.2705640 44 4.5014256 5.8345346 45 -3.2520962 4.5014256 46 -3.7009701 -3.2520962 47 -4.5677165 -3.7009701 48 -1.6252882 -4.5677165 49 -3.4264977 -1.6252882 50 6.8763160 -3.4264977 51 0.6700238 6.8763160 52 -4.3773909 0.6700238 53 -5.2162847 -4.3773909 54 -5.1452757 -5.2162847 55 -0.8589775 -5.1452757 56 -0.2147077 -0.8589775 57 -6.3886772 -0.2147077 58 -2.6225531 -6.3886772 59 -4.4840555 -2.6225531 60 0.5665132 -4.4840555 61 0.7337376 0.5665132 62 7.0512717 0.7337376 63 9.5891301 7.0512717 64 -4.9640426 9.5891301 65 -4.3814500 -4.9640426 66 -1.1412044 -4.3814500 67 4.8029350 -1.1412044 68 -3.0976288 4.8029350 69 10.8735364 -3.0976288 70 -2.0938617 10.8735364 71 2.2254999 -2.0938617 72 -0.6129119 2.2254999 73 -2.7892482 -0.6129119 74 6.2768529 -2.7892482 75 -2.6440787 6.2768529 76 1.6986132 -2.6440787 77 3.7054172 1.6986132 78 -3.6101057 3.7054172 79 4.8862047 -3.6101057 80 4.5689331 4.8862047 81 -2.7713142 4.5689331 82 -3.9060284 -2.7713142 83 -4.1547951 -3.9060284 84 0.9219386 -4.1547951 85 NA 0.9219386 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] 11.1338016 6.5026582 [2,] -3.2556089 11.1338016 [3,] -5.2083422 -3.2556089 [4,] -7.3369867 -5.2083422 [5,] 4.7026638 -7.3369867 [6,] 7.6345404 4.7026638 [7,] -3.9644100 7.6345404 [8,] -2.3322125 -3.9644100 [9,] -4.9641372 -2.3322125 [10,] -4.8020228 -4.9641372 [11,] -6.1211808 -4.8020228 [12,] -3.9613194 -6.1211808 [13,] -4.4758734 -3.9613194 [14,] 1.0480832 -4.4758734 [15,] 1.3410686 1.0480832 [16,] -3.7783053 1.3410686 [17,] -2.9139368 -3.7783053 [18,] -4.2508525 -2.9139368 [19,] -4.1134262 -4.2508525 [20,] -6.3394692 -4.1134262 [21,] -0.9699126 -6.3394692 [22,] -2.3400777 -0.9699126 [23,] 1.1855498 -2.3400777 [24,] -4.5414817 1.1855498 [25,] -0.1425271 -4.5414817 [26,] 7.5288865 -0.1425271 [27,] 1.4321315 7.5288865 [28,] 8.8955074 1.4321315 [29,] -5.1113629 8.8955074 [30,] -2.0605184 -5.1113629 [31,] 2.6477900 -2.0605184 [32,] -2.9151380 2.6477900 [33,] 4.9587221 -2.9151380 [34,] 4.0809803 4.9587221 [35,] 10.6540155 4.0809803 [36,] -4.7375664 10.6540155 [37,] 8.6429714 -4.7375664 [38,] 10.7368462 8.6429714 [39,] -5.9078539 10.7368462 [40,] 3.2312197 -5.9078539 [41,] -4.8192008 3.2312197 [42,] 11.2705640 -4.8192008 [43,] 5.8345346 11.2705640 [44,] 4.5014256 5.8345346 [45,] -3.2520962 4.5014256 [46,] -3.7009701 -3.2520962 [47,] -4.5677165 -3.7009701 [48,] -1.6252882 -4.5677165 [49,] -3.4264977 -1.6252882 [50,] 6.8763160 -3.4264977 [51,] 0.6700238 6.8763160 [52,] -4.3773909 0.6700238 [53,] -5.2162847 -4.3773909 [54,] -5.1452757 -5.2162847 [55,] -0.8589775 -5.1452757 [56,] -0.2147077 -0.8589775 [57,] -6.3886772 -0.2147077 [58,] -2.6225531 -6.3886772 [59,] -4.4840555 -2.6225531 [60,] 0.5665132 -4.4840555 [61,] 0.7337376 0.5665132 [62,] 7.0512717 0.7337376 [63,] 9.5891301 7.0512717 [64,] -4.9640426 9.5891301 [65,] -4.3814500 -4.9640426 [66,] -1.1412044 -4.3814500 [67,] 4.8029350 -1.1412044 [68,] -3.0976288 4.8029350 [69,] 10.8735364 -3.0976288 [70,] -2.0938617 10.8735364 [71,] 2.2254999 -2.0938617 [72,] -0.6129119 2.2254999 [73,] -2.7892482 -0.6129119 [74,] 6.2768529 -2.7892482 [75,] -2.6440787 6.2768529 [76,] 1.6986132 -2.6440787 [77,] 3.7054172 1.6986132 [78,] -3.6101057 3.7054172 [79,] 4.8862047 -3.6101057 [80,] 4.5689331 4.8862047 [81,] -2.7713142 4.5689331 [82,] -3.9060284 -2.7713142 [83,] -4.1547951 -3.9060284 [84,] 0.9219386 -4.1547951 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 11.1338016 6.5026582 2 -3.2556089 11.1338016 3 -5.2083422 -3.2556089 4 -7.3369867 -5.2083422 5 4.7026638 -7.3369867 6 7.6345404 4.7026638 7 -3.9644100 7.6345404 8 -2.3322125 -3.9644100 9 -4.9641372 -2.3322125 10 -4.8020228 -4.9641372 11 -6.1211808 -4.8020228 12 -3.9613194 -6.1211808 13 -4.4758734 -3.9613194 14 1.0480832 -4.4758734 15 1.3410686 1.0480832 16 -3.7783053 1.3410686 17 -2.9139368 -3.7783053 18 -4.2508525 -2.9139368 19 -4.1134262 -4.2508525 20 -6.3394692 -4.1134262 21 -0.9699126 -6.3394692 22 -2.3400777 -0.9699126 23 1.1855498 -2.3400777 24 -4.5414817 1.1855498 25 -0.1425271 -4.5414817 26 7.5288865 -0.1425271 27 1.4321315 7.5288865 28 8.8955074 1.4321315 29 -5.1113629 8.8955074 30 -2.0605184 -5.1113629 31 2.6477900 -2.0605184 32 -2.9151380 2.6477900 33 4.9587221 -2.9151380 34 4.0809803 4.9587221 35 10.6540155 4.0809803 36 -4.7375664 10.6540155 37 8.6429714 -4.7375664 38 10.7368462 8.6429714 39 -5.9078539 10.7368462 40 3.2312197 -5.9078539 41 -4.8192008 3.2312197 42 11.2705640 -4.8192008 43 5.8345346 11.2705640 44 4.5014256 5.8345346 45 -3.2520962 4.5014256 46 -3.7009701 -3.2520962 47 -4.5677165 -3.7009701 48 -1.6252882 -4.5677165 49 -3.4264977 -1.6252882 50 6.8763160 -3.4264977 51 0.6700238 6.8763160 52 -4.3773909 0.6700238 53 -5.2162847 -4.3773909 54 -5.1452757 -5.2162847 55 -0.8589775 -5.1452757 56 -0.2147077 -0.8589775 57 -6.3886772 -0.2147077 58 -2.6225531 -6.3886772 59 -4.4840555 -2.6225531 60 0.5665132 -4.4840555 61 0.7337376 0.5665132 62 7.0512717 0.7337376 63 9.5891301 7.0512717 64 -4.9640426 9.5891301 65 -4.3814500 -4.9640426 66 -1.1412044 -4.3814500 67 4.8029350 -1.1412044 68 -3.0976288 4.8029350 69 10.8735364 -3.0976288 70 -2.0938617 10.8735364 71 2.2254999 -2.0938617 72 -0.6129119 2.2254999 73 -2.7892482 -0.6129119 74 6.2768529 -2.7892482 75 -2.6440787 6.2768529 76 1.6986132 -2.6440787 77 3.7054172 1.6986132 78 -3.6101057 3.7054172 79 4.8862047 -3.6101057 80 4.5689331 4.8862047 81 -2.7713142 4.5689331 82 -3.9060284 -2.7713142 83 -4.1547951 -3.9060284 84 0.9219386 -4.1547951 > 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/7vbrw1324322917.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/8igl11324322917.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/94kq31324322917.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/10fxw21324322917.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/11io401324322917.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/12fbdh1324322917.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/134ofx1324322917.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/14mprh1324322917.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/151iej1324322918.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/16yzl31324322918.tab") + } > > try(system("convert tmp/1iozp1324322917.ps tmp/1iozp1324322917.png",intern=TRUE)) character(0) > try(system("convert tmp/2yv7t1324322917.ps tmp/2yv7t1324322917.png",intern=TRUE)) character(0) > try(system("convert tmp/3mlr11324322917.ps tmp/3mlr11324322917.png",intern=TRUE)) character(0) > try(system("convert tmp/4hq6d1324322917.ps tmp/4hq6d1324322917.png",intern=TRUE)) character(0) > try(system("convert tmp/52tay1324322917.ps tmp/52tay1324322917.png",intern=TRUE)) character(0) > try(system("convert tmp/6sxat1324322917.ps tmp/6sxat1324322917.png",intern=TRUE)) character(0) > try(system("convert tmp/7vbrw1324322917.ps tmp/7vbrw1324322917.png",intern=TRUE)) character(0) > try(system("convert tmp/8igl11324322917.ps tmp/8igl11324322917.png",intern=TRUE)) character(0) > try(system("convert tmp/94kq31324322917.ps tmp/94kq31324322917.png",intern=TRUE)) character(0) > try(system("convert tmp/10fxw21324322917.ps tmp/10fxw21324322917.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 3.704 0.693 4.409