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(11 + ,7 + ,3 + ,2 + ,3 + ,7 + ,6 + ,11 + ,7 + ,5 + ,6 + ,0 + ,7 + ,7 + ,11 + ,6 + ,6 + ,6 + ,0 + ,8 + ,8 + ,11 + ,6 + ,6 + ,6 + ,6 + ,9 + ,8 + ,11 + ,8 + ,7 + ,8 + ,5 + ,5 + ,9 + ,11 + ,8 + ,3 + ,1 + ,0 + ,7 + ,8 + ,11 + ,8 + ,2 + ,9 + ,8 + ,8 + ,8 + ,11 + ,5 + ,4 + ,4 + ,0 + ,7 + ,7 + ,11 + ,4 + ,7 + ,7 + ,0 + ,8 + ,7 + ,11 + ,9 + ,4 + ,4 + ,9 + ,8 + ,4 + ,11 + ,6 + ,6 + ,6 + ,6 + ,6 + ,6 + ,11 + ,6 + ,6 + ,5 + ,6 + ,4 + ,7 + ,11 + ,5 + ,7 + ,7 + ,5 + ,8 + ,5 + ,11 + ,6 + ,4 + ,5 + ,4 + ,8 + ,8 + ,11 + ,2 + ,6 + ,6 + ,0 + ,7 + ,5 + ,11 + ,4 + ,5 + ,5 + ,0 + ,9 + ,4 + ,11 + ,2 + ,0 + ,2 + ,2 + ,2 + ,9 + ,11 + ,6 + ,9 + ,9 + ,6 + ,8 + ,8 + ,11 + ,7 + ,4 + ,4 + ,0 + ,8 + ,4 + ,11 + ,8 + ,2 + ,4 + ,4 + ,4 + ,6 + ,11 + ,5 + ,2 + ,5 + ,5 + ,5 + ,6 + ,11 + ,7 + ,7 + ,7 + ,7 + ,7 + ,7 + ,11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+ ,5 + ,5 + ,5 + ,0 + ,5 + ,5 + ,12 + ,4 + ,4 + ,4 + ,4 + ,9 + ,8 + ,12 + ,6 + ,6 + ,6 + ,6 + ,6 + ,6 + ,12 + ,5 + ,1 + ,1 + ,0 + ,9 + ,6 + ,12 + ,4 + ,4 + ,5 + ,4 + ,3 + ,6 + ,12 + ,7 + ,4 + ,2 + ,7 + ,7 + ,7 + ,12 + ,6 + ,6 + ,6 + ,0 + ,6 + ,7 + ,12 + ,7 + ,5 + ,5 + ,5 + ,5 + ,9 + ,12 + ,6 + ,9 + ,2 + ,6 + ,6 + ,6 + ,12 + ,6 + ,6 + ,6 + ,6 + ,9 + ,6 + ,12 + ,8 + ,8 + ,8 + ,8 + ,8 + ,6 + ,12 + ,7 + ,7 + ,7 + ,2 + ,7 + ,4 + ,12 + ,7 + ,7 + ,7 + ,7 + ,7 + ,7 + ,12 + ,4 + ,0 + ,9 + ,0 + ,4 + ,8 + ,12 + ,6 + ,2 + ,2 + ,0 + ,8 + ,7 + ,12 + ,5 + ,6 + ,6 + ,5 + ,5 + ,9 + ,12 + ,2 + ,5 + ,5 + ,0 + ,9 + ,6) + ,dim=c(7 + ,156) + ,dimnames=list(c('Maand' + ,'Schoolprestaties' + ,'Sport' + ,'GoingOut' + ,'Relation' + ,'Friends' + ,'Job') + ,1:156)) > y <- array(NA,dim=c(7,156),dimnames=list(c('Maand','Schoolprestaties','Sport','GoingOut','Relation','Friends','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 Friends Job 1 7 11 3 2 3 7 6 2 7 11 5 6 0 7 7 3 6 11 6 6 0 8 8 4 6 11 6 6 6 9 8 5 8 11 7 8 5 5 9 6 8 11 3 1 0 7 8 7 8 11 2 9 8 8 8 8 5 11 4 4 0 7 7 9 4 11 7 7 0 8 7 10 9 11 4 4 9 8 4 11 6 11 6 6 6 6 6 12 6 11 6 5 6 4 7 13 5 11 7 7 5 8 5 14 6 11 4 5 4 8 8 15 2 11 6 6 0 7 5 16 4 11 5 5 0 9 4 17 2 11 0 2 2 2 9 18 6 11 9 9 6 8 8 19 7 11 4 4 0 8 4 20 8 11 2 4 4 4 6 21 5 11 2 5 5 5 6 22 7 11 7 7 7 7 7 23 5 11 5 5 5 8 3 24 4 11 9 9 4 4 4 25 6 11 6 6 6 6 6 26 6 11 6 6 6 6 6 27 7 11 7 3 0 9 7 28 7 11 3 3 1 7 5 29 8 11 6 5 0 6 8 30 4 11 6 5 4 4 6 31 4 11 4 4 4 8 4 32 7 11 7 7 7 3 9 33 7 11 7 6 7 7 7 34 4 11 2 7 0 4 4 35 7 11 4 4 4 7 6 36 5 11 5 5 5 8 8 37 6 11 6 6 0 6 6 38 5 11 5 5 5 5 5 39 6 11 6 0 1 6 6 40 7 11 6 6 2 9 6 41 6 11 6 5 0 8 4 42 9 11 3 3 9 7 7 43 7 11 3 3 3 3 9 44 4 11 3 3 0 4 8 45 6 11 6 7 6 6 6 46 5 11 7 7 1 8 6 47 5 11 5 1 5 5 5 48 4 11 5 5 0 7 7 49 7 11 5 5 0 7 5 50 6 11 6 6 0 9 8 51 6 11 2 2 6 6 6 52 7 11 6 6 7 8 8 53 5 11 5 5 0 5 5 54 4 11 4 2 4 4 4 55 5 11 7 7 5 8 5 56 5 11 5 5 1 9 6 57 4 12 3 3 4 4 4 58 9 12 6 6 9 8 6 59 8 12 2 2 2 2 9 60 8 12 8 8 8 8 7 61 3 12 3 5 3 7 3 62 6 12 0 2 1 7 6 63 6 12 2 6 0 6 6 64 6 12 8 2 6 6 6 65 5 12 4 1 0 5 5 66 5 12 5 5 0 8 5 67 6 12 6 6 6 4 5 68 7 12 5 2 2 9 9 69 6 12 6 6 1 6 8 70 5 12 2 2 5 5 5 71 5 12 6 6 5 5 6 72 7 12 2 5 5 7 7 73 5 12 5 0 5 8 5 74 6 12 6 2 6 9 6 75 6 12 4 4 6 6 6 76 9 12 6 1 0 6 6 77 8 12 5 5 0 5 6 78 5 12 5 5 1 3 9 79 7 12 4 2 7 7 7 80 7 12 2 2 2 9 9 81 4 12 7 7 4 7 4 82 6 12 5 5 0 8 8 83 5 12 6 2 5 5 5 84 5 12 5 5 5 5 8 85 3 12 3 3 3 8 9 86 6 12 6 6 0 6 6 87 4 12 4 1 4 9 4 88 9 12 5 5 9 5 7 89 8 12 7 7 0 8 8 90 4 12 4 2 4 8 9 91 2 12 6 6 2 7 9 92 7 12 8 8 7 7 7 93 7 12 7 7 7 8 8 94 6 12 6 6 6 4 4 95 5 12 7 7 0 5 6 96 8 12 4 4 5 9 7 97 6 12 0 5 6 6 6 98 3 12 3 2 0 7 7 99 5 12 5 5 5 5 5 100 9 12 6 2 9 2 9 101 7 12 5 5 0 7 7 102 7 12 7 7 7 7 7 103 6 12 6 5 1 6 6 104 3 12 8 8 3 8 6 105 7 12 7 2 7 9 9 106 8 12 8 8 8 8 9 107 3 12 3 3 0 3 8 108 5 12 8 2 5 5 8 109 8 12 3 3 3 7 3 110 7 12 4 5 0 8 6 111 5 12 2 2 5 5 5 112 7 12 7 2 7 9 7 113 6 12 6 6 0 6 6 114 7 12 2 2 0 7 7 115 9 12 7 7 0 7 7 116 6 12 6 6 6 6 6 117 6 12 6 2 0 3 8 118 6 12 6 2 6 9 9 119 6 12 6 5 6 6 6 120 2 12 6 6 2 2 9 121 5 12 4 4 5 5 5 122 5 12 2 5 0 5 6 123 4 12 7 7 4 9 4 124 7 12 6 6 0 7 7 125 6 12 6 6 6 6 6 126 5 12 5 5 5 8 8 127 8 12 8 2 8 8 8 128 7 12 6 6 6 6 9 129 5 12 0 3 5 3 8 130 4 12 4 2 0 7 4 131 8 12 8 8 8 9 6 132 6 12 6 6 0 7 6 133 9 12 4 4 9 4 7 134 5 12 6 6 5 5 9 135 6 12 2 5 0 6 8 136 4 12 4 4 0 4 4 137 6 12 2 2 0 6 6 138 3 12 3 3 3 7 9 139 6 12 6 6 6 6 6 140 5 12 5 5 0 5 5 141 4 12 4 4 4 9 8 142 6 12 6 6 6 6 6 143 5 12 1 1 0 9 6 144 4 12 4 5 4 3 6 145 7 12 4 2 7 7 7 146 6 12 6 6 0 6 7 147 7 12 5 5 5 5 9 148 6 12 9 2 6 6 6 149 6 12 6 6 6 9 6 150 8 12 8 8 8 8 6 151 7 12 7 7 2 7 4 152 7 12 7 7 7 7 7 153 4 12 0 9 0 4 8 154 6 12 2 2 0 8 7 155 5 12 6 6 5 5 9 156 2 12 5 5 0 9 6 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) Maand Sport GoingOut Relation Friends 4.55612 -0.09910 0.04966 -0.03000 0.16993 0.11909 Job 0.15153 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -4.0221 -0.8511 0.0072 0.8914 3.7414 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 4.55612 3.06251 1.488 0.13894 Maand -0.09910 0.25644 -0.386 0.69971 Sport 0.04966 0.07192 0.691 0.49095 GoingOut -0.03000 0.06561 -0.457 0.64811 Relation 0.16993 0.04347 3.909 0.00014 *** Friends 0.11909 0.06900 1.726 0.08642 . Job 0.15153 0.07804 1.942 0.05408 . --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 1.509 on 149 degrees of freedom Multiple R-squared: 0.1535, Adjusted R-squared: 0.1194 F-statistic: 4.504 on 6 and 149 DF, p-value: 0.000319 > 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.57264329 0.85471343 0.42735671 [2,] 0.56966081 0.86067838 0.43033919 [3,] 0.57536493 0.84927013 0.42463507 [4,] 0.45458154 0.90916308 0.54541846 [5,] 0.40459361 0.80918721 0.59540639 [6,] 0.55247691 0.89504618 0.44752309 [7,] 0.45581543 0.91163086 0.54418457 [8,] 0.86840248 0.26319505 0.13159752 [9,] 0.84461754 0.31076492 0.15538246 [10,] 0.88952053 0.22095894 0.11047947 [11,] 0.93593051 0.12813897 0.06406949 [12,] 0.91887474 0.16225053 0.08112526 [13,] 0.88720577 0.22558845 0.11279423 [14,] 0.86849290 0.26301421 0.13150710 [15,] 0.83652357 0.32695285 0.16347643 [16,] 0.78996325 0.42007350 0.21003675 [17,] 0.73724263 0.52551473 0.26275737 [18,] 0.69441750 0.61116501 0.30558250 [19,] 0.68951802 0.62096395 0.31048198 [20,] 0.79192148 0.41615704 0.20807852 [21,] 0.77907109 0.44185782 0.22092891 [22,] 0.80970673 0.38058655 0.19029327 [23,] 0.77441568 0.45116863 0.22558432 [24,] 0.72628702 0.54742596 0.27371298 [25,] 0.69018700 0.61962599 0.30981300 [26,] 0.64944329 0.70111342 0.35055671 [27,] 0.68944627 0.62110746 0.31055373 [28,] 0.66347955 0.67304091 0.33652045 [29,] 0.61824022 0.76351956 0.38175978 [30,] 0.56453927 0.87092146 0.43546073 [31,] 0.53339328 0.93321344 0.46660672 [32,] 0.49786682 0.99573364 0.50213318 [33,] 0.50366357 0.99267287 0.49633643 [34,] 0.47923723 0.95847446 0.52076277 [35,] 0.46493336 0.92986672 0.53506664 [36,] 0.41132086 0.82264171 0.58867914 [37,] 0.36281522 0.72563044 0.63718478 [38,] 0.33918491 0.67836983 0.66081509 [39,] 0.33495062 0.66990125 0.66504938 [40,] 0.37528957 0.75057913 0.62471043 [41,] 0.32975621 0.65951241 0.67024379 [42,] 0.29513112 0.59026224 0.70486888 [43,] 0.25831788 0.51663576 0.74168212 [44,] 0.22499596 0.44999192 0.77500404 [45,] 0.20481300 0.40962600 0.79518700 [46,] 0.18156628 0.36313255 0.81843372 [47,] 0.15999622 0.31999245 0.84000378 [48,] 0.13783418 0.27566836 0.86216582 [49,] 0.16189159 0.32378318 0.83810841 [50,] 0.19027342 0.38054684 0.80972658 [51,] 0.16338220 0.32676441 0.83661780 [52,] 0.22533348 0.45066696 0.77466652 [53,] 0.19560417 0.39120834 0.80439583 [54,] 0.17427350 0.34854700 0.82572650 [55,] 0.15410120 0.30820239 0.84589880 [56,] 0.12702658 0.25405316 0.87297342 [57,] 0.10501738 0.21003477 0.89498262 [58,] 0.08588454 0.17176908 0.91411546 [59,] 0.07569895 0.15139789 0.92430105 [60,] 0.06037917 0.12075833 0.93962083 [61,] 0.05177295 0.10354589 0.94822705 [62,] 0.04433125 0.08866249 0.95566875 [63,] 0.03671167 0.07342333 0.96328833 [64,] 0.03689948 0.07379897 0.96310052 [65,] 0.03107620 0.06215239 0.96892380 [66,] 0.02371624 0.04743249 0.97628376 [67,] 0.08291146 0.16582291 0.91708854 [68,] 0.14510956 0.29021913 0.85489044 [69,] 0.12806745 0.25613490 0.87193255 [70,] 0.10714743 0.21429486 0.89285257 [71,] 0.10052589 0.20105177 0.89947411 [72,] 0.11099166 0.22198332 0.88900834 [73,] 0.09454458 0.18908916 0.90545542 [74,] 0.08296476 0.16592953 0.91703524 [75,] 0.07873675 0.15747350 0.92126325 [76,] 0.17959879 0.35919759 0.82040121 [77,] 0.15904208 0.31808416 0.84095792 [78,] 0.18120229 0.36240459 0.81879771 [79,] 0.22154412 0.44308824 0.77845588 [80,] 0.28022217 0.56044434 0.71977783 [81,] 0.35233240 0.70466480 0.64766760 [82,] 0.61102885 0.77794229 0.38897115 [83,] 0.56635238 0.86729523 0.43364762 [84,] 0.51851028 0.96297944 0.48148972 [85,] 0.47321903 0.94643807 0.52678097 [86,] 0.42476504 0.84953007 0.57523496 [87,] 0.42977745 0.85955490 0.57022255 [88,] 0.38266169 0.76532339 0.61733831 [89,] 0.43808327 0.87616653 0.56191673 [90,] 0.40454110 0.80908220 0.59545890 [91,] 0.48131889 0.96263777 0.51868111 [92,] 0.49099306 0.98198612 0.50900694 [93,] 0.44410403 0.88820806 0.55589597 [94,] 0.40313301 0.80626602 0.59686699 [95,] 0.56469011 0.87061978 0.43530989 [96,] 0.51646385 0.96707231 0.48353615 [97,] 0.48509674 0.97019347 0.51490326 [98,] 0.50171178 0.99657644 0.49828822 [99,] 0.48268893 0.96537786 0.51731107 [100,] 0.57351539 0.85296922 0.42648461 [101,] 0.58482904 0.83034192 0.41517096 [102,] 0.53727378 0.92545244 0.46272622 [103,] 0.48362008 0.96724017 0.51637992 [104,] 0.44189326 0.88378652 0.55810674 [105,] 0.48464784 0.96929568 0.51535216 [106,] 0.75044828 0.49910344 0.24955172 [107,] 0.70402667 0.59194665 0.29597333 [108,] 0.69808799 0.60382402 0.30191201 [109,] 0.65442925 0.69114151 0.34557075 [110,] 0.60048058 0.79903884 0.39951942 [111,] 0.78816063 0.42367874 0.21183937 [112,] 0.75763426 0.48473149 0.24236574 [113,] 0.71071449 0.57857102 0.28928551 [114,] 0.76017640 0.47964720 0.23982360 [115,] 0.80622373 0.38755254 0.19377627 [116,] 0.76517910 0.46964180 0.23482090 [117,] 0.74251091 0.51497818 0.25748909 [118,] 0.71630253 0.56739494 0.28369747 [119,] 0.67781512 0.64436975 0.32218488 [120,] 0.63029155 0.73941689 0.36970845 [121,] 0.59590914 0.80818171 0.40409086 [122,] 0.54926615 0.90146771 0.45073385 [123,] 0.53258642 0.93482715 0.46741358 [124,] 0.58051786 0.83896429 0.41948214 [125,] 0.51814913 0.96370173 0.48185087 [126,] 0.53200459 0.93599081 0.46799541 [127,] 0.50405494 0.99189012 0.49594506 [128,] 0.48514648 0.97029297 0.51485352 [129,] 0.53646178 0.92707644 0.46353822 [130,] 0.44775524 0.89551049 0.55224476 [131,] 0.35460311 0.70920622 0.64539689 [132,] 0.37984524 0.75969047 0.62015476 [133,] 0.28648061 0.57296123 0.71351939 [134,] 0.20204345 0.40408689 0.79795655 [135,] 0.26101720 0.52203440 0.73898280 [136,] 0.16544240 0.33088480 0.83455760 [137,] 0.23036891 0.46073782 0.76963109 > postscript(file="/var/wessaorg/rcomp/tmp/1y2gr1324493917.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/299fi1324493917.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/3idf31324493917.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/4g0zv1324493917.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/5o2ja1324493917.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.192439377 1.571381558 0.251103806 -0.887550427 1.617561433 2.369168219 7 8 9 10 11 12 1.180336062 -0.438961526 -1.617029805 2.367178703 -0.227224754 -0.170568459 13 14 15 16 17 18 -1.163614747 -0.359284898 -3.175228748 -1.242228127 -3.347768245 -0.827435240 19 20 21 22 23 24 1.896522454 2.489452138 -0.769564745 0.312572344 -0.821246574 -1.405113192 25 26 27 28 29 30 -0.227224754 -0.227224754 1.143870731 1.713820714 2.459285339 -1.679189054 31 32 33 34 35 36 -1.783185880 0.485888799 0.282570411 -0.437783254 1.032855378 -1.578872762 37 38 39 40 41 42 0.792337747 -0.767021851 0.442399067 1.095208382 0.827202824 2.051353571 43 44 45 46 47 48 1.244232527 -1.213552717 -0.197222821 -0.635431651 -0.887029582 -1.458620375 49 50 51 52 53 54 1.844430101 0.132012073 -0.148589359 0.061614222 0.082613566 -1.366822814 55 56 57 58 59 60 -1.163614747 -0.715205686 -1.188059068 2.123911562 2.652011224 1.102995711 61 62 63 64 65 66 -2.163878080 0.780376920 1.090081904 -0.347453016 0.111367648 -0.175560600 67 68 69 70 71 72 0.261584981 0.669386751 0.418461220 -0.608944274 -0.839104906 0.939827584 73 74 75 76 77 78 -1.175205681 -0.605406651 -0.088806025 3.741429115 3.030189360 -0.356129971 79 80 81 82 83 84 0.410646056 0.818369095 -1.623969661 0.369863686 -0.807587399 -1.122496533 85 86 87 88 89 90 -3.252125104 0.891438779 -1.893182379 2.349320371 2.330545989 -2.501714902 91 92 93 94 95 96 -4.022082834 0.392014527 0.141056405 0.413110219 -0.009128337 1.572320623 97 98 99 100 101 102 0.139839033 -2.350203579 -0.667920820 2.263878514 1.640480657 0.411673376 103 104 105 106 107 108 0.691509762 -2.895843634 -0.279570229 0.799945235 -1.995359953 -1.361484675 109 110 111 112 113 114 2.776118055 1.722574943 -0.608944274 0.023480246 0.891438779 1.699457203 115 116 117 118 119 120 3.601162960 -0.128123722 0.825655770 -1.059982364 -0.158125655 -3.426624171 121 122 123 124 125 126 -0.648261971 0.179171704 -1.862153126 1.620821808 -0.128123722 -1.479771731 127 128 129 130 131 132 0.771458877 0.417300565 -0.696013026 -0.945288647 1.135429216 0.772347046 133 134 135 136 137 138 2.488070953 -1.293680619 0.757029496 -0.528009583 0.970074173 -3.133033372 139 140 141 142 143 144 -0.128123722 0.181714598 -2.409277531 -0.128123722 -0.367542176 -1.361674727 145 146 147 148 149 150 0.410646056 0.739913541 0.725978230 -0.397113797 -0.485398920 1.254520949 151 152 153 154 155 156 1.715884506 0.411673376 -0.785457745 0.580365470 -1.293680619 -3.446177571 > postscript(file="/var/wessaorg/rcomp/tmp/6si6u1324493917.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.192439377 NA 1 1.571381558 1.192439377 2 0.251103806 1.571381558 3 -0.887550427 0.251103806 4 1.617561433 -0.887550427 5 2.369168219 1.617561433 6 1.180336062 2.369168219 7 -0.438961526 1.180336062 8 -1.617029805 -0.438961526 9 2.367178703 -1.617029805 10 -0.227224754 2.367178703 11 -0.170568459 -0.227224754 12 -1.163614747 -0.170568459 13 -0.359284898 -1.163614747 14 -3.175228748 -0.359284898 15 -1.242228127 -3.175228748 16 -3.347768245 -1.242228127 17 -0.827435240 -3.347768245 18 1.896522454 -0.827435240 19 2.489452138 1.896522454 20 -0.769564745 2.489452138 21 0.312572344 -0.769564745 22 -0.821246574 0.312572344 23 -1.405113192 -0.821246574 24 -0.227224754 -1.405113192 25 -0.227224754 -0.227224754 26 1.143870731 -0.227224754 27 1.713820714 1.143870731 28 2.459285339 1.713820714 29 -1.679189054 2.459285339 30 -1.783185880 -1.679189054 31 0.485888799 -1.783185880 32 0.282570411 0.485888799 33 -0.437783254 0.282570411 34 1.032855378 -0.437783254 35 -1.578872762 1.032855378 36 0.792337747 -1.578872762 37 -0.767021851 0.792337747 38 0.442399067 -0.767021851 39 1.095208382 0.442399067 40 0.827202824 1.095208382 41 2.051353571 0.827202824 42 1.244232527 2.051353571 43 -1.213552717 1.244232527 44 -0.197222821 -1.213552717 45 -0.635431651 -0.197222821 46 -0.887029582 -0.635431651 47 -1.458620375 -0.887029582 48 1.844430101 -1.458620375 49 0.132012073 1.844430101 50 -0.148589359 0.132012073 51 0.061614222 -0.148589359 52 0.082613566 0.061614222 53 -1.366822814 0.082613566 54 -1.163614747 -1.366822814 55 -0.715205686 -1.163614747 56 -1.188059068 -0.715205686 57 2.123911562 -1.188059068 58 2.652011224 2.123911562 59 1.102995711 2.652011224 60 -2.163878080 1.102995711 61 0.780376920 -2.163878080 62 1.090081904 0.780376920 63 -0.347453016 1.090081904 64 0.111367648 -0.347453016 65 -0.175560600 0.111367648 66 0.261584981 -0.175560600 67 0.669386751 0.261584981 68 0.418461220 0.669386751 69 -0.608944274 0.418461220 70 -0.839104906 -0.608944274 71 0.939827584 -0.839104906 72 -1.175205681 0.939827584 73 -0.605406651 -1.175205681 74 -0.088806025 -0.605406651 75 3.741429115 -0.088806025 76 3.030189360 3.741429115 77 -0.356129971 3.030189360 78 0.410646056 -0.356129971 79 0.818369095 0.410646056 80 -1.623969661 0.818369095 81 0.369863686 -1.623969661 82 -0.807587399 0.369863686 83 -1.122496533 -0.807587399 84 -3.252125104 -1.122496533 85 0.891438779 -3.252125104 86 -1.893182379 0.891438779 87 2.349320371 -1.893182379 88 2.330545989 2.349320371 89 -2.501714902 2.330545989 90 -4.022082834 -2.501714902 91 0.392014527 -4.022082834 92 0.141056405 0.392014527 93 0.413110219 0.141056405 94 -0.009128337 0.413110219 95 1.572320623 -0.009128337 96 0.139839033 1.572320623 97 -2.350203579 0.139839033 98 -0.667920820 -2.350203579 99 2.263878514 -0.667920820 100 1.640480657 2.263878514 101 0.411673376 1.640480657 102 0.691509762 0.411673376 103 -2.895843634 0.691509762 104 -0.279570229 -2.895843634 105 0.799945235 -0.279570229 106 -1.995359953 0.799945235 107 -1.361484675 -1.995359953 108 2.776118055 -1.361484675 109 1.722574943 2.776118055 110 -0.608944274 1.722574943 111 0.023480246 -0.608944274 112 0.891438779 0.023480246 113 1.699457203 0.891438779 114 3.601162960 1.699457203 115 -0.128123722 3.601162960 116 0.825655770 -0.128123722 117 -1.059982364 0.825655770 118 -0.158125655 -1.059982364 119 -3.426624171 -0.158125655 120 -0.648261971 -3.426624171 121 0.179171704 -0.648261971 122 -1.862153126 0.179171704 123 1.620821808 -1.862153126 124 -0.128123722 1.620821808 125 -1.479771731 -0.128123722 126 0.771458877 -1.479771731 127 0.417300565 0.771458877 128 -0.696013026 0.417300565 129 -0.945288647 -0.696013026 130 1.135429216 -0.945288647 131 0.772347046 1.135429216 132 2.488070953 0.772347046 133 -1.293680619 2.488070953 134 0.757029496 -1.293680619 135 -0.528009583 0.757029496 136 0.970074173 -0.528009583 137 -3.133033372 0.970074173 138 -0.128123722 -3.133033372 139 0.181714598 -0.128123722 140 -2.409277531 0.181714598 141 -0.128123722 -2.409277531 142 -0.367542176 -0.128123722 143 -1.361674727 -0.367542176 144 0.410646056 -1.361674727 145 0.739913541 0.410646056 146 0.725978230 0.739913541 147 -0.397113797 0.725978230 148 -0.485398920 -0.397113797 149 1.254520949 -0.485398920 150 1.715884506 1.254520949 151 0.411673376 1.715884506 152 -0.785457745 0.411673376 153 0.580365470 -0.785457745 154 -1.293680619 0.580365470 155 -3.446177571 -1.293680619 156 NA -3.446177571 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] 1.571381558 1.192439377 [2,] 0.251103806 1.571381558 [3,] -0.887550427 0.251103806 [4,] 1.617561433 -0.887550427 [5,] 2.369168219 1.617561433 [6,] 1.180336062 2.369168219 [7,] -0.438961526 1.180336062 [8,] -1.617029805 -0.438961526 [9,] 2.367178703 -1.617029805 [10,] -0.227224754 2.367178703 [11,] -0.170568459 -0.227224754 [12,] -1.163614747 -0.170568459 [13,] -0.359284898 -1.163614747 [14,] -3.175228748 -0.359284898 [15,] -1.242228127 -3.175228748 [16,] -3.347768245 -1.242228127 [17,] -0.827435240 -3.347768245 [18,] 1.896522454 -0.827435240 [19,] 2.489452138 1.896522454 [20,] -0.769564745 2.489452138 [21,] 0.312572344 -0.769564745 [22,] -0.821246574 0.312572344 [23,] -1.405113192 -0.821246574 [24,] -0.227224754 -1.405113192 [25,] -0.227224754 -0.227224754 [26,] 1.143870731 -0.227224754 [27,] 1.713820714 1.143870731 [28,] 2.459285339 1.713820714 [29,] -1.679189054 2.459285339 [30,] -1.783185880 -1.679189054 [31,] 0.485888799 -1.783185880 [32,] 0.282570411 0.485888799 [33,] -0.437783254 0.282570411 [34,] 1.032855378 -0.437783254 [35,] -1.578872762 1.032855378 [36,] 0.792337747 -1.578872762 [37,] -0.767021851 0.792337747 [38,] 0.442399067 -0.767021851 [39,] 1.095208382 0.442399067 [40,] 0.827202824 1.095208382 [41,] 2.051353571 0.827202824 [42,] 1.244232527 2.051353571 [43,] -1.213552717 1.244232527 [44,] -0.197222821 -1.213552717 [45,] -0.635431651 -0.197222821 [46,] -0.887029582 -0.635431651 [47,] -1.458620375 -0.887029582 [48,] 1.844430101 -1.458620375 [49,] 0.132012073 1.844430101 [50,] -0.148589359 0.132012073 [51,] 0.061614222 -0.148589359 [52,] 0.082613566 0.061614222 [53,] -1.366822814 0.082613566 [54,] -1.163614747 -1.366822814 [55,] -0.715205686 -1.163614747 [56,] -1.188059068 -0.715205686 [57,] 2.123911562 -1.188059068 [58,] 2.652011224 2.123911562 [59,] 1.102995711 2.652011224 [60,] -2.163878080 1.102995711 [61,] 0.780376920 -2.163878080 [62,] 1.090081904 0.780376920 [63,] -0.347453016 1.090081904 [64,] 0.111367648 -0.347453016 [65,] -0.175560600 0.111367648 [66,] 0.261584981 -0.175560600 [67,] 0.669386751 0.261584981 [68,] 0.418461220 0.669386751 [69,] -0.608944274 0.418461220 [70,] -0.839104906 -0.608944274 [71,] 0.939827584 -0.839104906 [72,] -1.175205681 0.939827584 [73,] -0.605406651 -1.175205681 [74,] -0.088806025 -0.605406651 [75,] 3.741429115 -0.088806025 [76,] 3.030189360 3.741429115 [77,] -0.356129971 3.030189360 [78,] 0.410646056 -0.356129971 [79,] 0.818369095 0.410646056 [80,] -1.623969661 0.818369095 [81,] 0.369863686 -1.623969661 [82,] -0.807587399 0.369863686 [83,] -1.122496533 -0.807587399 [84,] -3.252125104 -1.122496533 [85,] 0.891438779 -3.252125104 [86,] -1.893182379 0.891438779 [87,] 2.349320371 -1.893182379 [88,] 2.330545989 2.349320371 [89,] -2.501714902 2.330545989 [90,] -4.022082834 -2.501714902 [91,] 0.392014527 -4.022082834 [92,] 0.141056405 0.392014527 [93,] 0.413110219 0.141056405 [94,] -0.009128337 0.413110219 [95,] 1.572320623 -0.009128337 [96,] 0.139839033 1.572320623 [97,] -2.350203579 0.139839033 [98,] -0.667920820 -2.350203579 [99,] 2.263878514 -0.667920820 [100,] 1.640480657 2.263878514 [101,] 0.411673376 1.640480657 [102,] 0.691509762 0.411673376 [103,] -2.895843634 0.691509762 [104,] -0.279570229 -2.895843634 [105,] 0.799945235 -0.279570229 [106,] -1.995359953 0.799945235 [107,] -1.361484675 -1.995359953 [108,] 2.776118055 -1.361484675 [109,] 1.722574943 2.776118055 [110,] -0.608944274 1.722574943 [111,] 0.023480246 -0.608944274 [112,] 0.891438779 0.023480246 [113,] 1.699457203 0.891438779 [114,] 3.601162960 1.699457203 [115,] -0.128123722 3.601162960 [116,] 0.825655770 -0.128123722 [117,] -1.059982364 0.825655770 [118,] -0.158125655 -1.059982364 [119,] -3.426624171 -0.158125655 [120,] -0.648261971 -3.426624171 [121,] 0.179171704 -0.648261971 [122,] -1.862153126 0.179171704 [123,] 1.620821808 -1.862153126 [124,] -0.128123722 1.620821808 [125,] -1.479771731 -0.128123722 [126,] 0.771458877 -1.479771731 [127,] 0.417300565 0.771458877 [128,] -0.696013026 0.417300565 [129,] -0.945288647 -0.696013026 [130,] 1.135429216 -0.945288647 [131,] 0.772347046 1.135429216 [132,] 2.488070953 0.772347046 [133,] -1.293680619 2.488070953 [134,] 0.757029496 -1.293680619 [135,] -0.528009583 0.757029496 [136,] 0.970074173 -0.528009583 [137,] -3.133033372 0.970074173 [138,] -0.128123722 -3.133033372 [139,] 0.181714598 -0.128123722 [140,] -2.409277531 0.181714598 [141,] -0.128123722 -2.409277531 [142,] -0.367542176 -0.128123722 [143,] -1.361674727 -0.367542176 [144,] 0.410646056 -1.361674727 [145,] 0.739913541 0.410646056 [146,] 0.725978230 0.739913541 [147,] -0.397113797 0.725978230 [148,] -0.485398920 -0.397113797 [149,] 1.254520949 -0.485398920 [150,] 1.715884506 1.254520949 [151,] 0.411673376 1.715884506 [152,] -0.785457745 0.411673376 [153,] 0.580365470 -0.785457745 [154,] -1.293680619 0.580365470 [155,] -3.446177571 -1.293680619 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 1.571381558 1.192439377 2 0.251103806 1.571381558 3 -0.887550427 0.251103806 4 1.617561433 -0.887550427 5 2.369168219 1.617561433 6 1.180336062 2.369168219 7 -0.438961526 1.180336062 8 -1.617029805 -0.438961526 9 2.367178703 -1.617029805 10 -0.227224754 2.367178703 11 -0.170568459 -0.227224754 12 -1.163614747 -0.170568459 13 -0.359284898 -1.163614747 14 -3.175228748 -0.359284898 15 -1.242228127 -3.175228748 16 -3.347768245 -1.242228127 17 -0.827435240 -3.347768245 18 1.896522454 -0.827435240 19 2.489452138 1.896522454 20 -0.769564745 2.489452138 21 0.312572344 -0.769564745 22 -0.821246574 0.312572344 23 -1.405113192 -0.821246574 24 -0.227224754 -1.405113192 25 -0.227224754 -0.227224754 26 1.143870731 -0.227224754 27 1.713820714 1.143870731 28 2.459285339 1.713820714 29 -1.679189054 2.459285339 30 -1.783185880 -1.679189054 31 0.485888799 -1.783185880 32 0.282570411 0.485888799 33 -0.437783254 0.282570411 34 1.032855378 -0.437783254 35 -1.578872762 1.032855378 36 0.792337747 -1.578872762 37 -0.767021851 0.792337747 38 0.442399067 -0.767021851 39 1.095208382 0.442399067 40 0.827202824 1.095208382 41 2.051353571 0.827202824 42 1.244232527 2.051353571 43 -1.213552717 1.244232527 44 -0.197222821 -1.213552717 45 -0.635431651 -0.197222821 46 -0.887029582 -0.635431651 47 -1.458620375 -0.887029582 48 1.844430101 -1.458620375 49 0.132012073 1.844430101 50 -0.148589359 0.132012073 51 0.061614222 -0.148589359 52 0.082613566 0.061614222 53 -1.366822814 0.082613566 54 -1.163614747 -1.366822814 55 -0.715205686 -1.163614747 56 -1.188059068 -0.715205686 57 2.123911562 -1.188059068 58 2.652011224 2.123911562 59 1.102995711 2.652011224 60 -2.163878080 1.102995711 61 0.780376920 -2.163878080 62 1.090081904 0.780376920 63 -0.347453016 1.090081904 64 0.111367648 -0.347453016 65 -0.175560600 0.111367648 66 0.261584981 -0.175560600 67 0.669386751 0.261584981 68 0.418461220 0.669386751 69 -0.608944274 0.418461220 70 -0.839104906 -0.608944274 71 0.939827584 -0.839104906 72 -1.175205681 0.939827584 73 -0.605406651 -1.175205681 74 -0.088806025 -0.605406651 75 3.741429115 -0.088806025 76 3.030189360 3.741429115 77 -0.356129971 3.030189360 78 0.410646056 -0.356129971 79 0.818369095 0.410646056 80 -1.623969661 0.818369095 81 0.369863686 -1.623969661 82 -0.807587399 0.369863686 83 -1.122496533 -0.807587399 84 -3.252125104 -1.122496533 85 0.891438779 -3.252125104 86 -1.893182379 0.891438779 87 2.349320371 -1.893182379 88 2.330545989 2.349320371 89 -2.501714902 2.330545989 90 -4.022082834 -2.501714902 91 0.392014527 -4.022082834 92 0.141056405 0.392014527 93 0.413110219 0.141056405 94 -0.009128337 0.413110219 95 1.572320623 -0.009128337 96 0.139839033 1.572320623 97 -2.350203579 0.139839033 98 -0.667920820 -2.350203579 99 2.263878514 -0.667920820 100 1.640480657 2.263878514 101 0.411673376 1.640480657 102 0.691509762 0.411673376 103 -2.895843634 0.691509762 104 -0.279570229 -2.895843634 105 0.799945235 -0.279570229 106 -1.995359953 0.799945235 107 -1.361484675 -1.995359953 108 2.776118055 -1.361484675 109 1.722574943 2.776118055 110 -0.608944274 1.722574943 111 0.023480246 -0.608944274 112 0.891438779 0.023480246 113 1.699457203 0.891438779 114 3.601162960 1.699457203 115 -0.128123722 3.601162960 116 0.825655770 -0.128123722 117 -1.059982364 0.825655770 118 -0.158125655 -1.059982364 119 -3.426624171 -0.158125655 120 -0.648261971 -3.426624171 121 0.179171704 -0.648261971 122 -1.862153126 0.179171704 123 1.620821808 -1.862153126 124 -0.128123722 1.620821808 125 -1.479771731 -0.128123722 126 0.771458877 -1.479771731 127 0.417300565 0.771458877 128 -0.696013026 0.417300565 129 -0.945288647 -0.696013026 130 1.135429216 -0.945288647 131 0.772347046 1.135429216 132 2.488070953 0.772347046 133 -1.293680619 2.488070953 134 0.757029496 -1.293680619 135 -0.528009583 0.757029496 136 0.970074173 -0.528009583 137 -3.133033372 0.970074173 138 -0.128123722 -3.133033372 139 0.181714598 -0.128123722 140 -2.409277531 0.181714598 141 -0.128123722 -2.409277531 142 -0.367542176 -0.128123722 143 -1.361674727 -0.367542176 144 0.410646056 -1.361674727 145 0.739913541 0.410646056 146 0.725978230 0.739913541 147 -0.397113797 0.725978230 148 -0.485398920 -0.397113797 149 1.254520949 -0.485398920 150 1.715884506 1.254520949 151 0.411673376 1.715884506 152 -0.785457745 0.411673376 153 0.580365470 -0.785457745 154 -1.293680619 0.580365470 155 -3.446177571 -1.293680619 > 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/74jba1324493917.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/8uuss1324493917.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/9w9j51324493917.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/10jzo11324493917.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/11d45t1324493917.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/1244pt1324493917.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/1378401324493917.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/14rbvv1324493917.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/15v65p1324493917.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/161yiy1324493917.tab") + } > > try(system("convert tmp/1y2gr1324493917.ps tmp/1y2gr1324493917.png",intern=TRUE)) character(0) > try(system("convert tmp/299fi1324493917.ps tmp/299fi1324493917.png",intern=TRUE)) character(0) > try(system("convert tmp/3idf31324493917.ps tmp/3idf31324493917.png",intern=TRUE)) character(0) > try(system("convert tmp/4g0zv1324493917.ps tmp/4g0zv1324493917.png",intern=TRUE)) character(0) > try(system("convert tmp/5o2ja1324493917.ps tmp/5o2ja1324493917.png",intern=TRUE)) character(0) > try(system("convert tmp/6si6u1324493917.ps tmp/6si6u1324493917.png",intern=TRUE)) character(0) > try(system("convert tmp/74jba1324493917.ps tmp/74jba1324493917.png",intern=TRUE)) character(0) > try(system("convert tmp/8uuss1324493917.ps tmp/8uuss1324493917.png",intern=TRUE)) character(0) > try(system("convert tmp/9w9j51324493917.ps tmp/9w9j51324493917.png",intern=TRUE)) character(0) > try(system("convert tmp/10jzo11324493917.ps tmp/10jzo11324493917.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 5.110 0.680 5.807