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(11 + ,14 + ,3 + ,2 + ,3 + ,3 + ,3 + ,7 + ,6 + ,11 + ,8 + ,5 + ,6 + ,0 + ,7 + ,7 + ,2 + ,7 + ,11 + ,12 + ,6 + ,6 + ,0 + ,6 + ,8 + ,3 + ,8 + ,11 + ,7 + ,6 + ,6 + ,6 + ,6 + ,9 + ,8 + ,8 + ,11 + ,10 + ,7 + ,8 + ,5 + ,5 + ,5 + ,7 + ,9 + ,11 + ,9 + ,3 + ,1 + ,0 + ,7 + ,7 + ,7 + ,8 + ,11 + ,16 + ,8 + ,9 + ,8 + ,8 + ,8 + ,9 + ,8 + ,11 + ,7 + ,4 + ,4 + ,0 + ,2 + ,3 + ,2 + ,7 + ,11 + ,14 + ,7 + ,7 + ,0 + ,4 + ,8 + ,4 + ,7 + ,11 + ,6 + ,4 + ,4 + ,9 + ,9 + ,4 + ,4 + ,4 + ,11 + ,16 + ,6 + ,6 + ,6 + ,6 + ,6 + ,6 + ,6 + ,11 + ,11 + ,6 + ,5 + ,6 + ,6 + ,4 + ,4 + ,7 + ,11 + ,17 + ,7 + ,7 + ,5 + ,5 + ,8 + ,9 + ,5 + ,11 + ,12 + ,4 + ,5 + ,4 + ,4 + ,8 + ,8 + ,8 + ,11 + ,7 + ,6 + ,6 + ,0 + ,2 + ,2 + ,7 + ,5 + ,11 + ,13 + ,5 + ,5 + ,0 + ,4 + ,9 + ,4 + ,4 + ,11 + ,9 + ,0 + ,2 + ,2 + ,2 + ,2 + ,2 + ,9 + ,11 + ,15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8 + ,7 + ,7 + ,12 + ,14 + ,6 + ,6 + ,5 + ,5 + ,5 + ,5 + ,9 + ,12 + ,11 + ,5 + ,5 + ,0 + ,2 + ,9 + ,2 + ,6) + ,dim=c(9 + ,156) + ,dimnames=list(c('Maand' + ,'Schoolprestaties' + ,'Sport' + ,'GoingOut' + ,'Relation' + ,'Family' + ,'Friends' + ,'Coach' + ,'Job') + ,1:156)) > y <- array(NA,dim=c(9,156),dimnames=list(c('Maand','Schoolprestaties','Sport','GoingOut','Relation','Family','Friends','Coach','Job'),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 = 'No Linear Trend' > par2 = 'Do not include Seasonal Dummies' > par1 = '2' > 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 Schoolprestaties Maand Sport GoingOut Relation Family Friends Coach Job 1 14 11 3 2 3 3 3 7 6 2 8 11 5 6 0 7 7 2 7 3 12 11 6 6 0 6 8 3 8 4 7 11 6 6 6 6 9 8 8 5 10 11 7 8 5 5 5 7 9 6 9 11 3 1 0 7 7 7 8 7 16 11 8 9 8 8 8 9 8 8 7 11 4 4 0 2 3 2 7 9 14 11 7 7 0 4 8 4 7 10 6 11 4 4 9 9 4 4 4 11 16 11 6 6 6 6 6 6 6 12 11 11 6 5 6 6 4 4 7 13 17 11 7 7 5 5 8 9 5 14 12 11 4 5 4 4 8 8 8 15 7 11 6 6 0 2 2 7 5 16 13 11 5 5 0 4 9 4 4 17 9 11 0 2 2 2 2 2 9 18 15 11 9 9 6 6 8 8 8 19 7 11 4 4 0 4 8 4 4 20 9 11 4 4 4 4 4 4 6 21 7 11 2 5 5 5 5 2 6 22 14 11 7 7 7 7 7 9 7 23 15 11 5 5 5 5 3 3 3 24 7 11 9 9 4 4 4 4 4 25 13 11 6 6 6 6 6 6 6 26 17 11 6 6 6 6 6 6 6 27 15 11 7 3 0 7 9 7 7 28 14 11 3 3 1 2 2 2 5 29 14 11 6 5 0 6 6 6 8 30 8 11 6 5 4 4 4 4 6 31 8 11 4 4 4 4 8 2 4 32 12 11 7 7 7 7 3 9 9 33 14 11 7 6 7 7 7 7 7 34 8 11 7 7 0 4 4 4 4 35 11 11 4 4 4 4 4 4 6 36 16 11 5 5 5 5 8 7 8 37 11 11 6 6 0 6 6 6 6 38 8 11 5 5 5 5 5 5 5 39 14 11 6 0 1 6 6 6 6 40 16 11 6 6 2 2 9 2 6 41 14 11 6 5 0 6 4 2 4 42 5 11 3 3 9 9 7 7 7 43 8 11 3 3 3 3 3 3 9 44 10 11 3 3 0 4 4 4 8 45 8 11 6 7 6 6 6 6 6 46 13 11 7 7 1 5 8 5 6 47 15 11 5 1 5 5 5 7 5 48 6 11 5 5 0 4 4 4 7 49 12 11 5 5 0 2 2 2 5 50 14 11 6 6 0 6 9 6 8 51 5 11 6 2 6 6 6 9 6 52 15 11 6 6 7 7 8 8 8 53 11 11 5 5 0 5 5 5 5 54 8 11 4 2 4 4 4 4 4 55 13 11 7 7 5 5 5 2 5 56 14 11 5 5 1 5 9 9 6 57 12 12 3 3 4 4 4 4 4 58 16 12 6 6 9 9 8 6 6 59 10 12 2 2 2 2 2 2 9 60 15 12 8 8 8 8 8 8 7 61 8 12 3 5 3 3 3 3 3 62 16 12 0 2 1 6 3 3 6 63 19 12 6 6 0 6 6 7 6 64 14 12 8 2 6 6 6 2 6 65 7 12 4 1 0 5 5 9 5 66 13 12 5 5 0 5 5 5 5 67 15 12 6 6 6 6 4 4 5 68 7 12 5 2 2 2 9 2 9 69 13 12 6 6 1 6 6 6 8 70 4 12 2 2 5 5 5 5 5 71 14 12 6 6 5 5 5 5 6 72 13 12 5 5 5 5 3 9 7 73 11 12 5 0 5 5 8 2 5 74 14 12 6 2 6 6 9 6 6 75 12 12 4 4 6 6 6 6 6 76 15 12 6 1 0 9 6 6 6 77 14 12 5 5 0 5 5 5 6 78 13 12 5 5 1 5 3 3 9 79 7 12 4 2 7 7 4 2 7 80 5 12 2 2 2 2 9 2 9 81 7 12 7 7 4 4 4 4 4 82 13 12 5 5 0 6 8 8 8 83 13 12 6 2 5 5 5 5 5 84 11 12 5 5 5 5 5 9 8 85 6 12 3 3 3 3 8 2 9 86 12 12 6 6 0 6 6 6 6 87 8 12 4 1 4 4 9 4 4 88 11 12 5 5 9 9 5 5 7 89 12 12 7 7 0 8 8 8 8 90 9 12 4 2 4 4 3 3 9 91 12 12 6 6 2 2 2 2 9 92 13 12 8 8 7 7 7 7 7 93 16 12 7 7 7 7 7 7 8 94 16 12 6 6 6 6 4 9 4 95 11 12 7 7 0 5 5 5 6 96 8 12 4 4 5 5 9 5 7 97 4 12 0 5 6 6 6 2 6 98 7 12 3 2 0 3 3 3 7 99 14 12 5 5 5 5 5 5 5 100 11 12 6 2 9 9 2 2 9 101 17 12 5 5 0 7 7 7 7 102 15 12 7 7 7 7 7 7 7 103 14 12 6 5 1 6 6 6 6 104 5 12 8 8 3 3 8 3 6 105 4 12 7 2 7 7 9 3 9 106 19 12 8 8 8 8 8 2 9 107 11 12 3 3 0 3 3 3 8 108 15 12 8 2 5 5 5 5 8 109 10 12 3 3 3 3 3 3 3 110 9 12 4 5 0 4 4 4 6 111 12 12 2 2 5 5 5 5 5 112 15 12 7 2 7 7 9 7 7 113 7 12 6 6 0 6 6 6 6 114 13 12 2 2 0 7 7 7 7 115 14 12 7 7 0 9 7 2 7 116 14 12 6 6 6 6 6 6 6 117 14 12 6 2 0 6 3 9 8 118 8 12 6 2 6 6 9 4 9 119 15 12 6 5 6 6 6 6 6 120 15 12 6 6 2 2 2 2 9 121 9 12 4 4 5 5 5 2 5 122 16 12 5 5 0 5 5 5 6 123 9 12 7 7 4 4 9 4 4 124 15 12 6 6 0 7 7 7 7 125 15 12 6 6 6 6 6 6 6 126 6 12 5 5 5 5 8 7 8 127 8 12 8 2 8 8 8 8 8 128 15 12 6 6 6 6 6 6 9 129 10 12 0 3 5 5 3 3 8 130 9 12 4 2 0 4 4 4 4 131 14 12 8 8 8 8 9 8 6 132 12 12 6 6 0 6 6 9 6 133 8 12 4 4 9 9 4 2 7 134 11 12 6 6 5 5 5 5 9 135 13 12 2 5 0 6 6 6 8 136 9 12 4 4 0 4 4 4 4 137 15 12 6 2 0 6 6 6 6 138 13 12 3 3 3 3 3 3 9 139 15 12 6 6 6 6 6 6 6 140 14 12 5 5 0 5 5 5 5 141 16 12 4 4 4 4 9 8 8 142 12 12 6 6 6 6 6 6 6 143 14 12 1 1 0 5 9 5 6 144 10 12 4 5 4 4 3 3 6 145 10 12 4 2 7 7 7 2 7 146 4 12 6 6 0 6 6 6 7 147 8 12 5 5 5 5 5 5 9 148 17 12 9 2 6 6 6 6 6 149 16 12 6 6 6 6 9 6 6 150 12 12 8 8 8 8 8 9 6 151 12 12 7 7 2 2 4 4 4 152 15 12 7 7 7 7 7 7 7 153 9 12 0 9 0 4 4 4 8 154 13 12 6 2 0 6 8 7 7 155 14 12 6 6 5 5 5 5 9 156 11 12 5 5 0 2 9 2 6 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) Maand Sport GoingOut Relation Family -1.0445311 0.6520827 0.4533694 0.1040109 -0.1392341 0.2677767 Friends Coach Job -0.0757162 0.3315235 0.0008058 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -9.2719 -2.2644 0.6796 2.1445 6.7718 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) -1.0445311 6.4896019 -0.161 0.8724 Maand 0.6520827 0.5514756 1.182 0.2389 Sport 0.4533694 0.1763692 2.571 0.0111 * GoingOut 0.1040109 0.1441971 0.721 0.4719 Relation -0.1392341 0.1004351 -1.386 0.1678 Family 0.2677767 0.1905155 1.406 0.1620 Friends -0.0757162 0.1381356 -0.548 0.5844 Coach 0.3315235 0.1393361 2.379 0.0186 * Job 0.0008058 0.1677641 0.005 0.9962 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 3.221 on 147 degrees of freedom Multiple R-squared: 0.1939, Adjusted R-squared: 0.15 F-statistic: 4.42 on 8 and 147 DF, p-value: 8.167e-05 > 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.5928635 0.8142729 0.40713647 [2,] 0.6406681 0.7186638 0.35933191 [3,] 0.7105972 0.5788055 0.28940275 [4,] 0.9036762 0.1926476 0.09632378 [5,] 0.8517983 0.2964035 0.14820174 [6,] 0.8491009 0.3017982 0.15089908 [7,] 0.7868303 0.4263393 0.21316966 [8,] 0.8048555 0.3902891 0.19514453 [9,] 0.7431484 0.5137032 0.25685159 [10,] 0.6723742 0.6552517 0.32762584 [11,] 0.5975054 0.8049892 0.40249461 [12,] 0.6859313 0.6281375 0.31406874 [13,] 0.7849908 0.4300184 0.21500921 [14,] 0.7315006 0.5369988 0.26849939 [15,] 0.7877060 0.4245880 0.21229401 [16,] 0.7398961 0.5202078 0.26010392 [17,] 0.8006474 0.3987052 0.19935262 [18,] 0.7919321 0.4161357 0.20806787 [19,] 0.8021880 0.3956240 0.19781199 [20,] 0.7812268 0.4375463 0.21877316 [21,] 0.7358232 0.5283535 0.26417677 [22,] 0.6852422 0.6295156 0.31475781 [23,] 0.6667944 0.6664112 0.33320561 [24,] 0.6112308 0.7775384 0.38876918 [25,] 0.6143126 0.7713747 0.38568735 [26,] 0.5599520 0.8800959 0.44004797 [27,] 0.5518569 0.8962862 0.44814311 [28,] 0.4993075 0.9986149 0.50069253 [29,] 0.5481252 0.9037496 0.45187479 [30,] 0.6049461 0.7901078 0.39505391 [31,] 0.7028679 0.5942642 0.29713212 [32,] 0.6669876 0.6660248 0.33301239 [33,] 0.6165094 0.7669812 0.38349058 [34,] 0.6192636 0.7614728 0.38073638 [35,] 0.5683079 0.8633842 0.43169209 [36,] 0.5477799 0.9044403 0.45222013 [37,] 0.5925125 0.8149751 0.40748754 [38,] 0.5634866 0.8730267 0.43651336 [39,] 0.5309630 0.9380740 0.46903701 [40,] 0.7964436 0.4071129 0.20355644 [41,] 0.7778026 0.4443949 0.22219743 [42,] 0.7410296 0.5179408 0.25897042 [43,] 0.7247850 0.5504301 0.27521505 [44,] 0.6874464 0.6251072 0.31255362 [45,] 0.6466485 0.7067030 0.35335150 [46,] 0.6047020 0.7905960 0.39529801 [47,] 0.5756692 0.8486615 0.42433075 [48,] 0.5392603 0.9214794 0.46073968 [49,] 0.4939261 0.9878522 0.50607390 [50,] 0.4681685 0.9363370 0.53183149 [51,] 0.6321691 0.7356617 0.36783085 [52,] 0.6710791 0.6578419 0.32892094 [53,] 0.6422691 0.7154618 0.35773088 [54,] 0.7730456 0.4539087 0.22695436 [55,] 0.7363490 0.5273020 0.26365098 [56,] 0.7191030 0.5617940 0.28089702 [57,] 0.7708821 0.4582359 0.22911794 [58,] 0.7351121 0.5297757 0.26488787 [59,] 0.8328913 0.3342173 0.16710866 [60,] 0.8090612 0.3818776 0.19093878 [61,] 0.7771300 0.4457400 0.22286999 [62,] 0.7472535 0.5054930 0.25274652 [63,] 0.7223148 0.5553704 0.27768518 [64,] 0.6807774 0.6384451 0.31922256 [65,] 0.6448897 0.7102205 0.35511027 [66,] 0.6105346 0.7789308 0.38946538 [67,] 0.5700524 0.8598952 0.42994760 [68,] 0.5735766 0.8528467 0.42642336 [69,] 0.5856009 0.8287982 0.41439912 [70,] 0.6649748 0.6700505 0.33502523 [71,] 0.6215943 0.7568115 0.37840574 [72,] 0.5808769 0.8382462 0.41912308 [73,] 0.5594387 0.8811227 0.44056133 [74,] 0.5482146 0.9035708 0.45178541 [75,] 0.5073589 0.9852822 0.49264111 [76,] 0.4730848 0.9461696 0.52691520 [77,] 0.4313917 0.8627834 0.56860830 [78,] 0.4169398 0.8338796 0.58306020 [79,] 0.3775374 0.7550749 0.62246257 [80,] 0.3362985 0.6725971 0.66370146 [81,] 0.2968045 0.5936091 0.70319547 [82,] 0.2777229 0.5554459 0.72227707 [83,] 0.2530733 0.5061467 0.74692666 [84,] 0.2310921 0.4621843 0.76890786 [85,] 0.2162974 0.4325948 0.78370262 [86,] 0.2461934 0.4923868 0.75380660 [87,] 0.2409578 0.4819156 0.75904220 [88,] 0.2218996 0.4437992 0.77810040 [89,] 0.1881945 0.3763890 0.81180551 [90,] 0.2022969 0.4045937 0.79770314 [91,] 0.1761057 0.3522114 0.82389430 [92,] 0.1492935 0.2985870 0.85070651 [93,] 0.2624951 0.5249902 0.73750491 [94,] 0.4879830 0.9759660 0.51201698 [95,] 0.6548206 0.6903589 0.34517943 [96,] 0.6070779 0.7858441 0.39292207 [97,] 0.5765937 0.8468126 0.42340628 [98,] 0.5265442 0.9469116 0.47345578 [99,] 0.5008931 0.9982138 0.49910690 [100,] 0.4569645 0.9139291 0.54303545 [101,] 0.4255889 0.8511778 0.57441109 [102,] 0.5476144 0.9047711 0.45238555 [103,] 0.4995665 0.9991331 0.50043345 [104,] 0.4951111 0.9902221 0.50488894 [105,] 0.4500660 0.9001319 0.54993404 [106,] 0.3943514 0.7887028 0.60564860 [107,] 0.3946351 0.7892701 0.60536493 [108,] 0.3738000 0.7476000 0.62619999 [109,] 0.3910502 0.7821004 0.60894981 [110,] 0.3416484 0.6832969 0.65835157 [111,] 0.3831053 0.7662105 0.61689473 [112,] 0.3858033 0.7716066 0.61419668 [113,] 0.3904499 0.7808997 0.60955013 [114,] 0.3646369 0.7292739 0.63536306 [115,] 0.6590853 0.6818295 0.34091474 [116,] 0.8831772 0.2336456 0.11682282 [117,] 0.8708005 0.2583990 0.12919950 [118,] 0.8341268 0.3317463 0.16587316 [119,] 0.8399568 0.3200864 0.16004322 [120,] 0.7896849 0.4206301 0.21031507 [121,] 0.7368282 0.5263437 0.26317184 [122,] 0.6734786 0.6530429 0.32652143 [123,] 0.5949916 0.8100169 0.40500843 [124,] 0.5730572 0.8538856 0.42694281 [125,] 0.5733839 0.8532322 0.42661611 [126,] 0.5499940 0.9000120 0.45000602 [127,] 0.4763029 0.9526058 0.52369708 [128,] 0.4024943 0.8049886 0.59750569 [129,] 0.4515012 0.9030024 0.54849879 [130,] 0.4485251 0.8970502 0.55147488 [131,] 0.3388323 0.6776646 0.66116770 [132,] 0.2467660 0.4935320 0.75323399 [133,] 0.1520091 0.3040181 0.84799095 > postscript(file="/var/www/rcomp/tmp/1jsee1321982348.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/2i2141321982348.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/3mydm1321982348.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/4h2fc1321982348.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/5xnnk1321982348.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 3.81951318 -3.03240183 0.52539234 -5.22110445 -2.72609992 -2.26403192 7 8 9 10 11 12 1.89579926 -2.33499184 2.17284772 -4.54123530 4.21640566 -0.16877453 13 14 15 16 17 18 3.94523555 0.97101424 -5.18147452 2.36574177 1.88764795 1.03103857 19 20 21 22 23 24 -3.15259411 -0.90013390 -1.48718545 0.61082265 4.67216793 -5.68542372 25 26 27 28 29 30 1.21640566 5.21640566 1.86670685 5.28751794 1.48340040 -2.91088356 31 32 33 34 35 36 -0.93261070 -1.69365354 1.37788055 -4.12759956 1.09986610 4.72062577 37 38 39 40 41 42 -1.61899893 -2.84105834 2.14430052 6.28381852 2.66128524 -5.75369442 43 44 45 46 47 48 -0.96082103 0.09869841 -3.88760523 0.71358740 3.91193821 -5.01525635 49 50 51 52 53 54 2.03352329 1.60653798 -7.36212129 2.57463680 -0.53722883 -1.69050056 55 56 57 58 59 60 2.03875163 1.57797008 2.00677525 3.33012752 1.32882650 0.68005677 61 62 63 64 65 66 -1.81609080 6.77183441 5.39739488 2.39972181 -5.64599259 0.81068849 67 68 69 70 71 72 3.07674346 -2.50126855 -0.13345907 -5.82100019 1.94867292 0.02772108 73 74 75 76 77 78 1.24863243 2.20751502 0.67908353 1.44564278 1.80988271 1.45831416 79 80 81 82 83 84 -3.06758134 -3.14116040 -5.22274585 -0.22692760 1.36552227 -1.82165239 85 86 87 88 89 90 -2.90279943 -1.27108161 -1.85999156 -1.00892295 -2.87724153 -1.09080480 91 92 93 94 95 96 1.09930540 -0.93559329 2.62098120 2.41993171 -2.30487784 -2.63450768 97 98 99 100 101 102 -4.28535580 -2.92498355 2.50685898 -0.38444917 3.76190884 1.62178698 103 104 105 106 107 108 0.97216338 -7.01880696 -7.38224378 6.66758624 0.97019977 2.45636616 109 110 111 112 113 114 0.39193098 -2.21316387 2.17899981 2.29327375 -6.27108161 1.43404967 115 116 117 118 119 120 0.76921245 1.56432298 -0.07836859 -3.13185532 2.66833387 4.09930540 121 122 123 124 125 126 -0.94119022 3.80988271 -2.84416507 1.20452857 2.56432298 -5.93145691 127 128 129 130 131 132 -5.69668367 2.56190564 1.49092504 -1.89951963 -0.24342130 -2.26565213 133 134 135 136 137 138 -2.53268831 -1.05374442 1.64479525 -2.10754141 2.14496196 3.38709629 139 140 141 142 143 144 2.56432298 1.81068849 4.49865861 -0.43567702 4.34226843 -0.40042013 145 146 147 148 149 150 0.15956712 -9.27188739 -3.49636415 3.62025840 3.79147145 -2.65066096 151 152 153 154 155 156 0.03433934 1.62178698 -0.81734147 -0.03593502 1.94625558 0.91064792 > postscript(file="/var/www/rcomp/tmp/6jgpa1321982348.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 3.81951318 NA 1 -3.03240183 3.81951318 2 0.52539234 -3.03240183 3 -5.22110445 0.52539234 4 -2.72609992 -5.22110445 5 -2.26403192 -2.72609992 6 1.89579926 -2.26403192 7 -2.33499184 1.89579926 8 2.17284772 -2.33499184 9 -4.54123530 2.17284772 10 4.21640566 -4.54123530 11 -0.16877453 4.21640566 12 3.94523555 -0.16877453 13 0.97101424 3.94523555 14 -5.18147452 0.97101424 15 2.36574177 -5.18147452 16 1.88764795 2.36574177 17 1.03103857 1.88764795 18 -3.15259411 1.03103857 19 -0.90013390 -3.15259411 20 -1.48718545 -0.90013390 21 0.61082265 -1.48718545 22 4.67216793 0.61082265 23 -5.68542372 4.67216793 24 1.21640566 -5.68542372 25 5.21640566 1.21640566 26 1.86670685 5.21640566 27 5.28751794 1.86670685 28 1.48340040 5.28751794 29 -2.91088356 1.48340040 30 -0.93261070 -2.91088356 31 -1.69365354 -0.93261070 32 1.37788055 -1.69365354 33 -4.12759956 1.37788055 34 1.09986610 -4.12759956 35 4.72062577 1.09986610 36 -1.61899893 4.72062577 37 -2.84105834 -1.61899893 38 2.14430052 -2.84105834 39 6.28381852 2.14430052 40 2.66128524 6.28381852 41 -5.75369442 2.66128524 42 -0.96082103 -5.75369442 43 0.09869841 -0.96082103 44 -3.88760523 0.09869841 45 0.71358740 -3.88760523 46 3.91193821 0.71358740 47 -5.01525635 3.91193821 48 2.03352329 -5.01525635 49 1.60653798 2.03352329 50 -7.36212129 1.60653798 51 2.57463680 -7.36212129 52 -0.53722883 2.57463680 53 -1.69050056 -0.53722883 54 2.03875163 -1.69050056 55 1.57797008 2.03875163 56 2.00677525 1.57797008 57 3.33012752 2.00677525 58 1.32882650 3.33012752 59 0.68005677 1.32882650 60 -1.81609080 0.68005677 61 6.77183441 -1.81609080 62 5.39739488 6.77183441 63 2.39972181 5.39739488 64 -5.64599259 2.39972181 65 0.81068849 -5.64599259 66 3.07674346 0.81068849 67 -2.50126855 3.07674346 68 -0.13345907 -2.50126855 69 -5.82100019 -0.13345907 70 1.94867292 -5.82100019 71 0.02772108 1.94867292 72 1.24863243 0.02772108 73 2.20751502 1.24863243 74 0.67908353 2.20751502 75 1.44564278 0.67908353 76 1.80988271 1.44564278 77 1.45831416 1.80988271 78 -3.06758134 1.45831416 79 -3.14116040 -3.06758134 80 -5.22274585 -3.14116040 81 -0.22692760 -5.22274585 82 1.36552227 -0.22692760 83 -1.82165239 1.36552227 84 -2.90279943 -1.82165239 85 -1.27108161 -2.90279943 86 -1.85999156 -1.27108161 87 -1.00892295 -1.85999156 88 -2.87724153 -1.00892295 89 -1.09080480 -2.87724153 90 1.09930540 -1.09080480 91 -0.93559329 1.09930540 92 2.62098120 -0.93559329 93 2.41993171 2.62098120 94 -2.30487784 2.41993171 95 -2.63450768 -2.30487784 96 -4.28535580 -2.63450768 97 -2.92498355 -4.28535580 98 2.50685898 -2.92498355 99 -0.38444917 2.50685898 100 3.76190884 -0.38444917 101 1.62178698 3.76190884 102 0.97216338 1.62178698 103 -7.01880696 0.97216338 104 -7.38224378 -7.01880696 105 6.66758624 -7.38224378 106 0.97019977 6.66758624 107 2.45636616 0.97019977 108 0.39193098 2.45636616 109 -2.21316387 0.39193098 110 2.17899981 -2.21316387 111 2.29327375 2.17899981 112 -6.27108161 2.29327375 113 1.43404967 -6.27108161 114 0.76921245 1.43404967 115 1.56432298 0.76921245 116 -0.07836859 1.56432298 117 -3.13185532 -0.07836859 118 2.66833387 -3.13185532 119 4.09930540 2.66833387 120 -0.94119022 4.09930540 121 3.80988271 -0.94119022 122 -2.84416507 3.80988271 123 1.20452857 -2.84416507 124 2.56432298 1.20452857 125 -5.93145691 2.56432298 126 -5.69668367 -5.93145691 127 2.56190564 -5.69668367 128 1.49092504 2.56190564 129 -1.89951963 1.49092504 130 -0.24342130 -1.89951963 131 -2.26565213 -0.24342130 132 -2.53268831 -2.26565213 133 -1.05374442 -2.53268831 134 1.64479525 -1.05374442 135 -2.10754141 1.64479525 136 2.14496196 -2.10754141 137 3.38709629 2.14496196 138 2.56432298 3.38709629 139 1.81068849 2.56432298 140 4.49865861 1.81068849 141 -0.43567702 4.49865861 142 4.34226843 -0.43567702 143 -0.40042013 4.34226843 144 0.15956712 -0.40042013 145 -9.27188739 0.15956712 146 -3.49636415 -9.27188739 147 3.62025840 -3.49636415 148 3.79147145 3.62025840 149 -2.65066096 3.79147145 150 0.03433934 -2.65066096 151 1.62178698 0.03433934 152 -0.81734147 1.62178698 153 -0.03593502 -0.81734147 154 1.94625558 -0.03593502 155 0.91064792 1.94625558 156 NA 0.91064792 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -3.03240183 3.81951318 [2,] 0.52539234 -3.03240183 [3,] -5.22110445 0.52539234 [4,] -2.72609992 -5.22110445 [5,] -2.26403192 -2.72609992 [6,] 1.89579926 -2.26403192 [7,] -2.33499184 1.89579926 [8,] 2.17284772 -2.33499184 [9,] -4.54123530 2.17284772 [10,] 4.21640566 -4.54123530 [11,] -0.16877453 4.21640566 [12,] 3.94523555 -0.16877453 [13,] 0.97101424 3.94523555 [14,] -5.18147452 0.97101424 [15,] 2.36574177 -5.18147452 [16,] 1.88764795 2.36574177 [17,] 1.03103857 1.88764795 [18,] -3.15259411 1.03103857 [19,] -0.90013390 -3.15259411 [20,] -1.48718545 -0.90013390 [21,] 0.61082265 -1.48718545 [22,] 4.67216793 0.61082265 [23,] -5.68542372 4.67216793 [24,] 1.21640566 -5.68542372 [25,] 5.21640566 1.21640566 [26,] 1.86670685 5.21640566 [27,] 5.28751794 1.86670685 [28,] 1.48340040 5.28751794 [29,] -2.91088356 1.48340040 [30,] -0.93261070 -2.91088356 [31,] -1.69365354 -0.93261070 [32,] 1.37788055 -1.69365354 [33,] -4.12759956 1.37788055 [34,] 1.09986610 -4.12759956 [35,] 4.72062577 1.09986610 [36,] -1.61899893 4.72062577 [37,] -2.84105834 -1.61899893 [38,] 2.14430052 -2.84105834 [39,] 6.28381852 2.14430052 [40,] 2.66128524 6.28381852 [41,] -5.75369442 2.66128524 [42,] -0.96082103 -5.75369442 [43,] 0.09869841 -0.96082103 [44,] -3.88760523 0.09869841 [45,] 0.71358740 -3.88760523 [46,] 3.91193821 0.71358740 [47,] -5.01525635 3.91193821 [48,] 2.03352329 -5.01525635 [49,] 1.60653798 2.03352329 [50,] -7.36212129 1.60653798 [51,] 2.57463680 -7.36212129 [52,] -0.53722883 2.57463680 [53,] -1.69050056 -0.53722883 [54,] 2.03875163 -1.69050056 [55,] 1.57797008 2.03875163 [56,] 2.00677525 1.57797008 [57,] 3.33012752 2.00677525 [58,] 1.32882650 3.33012752 [59,] 0.68005677 1.32882650 [60,] -1.81609080 0.68005677 [61,] 6.77183441 -1.81609080 [62,] 5.39739488 6.77183441 [63,] 2.39972181 5.39739488 [64,] -5.64599259 2.39972181 [65,] 0.81068849 -5.64599259 [66,] 3.07674346 0.81068849 [67,] -2.50126855 3.07674346 [68,] -0.13345907 -2.50126855 [69,] -5.82100019 -0.13345907 [70,] 1.94867292 -5.82100019 [71,] 0.02772108 1.94867292 [72,] 1.24863243 0.02772108 [73,] 2.20751502 1.24863243 [74,] 0.67908353 2.20751502 [75,] 1.44564278 0.67908353 [76,] 1.80988271 1.44564278 [77,] 1.45831416 1.80988271 [78,] -3.06758134 1.45831416 [79,] -3.14116040 -3.06758134 [80,] -5.22274585 -3.14116040 [81,] -0.22692760 -5.22274585 [82,] 1.36552227 -0.22692760 [83,] -1.82165239 1.36552227 [84,] -2.90279943 -1.82165239 [85,] -1.27108161 -2.90279943 [86,] -1.85999156 -1.27108161 [87,] -1.00892295 -1.85999156 [88,] -2.87724153 -1.00892295 [89,] -1.09080480 -2.87724153 [90,] 1.09930540 -1.09080480 [91,] -0.93559329 1.09930540 [92,] 2.62098120 -0.93559329 [93,] 2.41993171 2.62098120 [94,] -2.30487784 2.41993171 [95,] -2.63450768 -2.30487784 [96,] -4.28535580 -2.63450768 [97,] -2.92498355 -4.28535580 [98,] 2.50685898 -2.92498355 [99,] -0.38444917 2.50685898 [100,] 3.76190884 -0.38444917 [101,] 1.62178698 3.76190884 [102,] 0.97216338 1.62178698 [103,] -7.01880696 0.97216338 [104,] -7.38224378 -7.01880696 [105,] 6.66758624 -7.38224378 [106,] 0.97019977 6.66758624 [107,] 2.45636616 0.97019977 [108,] 0.39193098 2.45636616 [109,] -2.21316387 0.39193098 [110,] 2.17899981 -2.21316387 [111,] 2.29327375 2.17899981 [112,] -6.27108161 2.29327375 [113,] 1.43404967 -6.27108161 [114,] 0.76921245 1.43404967 [115,] 1.56432298 0.76921245 [116,] -0.07836859 1.56432298 [117,] -3.13185532 -0.07836859 [118,] 2.66833387 -3.13185532 [119,] 4.09930540 2.66833387 [120,] -0.94119022 4.09930540 [121,] 3.80988271 -0.94119022 [122,] -2.84416507 3.80988271 [123,] 1.20452857 -2.84416507 [124,] 2.56432298 1.20452857 [125,] -5.93145691 2.56432298 [126,] -5.69668367 -5.93145691 [127,] 2.56190564 -5.69668367 [128,] 1.49092504 2.56190564 [129,] -1.89951963 1.49092504 [130,] -0.24342130 -1.89951963 [131,] -2.26565213 -0.24342130 [132,] -2.53268831 -2.26565213 [133,] -1.05374442 -2.53268831 [134,] 1.64479525 -1.05374442 [135,] -2.10754141 1.64479525 [136,] 2.14496196 -2.10754141 [137,] 3.38709629 2.14496196 [138,] 2.56432298 3.38709629 [139,] 1.81068849 2.56432298 [140,] 4.49865861 1.81068849 [141,] -0.43567702 4.49865861 [142,] 4.34226843 -0.43567702 [143,] -0.40042013 4.34226843 [144,] 0.15956712 -0.40042013 [145,] -9.27188739 0.15956712 [146,] -3.49636415 -9.27188739 [147,] 3.62025840 -3.49636415 [148,] 3.79147145 3.62025840 [149,] -2.65066096 3.79147145 [150,] 0.03433934 -2.65066096 [151,] 1.62178698 0.03433934 [152,] -0.81734147 1.62178698 [153,] -0.03593502 -0.81734147 [154,] 1.94625558 -0.03593502 [155,] 0.91064792 1.94625558 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -3.03240183 3.81951318 2 0.52539234 -3.03240183 3 -5.22110445 0.52539234 4 -2.72609992 -5.22110445 5 -2.26403192 -2.72609992 6 1.89579926 -2.26403192 7 -2.33499184 1.89579926 8 2.17284772 -2.33499184 9 -4.54123530 2.17284772 10 4.21640566 -4.54123530 11 -0.16877453 4.21640566 12 3.94523555 -0.16877453 13 0.97101424 3.94523555 14 -5.18147452 0.97101424 15 2.36574177 -5.18147452 16 1.88764795 2.36574177 17 1.03103857 1.88764795 18 -3.15259411 1.03103857 19 -0.90013390 -3.15259411 20 -1.48718545 -0.90013390 21 0.61082265 -1.48718545 22 4.67216793 0.61082265 23 -5.68542372 4.67216793 24 1.21640566 -5.68542372 25 5.21640566 1.21640566 26 1.86670685 5.21640566 27 5.28751794 1.86670685 28 1.48340040 5.28751794 29 -2.91088356 1.48340040 30 -0.93261070 -2.91088356 31 -1.69365354 -0.93261070 32 1.37788055 -1.69365354 33 -4.12759956 1.37788055 34 1.09986610 -4.12759956 35 4.72062577 1.09986610 36 -1.61899893 4.72062577 37 -2.84105834 -1.61899893 38 2.14430052 -2.84105834 39 6.28381852 2.14430052 40 2.66128524 6.28381852 41 -5.75369442 2.66128524 42 -0.96082103 -5.75369442 43 0.09869841 -0.96082103 44 -3.88760523 0.09869841 45 0.71358740 -3.88760523 46 3.91193821 0.71358740 47 -5.01525635 3.91193821 48 2.03352329 -5.01525635 49 1.60653798 2.03352329 50 -7.36212129 1.60653798 51 2.57463680 -7.36212129 52 -0.53722883 2.57463680 53 -1.69050056 -0.53722883 54 2.03875163 -1.69050056 55 1.57797008 2.03875163 56 2.00677525 1.57797008 57 3.33012752 2.00677525 58 1.32882650 3.33012752 59 0.68005677 1.32882650 60 -1.81609080 0.68005677 61 6.77183441 -1.81609080 62 5.39739488 6.77183441 63 2.39972181 5.39739488 64 -5.64599259 2.39972181 65 0.81068849 -5.64599259 66 3.07674346 0.81068849 67 -2.50126855 3.07674346 68 -0.13345907 -2.50126855 69 -5.82100019 -0.13345907 70 1.94867292 -5.82100019 71 0.02772108 1.94867292 72 1.24863243 0.02772108 73 2.20751502 1.24863243 74 0.67908353 2.20751502 75 1.44564278 0.67908353 76 1.80988271 1.44564278 77 1.45831416 1.80988271 78 -3.06758134 1.45831416 79 -3.14116040 -3.06758134 80 -5.22274585 -3.14116040 81 -0.22692760 -5.22274585 82 1.36552227 -0.22692760 83 -1.82165239 1.36552227 84 -2.90279943 -1.82165239 85 -1.27108161 -2.90279943 86 -1.85999156 -1.27108161 87 -1.00892295 -1.85999156 88 -2.87724153 -1.00892295 89 -1.09080480 -2.87724153 90 1.09930540 -1.09080480 91 -0.93559329 1.09930540 92 2.62098120 -0.93559329 93 2.41993171 2.62098120 94 -2.30487784 2.41993171 95 -2.63450768 -2.30487784 96 -4.28535580 -2.63450768 97 -2.92498355 -4.28535580 98 2.50685898 -2.92498355 99 -0.38444917 2.50685898 100 3.76190884 -0.38444917 101 1.62178698 3.76190884 102 0.97216338 1.62178698 103 -7.01880696 0.97216338 104 -7.38224378 -7.01880696 105 6.66758624 -7.38224378 106 0.97019977 6.66758624 107 2.45636616 0.97019977 108 0.39193098 2.45636616 109 -2.21316387 0.39193098 110 2.17899981 -2.21316387 111 2.29327375 2.17899981 112 -6.27108161 2.29327375 113 1.43404967 -6.27108161 114 0.76921245 1.43404967 115 1.56432298 0.76921245 116 -0.07836859 1.56432298 117 -3.13185532 -0.07836859 118 2.66833387 -3.13185532 119 4.09930540 2.66833387 120 -0.94119022 4.09930540 121 3.80988271 -0.94119022 122 -2.84416507 3.80988271 123 1.20452857 -2.84416507 124 2.56432298 1.20452857 125 -5.93145691 2.56432298 126 -5.69668367 -5.93145691 127 2.56190564 -5.69668367 128 1.49092504 2.56190564 129 -1.89951963 1.49092504 130 -0.24342130 -1.89951963 131 -2.26565213 -0.24342130 132 -2.53268831 -2.26565213 133 -1.05374442 -2.53268831 134 1.64479525 -1.05374442 135 -2.10754141 1.64479525 136 2.14496196 -2.10754141 137 3.38709629 2.14496196 138 2.56432298 3.38709629 139 1.81068849 2.56432298 140 4.49865861 1.81068849 141 -0.43567702 4.49865861 142 4.34226843 -0.43567702 143 -0.40042013 4.34226843 144 0.15956712 -0.40042013 145 -9.27188739 0.15956712 146 -3.49636415 -9.27188739 147 3.62025840 -3.49636415 148 3.79147145 3.62025840 149 -2.65066096 3.79147145 150 0.03433934 -2.65066096 151 1.62178698 0.03433934 152 -0.81734147 1.62178698 153 -0.03593502 -0.81734147 154 1.94625558 -0.03593502 155 0.91064792 1.94625558 > 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/739cj1321982348.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/8hpz11321982348.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/9ief01321982348.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/10hh531321982348.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/11fipw1321982348.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/12l49j1321982348.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/13sw4c1321982348.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/14dtmh1321982348.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/153y0k1321982348.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/16o0m61321982348.tab") + } > > try(system("convert tmp/1jsee1321982348.ps tmp/1jsee1321982348.png",intern=TRUE)) character(0) > try(system("convert tmp/2i2141321982348.ps tmp/2i2141321982348.png",intern=TRUE)) character(0) > try(system("convert tmp/3mydm1321982348.ps tmp/3mydm1321982348.png",intern=TRUE)) character(0) > try(system("convert tmp/4h2fc1321982348.ps tmp/4h2fc1321982348.png",intern=TRUE)) character(0) > try(system("convert tmp/5xnnk1321982348.ps tmp/5xnnk1321982348.png",intern=TRUE)) character(0) > try(system("convert tmp/6jgpa1321982348.ps tmp/6jgpa1321982348.png",intern=TRUE)) character(0) > try(system("convert tmp/739cj1321982348.ps tmp/739cj1321982348.png",intern=TRUE)) character(0) > try(system("convert tmp/8hpz11321982348.ps tmp/8hpz11321982348.png",intern=TRUE)) character(0) > try(system("convert tmp/9ief01321982348.ps tmp/9ief01321982348.png",intern=TRUE)) character(0) > try(system("convert tmp/10hh531321982348.ps tmp/10hh531321982348.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 6.500 0.400 6.975