R version 2.12.0 (2010-10-15) Copyright (C) 2010 The R Foundation for Statistical Computing ISBN 3-900051-07-0 Platform: i486-pc-linux-gnu (32-bit) R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > x <- array(list(13 + ,13 + ,14 + ,13 + ,3 + ,2 + ,1 + ,12 + ,12 + ,8 + ,13 + ,5 + ,1 + ,1 + ,15 + ,10 + ,12 + ,16 + ,6 + ,0 + ,1 + ,12 + ,9 + ,7 + ,12 + ,6 + ,3 + ,1 + ,10 + ,10 + ,10 + ,11 + ,5 + ,3 + ,1 + ,12 + ,12 + ,7 + ,12 + ,3 + ,1 + ,1 + ,15 + ,13 + ,16 + ,18 + ,8 + ,3 + ,1 + ,9 + ,12 + ,11 + ,11 + ,4 + ,1 + ,1 + ,12 + ,12 + ,14 + ,14 + ,4 + ,4 + ,1 + ,11 + ,6 + ,6 + ,9 + ,4 + ,0 + ,1 + ,11 + ,5 + ,16 + ,14 + ,6 + ,3 + ,1 + ,11 + ,12 + ,11 + ,12 + ,6 + ,2 + ,1 + ,15 + ,11 + ,16 + ,11 + ,5 + ,4 + ,1 + ,7 + ,14 + ,12 + ,12 + ,4 + ,3 + ,1 + ,11 + ,14 + ,7 + ,13 + ,6 + ,1 + ,1 + ,11 + ,12 + ,13 + ,11 + ,4 + ,1 + ,1 + ,10 + ,12 + ,11 + ,12 + ,6 + ,2 + ,1 + ,14 + ,11 + ,15 + ,16 + ,6 + ,3 + ,1 + ,10 + ,11 + ,7 + ,9 + ,4 + ,1 + ,2 + ,6 + ,7 + ,9 + ,11 + ,4 + ,1 + ,2 + ,11 + ,9 + ,7 + ,13 + ,2 + ,2 + ,2 + ,15 + ,11 + ,14 + ,15 + ,7 + ,3 + ,2 + ,11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+ ,10 + ,14 + ,14 + ,5 + ,4 + ,8 + ,12 + ,11 + ,16 + ,13 + ,4 + ,1 + ,8 + ,13 + ,12 + ,14 + ,14 + ,6 + ,2 + ,8 + ,15 + ,12 + ,14 + ,16 + ,4 + ,0 + ,8 + ,8 + ,10 + ,10 + ,6 + ,4 + ,5 + ,8 + ,12 + ,12 + ,10 + ,13 + ,4 + ,2 + ,8 + ,10 + ,13 + ,4 + ,13 + ,6 + ,1 + ,8 + ,8 + ,12 + ,8 + ,14 + ,5 + ,1 + ,8 + ,10 + ,15 + ,15 + ,15 + ,6 + ,4 + ,8 + ,15 + ,11 + ,16 + ,14 + ,6 + ,3 + ,8 + ,16 + ,12 + ,12 + ,15 + ,8 + ,0 + ,9 + ,13 + ,11 + ,12 + ,13 + ,7 + ,3 + ,10 + ,16 + ,12 + ,15 + ,16 + ,7 + ,3 + ,10 + ,9 + ,11 + ,9 + ,12 + ,4 + ,0 + ,14 + ,14 + ,10 + ,12 + ,15 + ,6 + ,2 + ,14 + ,14 + ,11 + ,14 + ,12 + ,6 + ,5 + ,14 + ,12 + ,11 + ,11 + ,14 + ,2 + ,2 + ,14) + ,dim=c(7 + ,156) + ,dimnames=list(c('Popularity' + ,'FindingFriends' + ,'KnowingPeople' + ,'Liked' + ,'Celebrity' + ,'Sum_friends' + ,'Day') + ,1:156)) > y <- array(NA,dim=c(7,156),dimnames=list(c('Popularity','FindingFriends','KnowingPeople','Liked','Celebrity','Sum_friends','Day'),1:156)) > for (i in 1:dim(x)[1]) + { + for (j in 1:dim(x)[2]) + { + y[i,j] <- as.numeric(x[i,j]) + } + } > par3 = 'Linear Trend' > par2 = 'Do not include Seasonal Dummies' > par1 = '1' > library(lattice) > library(lmtest) Loading required package: zoo > n25 <- 25 #minimum number of obs. for Goldfeld-Quandt test > par1 <- as.numeric(par1) > x <- t(y) > k <- length(x[1,]) > n <- length(x[,1]) > x1 <- cbind(x[,par1], x[,1:k!=par1]) > mycolnames <- c(colnames(x)[par1], colnames(x)[1:k!=par1]) > colnames(x1) <- mycolnames #colnames(x)[par1] > x <- x1 > if (par3 == 'First Differences'){ + x2 <- array(0, dim=c(n-1,k), dimnames=list(1:(n-1), paste('(1-B)',colnames(x),sep=''))) + for (i in 1:n-1) { + for (j in 1:k) { + x2[i,j] <- x[i+1,j] - x[i,j] + } + } + x <- x2 + } > if (par2 == 'Include Monthly Dummies'){ + x2 <- array(0, dim=c(n,11), dimnames=list(1:n, paste('M', seq(1:11), sep =''))) + for (i in 1:11){ + x2[seq(i,n,12),i] <- 1 + } + x <- cbind(x, x2) + } > if (par2 == 'Include Quarterly Dummies'){ + x2 <- array(0, dim=c(n,3), dimnames=list(1:n, paste('Q', seq(1:3), sep =''))) + for (i in 1:3){ + x2[seq(i,n,4),i] <- 1 + } + x <- cbind(x, x2) + } > k <- length(x[1,]) > if (par3 == 'Linear Trend'){ + x <- cbind(x, c(1:n)) + colnames(x)[k+1] <- 't' + } > x Popularity FindingFriends KnowingPeople Liked Celebrity Sum_friends Day t 1 13 13 14 13 3 2 1 1 2 12 12 8 13 5 1 1 2 3 15 10 12 16 6 0 1 3 4 12 9 7 12 6 3 1 4 5 10 10 10 11 5 3 1 5 6 12 12 7 12 3 1 1 6 7 15 13 16 18 8 3 1 7 8 9 12 11 11 4 1 1 8 9 12 12 14 14 4 4 1 9 10 11 6 6 9 4 0 1 10 11 11 5 16 14 6 3 1 11 12 11 12 11 12 6 2 1 12 13 15 11 16 11 5 4 1 13 14 7 14 12 12 4 3 1 14 15 11 14 7 13 6 1 1 15 16 11 12 13 11 4 1 1 16 17 10 12 11 12 6 2 1 17 18 14 11 15 16 6 3 1 18 19 10 11 7 9 4 1 2 19 20 6 7 9 11 4 1 2 20 21 11 9 7 13 2 2 2 21 22 15 11 14 15 7 3 2 22 23 11 11 15 10 5 4 2 23 24 12 12 7 11 4 2 2 24 25 14 12 15 13 6 1 2 25 26 15 11 17 16 6 2 2 26 27 9 11 15 15 7 2 2 27 28 13 8 14 14 5 4 2 28 29 13 9 14 14 6 2 2 29 30 16 12 8 14 4 3 2 30 31 13 10 8 8 4 3 2 31 32 12 10 14 13 7 3 2 32 33 14 12 14 15 7 4 2 33 34 11 8 8 13 4 2 3 34 35 9 12 11 11 4 2 3 35 36 16 11 16 15 6 4 3 36 37 12 12 10 15 6 3 3 37 38 10 7 8 9 5 4 3 38 39 13 11 14 13 6 2 3 39 40 16 11 16 16 7 5 3 40 41 14 12 13 13 6 3 3 41 42 15 9 5 11 3 1 3 42 43 5 15 8 12 3 1 3 43 44 8 11 10 12 4 1 3 44 45 11 11 8 12 6 2 3 45 46 16 11 13 14 7 3 3 46 47 17 11 15 14 5 9 3 47 48 9 15 6 8 4 0 3 48 49 9 11 12 13 5 0 3 49 50 13 12 16 16 6 2 3 50 51 10 12 5 13 6 2 3 51 52 6 9 15 11 6 3 4 52 53 12 12 12 14 5 1 4 53 54 8 12 8 13 4 2 4 54 55 14 13 13 13 5 0 4 55 56 12 11 14 13 5 5 4 56 57 11 9 12 12 4 2 4 57 58 16 9 16 16 6 4 4 58 59 8 11 10 15 2 3 4 59 60 15 11 15 15 8 0 4 60 61 7 12 8 12 3 0 4 61 62 16 12 16 14 6 4 4 62 63 14 9 19 12 6 1 4 63 64 16 11 14 15 6 1 4 64 65 9 9 6 12 5 4 4 65 66 14 12 13 13 5 2 4 66 67 11 12 15 12 6 4 4 67 68 13 12 7 12 5 1 4 68 69 15 12 13 13 6 4 5 69 70 5 14 4 5 2 2 5 70 71 15 11 14 13 5 5 5 71 72 13 12 13 13 5 4 5 72 73 11 11 11 14 5 4 5 73 74 11 6 14 17 6 4 5 74 75 12 10 12 13 6 4 5 75 76 12 12 15 13 6 3 5 76 77 12 13 14 12 5 3 5 77 78 12 8 13 13 5 3 5 78 79 14 12 8 14 4 2 5 79 80 6 12 6 11 2 1 5 80 81 7 12 7 12 4 1 5 81 82 14 6 13 12 6 5 5 82 83 14 11 13 16 6 4 5 83 84 10 10 11 12 5 2 5 84 85 13 12 5 12 3 3 5 85 86 12 13 12 12 6 2 5 86 87 9 11 8 10 4 2 6 87 88 12 7 11 15 5 2 6 88 89 16 11 14 15 8 2 6 89 90 10 11 9 12 4 3 6 90 91 14 11 10 16 6 2 6 91 92 10 11 13 15 6 3 6 92 93 16 12 16 16 7 4 6 93 94 15 10 16 13 6 3 6 94 95 12 11 11 12 5 3 6 95 96 10 12 8 11 4 0 6 96 97 8 7 4 13 6 1 6 97 98 8 13 7 10 3 2 6 98 99 11 8 14 15 5 2 6 99 100 13 12 11 13 6 3 6 100 101 16 11 17 16 7 4 6 101 102 16 12 15 15 7 4 6 102 103 14 14 17 18 6 1 6 103 104 11 10 5 13 3 2 6 104 105 4 10 4 10 2 2 6 105 106 14 13 10 16 8 3 6 106 107 9 10 11 13 3 3 7 107 108 14 11 15 15 8 3 7 108 109 8 10 10 14 3 1 7 109 110 8 7 9 15 4 1 7 110 111 11 10 12 14 5 1 7 111 112 12 8 15 13 7 1 7 112 113 11 12 7 13 6 0 7 113 114 14 12 13 15 6 1 7 114 115 15 12 12 16 7 3 7 115 116 16 11 14 14 6 3 7 116 117 16 12 14 14 6 0 7 117 118 11 12 8 16 6 2 7 118 119 14 12 15 14 6 5 7 119 120 14 11 12 12 4 2 7 120 121 12 12 12 13 4 3 7 121 122 14 11 16 12 5 3 7 122 123 8 11 9 12 4 5 7 123 124 13 13 15 14 6 4 7 124 125 16 12 15 14 6 4 7 125 126 12 12 6 14 5 0 7 126 127 16 12 14 16 8 3 7 127 128 12 12 15 13 6 0 7 128 129 11 8 10 14 5 2 7 129 130 4 8 6 4 4 0 7 130 131 16 12 14 16 8 6 7 131 132 15 11 12 13 6 3 7 132 133 10 12 8 16 4 1 7 133 134 13 13 11 15 6 6 7 134 135 15 12 13 14 6 2 7 135 136 12 12 9 13 4 1 7 136 137 14 11 15 14 6 3 7 137 138 7 12 13 12 3 1 8 138 139 19 12 15 15 6 2 8 139 140 12 10 14 14 5 4 8 140 141 12 11 16 13 4 1 8 141 142 13 12 14 14 6 2 8 142 143 15 12 14 16 4 0 8 143 144 8 10 10 6 4 5 8 144 145 12 12 10 13 4 2 8 145 146 10 13 4 13 6 1 8 146 147 8 12 8 14 5 1 8 147 148 10 15 15 15 6 4 8 148 149 15 11 16 14 6 3 8 149 150 16 12 12 15 8 0 9 150 151 13 11 12 13 7 3 10 151 152 16 12 15 16 7 3 10 152 153 9 11 9 12 4 0 14 153 154 14 10 12 15 6 2 14 154 155 14 11 14 12 6 5 14 155 156 12 11 11 14 2 2 14 156 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) FindingFriends KnowingPeople Liked Celebrity -0.093121 0.114501 0.209268 0.358379 0.616587 Sum_friends Day t 0.213465 0.104201 -0.006679 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -6.4280 -1.2541 0.0269 1.3859 6.9788 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) -0.093121 1.454348 -0.064 0.949033 FindingFriends 0.114501 0.097256 1.177 0.240957 KnowingPeople 0.209268 0.064112 3.264 0.001364 ** Liked 0.358379 0.097379 3.680 0.000326 *** Celebrity 0.616587 0.157441 3.916 0.000137 *** Sum_friends 0.213465 0.120726 1.768 0.079093 . Day 0.104201 0.195341 0.533 0.594537 t -0.006679 0.011864 -0.563 0.574300 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 2.103 on 148 degrees of freedom Multiple R-squared: 0.5105, Adjusted R-squared: 0.4874 F-statistic: 22.05 on 7 and 148 DF, p-value: < 2.2e-16 > if (n > n25) { + kp3 <- k + 3 + nmkm3 <- n - k - 3 + gqarr <- array(NA, dim=c(nmkm3-kp3+1,3)) + numgqtests <- 0 + numsignificant1 <- 0 + numsignificant5 <- 0 + numsignificant10 <- 0 + for (mypoint in kp3:nmkm3) { + j <- 0 + numgqtests <- numgqtests + 1 + for (myalt in c('greater', 'two.sided', 'less')) { + j <- j + 1 + gqarr[mypoint-kp3+1,j] <- gqtest(mylm, point=mypoint, alternative=myalt)$p.value + } + if (gqarr[mypoint-kp3+1,2] < 0.01) numsignificant1 <- numsignificant1 + 1 + if (gqarr[mypoint-kp3+1,2] < 0.05) numsignificant5 <- numsignificant5 + 1 + if (gqarr[mypoint-kp3+1,2] < 0.10) numsignificant10 <- numsignificant10 + 1 + } + gqarr + } [,1] [,2] [,3] [1,] 0.2319585 0.46391695 0.768041525 [2,] 0.1449269 0.28985376 0.855073122 [3,] 0.6768478 0.64630435 0.323152174 [4,] 0.8073182 0.38536360 0.192681801 [5,] 0.7427820 0.51443596 0.257217978 [6,] 0.6564144 0.68717126 0.343585631 [7,] 0.5691293 0.86174148 0.430870740 [8,] 0.5435395 0.91292095 0.456460477 [9,] 0.4536087 0.90721743 0.546391283 [10,] 0.5914349 0.81713022 0.408565110 [11,] 0.6103376 0.77932487 0.389662433 [12,] 0.6363470 0.72730591 0.363652953 [13,] 0.5644096 0.87118085 0.435590425 [14,] 0.5674443 0.86511150 0.432555749 [15,] 0.5218916 0.95621686 0.478108428 [16,] 0.4564734 0.91294689 0.543526557 [17,] 0.6938932 0.61221354 0.306106770 [18,] 0.6504963 0.69900733 0.349503666 [19,] 0.5966517 0.80669657 0.403348283 [20,] 0.7587721 0.48245573 0.241227867 [21,] 0.8366734 0.32665311 0.163326554 [22,] 0.8031135 0.39377298 0.196886491 [23,] 0.7590394 0.48192125 0.240960623 [24,] 0.7286911 0.54261786 0.271308928 [25,] 0.7213769 0.55724611 0.278623055 [26,] 0.7198323 0.56033537 0.280167684 [27,] 0.6935479 0.61290421 0.306452104 [28,] 0.6452524 0.70949512 0.354747560 [29,] 0.5968965 0.80620709 0.403103543 [30,] 0.5536627 0.89267456 0.446337281 [31,] 0.5138072 0.97238564 0.486192818 [32,] 0.7908096 0.41838074 0.209190369 [33,] 0.9575482 0.08490364 0.042451821 [34,] 0.9610055 0.07798902 0.038994511 [35,] 0.9487811 0.10243782 0.051218911 [36,] 0.9556607 0.08867868 0.044339342 [37,] 0.9552245 0.08955097 0.044775485 [38,] 0.9452516 0.10949674 0.054748368 [39,] 0.9427397 0.11452052 0.057260260 [40,] 0.9316304 0.13673915 0.068369577 [41,] 0.9235815 0.15283706 0.076418531 [42,] 0.9881598 0.02368030 0.011840152 [43,] 0.9846222 0.03075553 0.015377766 [44,] 0.9876017 0.02479654 0.012398270 [45,] 0.9921897 0.01562069 0.007810347 [46,] 0.9896349 0.02073020 0.010365101 [47,] 0.9859361 0.02812772 0.014063859 [48,] 0.9842134 0.03157316 0.015786578 [49,] 0.9892848 0.02143045 0.010715227 [50,] 0.9884596 0.02308070 0.011540351 [51,] 0.9883191 0.02336171 0.011680855 [52,] 0.9887439 0.02251215 0.011256073 [53,] 0.9873525 0.02529502 0.012647508 [54,] 0.9898229 0.02035421 0.010177105 [55,] 0.9886495 0.02270095 0.011350473 [56,] 0.9879518 0.02409639 0.012048195 [57,] 0.9883479 0.02330421 0.011652107 [58,] 0.9905749 0.01885018 0.009425088 [59,] 0.9900789 0.01984210 0.009921051 [60,] 0.9869746 0.02605089 0.013025447 [61,] 0.9873789 0.02524226 0.012621130 [62,] 0.9831883 0.03362342 0.016811710 [63,] 0.9800777 0.03984460 0.019922299 [64,] 0.9860153 0.02796933 0.013984666 [65,] 0.9815516 0.03689670 0.018448352 [66,] 0.9784707 0.04305858 0.021529292 [67,] 0.9719950 0.05600997 0.028004983 [68,] 0.9633422 0.07331565 0.036657825 [69,] 0.9761693 0.04766131 0.023830653 [70,] 0.9743586 0.05128280 0.025641401 [71,] 0.9774080 0.04518400 0.022591999 [72,] 0.9771643 0.04567142 0.022835710 [73,] 0.9697343 0.06053143 0.030265715 [74,] 0.9626228 0.07475437 0.037377185 [75,] 0.9879650 0.02406995 0.012034975 [76,] 0.9837860 0.03242790 0.016213951 [77,] 0.9782641 0.04347189 0.021735946 [78,] 0.9719501 0.05609980 0.028049900 [79,] 0.9669478 0.06610431 0.033052157 [80,] 0.9574460 0.08510807 0.042554036 [81,] 0.9503477 0.09930469 0.049652343 [82,] 0.9692206 0.06155883 0.030779416 [83,] 0.9606495 0.07870107 0.039350534 [84,] 0.9566776 0.08664472 0.043322360 [85,] 0.9465688 0.10686230 0.053431152 [86,] 0.9352304 0.12953929 0.064769645 [87,] 0.9279499 0.14410018 0.072050091 [88,] 0.9105085 0.17898307 0.089491533 [89,] 0.9003600 0.19928000 0.099640002 [90,] 0.8808113 0.23837735 0.119188673 [91,] 0.8549989 0.29000223 0.145001117 [92,] 0.8347836 0.33043287 0.165216435 [93,] 0.8365794 0.32684116 0.163420581 [94,] 0.8889877 0.22202466 0.111012332 [95,] 0.8861923 0.22761536 0.113807680 [96,] 0.8595331 0.28093379 0.140466896 [97,] 0.8325014 0.33499715 0.167498577 [98,] 0.8247189 0.35056224 0.175281118 [99,] 0.8169834 0.36603314 0.183016570 [100,] 0.8370563 0.32588746 0.162943732 [101,] 0.8261413 0.34771735 0.173858673 [102,] 0.8834129 0.23317422 0.116587110 [103,] 0.8545885 0.29082292 0.145411458 [104,] 0.8310828 0.33783448 0.168917242 [105,] 0.7969393 0.40612149 0.203060746 [106,] 0.7854262 0.42914762 0.214573808 [107,] 0.7868211 0.42635780 0.213178902 [108,] 0.7898540 0.42029194 0.210145968 [109,] 0.7485819 0.50283627 0.251418133 [110,] 0.7939435 0.41211299 0.206056493 [111,] 0.7543392 0.49132162 0.245660808 [112,] 0.7197070 0.56058599 0.280292997 [113,] 0.7173725 0.56525491 0.282627455 [114,] 0.6773158 0.64536842 0.322684209 [115,] 0.6601115 0.67977700 0.339888502 [116,] 0.6414794 0.71704114 0.358520569 [117,] 0.5775342 0.84493162 0.422465812 [118,] 0.5463987 0.90720251 0.453601257 [119,] 0.5488826 0.90223471 0.451117355 [120,] 0.5637784 0.87244316 0.436221580 [121,] 0.5052318 0.98953643 0.494768214 [122,] 0.4604197 0.92083949 0.539580256 [123,] 0.4448596 0.88971923 0.555140383 [124,] 0.3723995 0.74479891 0.627600545 [125,] 0.3196238 0.63924761 0.680376196 [126,] 0.3016831 0.60336625 0.698316873 [127,] 0.2345383 0.46907658 0.765461710 [128,] 0.3218850 0.64376992 0.678115042 [129,] 0.7053279 0.58934421 0.294672103 [130,] 0.6616926 0.67661484 0.338307418 [131,] 0.5946869 0.81062627 0.405313133 [132,] 0.4931567 0.98631334 0.506843328 [133,] 0.4230697 0.84613937 0.576930317 [134,] 0.2971135 0.59422699 0.702886506 [135,] 0.5276348 0.94473031 0.472365154 > postscript(file="/var/www/rcomp/tmp/1zjrh1322008504.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/www/rcomp/tmp/2w1q51322008504.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/www/rcomp/tmp/3nndx1322008504.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/www/rcomp/tmp/46eh41322008504.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/www/rcomp/tmp/54omt1322008504.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > qqnorm(mysum$resid, main='Residual Normal Q-Q Plot') > qqline(mysum$resid) > grid() > dev.off() null device 1 > (myerror <- as.ts(mysum$resid)) Time Series: Start = 1 End = 156 Frequency = 1 1 2 3 4 5 6 1.64171298 0.99879387 1.91914295 0.87978603 -0.88087510 2.82633291 7 8 9 10 11 12 -1.82504351 -1.25559119 -0.59224728 3.42133838 -2.21562790 -1.03389239 13 14 15 16 17 18 2.58898245 -4.43909438 -0.55069702 0.37930601 -2.00049608 -0.36336872 19 20 21 22 23 24 1.38201228 -3.28859807 2.21056876 0.51020734 -0.88077846 2.37068548 25 26 27 28 29 30 0.96674966 0.38079256 -5.45220010 0.27187518 -0.02560476 4.91289200 31 32 33 34 35 36 4.29884534 -1.59174164 -0.74428662 0.86525632 -1.49711705 1.48410225 37 38 39 40 41 42 -1.15464423 0.39647218 0.06636360 0.32238850 0.96102473 6.97880405 43 44 45 46 47 48 -4.68770750 -2.25814804 -0.27957150 2.13395609 2.67448517 0.79461748 49 50 51 52 53 54 -2.40479003 -1.46833846 -1.08457035 -6.42798022 -0.16861807 -2.56336361 55 56 57 58 59 60 2.09281420 -0.94809621 0.32148242 1.39746903 -2.53105012 0.37015624 61 62 63 64 65 66 -2.11471329 1.79743993 0.87696862 2.62585196 -1.41298964 1.85385782 67 68 69 70 71 72 -2.24313804 2.69467037 1.72617813 -0.85242054 2.04789210 0.36280337 73 74 75 76 77 78 -1.45585796 -3.19620171 -0.79547557 -1.43213924 -0.35572657 0.07434820 79 80 81 82 83 84 3.14103868 -1.91196964 -2.70611238 1.64492930 -0.14094697 -1.12419828 85 86 87 88 89 90 3.92879963 -0.28019908 -0.36171217 0.06668567 1.13779265 -0.48116480 91 92 93 94 95 96 0.86302126 -3.61319090 0.46275108 1.60362068 0.51710715 0.65245081 97 98 99 100 101 102 -2.09468732 -0.69138666 -1.60214894 0.46103623 0.42141787 1.09051152 103 104 105 106 107 108 -1.36850274 2.03559333 -3.05673560 -0.71243171 -1.51764491 -1.26223514 109 110 111 112 113 114 -2.22646717 -2.64198213 -0.86482046 -1.13174056 -0.07886609 0.74198050 115 116 117 118 119 120 0.55603273 2.59202095 3.12459317 -1.75680353 -0.13864025 3.20067178 121 122 123 124 125 126 0.52100657 1.54690435 -2.79187918 -1.00628038 2.11490002 1.47544159 127 128 129 130 131 132 0.60105951 -0.65282476 -0.31051927 -1.83946302 -0.01261754 2.47580467 133 134 135 136 137 138 -1.20997499 -0.88772200 2.02715894 1.67593025 0.52301700 -3.27701955 139 140 141 142 143 144 5.17275983 -0.83425349 0.25474793 -0.23955530 2.71047101 -0.70031081 145 146 147 148 149 150 1.20910984 -0.66281156 -3.12049613 -4.53755963 1.28969907 1.96359093 151 152 153 154 155 156 -0.32647866 0.86275821 -1.25358215 0.50455268 0.41293571 1.43740699 > postscript(file="/var/www/rcomp/tmp/60k9o1322008504.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > dum <- cbind(lag(myerror,k=1),myerror) > dum Time Series: Start = 0 End = 156 Frequency = 1 lag(myerror, k = 1) myerror 0 1.64171298 NA 1 0.99879387 1.64171298 2 1.91914295 0.99879387 3 0.87978603 1.91914295 4 -0.88087510 0.87978603 5 2.82633291 -0.88087510 6 -1.82504351 2.82633291 7 -1.25559119 -1.82504351 8 -0.59224728 -1.25559119 9 3.42133838 -0.59224728 10 -2.21562790 3.42133838 11 -1.03389239 -2.21562790 12 2.58898245 -1.03389239 13 -4.43909438 2.58898245 14 -0.55069702 -4.43909438 15 0.37930601 -0.55069702 16 -2.00049608 0.37930601 17 -0.36336872 -2.00049608 18 1.38201228 -0.36336872 19 -3.28859807 1.38201228 20 2.21056876 -3.28859807 21 0.51020734 2.21056876 22 -0.88077846 0.51020734 23 2.37068548 -0.88077846 24 0.96674966 2.37068548 25 0.38079256 0.96674966 26 -5.45220010 0.38079256 27 0.27187518 -5.45220010 28 -0.02560476 0.27187518 29 4.91289200 -0.02560476 30 4.29884534 4.91289200 31 -1.59174164 4.29884534 32 -0.74428662 -1.59174164 33 0.86525632 -0.74428662 34 -1.49711705 0.86525632 35 1.48410225 -1.49711705 36 -1.15464423 1.48410225 37 0.39647218 -1.15464423 38 0.06636360 0.39647218 39 0.32238850 0.06636360 40 0.96102473 0.32238850 41 6.97880405 0.96102473 42 -4.68770750 6.97880405 43 -2.25814804 -4.68770750 44 -0.27957150 -2.25814804 45 2.13395609 -0.27957150 46 2.67448517 2.13395609 47 0.79461748 2.67448517 48 -2.40479003 0.79461748 49 -1.46833846 -2.40479003 50 -1.08457035 -1.46833846 51 -6.42798022 -1.08457035 52 -0.16861807 -6.42798022 53 -2.56336361 -0.16861807 54 2.09281420 -2.56336361 55 -0.94809621 2.09281420 56 0.32148242 -0.94809621 57 1.39746903 0.32148242 58 -2.53105012 1.39746903 59 0.37015624 -2.53105012 60 -2.11471329 0.37015624 61 1.79743993 -2.11471329 62 0.87696862 1.79743993 63 2.62585196 0.87696862 64 -1.41298964 2.62585196 65 1.85385782 -1.41298964 66 -2.24313804 1.85385782 67 2.69467037 -2.24313804 68 1.72617813 2.69467037 69 -0.85242054 1.72617813 70 2.04789210 -0.85242054 71 0.36280337 2.04789210 72 -1.45585796 0.36280337 73 -3.19620171 -1.45585796 74 -0.79547557 -3.19620171 75 -1.43213924 -0.79547557 76 -0.35572657 -1.43213924 77 0.07434820 -0.35572657 78 3.14103868 0.07434820 79 -1.91196964 3.14103868 80 -2.70611238 -1.91196964 81 1.64492930 -2.70611238 82 -0.14094697 1.64492930 83 -1.12419828 -0.14094697 84 3.92879963 -1.12419828 85 -0.28019908 3.92879963 86 -0.36171217 -0.28019908 87 0.06668567 -0.36171217 88 1.13779265 0.06668567 89 -0.48116480 1.13779265 90 0.86302126 -0.48116480 91 -3.61319090 0.86302126 92 0.46275108 -3.61319090 93 1.60362068 0.46275108 94 0.51710715 1.60362068 95 0.65245081 0.51710715 96 -2.09468732 0.65245081 97 -0.69138666 -2.09468732 98 -1.60214894 -0.69138666 99 0.46103623 -1.60214894 100 0.42141787 0.46103623 101 1.09051152 0.42141787 102 -1.36850274 1.09051152 103 2.03559333 -1.36850274 104 -3.05673560 2.03559333 105 -0.71243171 -3.05673560 106 -1.51764491 -0.71243171 107 -1.26223514 -1.51764491 108 -2.22646717 -1.26223514 109 -2.64198213 -2.22646717 110 -0.86482046 -2.64198213 111 -1.13174056 -0.86482046 112 -0.07886609 -1.13174056 113 0.74198050 -0.07886609 114 0.55603273 0.74198050 115 2.59202095 0.55603273 116 3.12459317 2.59202095 117 -1.75680353 3.12459317 118 -0.13864025 -1.75680353 119 3.20067178 -0.13864025 120 0.52100657 3.20067178 121 1.54690435 0.52100657 122 -2.79187918 1.54690435 123 -1.00628038 -2.79187918 124 2.11490002 -1.00628038 125 1.47544159 2.11490002 126 0.60105951 1.47544159 127 -0.65282476 0.60105951 128 -0.31051927 -0.65282476 129 -1.83946302 -0.31051927 130 -0.01261754 -1.83946302 131 2.47580467 -0.01261754 132 -1.20997499 2.47580467 133 -0.88772200 -1.20997499 134 2.02715894 -0.88772200 135 1.67593025 2.02715894 136 0.52301700 1.67593025 137 -3.27701955 0.52301700 138 5.17275983 -3.27701955 139 -0.83425349 5.17275983 140 0.25474793 -0.83425349 141 -0.23955530 0.25474793 142 2.71047101 -0.23955530 143 -0.70031081 2.71047101 144 1.20910984 -0.70031081 145 -0.66281156 1.20910984 146 -3.12049613 -0.66281156 147 -4.53755963 -3.12049613 148 1.28969907 -4.53755963 149 1.96359093 1.28969907 150 -0.32647866 1.96359093 151 0.86275821 -0.32647866 152 -1.25358215 0.86275821 153 0.50455268 -1.25358215 154 0.41293571 0.50455268 155 1.43740699 0.41293571 156 NA 1.43740699 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] 0.99879387 1.64171298 [2,] 1.91914295 0.99879387 [3,] 0.87978603 1.91914295 [4,] -0.88087510 0.87978603 [5,] 2.82633291 -0.88087510 [6,] -1.82504351 2.82633291 [7,] -1.25559119 -1.82504351 [8,] -0.59224728 -1.25559119 [9,] 3.42133838 -0.59224728 [10,] -2.21562790 3.42133838 [11,] -1.03389239 -2.21562790 [12,] 2.58898245 -1.03389239 [13,] -4.43909438 2.58898245 [14,] -0.55069702 -4.43909438 [15,] 0.37930601 -0.55069702 [16,] -2.00049608 0.37930601 [17,] -0.36336872 -2.00049608 [18,] 1.38201228 -0.36336872 [19,] -3.28859807 1.38201228 [20,] 2.21056876 -3.28859807 [21,] 0.51020734 2.21056876 [22,] -0.88077846 0.51020734 [23,] 2.37068548 -0.88077846 [24,] 0.96674966 2.37068548 [25,] 0.38079256 0.96674966 [26,] -5.45220010 0.38079256 [27,] 0.27187518 -5.45220010 [28,] -0.02560476 0.27187518 [29,] 4.91289200 -0.02560476 [30,] 4.29884534 4.91289200 [31,] -1.59174164 4.29884534 [32,] -0.74428662 -1.59174164 [33,] 0.86525632 -0.74428662 [34,] -1.49711705 0.86525632 [35,] 1.48410225 -1.49711705 [36,] -1.15464423 1.48410225 [37,] 0.39647218 -1.15464423 [38,] 0.06636360 0.39647218 [39,] 0.32238850 0.06636360 [40,] 0.96102473 0.32238850 [41,] 6.97880405 0.96102473 [42,] -4.68770750 6.97880405 [43,] -2.25814804 -4.68770750 [44,] -0.27957150 -2.25814804 [45,] 2.13395609 -0.27957150 [46,] 2.67448517 2.13395609 [47,] 0.79461748 2.67448517 [48,] -2.40479003 0.79461748 [49,] -1.46833846 -2.40479003 [50,] -1.08457035 -1.46833846 [51,] -6.42798022 -1.08457035 [52,] -0.16861807 -6.42798022 [53,] -2.56336361 -0.16861807 [54,] 2.09281420 -2.56336361 [55,] -0.94809621 2.09281420 [56,] 0.32148242 -0.94809621 [57,] 1.39746903 0.32148242 [58,] -2.53105012 1.39746903 [59,] 0.37015624 -2.53105012 [60,] -2.11471329 0.37015624 [61,] 1.79743993 -2.11471329 [62,] 0.87696862 1.79743993 [63,] 2.62585196 0.87696862 [64,] -1.41298964 2.62585196 [65,] 1.85385782 -1.41298964 [66,] -2.24313804 1.85385782 [67,] 2.69467037 -2.24313804 [68,] 1.72617813 2.69467037 [69,] -0.85242054 1.72617813 [70,] 2.04789210 -0.85242054 [71,] 0.36280337 2.04789210 [72,] -1.45585796 0.36280337 [73,] -3.19620171 -1.45585796 [74,] -0.79547557 -3.19620171 [75,] -1.43213924 -0.79547557 [76,] -0.35572657 -1.43213924 [77,] 0.07434820 -0.35572657 [78,] 3.14103868 0.07434820 [79,] -1.91196964 3.14103868 [80,] -2.70611238 -1.91196964 [81,] 1.64492930 -2.70611238 [82,] -0.14094697 1.64492930 [83,] -1.12419828 -0.14094697 [84,] 3.92879963 -1.12419828 [85,] -0.28019908 3.92879963 [86,] -0.36171217 -0.28019908 [87,] 0.06668567 -0.36171217 [88,] 1.13779265 0.06668567 [89,] -0.48116480 1.13779265 [90,] 0.86302126 -0.48116480 [91,] -3.61319090 0.86302126 [92,] 0.46275108 -3.61319090 [93,] 1.60362068 0.46275108 [94,] 0.51710715 1.60362068 [95,] 0.65245081 0.51710715 [96,] -2.09468732 0.65245081 [97,] -0.69138666 -2.09468732 [98,] -1.60214894 -0.69138666 [99,] 0.46103623 -1.60214894 [100,] 0.42141787 0.46103623 [101,] 1.09051152 0.42141787 [102,] -1.36850274 1.09051152 [103,] 2.03559333 -1.36850274 [104,] -3.05673560 2.03559333 [105,] -0.71243171 -3.05673560 [106,] -1.51764491 -0.71243171 [107,] -1.26223514 -1.51764491 [108,] -2.22646717 -1.26223514 [109,] -2.64198213 -2.22646717 [110,] -0.86482046 -2.64198213 [111,] -1.13174056 -0.86482046 [112,] -0.07886609 -1.13174056 [113,] 0.74198050 -0.07886609 [114,] 0.55603273 0.74198050 [115,] 2.59202095 0.55603273 [116,] 3.12459317 2.59202095 [117,] -1.75680353 3.12459317 [118,] -0.13864025 -1.75680353 [119,] 3.20067178 -0.13864025 [120,] 0.52100657 3.20067178 [121,] 1.54690435 0.52100657 [122,] -2.79187918 1.54690435 [123,] -1.00628038 -2.79187918 [124,] 2.11490002 -1.00628038 [125,] 1.47544159 2.11490002 [126,] 0.60105951 1.47544159 [127,] -0.65282476 0.60105951 [128,] -0.31051927 -0.65282476 [129,] -1.83946302 -0.31051927 [130,] -0.01261754 -1.83946302 [131,] 2.47580467 -0.01261754 [132,] -1.20997499 2.47580467 [133,] -0.88772200 -1.20997499 [134,] 2.02715894 -0.88772200 [135,] 1.67593025 2.02715894 [136,] 0.52301700 1.67593025 [137,] -3.27701955 0.52301700 [138,] 5.17275983 -3.27701955 [139,] -0.83425349 5.17275983 [140,] 0.25474793 -0.83425349 [141,] -0.23955530 0.25474793 [142,] 2.71047101 -0.23955530 [143,] -0.70031081 2.71047101 [144,] 1.20910984 -0.70031081 [145,] -0.66281156 1.20910984 [146,] -3.12049613 -0.66281156 [147,] -4.53755963 -3.12049613 [148,] 1.28969907 -4.53755963 [149,] 1.96359093 1.28969907 [150,] -0.32647866 1.96359093 [151,] 0.86275821 -0.32647866 [152,] -1.25358215 0.86275821 [153,] 0.50455268 -1.25358215 [154,] 0.41293571 0.50455268 [155,] 1.43740699 0.41293571 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 0.99879387 1.64171298 2 1.91914295 0.99879387 3 0.87978603 1.91914295 4 -0.88087510 0.87978603 5 2.82633291 -0.88087510 6 -1.82504351 2.82633291 7 -1.25559119 -1.82504351 8 -0.59224728 -1.25559119 9 3.42133838 -0.59224728 10 -2.21562790 3.42133838 11 -1.03389239 -2.21562790 12 2.58898245 -1.03389239 13 -4.43909438 2.58898245 14 -0.55069702 -4.43909438 15 0.37930601 -0.55069702 16 -2.00049608 0.37930601 17 -0.36336872 -2.00049608 18 1.38201228 -0.36336872 19 -3.28859807 1.38201228 20 2.21056876 -3.28859807 21 0.51020734 2.21056876 22 -0.88077846 0.51020734 23 2.37068548 -0.88077846 24 0.96674966 2.37068548 25 0.38079256 0.96674966 26 -5.45220010 0.38079256 27 0.27187518 -5.45220010 28 -0.02560476 0.27187518 29 4.91289200 -0.02560476 30 4.29884534 4.91289200 31 -1.59174164 4.29884534 32 -0.74428662 -1.59174164 33 0.86525632 -0.74428662 34 -1.49711705 0.86525632 35 1.48410225 -1.49711705 36 -1.15464423 1.48410225 37 0.39647218 -1.15464423 38 0.06636360 0.39647218 39 0.32238850 0.06636360 40 0.96102473 0.32238850 41 6.97880405 0.96102473 42 -4.68770750 6.97880405 43 -2.25814804 -4.68770750 44 -0.27957150 -2.25814804 45 2.13395609 -0.27957150 46 2.67448517 2.13395609 47 0.79461748 2.67448517 48 -2.40479003 0.79461748 49 -1.46833846 -2.40479003 50 -1.08457035 -1.46833846 51 -6.42798022 -1.08457035 52 -0.16861807 -6.42798022 53 -2.56336361 -0.16861807 54 2.09281420 -2.56336361 55 -0.94809621 2.09281420 56 0.32148242 -0.94809621 57 1.39746903 0.32148242 58 -2.53105012 1.39746903 59 0.37015624 -2.53105012 60 -2.11471329 0.37015624 61 1.79743993 -2.11471329 62 0.87696862 1.79743993 63 2.62585196 0.87696862 64 -1.41298964 2.62585196 65 1.85385782 -1.41298964 66 -2.24313804 1.85385782 67 2.69467037 -2.24313804 68 1.72617813 2.69467037 69 -0.85242054 1.72617813 70 2.04789210 -0.85242054 71 0.36280337 2.04789210 72 -1.45585796 0.36280337 73 -3.19620171 -1.45585796 74 -0.79547557 -3.19620171 75 -1.43213924 -0.79547557 76 -0.35572657 -1.43213924 77 0.07434820 -0.35572657 78 3.14103868 0.07434820 79 -1.91196964 3.14103868 80 -2.70611238 -1.91196964 81 1.64492930 -2.70611238 82 -0.14094697 1.64492930 83 -1.12419828 -0.14094697 84 3.92879963 -1.12419828 85 -0.28019908 3.92879963 86 -0.36171217 -0.28019908 87 0.06668567 -0.36171217 88 1.13779265 0.06668567 89 -0.48116480 1.13779265 90 0.86302126 -0.48116480 91 -3.61319090 0.86302126 92 0.46275108 -3.61319090 93 1.60362068 0.46275108 94 0.51710715 1.60362068 95 0.65245081 0.51710715 96 -2.09468732 0.65245081 97 -0.69138666 -2.09468732 98 -1.60214894 -0.69138666 99 0.46103623 -1.60214894 100 0.42141787 0.46103623 101 1.09051152 0.42141787 102 -1.36850274 1.09051152 103 2.03559333 -1.36850274 104 -3.05673560 2.03559333 105 -0.71243171 -3.05673560 106 -1.51764491 -0.71243171 107 -1.26223514 -1.51764491 108 -2.22646717 -1.26223514 109 -2.64198213 -2.22646717 110 -0.86482046 -2.64198213 111 -1.13174056 -0.86482046 112 -0.07886609 -1.13174056 113 0.74198050 -0.07886609 114 0.55603273 0.74198050 115 2.59202095 0.55603273 116 3.12459317 2.59202095 117 -1.75680353 3.12459317 118 -0.13864025 -1.75680353 119 3.20067178 -0.13864025 120 0.52100657 3.20067178 121 1.54690435 0.52100657 122 -2.79187918 1.54690435 123 -1.00628038 -2.79187918 124 2.11490002 -1.00628038 125 1.47544159 2.11490002 126 0.60105951 1.47544159 127 -0.65282476 0.60105951 128 -0.31051927 -0.65282476 129 -1.83946302 -0.31051927 130 -0.01261754 -1.83946302 131 2.47580467 -0.01261754 132 -1.20997499 2.47580467 133 -0.88772200 -1.20997499 134 2.02715894 -0.88772200 135 1.67593025 2.02715894 136 0.52301700 1.67593025 137 -3.27701955 0.52301700 138 5.17275983 -3.27701955 139 -0.83425349 5.17275983 140 0.25474793 -0.83425349 141 -0.23955530 0.25474793 142 2.71047101 -0.23955530 143 -0.70031081 2.71047101 144 1.20910984 -0.70031081 145 -0.66281156 1.20910984 146 -3.12049613 -0.66281156 147 -4.53755963 -3.12049613 148 1.28969907 -4.53755963 149 1.96359093 1.28969907 150 -0.32647866 1.96359093 151 0.86275821 -0.32647866 152 -1.25358215 0.86275821 153 0.50455268 -1.25358215 154 0.41293571 0.50455268 155 1.43740699 0.41293571 > 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/www/rcomp/tmp/7fjb01322008504.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/www/rcomp/tmp/8ce2b1322008504.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/www/rcomp/tmp/9yutu1322008504.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/www/rcomp/tmp/10wj0j1322008504.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/www/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/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/www/rcomp/tmp/117dgd1322008504.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/www/rcomp/tmp/12syiw1322008504.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/www/rcomp/tmp/13m5qm1322008504.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/www/rcomp/tmp/14p0b51322008504.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/www/rcomp/tmp/15kn5w1322008504.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/www/rcomp/tmp/1618801322008504.tab") + } > > try(system("convert tmp/1zjrh1322008504.ps tmp/1zjrh1322008504.png",intern=TRUE)) character(0) > try(system("convert tmp/2w1q51322008504.ps tmp/2w1q51322008504.png",intern=TRUE)) character(0) > try(system("convert tmp/3nndx1322008504.ps tmp/3nndx1322008504.png",intern=TRUE)) character(0) > try(system("convert tmp/46eh41322008504.ps tmp/46eh41322008504.png",intern=TRUE)) character(0) > try(system("convert tmp/54omt1322008504.ps tmp/54omt1322008504.png",intern=TRUE)) character(0) > try(system("convert tmp/60k9o1322008504.ps tmp/60k9o1322008504.png",intern=TRUE)) character(0) > try(system("convert tmp/7fjb01322008504.ps tmp/7fjb01322008504.png",intern=TRUE)) character(0) > try(system("convert tmp/8ce2b1322008504.ps tmp/8ce2b1322008504.png",intern=TRUE)) character(0) > try(system("convert tmp/9yutu1322008504.ps tmp/9yutu1322008504.png",intern=TRUE)) character(0) > try(system("convert tmp/10wj0j1322008504.ps tmp/10wj0j1322008504.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 5.040 0.270 5.284