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 + ,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 = '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 Maand Schoolprestaties Sport GoingOut Relation Family Friends Coach Job 1 11 14 3 2 3 3 3 7 6 2 11 8 5 6 0 7 7 2 7 3 11 12 6 6 0 6 8 3 8 4 11 7 6 6 6 6 9 8 8 5 11 10 7 8 5 5 5 7 9 6 11 9 3 1 0 7 7 7 8 7 11 16 8 9 8 8 8 9 8 8 11 7 4 4 0 2 3 2 7 9 11 14 7 7 0 4 8 4 7 10 11 6 4 4 9 9 4 4 4 11 11 16 6 6 6 6 6 6 6 12 11 11 6 5 6 6 4 4 7 13 11 17 7 7 5 5 8 9 5 14 11 12 4 5 4 4 8 8 8 15 11 7 6 6 0 2 2 7 5 16 11 13 5 5 0 4 9 4 4 17 11 9 0 2 2 2 2 2 9 18 11 15 9 9 6 6 8 8 8 19 11 7 4 4 0 4 8 4 4 20 11 9 4 4 4 4 4 4 6 21 11 7 2 5 5 5 5 2 6 22 11 14 7 7 7 7 7 9 7 23 11 15 5 5 5 5 3 3 3 24 11 7 9 9 4 4 4 4 4 25 11 13 6 6 6 6 6 6 6 26 11 17 6 6 6 6 6 6 6 27 11 15 7 3 0 7 9 7 7 28 11 14 3 3 1 2 2 2 5 29 11 14 6 5 0 6 6 6 8 30 11 8 6 5 4 4 4 4 6 31 11 8 4 4 4 4 8 2 4 32 11 12 7 7 7 7 3 9 9 33 11 14 7 6 7 7 7 7 7 34 11 8 7 7 0 4 4 4 4 35 11 11 4 4 4 4 4 4 6 36 11 16 5 5 5 5 8 7 8 37 11 11 6 6 0 6 6 6 6 38 11 8 5 5 5 5 5 5 5 39 11 14 6 0 1 6 6 6 6 40 11 16 6 6 2 2 9 2 6 41 11 14 6 5 0 6 4 2 4 42 11 5 3 3 9 9 7 7 7 43 11 8 3 3 3 3 3 3 9 44 11 10 3 3 0 4 4 4 8 45 11 8 6 7 6 6 6 6 6 46 11 13 7 7 1 5 8 5 6 47 11 15 5 1 5 5 5 7 5 48 11 6 5 5 0 4 4 4 7 49 11 12 5 5 0 2 2 2 5 50 11 14 6 6 0 6 9 6 8 51 11 5 6 2 6 6 6 9 6 52 11 15 6 6 7 7 8 8 8 53 11 11 5 5 0 5 5 5 5 54 11 8 4 2 4 4 4 4 4 55 11 13 7 7 5 5 5 2 5 56 11 14 5 5 1 5 9 9 6 57 12 12 3 3 4 4 4 4 4 58 12 16 6 6 9 9 8 6 6 59 12 10 2 2 2 2 2 2 9 60 12 15 8 8 8 8 8 8 7 61 12 8 3 5 3 3 3 3 3 62 12 16 0 2 1 6 3 3 6 63 12 19 6 6 0 6 6 7 6 64 12 14 8 2 6 6 6 2 6 65 12 7 4 1 0 5 5 9 5 66 12 13 5 5 0 5 5 5 5 67 12 15 6 6 6 6 4 4 5 68 12 7 5 2 2 2 9 2 9 69 12 13 6 6 1 6 6 6 8 70 12 4 2 2 5 5 5 5 5 71 12 14 6 6 5 5 5 5 6 72 12 13 5 5 5 5 3 9 7 73 12 11 5 0 5 5 8 2 5 74 12 14 6 2 6 6 9 6 6 75 12 12 4 4 6 6 6 6 6 76 12 15 6 1 0 9 6 6 6 77 12 14 5 5 0 5 5 5 6 78 12 13 5 5 1 5 3 3 9 79 12 7 4 2 7 7 4 2 7 80 12 5 2 2 2 2 9 2 9 81 12 7 7 7 4 4 4 4 4 82 12 13 5 5 0 6 8 8 8 83 12 13 6 2 5 5 5 5 5 84 12 11 5 5 5 5 5 9 8 85 12 6 3 3 3 3 8 2 9 86 12 12 6 6 0 6 6 6 6 87 12 8 4 1 4 4 9 4 4 88 12 11 5 5 9 9 5 5 7 89 12 12 7 7 0 8 8 8 8 90 12 9 4 2 4 4 3 3 9 91 12 12 6 6 2 2 2 2 9 92 12 13 8 8 7 7 7 7 7 93 12 16 7 7 7 7 7 7 8 94 12 16 6 6 6 6 4 9 4 95 12 11 7 7 0 5 5 5 6 96 12 8 4 4 5 5 9 5 7 97 12 4 0 5 6 6 6 2 6 98 12 7 3 2 0 3 3 3 7 99 12 14 5 5 5 5 5 5 5 100 12 11 6 2 9 9 2 2 9 101 12 17 5 5 0 7 7 7 7 102 12 15 7 7 7 7 7 7 7 103 12 14 6 5 1 6 6 6 6 104 12 5 8 8 3 3 8 3 6 105 12 4 7 2 7 7 9 3 9 106 12 19 8 8 8 8 8 2 9 107 12 11 3 3 0 3 3 3 8 108 12 15 8 2 5 5 5 5 8 109 12 10 3 3 3 3 3 3 3 110 12 9 4 5 0 4 4 4 6 111 12 12 2 2 5 5 5 5 5 112 12 15 7 2 7 7 9 7 7 113 12 7 6 6 0 6 6 6 6 114 12 13 2 2 0 7 7 7 7 115 12 14 7 7 0 9 7 2 7 116 12 14 6 6 6 6 6 6 6 117 12 14 6 2 0 6 3 9 8 118 12 8 6 2 6 6 9 4 9 119 12 15 6 5 6 6 6 6 6 120 12 15 6 6 2 2 2 2 9 121 12 9 4 4 5 5 5 2 5 122 12 16 5 5 0 5 5 5 6 123 12 9 7 7 4 4 9 4 4 124 12 15 6 6 0 7 7 7 7 125 12 15 6 6 6 6 6 6 6 126 12 6 5 5 5 5 8 7 8 127 12 8 8 2 8 8 8 8 8 128 12 15 6 6 6 6 6 6 9 129 12 10 0 3 5 5 3 3 8 130 12 9 4 2 0 4 4 4 4 131 12 14 8 8 8 8 9 8 6 132 12 12 6 6 0 6 6 9 6 133 12 8 4 4 9 9 4 2 7 134 12 11 6 6 5 5 5 5 9 135 12 13 2 5 0 6 6 6 8 136 12 9 4 4 0 4 4 4 4 137 12 15 6 2 0 6 6 6 6 138 12 13 3 3 3 3 3 3 9 139 12 15 6 6 6 6 6 6 6 140 12 14 5 5 0 5 5 5 5 141 12 16 4 4 4 4 9 8 8 142 12 12 6 6 6 6 6 6 6 143 12 14 1 1 0 5 9 5 6 144 12 10 4 5 4 4 3 3 6 145 12 10 4 2 7 7 7 2 7 146 12 4 6 6 0 6 6 6 7 147 12 8 5 5 5 5 5 5 9 148 12 17 9 2 6 6 6 6 6 149 12 16 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 12 15 7 7 7 7 7 7 7 153 12 9 0 9 0 4 4 4 8 154 12 13 6 2 0 6 8 7 7 155 12 14 6 6 5 5 5 5 9 156 12 11 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) Schoolprestaties Sport GoingOut 11.375227 0.014448 -0.011397 -0.029816 Relation Family Friends Coach 0.003637 0.037845 0.002299 -0.024865 Job 0.030111 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -0.7891 -0.5513 0.2470 0.3619 0.6333 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 11.375227 0.230388 49.374 <2e-16 *** Schoolprestaties 0.014448 0.012219 1.182 0.239 Sport -0.011397 0.026820 -0.425 0.672 GoingOut -0.029816 0.021361 -1.396 0.165 Relation 0.003637 0.015045 0.242 0.809 Family 0.037845 0.028378 1.334 0.184 Friends 0.002299 0.020582 0.112 0.911 Coach -0.024865 0.021037 -1.182 0.239 Job 0.030111 0.024848 1.212 0.228 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 0.4794 on 147 degrees of freedom Multiple R-squared: 0.05876, Adjusted R-squared: 0.007532 F-statistic: 1.147 on 8 and 147 DF, p-value: 0.3355 > 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,] 1.489287e-44 2.978574e-44 1.000000e+00 [2,] 1.051792e-62 2.103584e-62 1.000000e+00 [3,] 4.788383e-72 9.576765e-72 1.000000e+00 [4,] 2.024158e-86 4.048315e-86 1.000000e+00 [5,] 0.000000e+00 0.000000e+00 1.000000e+00 [6,] 4.267250e-116 8.534500e-116 1.000000e+00 [7,] 8.626652e-144 1.725330e-143 1.000000e+00 [8,] 6.326651e-147 1.265330e-146 1.000000e+00 [9,] 8.347018e-167 1.669404e-166 1.000000e+00 [10,] 8.652543e-183 1.730509e-182 1.000000e+00 [11,] 3.678746e-187 7.357493e-187 1.000000e+00 [12,] 5.306043e-207 1.061209e-206 1.000000e+00 [13,] 1.106728e-230 2.213456e-230 1.000000e+00 [14,] 3.149216e-227 6.298431e-227 1.000000e+00 [15,] 2.446155e-246 4.892310e-246 1.000000e+00 [16,] 2.579341e-263 5.158681e-263 1.000000e+00 [17,] 5.253948e-271 1.050790e-270 1.000000e+00 [18,] 6.738310e-297 1.347662e-296 1.000000e+00 [19,] 5.095550e-300 1.019110e-299 1.000000e+00 [20,] 4.810865e-319 9.621731e-319 1.000000e+00 [21,] 0.000000e+00 0.000000e+00 1.000000e+00 [22,] 0.000000e+00 0.000000e+00 1.000000e+00 [23,] 0.000000e+00 0.000000e+00 1.000000e+00 [24,] 0.000000e+00 0.000000e+00 1.000000e+00 [25,] 0.000000e+00 0.000000e+00 1.000000e+00 [26,] 0.000000e+00 0.000000e+00 1.000000e+00 [27,] 0.000000e+00 0.000000e+00 1.000000e+00 [28,] 0.000000e+00 0.000000e+00 1.000000e+00 [29,] 0.000000e+00 0.000000e+00 1.000000e+00 [30,] 0.000000e+00 0.000000e+00 1.000000e+00 [31,] 0.000000e+00 0.000000e+00 1.000000e+00 [32,] 0.000000e+00 0.000000e+00 1.000000e+00 [33,] 0.000000e+00 0.000000e+00 1.000000e+00 [34,] 0.000000e+00 0.000000e+00 1.000000e+00 [35,] 0.000000e+00 0.000000e+00 1.000000e+00 [36,] 0.000000e+00 0.000000e+00 1.000000e+00 [37,] 0.000000e+00 0.000000e+00 1.000000e+00 [38,] 0.000000e+00 0.000000e+00 1.000000e+00 [39,] 0.000000e+00 0.000000e+00 1.000000e+00 [40,] 0.000000e+00 0.000000e+00 1.000000e+00 [41,] 0.000000e+00 0.000000e+00 1.000000e+00 [42,] 0.000000e+00 0.000000e+00 1.000000e+00 [43,] 0.000000e+00 0.000000e+00 1.000000e+00 [44,] 0.000000e+00 0.000000e+00 1.000000e+00 [45,] 1.000000e+00 8.186630e-16 4.093315e-16 [46,] 1.000000e+00 0.000000e+00 0.000000e+00 [47,] 1.000000e+00 0.000000e+00 0.000000e+00 [48,] 1.000000e+00 0.000000e+00 0.000000e+00 [49,] 1.000000e+00 0.000000e+00 0.000000e+00 [50,] 1.000000e+00 0.000000e+00 0.000000e+00 [51,] 1.000000e+00 0.000000e+00 0.000000e+00 [52,] 1.000000e+00 0.000000e+00 0.000000e+00 [53,] 1.000000e+00 0.000000e+00 0.000000e+00 [54,] 1.000000e+00 0.000000e+00 0.000000e+00 [55,] 1.000000e+00 0.000000e+00 0.000000e+00 [56,] 1.000000e+00 0.000000e+00 0.000000e+00 [57,] 1.000000e+00 0.000000e+00 0.000000e+00 [58,] 1.000000e+00 0.000000e+00 0.000000e+00 [59,] 1.000000e+00 0.000000e+00 0.000000e+00 [60,] 1.000000e+00 0.000000e+00 0.000000e+00 [61,] 1.000000e+00 0.000000e+00 0.000000e+00 [62,] 1.000000e+00 0.000000e+00 0.000000e+00 [63,] 1.000000e+00 0.000000e+00 0.000000e+00 [64,] 1.000000e+00 0.000000e+00 0.000000e+00 [65,] 1.000000e+00 0.000000e+00 0.000000e+00 [66,] 1.000000e+00 0.000000e+00 0.000000e+00 [67,] 1.000000e+00 0.000000e+00 0.000000e+00 [68,] 1.000000e+00 0.000000e+00 0.000000e+00 [69,] 1.000000e+00 0.000000e+00 0.000000e+00 [70,] 1.000000e+00 0.000000e+00 0.000000e+00 [71,] 1.000000e+00 0.000000e+00 0.000000e+00 [72,] 1.000000e+00 0.000000e+00 0.000000e+00 [73,] 1.000000e+00 0.000000e+00 0.000000e+00 [74,] 1.000000e+00 0.000000e+00 0.000000e+00 [75,] 1.000000e+00 0.000000e+00 0.000000e+00 [76,] 1.000000e+00 0.000000e+00 0.000000e+00 [77,] 1.000000e+00 0.000000e+00 0.000000e+00 [78,] 1.000000e+00 0.000000e+00 0.000000e+00 [79,] 1.000000e+00 0.000000e+00 0.000000e+00 [80,] 1.000000e+00 0.000000e+00 0.000000e+00 [81,] 1.000000e+00 0.000000e+00 0.000000e+00 [82,] 1.000000e+00 0.000000e+00 0.000000e+00 [83,] 1.000000e+00 0.000000e+00 0.000000e+00 [84,] 1.000000e+00 0.000000e+00 0.000000e+00 [85,] 1.000000e+00 0.000000e+00 0.000000e+00 [86,] 1.000000e+00 0.000000e+00 0.000000e+00 [87,] 1.000000e+00 0.000000e+00 0.000000e+00 [88,] 1.000000e+00 0.000000e+00 0.000000e+00 [89,] 1.000000e+00 0.000000e+00 0.000000e+00 [90,] 1.000000e+00 0.000000e+00 0.000000e+00 [91,] 1.000000e+00 0.000000e+00 0.000000e+00 [92,] 1.000000e+00 0.000000e+00 0.000000e+00 [93,] 1.000000e+00 0.000000e+00 0.000000e+00 [94,] 1.000000e+00 0.000000e+00 0.000000e+00 [95,] 1.000000e+00 0.000000e+00 0.000000e+00 [96,] 1.000000e+00 0.000000e+00 0.000000e+00 [97,] 1.000000e+00 0.000000e+00 0.000000e+00 [98,] 1.000000e+00 0.000000e+00 0.000000e+00 [99,] 1.000000e+00 0.000000e+00 0.000000e+00 [100,] 1.000000e+00 0.000000e+00 0.000000e+00 [101,] 1.000000e+00 0.000000e+00 0.000000e+00 [102,] 1.000000e+00 0.000000e+00 0.000000e+00 [103,] 1.000000e+00 0.000000e+00 0.000000e+00 [104,] 1.000000e+00 0.000000e+00 0.000000e+00 [105,] 1.000000e+00 0.000000e+00 0.000000e+00 [106,] 1.000000e+00 0.000000e+00 0.000000e+00 [107,] 1.000000e+00 0.000000e+00 0.000000e+00 [108,] 1.000000e+00 0.000000e+00 0.000000e+00 [109,] 1.000000e+00 0.000000e+00 0.000000e+00 [110,] 1.000000e+00 0.000000e+00 0.000000e+00 [111,] 1.000000e+00 0.000000e+00 0.000000e+00 [112,] 1.000000e+00 0.000000e+00 0.000000e+00 [113,] 1.000000e+00 0.000000e+00 0.000000e+00 [114,] 1.000000e+00 4.835618e-315 2.417809e-315 [115,] 1.000000e+00 1.941219e-303 9.706095e-304 [116,] 1.000000e+00 1.786334e-286 8.931671e-287 [117,] 1.000000e+00 1.159753e-273 5.798767e-274 [118,] 1.000000e+00 1.621025e-263 8.105123e-264 [119,] 1.000000e+00 4.856014e-274 2.428007e-274 [120,] 1.000000e+00 3.183157e-227 1.591579e-227 [121,] 1.000000e+00 4.115114e-219 2.057557e-219 [122,] 1.000000e+00 7.588191e-204 3.794095e-204 [123,] 1.000000e+00 9.505722e-200 4.752861e-200 [124,] 1.000000e+00 6.755431e-176 3.377715e-176 [125,] 1.000000e+00 3.203952e-166 1.601976e-166 [126,] 1.000000e+00 1.811780e-147 9.058902e-148 [127,] 1.000000e+00 1.854270e-134 9.271352e-135 [128,] 1.000000e+00 1.137125e-116 5.685626e-117 [129,] 1.000000e+00 0.000000e+00 0.000000e+00 [130,] 1.000000e+00 1.453286e-87 7.266428e-88 [131,] 1.000000e+00 2.109891e-74 1.054946e-74 [132,] 1.000000e+00 1.355348e-59 6.776739e-60 [133,] 1.000000e+00 1.382227e-46 6.911133e-47 > postscript(file="/var/wessaorg/rcomp/tmp/1wi8x1321982081.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/2xh9g1321982081.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/3ul9f1321982081.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/4f4ik1321982081.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/5n5hv1321982081.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 -0.621640991 -0.696990464 -0.713089115 -0.540645899 -0.517258734 -0.789101859 7 8 9 10 11 12 -0.614239141 -0.555150940 -0.570108235 -0.700584242 -0.653290387 -0.686105813 13 14 15 16 17 18 -0.484938203 -0.580235361 -0.285880331 -0.550051328 -0.754464603 -0.530295280 19 20 21 22 23 24 -0.502274127 -0.596744214 -0.654334795 -0.582479105 -0.615934957 -0.301559980 25 26 27 28 29 30 -0.609945011 -0.667738846 -0.745060677 -0.638618255 -0.692609731 -0.529686010 31 32 33 34 35 36 -0.580999977 -0.604607071 -0.662024383 -0.383886071 -0.625641132 -0.692978546 37 38 39 40 41 42 -0.559225663 -0.529887978 -0.785105151 -0.593720485 -0.667024086 -0.749987090 43 44 45 46 47 48 -0.694926052 -0.698079864 -0.507886544 -0.542165549 -0.700562777 -0.527748851 49 50 51 52 53 54 -0.523658346 -0.669691784 -0.539028378 -0.695415744 -0.555047995 -0.581705584 55 56 57 58 59 60 -0.594298008 -0.541881127 0.378919968 0.217666042 0.253880511 0.375639851 61 62 63 64 65 66 0.545373849 0.109554129 0.350051220 0.179677200 0.471542570 0.416055088 67 68 69 70 71 72 0.346139044 0.315320385 0.348017830 0.404266978 0.394522971 0.441704238 73 74 75 76 77 78 0.196193896 0.249443611 0.322077528 0.120366098 0.371495370 0.246842692 79 80 81 82 83 84 0.168235239 0.310026943 0.616014101 0.355572229 0.319817995 0.435891079 85 86 87 88 89 90 0.297609269 0.426325878 0.376981199 0.200617790 0.376757582 0.230724518 91 92 93 94 95 96 0.389835433 0.423453209 0.308783614 0.486124606 0.497266666 0.359478909 97 98 99 100 101 102 0.322436015 0.360839967 0.383421270 -0.005351892 0.267479997 0.353343332 103 104 105 106 107 108 0.363975716 0.633320857 0.198915964 0.108436183 0.302751046 0.223380874 109 110 111 112 113 114 0.456844585 0.447620246 0.288679308 0.199663647 0.498568172 0.201634952 115 116 117 118 119 120 0.193239506 0.375606530 0.299433633 0.196071480 0.331341898 0.346490057 121 122 123 124 125 126 0.339856947 0.342598453 0.575620140 0.337589874 0.361158072 0.451506041 127 128 129 130 131 132 0.267770762 0.270824294 0.189134761 0.418394244 0.417900160 0.500919536 133 134 135 136 137 138 0.130455958 0.347534570 0.276251582 0.478026591 0.263715809 0.232831654 139 140 141 142 143 144 0.361158072 0.401606629 0.329855222 0.404503448 0.197445896 0.396058357 145 146 147 148 149 150 0.117991637 0.511802288 0.349666986 0.247186820 0.339811387 0.473961038 151 152 153 154 155 156 0.626734976 0.353343332 0.461075275 0.282767202 0.304189194 0.444582992 > postscript(file="/var/wessaorg/rcomp/tmp/6r89q1321982081.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 -0.621640991 NA 1 -0.696990464 -0.621640991 2 -0.713089115 -0.696990464 3 -0.540645899 -0.713089115 4 -0.517258734 -0.540645899 5 -0.789101859 -0.517258734 6 -0.614239141 -0.789101859 7 -0.555150940 -0.614239141 8 -0.570108235 -0.555150940 9 -0.700584242 -0.570108235 10 -0.653290387 -0.700584242 11 -0.686105813 -0.653290387 12 -0.484938203 -0.686105813 13 -0.580235361 -0.484938203 14 -0.285880331 -0.580235361 15 -0.550051328 -0.285880331 16 -0.754464603 -0.550051328 17 -0.530295280 -0.754464603 18 -0.502274127 -0.530295280 19 -0.596744214 -0.502274127 20 -0.654334795 -0.596744214 21 -0.582479105 -0.654334795 22 -0.615934957 -0.582479105 23 -0.301559980 -0.615934957 24 -0.609945011 -0.301559980 25 -0.667738846 -0.609945011 26 -0.745060677 -0.667738846 27 -0.638618255 -0.745060677 28 -0.692609731 -0.638618255 29 -0.529686010 -0.692609731 30 -0.580999977 -0.529686010 31 -0.604607071 -0.580999977 32 -0.662024383 -0.604607071 33 -0.383886071 -0.662024383 34 -0.625641132 -0.383886071 35 -0.692978546 -0.625641132 36 -0.559225663 -0.692978546 37 -0.529887978 -0.559225663 38 -0.785105151 -0.529887978 39 -0.593720485 -0.785105151 40 -0.667024086 -0.593720485 41 -0.749987090 -0.667024086 42 -0.694926052 -0.749987090 43 -0.698079864 -0.694926052 44 -0.507886544 -0.698079864 45 -0.542165549 -0.507886544 46 -0.700562777 -0.542165549 47 -0.527748851 -0.700562777 48 -0.523658346 -0.527748851 49 -0.669691784 -0.523658346 50 -0.539028378 -0.669691784 51 -0.695415744 -0.539028378 52 -0.555047995 -0.695415744 53 -0.581705584 -0.555047995 54 -0.594298008 -0.581705584 55 -0.541881127 -0.594298008 56 0.378919968 -0.541881127 57 0.217666042 0.378919968 58 0.253880511 0.217666042 59 0.375639851 0.253880511 60 0.545373849 0.375639851 61 0.109554129 0.545373849 62 0.350051220 0.109554129 63 0.179677200 0.350051220 64 0.471542570 0.179677200 65 0.416055088 0.471542570 66 0.346139044 0.416055088 67 0.315320385 0.346139044 68 0.348017830 0.315320385 69 0.404266978 0.348017830 70 0.394522971 0.404266978 71 0.441704238 0.394522971 72 0.196193896 0.441704238 73 0.249443611 0.196193896 74 0.322077528 0.249443611 75 0.120366098 0.322077528 76 0.371495370 0.120366098 77 0.246842692 0.371495370 78 0.168235239 0.246842692 79 0.310026943 0.168235239 80 0.616014101 0.310026943 81 0.355572229 0.616014101 82 0.319817995 0.355572229 83 0.435891079 0.319817995 84 0.297609269 0.435891079 85 0.426325878 0.297609269 86 0.376981199 0.426325878 87 0.200617790 0.376981199 88 0.376757582 0.200617790 89 0.230724518 0.376757582 90 0.389835433 0.230724518 91 0.423453209 0.389835433 92 0.308783614 0.423453209 93 0.486124606 0.308783614 94 0.497266666 0.486124606 95 0.359478909 0.497266666 96 0.322436015 0.359478909 97 0.360839967 0.322436015 98 0.383421270 0.360839967 99 -0.005351892 0.383421270 100 0.267479997 -0.005351892 101 0.353343332 0.267479997 102 0.363975716 0.353343332 103 0.633320857 0.363975716 104 0.198915964 0.633320857 105 0.108436183 0.198915964 106 0.302751046 0.108436183 107 0.223380874 0.302751046 108 0.456844585 0.223380874 109 0.447620246 0.456844585 110 0.288679308 0.447620246 111 0.199663647 0.288679308 112 0.498568172 0.199663647 113 0.201634952 0.498568172 114 0.193239506 0.201634952 115 0.375606530 0.193239506 116 0.299433633 0.375606530 117 0.196071480 0.299433633 118 0.331341898 0.196071480 119 0.346490057 0.331341898 120 0.339856947 0.346490057 121 0.342598453 0.339856947 122 0.575620140 0.342598453 123 0.337589874 0.575620140 124 0.361158072 0.337589874 125 0.451506041 0.361158072 126 0.267770762 0.451506041 127 0.270824294 0.267770762 128 0.189134761 0.270824294 129 0.418394244 0.189134761 130 0.417900160 0.418394244 131 0.500919536 0.417900160 132 0.130455958 0.500919536 133 0.347534570 0.130455958 134 0.276251582 0.347534570 135 0.478026591 0.276251582 136 0.263715809 0.478026591 137 0.232831654 0.263715809 138 0.361158072 0.232831654 139 0.401606629 0.361158072 140 0.329855222 0.401606629 141 0.404503448 0.329855222 142 0.197445896 0.404503448 143 0.396058357 0.197445896 144 0.117991637 0.396058357 145 0.511802288 0.117991637 146 0.349666986 0.511802288 147 0.247186820 0.349666986 148 0.339811387 0.247186820 149 0.473961038 0.339811387 150 0.626734976 0.473961038 151 0.353343332 0.626734976 152 0.461075275 0.353343332 153 0.282767202 0.461075275 154 0.304189194 0.282767202 155 0.444582992 0.304189194 156 NA 0.444582992 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -0.696990464 -0.621640991 [2,] -0.713089115 -0.696990464 [3,] -0.540645899 -0.713089115 [4,] -0.517258734 -0.540645899 [5,] -0.789101859 -0.517258734 [6,] -0.614239141 -0.789101859 [7,] -0.555150940 -0.614239141 [8,] -0.570108235 -0.555150940 [9,] -0.700584242 -0.570108235 [10,] -0.653290387 -0.700584242 [11,] -0.686105813 -0.653290387 [12,] -0.484938203 -0.686105813 [13,] -0.580235361 -0.484938203 [14,] -0.285880331 -0.580235361 [15,] -0.550051328 -0.285880331 [16,] -0.754464603 -0.550051328 [17,] -0.530295280 -0.754464603 [18,] -0.502274127 -0.530295280 [19,] -0.596744214 -0.502274127 [20,] -0.654334795 -0.596744214 [21,] -0.582479105 -0.654334795 [22,] -0.615934957 -0.582479105 [23,] -0.301559980 -0.615934957 [24,] -0.609945011 -0.301559980 [25,] -0.667738846 -0.609945011 [26,] -0.745060677 -0.667738846 [27,] -0.638618255 -0.745060677 [28,] -0.692609731 -0.638618255 [29,] -0.529686010 -0.692609731 [30,] -0.580999977 -0.529686010 [31,] -0.604607071 -0.580999977 [32,] -0.662024383 -0.604607071 [33,] -0.383886071 -0.662024383 [34,] -0.625641132 -0.383886071 [35,] -0.692978546 -0.625641132 [36,] -0.559225663 -0.692978546 [37,] -0.529887978 -0.559225663 [38,] -0.785105151 -0.529887978 [39,] -0.593720485 -0.785105151 [40,] -0.667024086 -0.593720485 [41,] -0.749987090 -0.667024086 [42,] -0.694926052 -0.749987090 [43,] -0.698079864 -0.694926052 [44,] -0.507886544 -0.698079864 [45,] -0.542165549 -0.507886544 [46,] -0.700562777 -0.542165549 [47,] -0.527748851 -0.700562777 [48,] -0.523658346 -0.527748851 [49,] -0.669691784 -0.523658346 [50,] -0.539028378 -0.669691784 [51,] -0.695415744 -0.539028378 [52,] -0.555047995 -0.695415744 [53,] -0.581705584 -0.555047995 [54,] -0.594298008 -0.581705584 [55,] -0.541881127 -0.594298008 [56,] 0.378919968 -0.541881127 [57,] 0.217666042 0.378919968 [58,] 0.253880511 0.217666042 [59,] 0.375639851 0.253880511 [60,] 0.545373849 0.375639851 [61,] 0.109554129 0.545373849 [62,] 0.350051220 0.109554129 [63,] 0.179677200 0.350051220 [64,] 0.471542570 0.179677200 [65,] 0.416055088 0.471542570 [66,] 0.346139044 0.416055088 [67,] 0.315320385 0.346139044 [68,] 0.348017830 0.315320385 [69,] 0.404266978 0.348017830 [70,] 0.394522971 0.404266978 [71,] 0.441704238 0.394522971 [72,] 0.196193896 0.441704238 [73,] 0.249443611 0.196193896 [74,] 0.322077528 0.249443611 [75,] 0.120366098 0.322077528 [76,] 0.371495370 0.120366098 [77,] 0.246842692 0.371495370 [78,] 0.168235239 0.246842692 [79,] 0.310026943 0.168235239 [80,] 0.616014101 0.310026943 [81,] 0.355572229 0.616014101 [82,] 0.319817995 0.355572229 [83,] 0.435891079 0.319817995 [84,] 0.297609269 0.435891079 [85,] 0.426325878 0.297609269 [86,] 0.376981199 0.426325878 [87,] 0.200617790 0.376981199 [88,] 0.376757582 0.200617790 [89,] 0.230724518 0.376757582 [90,] 0.389835433 0.230724518 [91,] 0.423453209 0.389835433 [92,] 0.308783614 0.423453209 [93,] 0.486124606 0.308783614 [94,] 0.497266666 0.486124606 [95,] 0.359478909 0.497266666 [96,] 0.322436015 0.359478909 [97,] 0.360839967 0.322436015 [98,] 0.383421270 0.360839967 [99,] -0.005351892 0.383421270 [100,] 0.267479997 -0.005351892 [101,] 0.353343332 0.267479997 [102,] 0.363975716 0.353343332 [103,] 0.633320857 0.363975716 [104,] 0.198915964 0.633320857 [105,] 0.108436183 0.198915964 [106,] 0.302751046 0.108436183 [107,] 0.223380874 0.302751046 [108,] 0.456844585 0.223380874 [109,] 0.447620246 0.456844585 [110,] 0.288679308 0.447620246 [111,] 0.199663647 0.288679308 [112,] 0.498568172 0.199663647 [113,] 0.201634952 0.498568172 [114,] 0.193239506 0.201634952 [115,] 0.375606530 0.193239506 [116,] 0.299433633 0.375606530 [117,] 0.196071480 0.299433633 [118,] 0.331341898 0.196071480 [119,] 0.346490057 0.331341898 [120,] 0.339856947 0.346490057 [121,] 0.342598453 0.339856947 [122,] 0.575620140 0.342598453 [123,] 0.337589874 0.575620140 [124,] 0.361158072 0.337589874 [125,] 0.451506041 0.361158072 [126,] 0.267770762 0.451506041 [127,] 0.270824294 0.267770762 [128,] 0.189134761 0.270824294 [129,] 0.418394244 0.189134761 [130,] 0.417900160 0.418394244 [131,] 0.500919536 0.417900160 [132,] 0.130455958 0.500919536 [133,] 0.347534570 0.130455958 [134,] 0.276251582 0.347534570 [135,] 0.478026591 0.276251582 [136,] 0.263715809 0.478026591 [137,] 0.232831654 0.263715809 [138,] 0.361158072 0.232831654 [139,] 0.401606629 0.361158072 [140,] 0.329855222 0.401606629 [141,] 0.404503448 0.329855222 [142,] 0.197445896 0.404503448 [143,] 0.396058357 0.197445896 [144,] 0.117991637 0.396058357 [145,] 0.511802288 0.117991637 [146,] 0.349666986 0.511802288 [147,] 0.247186820 0.349666986 [148,] 0.339811387 0.247186820 [149,] 0.473961038 0.339811387 [150,] 0.626734976 0.473961038 [151,] 0.353343332 0.626734976 [152,] 0.461075275 0.353343332 [153,] 0.282767202 0.461075275 [154,] 0.304189194 0.282767202 [155,] 0.444582992 0.304189194 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -0.696990464 -0.621640991 2 -0.713089115 -0.696990464 3 -0.540645899 -0.713089115 4 -0.517258734 -0.540645899 5 -0.789101859 -0.517258734 6 -0.614239141 -0.789101859 7 -0.555150940 -0.614239141 8 -0.570108235 -0.555150940 9 -0.700584242 -0.570108235 10 -0.653290387 -0.700584242 11 -0.686105813 -0.653290387 12 -0.484938203 -0.686105813 13 -0.580235361 -0.484938203 14 -0.285880331 -0.580235361 15 -0.550051328 -0.285880331 16 -0.754464603 -0.550051328 17 -0.530295280 -0.754464603 18 -0.502274127 -0.530295280 19 -0.596744214 -0.502274127 20 -0.654334795 -0.596744214 21 -0.582479105 -0.654334795 22 -0.615934957 -0.582479105 23 -0.301559980 -0.615934957 24 -0.609945011 -0.301559980 25 -0.667738846 -0.609945011 26 -0.745060677 -0.667738846 27 -0.638618255 -0.745060677 28 -0.692609731 -0.638618255 29 -0.529686010 -0.692609731 30 -0.580999977 -0.529686010 31 -0.604607071 -0.580999977 32 -0.662024383 -0.604607071 33 -0.383886071 -0.662024383 34 -0.625641132 -0.383886071 35 -0.692978546 -0.625641132 36 -0.559225663 -0.692978546 37 -0.529887978 -0.559225663 38 -0.785105151 -0.529887978 39 -0.593720485 -0.785105151 40 -0.667024086 -0.593720485 41 -0.749987090 -0.667024086 42 -0.694926052 -0.749987090 43 -0.698079864 -0.694926052 44 -0.507886544 -0.698079864 45 -0.542165549 -0.507886544 46 -0.700562777 -0.542165549 47 -0.527748851 -0.700562777 48 -0.523658346 -0.527748851 49 -0.669691784 -0.523658346 50 -0.539028378 -0.669691784 51 -0.695415744 -0.539028378 52 -0.555047995 -0.695415744 53 -0.581705584 -0.555047995 54 -0.594298008 -0.581705584 55 -0.541881127 -0.594298008 56 0.378919968 -0.541881127 57 0.217666042 0.378919968 58 0.253880511 0.217666042 59 0.375639851 0.253880511 60 0.545373849 0.375639851 61 0.109554129 0.545373849 62 0.350051220 0.109554129 63 0.179677200 0.350051220 64 0.471542570 0.179677200 65 0.416055088 0.471542570 66 0.346139044 0.416055088 67 0.315320385 0.346139044 68 0.348017830 0.315320385 69 0.404266978 0.348017830 70 0.394522971 0.404266978 71 0.441704238 0.394522971 72 0.196193896 0.441704238 73 0.249443611 0.196193896 74 0.322077528 0.249443611 75 0.120366098 0.322077528 76 0.371495370 0.120366098 77 0.246842692 0.371495370 78 0.168235239 0.246842692 79 0.310026943 0.168235239 80 0.616014101 0.310026943 81 0.355572229 0.616014101 82 0.319817995 0.355572229 83 0.435891079 0.319817995 84 0.297609269 0.435891079 85 0.426325878 0.297609269 86 0.376981199 0.426325878 87 0.200617790 0.376981199 88 0.376757582 0.200617790 89 0.230724518 0.376757582 90 0.389835433 0.230724518 91 0.423453209 0.389835433 92 0.308783614 0.423453209 93 0.486124606 0.308783614 94 0.497266666 0.486124606 95 0.359478909 0.497266666 96 0.322436015 0.359478909 97 0.360839967 0.322436015 98 0.383421270 0.360839967 99 -0.005351892 0.383421270 100 0.267479997 -0.005351892 101 0.353343332 0.267479997 102 0.363975716 0.353343332 103 0.633320857 0.363975716 104 0.198915964 0.633320857 105 0.108436183 0.198915964 106 0.302751046 0.108436183 107 0.223380874 0.302751046 108 0.456844585 0.223380874 109 0.447620246 0.456844585 110 0.288679308 0.447620246 111 0.199663647 0.288679308 112 0.498568172 0.199663647 113 0.201634952 0.498568172 114 0.193239506 0.201634952 115 0.375606530 0.193239506 116 0.299433633 0.375606530 117 0.196071480 0.299433633 118 0.331341898 0.196071480 119 0.346490057 0.331341898 120 0.339856947 0.346490057 121 0.342598453 0.339856947 122 0.575620140 0.342598453 123 0.337589874 0.575620140 124 0.361158072 0.337589874 125 0.451506041 0.361158072 126 0.267770762 0.451506041 127 0.270824294 0.267770762 128 0.189134761 0.270824294 129 0.418394244 0.189134761 130 0.417900160 0.418394244 131 0.500919536 0.417900160 132 0.130455958 0.500919536 133 0.347534570 0.130455958 134 0.276251582 0.347534570 135 0.478026591 0.276251582 136 0.263715809 0.478026591 137 0.232831654 0.263715809 138 0.361158072 0.232831654 139 0.401606629 0.361158072 140 0.329855222 0.401606629 141 0.404503448 0.329855222 142 0.197445896 0.404503448 143 0.396058357 0.197445896 144 0.117991637 0.396058357 145 0.511802288 0.117991637 146 0.349666986 0.511802288 147 0.247186820 0.349666986 148 0.339811387 0.247186820 149 0.473961038 0.339811387 150 0.626734976 0.473961038 151 0.353343332 0.626734976 152 0.461075275 0.353343332 153 0.282767202 0.461075275 154 0.304189194 0.282767202 155 0.444582992 0.304189194 > 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/7sunz1321982081.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/8jfhg1321982081.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/9yqdv1321982081.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/107nc11321982081.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/118lhn1321982081.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/12p08d1321982081.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/135p8w1321982081.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/14yhnq1321982081.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/15bapv1321982081.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/16q7bo1321982081.tab") + } > > try(system("convert tmp/1wi8x1321982081.ps tmp/1wi8x1321982081.png",intern=TRUE)) character(0) > try(system("convert tmp/2xh9g1321982081.ps tmp/2xh9g1321982081.png",intern=TRUE)) character(0) > try(system("convert tmp/3ul9f1321982081.ps tmp/3ul9f1321982081.png",intern=TRUE)) character(0) > try(system("convert tmp/4f4ik1321982081.ps tmp/4f4ik1321982081.png",intern=TRUE)) character(0) > try(system("convert tmp/5n5hv1321982081.ps tmp/5n5hv1321982081.png",intern=TRUE)) character(0) > try(system("convert tmp/6r89q1321982081.ps tmp/6r89q1321982081.png",intern=TRUE)) character(0) > try(system("convert tmp/7sunz1321982081.ps tmp/7sunz1321982081.png",intern=TRUE)) character(0) > try(system("convert tmp/8jfhg1321982081.ps tmp/8jfhg1321982081.png",intern=TRUE)) character(0) > try(system("convert tmp/9yqdv1321982081.ps tmp/9yqdv1321982081.png",intern=TRUE)) character(0) > try(system("convert tmp/107nc11321982081.ps tmp/107nc11321982081.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 5.308 0.510 6.938