R version 2.9.0 (2009-04-17) Copyright (C) 2009 The R Foundation for Statistical Computing ISBN 3-900051-07-0 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(12 + ,6 + ,15 + ,4 + ,7 + ,2 + ,2 + ,2 + ,2 + ,9 + ,11 + ,6 + ,15 + ,3 + ,5 + ,4 + ,1 + ,2 + ,2 + ,9 + ,14 + ,13 + ,14 + ,5 + ,7 + ,7 + ,4 + ,3 + ,4 + ,9 + ,12 + ,8 + ,10 + ,3 + ,3 + ,3 + ,1 + ,2 + ,3 + ,9 + ,21 + ,7 + ,10 + ,6 + ,7 + ,7 + ,5 + ,4 + ,4 + ,9 + ,12 + ,9 + ,12 + ,5 + ,7 + ,2 + ,1 + ,2 + ,3 + ,9 + ,22 + ,5 + ,18 + ,6 + ,7 + ,7 + ,1 + ,2 + ,3 + ,9 + ,11 + ,8 + ,12 + ,6 + ,1 + ,2 + ,1 + ,3 + ,4 + ,9 + ,10 + ,9 + ,14 + ,5 + ,4 + ,1 + ,1 + ,2 + ,3 + ,9 + ,13 + ,11 + ,18 + ,5 + ,5 + ,2 + ,1 + ,2 + ,4 + ,9 + ,10 + ,8 + ,9 + ,3 + ,6 + ,6 + ,2 + ,3 + ,3 + ,9 + ,8 + ,11 + ,11 + ,5 + ,4 + ,1 + ,1 + ,2 + ,2 + ,9 + ,15 + ,12 + ,11 + ,7 + ,7 + ,1 + ,3 + ,3 + ,3 + ,9 + ,10 + ,8 + ,17 + ,5 + ,6 + ,1 + ,1 + ,1 + ,3 + ,9 + ,14 + ,7 + ,8 + ,5 + ,2 + ,2 + ,1 + ,3 + ,3 + ,9 + ,14 + ,9 + ,16 + ,3 + ,2 + ,2 + ,1 + ,1 + ,2 +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+ ,4 + ,10 + ,19 + ,9 + ,11 + ,5 + ,5 + ,5 + ,1 + ,4 + ,4 + ,9 + ,15 + ,11 + ,8 + ,4 + ,6 + ,2 + ,2 + ,4 + ,4 + ,10 + ,14 + ,4 + ,7 + ,3 + ,6 + ,4 + ,2 + ,3 + ,4 + ,10 + ,11 + ,9 + ,11 + ,3 + ,6 + ,5 + ,1 + ,3 + ,3 + ,10 + ,9 + ,5 + ,13 + ,3 + ,1 + ,1 + ,1 + ,1 + ,4 + ,10 + ,18 + ,4 + ,9 + ,2 + ,3 + ,2 + ,1 + ,4 + ,4 + ,10) + ,dim=c(10 + ,145) + ,dimnames=list(c('Depression' + ,'CriticParents' + ,'ExpecParents' + ,'FutureWorrying' + ,'SleepDepri' + ,'ChangesLastYear' + ,'FreqSmoking' + ,'FreqHighAlc' + ,'FreqBeerOrWine' + ,'Month ') + ,1:145)) > y <- array(NA,dim=c(10,145),dimnames=list(c('Depression','CriticParents','ExpecParents','FutureWorrying','SleepDepri','ChangesLastYear','FreqSmoking','FreqHighAlc','FreqBeerOrWine','Month '),1:145)) > 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' > #'GNU S' R Code compiled by R2WASP v. 1.0.44 () > #Author: Prof. Dr. P. Wessa > #To cite this work: AUTHOR(S), (YEAR), YOUR SOFTWARE TITLE (vNUMBER) in Free Statistics Software (v$_version), Office for Research Development and Education, URL http://www.wessa.net/rwasp_YOURPAGE.wasp/ > #Source of accompanying publication: Office for Research, Development, and Education > #Technical description: Write here your technical program description (don't use hard returns!) > library(lattice) > library(lmtest) Loading required package: zoo Attaching package: 'zoo' The following object(s) are masked from package:base : as.Date.numeric > 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 Depression CriticParents ExpecParents FutureWorrying SleepDepri 1 12 6 15 4 7 2 11 6 15 3 5 3 14 13 14 5 7 4 12 8 10 3 3 5 21 7 10 6 7 6 12 9 12 5 7 7 22 5 18 6 7 8 11 8 12 6 1 9 10 9 14 5 4 10 13 11 18 5 5 11 10 8 9 3 6 12 8 11 11 5 4 13 15 12 11 7 7 14 10 8 17 5 6 15 14 7 8 5 2 16 14 9 16 3 2 17 11 12 21 5 6 18 10 20 24 6 7 19 13 7 21 5 5 20 7 8 14 2 2 21 12 8 7 5 7 22 14 16 18 4 4 23 11 10 18 6 5 24 9 6 13 3 5 25 11 8 11 5 5 26 15 9 13 4 3 27 13 9 13 5 5 28 9 11 18 2 1 29 15 12 14 2 1 30 10 8 12 5 3 31 11 7 9 2 2 32 13 8 12 2 3 33 8 9 8 2 2 34 20 4 5 5 5 35 12 8 10 5 2 36 10 8 11 1 3 37 10 8 11 5 4 38 9 6 12 2 6 39 14 8 12 6 2 40 8 4 15 1 7 41 14 7 12 4 6 42 11 14 16 3 5 43 13 10 14 2 3 44 11 9 17 5 3 45 11 8 10 3 4 46 10 11 17 4 5 47 14 8 12 3 2 48 18 8 13 6 7 49 14 10 13 4 6 50 11 8 11 5 5 51 12 10 13 2 6 52 13 7 12 5 5 53 9 8 12 5 2 54 10 7 12 3 3 55 15 9 9 5 5 56 20 5 7 7 7 57 12 7 17 4 4 58 12 7 12 2 7 59 14 7 12 3 5 60 13 9 9 6 6 61 11 5 9 7 6 62 17 8 13 4 3 63 12 8 10 4 5 64 13 8 11 4 7 65 14 9 12 5 7 66 13 6 10 2 5 67 15 8 13 3 6 68 13 6 6 3 5 69 10 4 7 4 5 70 11 6 13 3 2 71 13 4 11 4 5 72 17 12 18 6 4 73 13 6 9 2 6 74 9 11 9 4 5 75 11 8 11 5 3 76 10 10 11 2 3 77 9 10 15 1 4 78 12 4 8 2 2 79 12 8 11 5 2 80 13 9 14 4 5 81 13 9 14 4 4 82 22 7 12 6 6 83 13 7 12 1 4 84 15 11 8 4 6 85 13 8 11 5 4 86 15 8 10 2 2 87 10 7 17 3 5 88 11 5 16 3 2 89 16 7 13 6 7 90 11 9 15 5 1 91 11 8 11 4 3 92 10 6 12 4 5 93 10 8 16 5 6 94 16 10 20 5 6 95 12 10 16 6 2 96 11 8 11 6 5 97 16 11 15 5 5 98 19 8 15 7 3 99 11 8 12 5 6 100 15 6 9 5 5 101 24 20 24 7 7 102 14 6 15 5 1 103 15 12 18 6 6 104 11 9 17 6 4 105 15 5 12 4 7 106 12 10 15 5 2 107 10 5 11 1 6 108 14 6 11 6 7 109 9 6 12 5 5 110 15 10 14 2 2 111 15 5 11 1 1 112 14 13 20 5 3 113 11 7 11 6 3 114 8 9 12 5 3 115 11 8 12 5 5 116 8 5 11 4 2 117 10 4 10 2 4 118 11 9 11 3 6 119 13 7 12 3 5 120 11 5 9 5 5 121 20 5 8 3 2 122 10 4 6 2 3 123 12 7 12 2 2 124 14 9 15 3 6 125 23 8 13 6 5 126 14 8 17 5 4 127 16 11 14 6 6 128 11 10 16 2 4 129 12 9 15 5 6 130 10 12 16 5 2 131 14 10 11 5 0 132 12 10 11 1 1 133 12 7 16 4 5 134 11 10 15 2 2 135 12 6 14 2 5 136 13 6 9 7 6 137 17 11 13 6 7 138 11 8 11 5 5 139 12 9 14 5 5 140 19 9 11 5 5 141 15 11 8 4 6 142 14 4 7 3 6 143 11 9 11 3 6 144 9 5 13 3 1 145 18 4 9 2 3 ChangesLastYear FreqSmoking FreqHighAlc FreqBeerOrWine Month\r 1 2 2 2 2 9 2 4 1 2 2 9 3 7 4 3 4 9 4 3 1 2 3 9 5 7 5 4 4 9 6 2 1 2 3 9 7 7 1 2 3 9 8 2 1 3 4 9 9 1 1 2 3 9 10 2 1 2 4 9 11 6 2 3 3 9 12 1 1 2 2 9 13 1 3 3 3 9 14 1 1 1 3 9 15 2 1 3 3 9 16 2 1 1 2 9 17 2 1 3 3 9 18 1 1 2 2 9 19 7 2 3 4 9 20 1 4 4 5 9 21 2 1 3 3 9 22 4 2 3 3 9 23 2 1 1 1 9 24 1 2 2 4 9 25 1 3 1 3 9 26 5 1 3 4 9 27 2 1 3 3 9 28 1 1 2 3 9 29 3 1 2 1 9 30 1 1 3 4 9 31 2 2 2 4 9 32 5 1 2 2 9 33 2 1 2 2 9 34 6 1 1 1 9 35 4 1 2 3 9 36 1 1 3 4 9 37 3 1 1 1 9 38 6 1 2 3 9 39 7 2 3 3 9 40 4 1 2 2 9 41 1 2 1 4 9 42 5 1 1 3 9 43 3 1 3 3 9 44 2 2 3 2 9 45 2 1 3 3 9 46 2 1 3 2 9 47 2 1 2 1 9 48 1 1 3 3 9 49 2 1 2 3 9 50 1 4 3 5 9 51 2 2 4 1 9 52 2 1 3 3 9 53 5 1 3 4 9 54 5 4 3 3 9 55 2 2 3 4 9 56 1 1 2 2 9 57 1 1 3 3 9 58 2 1 3 4 9 59 3 1 1 1 9 60 7 1 1 1 9 61 4 1 1 1 10 62 4 2 4 4 10 63 1 1 3 2 10 64 2 1 2 3 10 65 2 2 3 4 10 66 2 1 1 2 10 67 5 2 4 5 10 68 1 2 3 3 10 69 6 4 2 3 10 70 2 1 3 3 10 71 2 1 3 4 10 72 4 3 3 4 10 73 6 1 2 3 10 74 2 1 1 1 10 75 2 1 1 3 10 76 2 1 1 1 10 77 1 1 3 3 10 78 1 1 4 5 10 79 2 1 2 3 10 80 2 1 2 3 10 81 3 4 2 4 10 82 3 1 2 5 10 83 5 1 3 4 10 84 2 2 4 4 10 85 5 1 2 4 10 86 3 1 3 4 10 87 1 1 3 4 10 88 2 1 2 3 10 89 2 1 2 4 10 90 1 1 3 3 10 91 2 1 3 3 10 92 2 1 3 3 10 93 5 1 3 4 10 94 5 1 3 3 10 95 2 1 3 4 10 96 3 1 2 2 10 97 5 5 3 5 10 98 5 1 3 3 10 99 6 1 2 4 10 100 2 1 1 2 10 101 7 3 3 4 10 102 1 1 2 3 10 103 1 1 2 4 10 104 6 1 3 3 10 105 6 1 1 1 10 106 2 1 3 4 10 107 1 1 2 4 10 108 2 1 2 2 10 109 1 4 2 5 10 110 2 4 2 4 10 111 1 1 2 4 10 112 3 1 3 3 10 113 3 1 3 4 10 114 6 4 3 4 10 115 4 2 3 4 10 116 1 1 3 3 10 117 2 1 1 5 10 118 5 1 3 3 10 119 6 1 4 4 10 120 3 1 2 4 10 121 5 1 2 4 10 122 3 2 4 4 10 123 2 4 3 4 10 124 3 4 2 5 10 125 2 1 3 3 10 126 5 1 1 1 10 127 5 1 2 4 10 128 7 2 4 4 10 129 4 1 3 3 10 130 4 1 3 4 10 131 5 1 3 4 10 132 1 3 2 4 10 133 4 2 4 4 10 134 1 2 1 4 10 135 4 1 3 4 10 136 6 1 1 3 10 137 7 2 2 5 10 138 1 3 1 3 9 139 3 1 2 4 10 140 5 1 4 4 9 141 2 2 4 4 10 142 4 2 3 4 10 143 5 1 3 3 10 144 1 1 1 4 10 145 2 1 4 4 10 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) CriticParents ExpecParents FutureWorrying 3.57528 0.04877 -0.06532 0.58391 SleepDepri ChangesLastYear FreqSmoking FreqHighAlc 0.20915 0.34483 -0.09573 0.27876 FreqBeerOrWine `Month\r` 0.21968 0.41894 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -6.368 -1.974 -0.355 1.408 9.056 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 3.57528 5.10419 0.700 0.484846 CriticParents 0.04877 0.11632 0.419 0.675678 ExpecParents -0.06532 0.08672 -0.753 0.452630 FutureWorrying 0.58391 0.16852 3.465 0.000711 *** SleepDepri 0.20915 0.14166 1.476 0.142170 ChangesLastYear 0.34483 0.13586 2.538 0.012283 * FreqSmoking -0.09573 0.27571 -0.347 0.728973 FreqHighAlc 0.27876 0.31551 0.884 0.378523 FreqBeerOrWine 0.21968 0.29341 0.749 0.455319 `Month\r` 0.41894 0.52355 0.800 0.425007 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 2.904 on 135 degrees of freedom Multiple R-squared: 0.2094, Adjusted R-squared: 0.1567 F-statistic: 3.972 on 9 and 135 DF, p-value: 0.0001621 > 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.46372017 0.92744034 0.5362798 [2,] 0.59524449 0.80951102 0.4047555 [3,] 0.52650285 0.94699430 0.4734972 [4,] 0.66027178 0.67945644 0.3397282 [5,] 0.57266392 0.85467216 0.4273361 [6,] 0.47944735 0.95889471 0.5205526 [7,] 0.57840681 0.84318639 0.4215932 [8,] 0.50182862 0.99634277 0.4981714 [9,] 0.42794197 0.85588394 0.5720580 [10,] 0.47076025 0.94152049 0.5292398 [11,] 0.51286476 0.97427047 0.4871352 [12,] 0.43576048 0.87152097 0.5642395 [13,] 0.37355132 0.74710264 0.6264487 [14,] 0.32770194 0.65540389 0.6722981 [15,] 0.27136291 0.54272581 0.7286371 [16,] 0.23030034 0.46060069 0.7696997 [17,] 0.29264871 0.58529742 0.7073513 [18,] 0.24667619 0.49335239 0.7533238 [19,] 0.20458391 0.40916782 0.7954161 [20,] 0.16254154 0.32508309 0.8374585 [21,] 0.15564837 0.31129674 0.8443516 [22,] 0.17508252 0.35016505 0.8249175 [23,] 0.17637913 0.35275827 0.8236209 [24,] 0.18037383 0.36074766 0.8196262 [25,] 0.22249854 0.44499708 0.7775015 [26,] 0.27636677 0.55273354 0.7236332 [27,] 0.29986516 0.59973033 0.7001348 [28,] 0.29206353 0.58412707 0.7079365 [29,] 0.30293504 0.60587008 0.6970650 [30,] 0.27031347 0.54062695 0.7296865 [31,] 0.26822901 0.53645802 0.7317710 [32,] 0.23008933 0.46017867 0.7699107 [33,] 0.19313122 0.38626244 0.8068688 [34,] 0.17151878 0.34303757 0.8284812 [35,] 0.17604693 0.35209387 0.8239531 [36,] 0.27906158 0.55812316 0.7209384 [37,] 0.26156577 0.52313154 0.7384342 [38,] 0.23327065 0.46654131 0.7667293 [39,] 0.19804535 0.39609070 0.8019547 [40,] 0.16287034 0.32574068 0.8371297 [41,] 0.24080384 0.48160767 0.7591962 [42,] 0.23956605 0.47913210 0.7604339 [43,] 0.22005169 0.44010339 0.7799483 [44,] 0.29942225 0.59884449 0.7005778 [45,] 0.26107955 0.52215909 0.7389205 [46,] 0.23343018 0.46686036 0.7665698 [47,] 0.20864040 0.41728080 0.7913596 [48,] 0.22503589 0.45007178 0.7749641 [49,] 0.19037036 0.38074073 0.8096296 [50,] 0.31376575 0.62753150 0.6862343 [51,] 0.26937264 0.53874528 0.7306274 [52,] 0.23056321 0.46112643 0.7694368 [53,] 0.19526060 0.39052121 0.8047394 [54,] 0.18046866 0.36093732 0.8195313 [55,] 0.15265943 0.30531887 0.8473406 [56,] 0.12759944 0.25519888 0.8724006 [57,] 0.14021317 0.28042635 0.8597868 [58,] 0.11399387 0.22798774 0.8860061 [59,] 0.09146604 0.18293208 0.9085340 [60,] 0.09524700 0.19049400 0.9047530 [61,] 0.07571599 0.15143198 0.9242840 [62,] 0.07685647 0.15371294 0.9231435 [63,] 0.06340368 0.12680735 0.9365963 [64,] 0.05059604 0.10119209 0.9494040 [65,] 0.04399039 0.08798077 0.9560096 [66,] 0.03387350 0.06774701 0.9661265 [67,] 0.02567776 0.05135553 0.9743222 [68,] 0.01943350 0.03886700 0.9805665 [69,] 0.01492667 0.02985333 0.9850733 [70,] 0.07444448 0.14888897 0.9255555 [71,] 0.05870097 0.11740195 0.9412990 [72,] 0.04621591 0.09243183 0.9537841 [73,] 0.03732530 0.07465060 0.9626747 [74,] 0.03693791 0.07387583 0.9630621 [75,] 0.03162401 0.06324803 0.9683760 [76,] 0.02348056 0.04696111 0.9765194 [77,] 0.02009464 0.04018927 0.9799054 [78,] 0.01584519 0.03169038 0.9841548 [79,] 0.01304104 0.02608208 0.9869590 [80,] 0.01285850 0.02571699 0.9871415 [81,] 0.01915087 0.03830174 0.9808491 [82,] 0.01507946 0.03015892 0.9849205 [83,] 0.01179797 0.02359595 0.9882020 [84,] 0.01218915 0.02437829 0.9878109 [85,] 0.01070919 0.02141837 0.9892908 [86,] 0.01667735 0.03335469 0.9833227 [87,] 0.01903697 0.03807394 0.9809630 [88,] 0.01560051 0.03120103 0.9843995 [89,] 0.07606437 0.15212874 0.9239356 [90,] 0.06810506 0.13621012 0.9318949 [91,] 0.05552747 0.11105494 0.9444725 [92,] 0.05747744 0.11495488 0.9425226 [93,] 0.04645804 0.09291607 0.9535420 [94,] 0.03547682 0.07095365 0.9645232 [95,] 0.03003944 0.06007888 0.9699606 [96,] 0.02170561 0.04341122 0.9782944 [97,] 0.01989002 0.03978004 0.9801100 [98,] 0.02865837 0.05731674 0.9713416 [99,] 0.03683109 0.07366219 0.9631689 [100,] 0.02711483 0.05422967 0.9728852 [101,] 0.02602313 0.05204627 0.9739769 [102,] 0.04800504 0.09601009 0.9519950 [103,] 0.04842185 0.09684371 0.9515781 [104,] 0.07648242 0.15296485 0.9235176 [105,] 0.05806998 0.11613997 0.9419300 [106,] 0.04770626 0.09541252 0.9522937 [107,] 0.03392635 0.06785270 0.9660737 [108,] 0.04021469 0.08042938 0.9597853 [109,] 0.17455205 0.34910410 0.8254480 [110,] 0.19609984 0.39219969 0.8039002 [111,] 0.14739510 0.29479020 0.8526049 [112,] 0.12502983 0.25005966 0.8749702 [113,] 0.53848783 0.92302434 0.4615122 [114,] 0.89214278 0.21571444 0.1078572 [115,] 0.89561963 0.20876074 0.1043804 [116,] 0.84659408 0.30681184 0.1534059 [117,] 0.83895125 0.32209751 0.1610488 [118,] 0.79359862 0.41280275 0.2064014 [119,] 0.74140023 0.51719953 0.2585998 [120,] 0.59484314 0.81031373 0.4051569 > postscript(file="/var/www/html/rcomp/tmp/1njj21290539827.ps",horizontal=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/html/rcomp/tmp/2ys041290539827.ps",horizontal=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/html/rcomp/tmp/3ys041290539827.ps",horizontal=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/html/rcomp/tmp/4ys041290539827.ps",horizontal=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/html/rcomp/tmp/5rjz81290539827.ps",horizontal=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 = 145 Frequency = 1 1 2 3 4 5 6 0.046676885 -0.736507906 -1.194781884 0.382800523 5.069636204 -1.194920444 7 8 9 10 11 12 7.084018633 -1.973596282 -2.091997665 0.298068957 -3.527496983 -4.165816765 13 14 15 16 17 18 0.683159409 -1.986807330 1.408339323 3.778371862 -1.822974275 -2.966976730 19 20 21 22 23 24 -1.218072810 -3.582897728 -1.751506408 1.194255475 -1.299254270 -2.176287727 25 26 27 28 29 30 -0.978110649 1.757969786 0.009938878 -0.549088980 4.890565125 -2.463158376 31 32 33 34 35 36 0.380191243 1.627367251 -2.439036568 6.348809563 -0.920696057 -0.192846269 37 38 39 40 41 42 -2.210717931 -3.467055760 -0.591490987 -2.889449154 2.195323575 -1.347120811 43 44 45 46 47 48 1.851679411 -0.995067684 -0.760280253 -2.022737042 3.506788785 4.401333396 49 50 51 52 53 54 1.614685230 -1.879270105 0.760075714 0.042164207 -4.633334261 -2.119020685 55 56 57 58 59 60 1.624708925 6.070271731 0.506651213 0.155902603 2.862038636 -1.771665111 61 62 63 64 65 66 -3.544923788 3.549607919 -0.407758860 -0.046494749 -0.016569871 2.070293119 67 68 69 70 71 72 0.941548107 0.888463707 -3.786515041 -0.467411134 0.068451008 2.678641287 73 74 75 76 77 78 -0.081948918 -3.187020029 -1.515037717 -0.421491689 -1.437516026 0.514147656 79 80 81 82 83 84 -0.584648540 0.518992543 0.450820911 7.324733222 0.913832716 1.138905178 85 86 87 88 89 90 -1.257128747 3.258478840 -1.757210460 0.056080828 1.745416970 -1.096922692 91 92 93 94 95 96 -1.488653131 -2.744090766 -4.627595354 1.755820867 -1.437949595 -2.921156960 97 98 99 100 101 102 1.533159295 3.986405592 -3.954942718 2.253250209 7.434523308 2.328155936 103 104 105 106 107 108 1.382134464 -3.901802704 1.503943622 -0.919361067 -0.814155246 0.102917748 109 110 111 112 113 114 -3.856579640 4.332997602 5.231598823 0.926619667 -3.172211750 -6.367831459 115 116 117 118 119 120 -3.239159263 -3.788353651 -1.282062072 -2.615465068 -1.086727129 -2.760937883 121 122 123 124 125 126 7.279347596 -2.199890687 1.069914293 1.462062919 9.055868186 1.072599545 127 128 129 130 131 132 0.790302769 -2.427808867 -2.177171786 -3.641249746 0.203168210 2.179199027 133 134 135 136 137 138 -1.623963384 0.830448389 -0.354983289 -2.722726579 0.702216647 -0.978110649 139 140 141 142 143 144 -1.629430547 4.346359999 1.138905178 0.587998306 -2.615465068 -1.526816596 145 6.245168055 > postscript(file="/var/www/html/rcomp/tmp/6rjz81290539827.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > dum <- cbind(lag(myerror,k=1),myerror) > dum Time Series: Start = 0 End = 145 Frequency = 1 lag(myerror, k = 1) myerror 0 0.046676885 NA 1 -0.736507906 0.046676885 2 -1.194781884 -0.736507906 3 0.382800523 -1.194781884 4 5.069636204 0.382800523 5 -1.194920444 5.069636204 6 7.084018633 -1.194920444 7 -1.973596282 7.084018633 8 -2.091997665 -1.973596282 9 0.298068957 -2.091997665 10 -3.527496983 0.298068957 11 -4.165816765 -3.527496983 12 0.683159409 -4.165816765 13 -1.986807330 0.683159409 14 1.408339323 -1.986807330 15 3.778371862 1.408339323 16 -1.822974275 3.778371862 17 -2.966976730 -1.822974275 18 -1.218072810 -2.966976730 19 -3.582897728 -1.218072810 20 -1.751506408 -3.582897728 21 1.194255475 -1.751506408 22 -1.299254270 1.194255475 23 -2.176287727 -1.299254270 24 -0.978110649 -2.176287727 25 1.757969786 -0.978110649 26 0.009938878 1.757969786 27 -0.549088980 0.009938878 28 4.890565125 -0.549088980 29 -2.463158376 4.890565125 30 0.380191243 -2.463158376 31 1.627367251 0.380191243 32 -2.439036568 1.627367251 33 6.348809563 -2.439036568 34 -0.920696057 6.348809563 35 -0.192846269 -0.920696057 36 -2.210717931 -0.192846269 37 -3.467055760 -2.210717931 38 -0.591490987 -3.467055760 39 -2.889449154 -0.591490987 40 2.195323575 -2.889449154 41 -1.347120811 2.195323575 42 1.851679411 -1.347120811 43 -0.995067684 1.851679411 44 -0.760280253 -0.995067684 45 -2.022737042 -0.760280253 46 3.506788785 -2.022737042 47 4.401333396 3.506788785 48 1.614685230 4.401333396 49 -1.879270105 1.614685230 50 0.760075714 -1.879270105 51 0.042164207 0.760075714 52 -4.633334261 0.042164207 53 -2.119020685 -4.633334261 54 1.624708925 -2.119020685 55 6.070271731 1.624708925 56 0.506651213 6.070271731 57 0.155902603 0.506651213 58 2.862038636 0.155902603 59 -1.771665111 2.862038636 60 -3.544923788 -1.771665111 61 3.549607919 -3.544923788 62 -0.407758860 3.549607919 63 -0.046494749 -0.407758860 64 -0.016569871 -0.046494749 65 2.070293119 -0.016569871 66 0.941548107 2.070293119 67 0.888463707 0.941548107 68 -3.786515041 0.888463707 69 -0.467411134 -3.786515041 70 0.068451008 -0.467411134 71 2.678641287 0.068451008 72 -0.081948918 2.678641287 73 -3.187020029 -0.081948918 74 -1.515037717 -3.187020029 75 -0.421491689 -1.515037717 76 -1.437516026 -0.421491689 77 0.514147656 -1.437516026 78 -0.584648540 0.514147656 79 0.518992543 -0.584648540 80 0.450820911 0.518992543 81 7.324733222 0.450820911 82 0.913832716 7.324733222 83 1.138905178 0.913832716 84 -1.257128747 1.138905178 85 3.258478840 -1.257128747 86 -1.757210460 3.258478840 87 0.056080828 -1.757210460 88 1.745416970 0.056080828 89 -1.096922692 1.745416970 90 -1.488653131 -1.096922692 91 -2.744090766 -1.488653131 92 -4.627595354 -2.744090766 93 1.755820867 -4.627595354 94 -1.437949595 1.755820867 95 -2.921156960 -1.437949595 96 1.533159295 -2.921156960 97 3.986405592 1.533159295 98 -3.954942718 3.986405592 99 2.253250209 -3.954942718 100 7.434523308 2.253250209 101 2.328155936 7.434523308 102 1.382134464 2.328155936 103 -3.901802704 1.382134464 104 1.503943622 -3.901802704 105 -0.919361067 1.503943622 106 -0.814155246 -0.919361067 107 0.102917748 -0.814155246 108 -3.856579640 0.102917748 109 4.332997602 -3.856579640 110 5.231598823 4.332997602 111 0.926619667 5.231598823 112 -3.172211750 0.926619667 113 -6.367831459 -3.172211750 114 -3.239159263 -6.367831459 115 -3.788353651 -3.239159263 116 -1.282062072 -3.788353651 117 -2.615465068 -1.282062072 118 -1.086727129 -2.615465068 119 -2.760937883 -1.086727129 120 7.279347596 -2.760937883 121 -2.199890687 7.279347596 122 1.069914293 -2.199890687 123 1.462062919 1.069914293 124 9.055868186 1.462062919 125 1.072599545 9.055868186 126 0.790302769 1.072599545 127 -2.427808867 0.790302769 128 -2.177171786 -2.427808867 129 -3.641249746 -2.177171786 130 0.203168210 -3.641249746 131 2.179199027 0.203168210 132 -1.623963384 2.179199027 133 0.830448389 -1.623963384 134 -0.354983289 0.830448389 135 -2.722726579 -0.354983289 136 0.702216647 -2.722726579 137 -0.978110649 0.702216647 138 -1.629430547 -0.978110649 139 4.346359999 -1.629430547 140 1.138905178 4.346359999 141 0.587998306 1.138905178 142 -2.615465068 0.587998306 143 -1.526816596 -2.615465068 144 6.245168055 -1.526816596 145 NA 6.245168055 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -0.736507906 0.046676885 [2,] -1.194781884 -0.736507906 [3,] 0.382800523 -1.194781884 [4,] 5.069636204 0.382800523 [5,] -1.194920444 5.069636204 [6,] 7.084018633 -1.194920444 [7,] -1.973596282 7.084018633 [8,] -2.091997665 -1.973596282 [9,] 0.298068957 -2.091997665 [10,] -3.527496983 0.298068957 [11,] -4.165816765 -3.527496983 [12,] 0.683159409 -4.165816765 [13,] -1.986807330 0.683159409 [14,] 1.408339323 -1.986807330 [15,] 3.778371862 1.408339323 [16,] -1.822974275 3.778371862 [17,] -2.966976730 -1.822974275 [18,] -1.218072810 -2.966976730 [19,] -3.582897728 -1.218072810 [20,] -1.751506408 -3.582897728 [21,] 1.194255475 -1.751506408 [22,] -1.299254270 1.194255475 [23,] -2.176287727 -1.299254270 [24,] -0.978110649 -2.176287727 [25,] 1.757969786 -0.978110649 [26,] 0.009938878 1.757969786 [27,] -0.549088980 0.009938878 [28,] 4.890565125 -0.549088980 [29,] -2.463158376 4.890565125 [30,] 0.380191243 -2.463158376 [31,] 1.627367251 0.380191243 [32,] -2.439036568 1.627367251 [33,] 6.348809563 -2.439036568 [34,] -0.920696057 6.348809563 [35,] -0.192846269 -0.920696057 [36,] -2.210717931 -0.192846269 [37,] -3.467055760 -2.210717931 [38,] -0.591490987 -3.467055760 [39,] -2.889449154 -0.591490987 [40,] 2.195323575 -2.889449154 [41,] -1.347120811 2.195323575 [42,] 1.851679411 -1.347120811 [43,] -0.995067684 1.851679411 [44,] -0.760280253 -0.995067684 [45,] -2.022737042 -0.760280253 [46,] 3.506788785 -2.022737042 [47,] 4.401333396 3.506788785 [48,] 1.614685230 4.401333396 [49,] -1.879270105 1.614685230 [50,] 0.760075714 -1.879270105 [51,] 0.042164207 0.760075714 [52,] -4.633334261 0.042164207 [53,] -2.119020685 -4.633334261 [54,] 1.624708925 -2.119020685 [55,] 6.070271731 1.624708925 [56,] 0.506651213 6.070271731 [57,] 0.155902603 0.506651213 [58,] 2.862038636 0.155902603 [59,] -1.771665111 2.862038636 [60,] -3.544923788 -1.771665111 [61,] 3.549607919 -3.544923788 [62,] -0.407758860 3.549607919 [63,] -0.046494749 -0.407758860 [64,] -0.016569871 -0.046494749 [65,] 2.070293119 -0.016569871 [66,] 0.941548107 2.070293119 [67,] 0.888463707 0.941548107 [68,] -3.786515041 0.888463707 [69,] -0.467411134 -3.786515041 [70,] 0.068451008 -0.467411134 [71,] 2.678641287 0.068451008 [72,] -0.081948918 2.678641287 [73,] -3.187020029 -0.081948918 [74,] -1.515037717 -3.187020029 [75,] -0.421491689 -1.515037717 [76,] -1.437516026 -0.421491689 [77,] 0.514147656 -1.437516026 [78,] -0.584648540 0.514147656 [79,] 0.518992543 -0.584648540 [80,] 0.450820911 0.518992543 [81,] 7.324733222 0.450820911 [82,] 0.913832716 7.324733222 [83,] 1.138905178 0.913832716 [84,] -1.257128747 1.138905178 [85,] 3.258478840 -1.257128747 [86,] -1.757210460 3.258478840 [87,] 0.056080828 -1.757210460 [88,] 1.745416970 0.056080828 [89,] -1.096922692 1.745416970 [90,] -1.488653131 -1.096922692 [91,] -2.744090766 -1.488653131 [92,] -4.627595354 -2.744090766 [93,] 1.755820867 -4.627595354 [94,] -1.437949595 1.755820867 [95,] -2.921156960 -1.437949595 [96,] 1.533159295 -2.921156960 [97,] 3.986405592 1.533159295 [98,] -3.954942718 3.986405592 [99,] 2.253250209 -3.954942718 [100,] 7.434523308 2.253250209 [101,] 2.328155936 7.434523308 [102,] 1.382134464 2.328155936 [103,] -3.901802704 1.382134464 [104,] 1.503943622 -3.901802704 [105,] -0.919361067 1.503943622 [106,] -0.814155246 -0.919361067 [107,] 0.102917748 -0.814155246 [108,] -3.856579640 0.102917748 [109,] 4.332997602 -3.856579640 [110,] 5.231598823 4.332997602 [111,] 0.926619667 5.231598823 [112,] -3.172211750 0.926619667 [113,] -6.367831459 -3.172211750 [114,] -3.239159263 -6.367831459 [115,] -3.788353651 -3.239159263 [116,] -1.282062072 -3.788353651 [117,] -2.615465068 -1.282062072 [118,] -1.086727129 -2.615465068 [119,] -2.760937883 -1.086727129 [120,] 7.279347596 -2.760937883 [121,] -2.199890687 7.279347596 [122,] 1.069914293 -2.199890687 [123,] 1.462062919 1.069914293 [124,] 9.055868186 1.462062919 [125,] 1.072599545 9.055868186 [126,] 0.790302769 1.072599545 [127,] -2.427808867 0.790302769 [128,] -2.177171786 -2.427808867 [129,] -3.641249746 -2.177171786 [130,] 0.203168210 -3.641249746 [131,] 2.179199027 0.203168210 [132,] -1.623963384 2.179199027 [133,] 0.830448389 -1.623963384 [134,] -0.354983289 0.830448389 [135,] -2.722726579 -0.354983289 [136,] 0.702216647 -2.722726579 [137,] -0.978110649 0.702216647 [138,] -1.629430547 -0.978110649 [139,] 4.346359999 -1.629430547 [140,] 1.138905178 4.346359999 [141,] 0.587998306 1.138905178 [142,] -2.615465068 0.587998306 [143,] -1.526816596 -2.615465068 [144,] 6.245168055 -1.526816596 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -0.736507906 0.046676885 2 -1.194781884 -0.736507906 3 0.382800523 -1.194781884 4 5.069636204 0.382800523 5 -1.194920444 5.069636204 6 7.084018633 -1.194920444 7 -1.973596282 7.084018633 8 -2.091997665 -1.973596282 9 0.298068957 -2.091997665 10 -3.527496983 0.298068957 11 -4.165816765 -3.527496983 12 0.683159409 -4.165816765 13 -1.986807330 0.683159409 14 1.408339323 -1.986807330 15 3.778371862 1.408339323 16 -1.822974275 3.778371862 17 -2.966976730 -1.822974275 18 -1.218072810 -2.966976730 19 -3.582897728 -1.218072810 20 -1.751506408 -3.582897728 21 1.194255475 -1.751506408 22 -1.299254270 1.194255475 23 -2.176287727 -1.299254270 24 -0.978110649 -2.176287727 25 1.757969786 -0.978110649 26 0.009938878 1.757969786 27 -0.549088980 0.009938878 28 4.890565125 -0.549088980 29 -2.463158376 4.890565125 30 0.380191243 -2.463158376 31 1.627367251 0.380191243 32 -2.439036568 1.627367251 33 6.348809563 -2.439036568 34 -0.920696057 6.348809563 35 -0.192846269 -0.920696057 36 -2.210717931 -0.192846269 37 -3.467055760 -2.210717931 38 -0.591490987 -3.467055760 39 -2.889449154 -0.591490987 40 2.195323575 -2.889449154 41 -1.347120811 2.195323575 42 1.851679411 -1.347120811 43 -0.995067684 1.851679411 44 -0.760280253 -0.995067684 45 -2.022737042 -0.760280253 46 3.506788785 -2.022737042 47 4.401333396 3.506788785 48 1.614685230 4.401333396 49 -1.879270105 1.614685230 50 0.760075714 -1.879270105 51 0.042164207 0.760075714 52 -4.633334261 0.042164207 53 -2.119020685 -4.633334261 54 1.624708925 -2.119020685 55 6.070271731 1.624708925 56 0.506651213 6.070271731 57 0.155902603 0.506651213 58 2.862038636 0.155902603 59 -1.771665111 2.862038636 60 -3.544923788 -1.771665111 61 3.549607919 -3.544923788 62 -0.407758860 3.549607919 63 -0.046494749 -0.407758860 64 -0.016569871 -0.046494749 65 2.070293119 -0.016569871 66 0.941548107 2.070293119 67 0.888463707 0.941548107 68 -3.786515041 0.888463707 69 -0.467411134 -3.786515041 70 0.068451008 -0.467411134 71 2.678641287 0.068451008 72 -0.081948918 2.678641287 73 -3.187020029 -0.081948918 74 -1.515037717 -3.187020029 75 -0.421491689 -1.515037717 76 -1.437516026 -0.421491689 77 0.514147656 -1.437516026 78 -0.584648540 0.514147656 79 0.518992543 -0.584648540 80 0.450820911 0.518992543 81 7.324733222 0.450820911 82 0.913832716 7.324733222 83 1.138905178 0.913832716 84 -1.257128747 1.138905178 85 3.258478840 -1.257128747 86 -1.757210460 3.258478840 87 0.056080828 -1.757210460 88 1.745416970 0.056080828 89 -1.096922692 1.745416970 90 -1.488653131 -1.096922692 91 -2.744090766 -1.488653131 92 -4.627595354 -2.744090766 93 1.755820867 -4.627595354 94 -1.437949595 1.755820867 95 -2.921156960 -1.437949595 96 1.533159295 -2.921156960 97 3.986405592 1.533159295 98 -3.954942718 3.986405592 99 2.253250209 -3.954942718 100 7.434523308 2.253250209 101 2.328155936 7.434523308 102 1.382134464 2.328155936 103 -3.901802704 1.382134464 104 1.503943622 -3.901802704 105 -0.919361067 1.503943622 106 -0.814155246 -0.919361067 107 0.102917748 -0.814155246 108 -3.856579640 0.102917748 109 4.332997602 -3.856579640 110 5.231598823 4.332997602 111 0.926619667 5.231598823 112 -3.172211750 0.926619667 113 -6.367831459 -3.172211750 114 -3.239159263 -6.367831459 115 -3.788353651 -3.239159263 116 -1.282062072 -3.788353651 117 -2.615465068 -1.282062072 118 -1.086727129 -2.615465068 119 -2.760937883 -1.086727129 120 7.279347596 -2.760937883 121 -2.199890687 7.279347596 122 1.069914293 -2.199890687 123 1.462062919 1.069914293 124 9.055868186 1.462062919 125 1.072599545 9.055868186 126 0.790302769 1.072599545 127 -2.427808867 0.790302769 128 -2.177171786 -2.427808867 129 -3.641249746 -2.177171786 130 0.203168210 -3.641249746 131 2.179199027 0.203168210 132 -1.623963384 2.179199027 133 0.830448389 -1.623963384 134 -0.354983289 0.830448389 135 -2.722726579 -0.354983289 136 0.702216647 -2.722726579 137 -0.978110649 0.702216647 138 -1.629430547 -0.978110649 139 4.346359999 -1.629430547 140 1.138905178 4.346359999 141 0.587998306 1.138905178 142 -2.615465068 0.587998306 143 -1.526816596 -2.615465068 144 6.245168055 -1.526816596 > 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/html/rcomp/tmp/71aga1290539827.ps",horizontal=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/html/rcomp/tmp/81aga1290539827.ps",horizontal=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/html/rcomp/tmp/9u2yd1290539827.ps",horizontal=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/html/rcomp/tmp/10u2yd1290539827.ps",horizontal=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/html/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/html/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/html/rcomp/tmp/11xkwj1290539827.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/html/rcomp/tmp/121lvp1290539827.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/html/rcomp/tmp/13q4s11290539827.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/html/rcomp/tmp/140v941290539827.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/html/rcomp/tmp/154e7s1290539827.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/html/rcomp/tmp/16ion11290539827.tab") + } > > try(system("convert tmp/1njj21290539827.ps tmp/1njj21290539827.png",intern=TRUE)) character(0) > try(system("convert tmp/2ys041290539827.ps tmp/2ys041290539827.png",intern=TRUE)) character(0) > try(system("convert tmp/3ys041290539827.ps tmp/3ys041290539827.png",intern=TRUE)) character(0) > try(system("convert tmp/4ys041290539827.ps tmp/4ys041290539827.png",intern=TRUE)) character(0) > try(system("convert tmp/5rjz81290539827.ps tmp/5rjz81290539827.png",intern=TRUE)) character(0) > try(system("convert tmp/6rjz81290539827.ps tmp/6rjz81290539827.png",intern=TRUE)) character(0) > try(system("convert tmp/71aga1290539827.ps tmp/71aga1290539827.png",intern=TRUE)) character(0) > try(system("convert tmp/81aga1290539827.ps tmp/81aga1290539827.png",intern=TRUE)) character(0) > try(system("convert tmp/9u2yd1290539827.ps tmp/9u2yd1290539827.png",intern=TRUE)) character(0) > try(system("convert tmp/10u2yd1290539827.ps tmp/10u2yd1290539827.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 4.025 1.661 10.072