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 + ,11 + ,6 + ,15 + ,3 + ,5 + ,4 + ,1 + ,2 + ,2 + ,14 + ,13 + ,14 + ,5 + ,7 + ,7 + ,4 + ,3 + ,4 + ,12 + ,8 + ,10 + ,3 + ,3 + ,3 + ,1 + ,2 + ,3 + ,21 + ,7 + ,10 + ,6 + ,7 + ,7 + ,5 + ,4 + ,4 + ,12 + ,9 + ,12 + ,5 + ,7 + ,2 + ,1 + ,2 + ,3 + ,22 + ,5 + ,18 + ,6 + ,7 + ,7 + ,1 + ,2 + ,3 + ,11 + ,8 + ,12 + ,6 + ,1 + ,2 + ,1 + ,3 + ,4 + ,10 + ,9 + ,14 + ,5 + ,4 + ,1 + ,1 + ,2 + ,3 + ,13 + ,11 + ,18 + ,5 + ,5 + ,2 + ,1 + ,2 + ,4 + ,10 + ,8 + ,9 + ,3 + ,6 + ,6 + ,2 + ,3 + ,3 + ,8 + ,11 + ,11 + ,5 + ,4 + ,1 + ,1 + ,2 + ,2 + ,15 + ,12 + ,11 + ,7 + ,7 + ,1 + ,3 + ,3 + ,3 + ,10 + ,8 + ,17 + ,5 + ,6 + ,1 + ,1 + ,1 + ,3 + ,14 + ,7 + ,8 + ,5 + ,2 + ,2 + ,1 + ,3 + ,3 + ,14 + ,9 + ,16 + ,3 + ,2 + ,2 + ,1 + ,1 + ,2 + ,11 + ,12 + ,21 + ,5 + ,6 + ,2 + ,1 + ,3 + ,3 + ,10 + ,20 + ,24 + ,6 + ,7 + ,1 +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,1 + ,1 + ,3 + ,2 + ,4 + ,12 + ,7 + ,16 + ,4 + ,5 + ,4 + ,2 + ,4 + ,4 + ,11 + ,10 + ,15 + ,2 + ,2 + ,1 + ,2 + ,1 + ,4 + ,12 + ,6 + ,14 + ,2 + ,5 + ,4 + ,1 + ,3 + ,4 + ,13 + ,6 + ,9 + ,7 + ,6 + ,6 + ,1 + ,1 + ,3 + ,17 + ,11 + ,13 + ,6 + ,7 + ,7 + ,2 + ,2 + ,5 + ,11 + ,8 + ,11 + ,5 + ,5 + ,1 + ,3 + ,1 + ,3 + ,12 + ,9 + ,14 + ,5 + ,5 + ,3 + ,1 + ,2 + ,4 + ,19 + ,9 + ,11 + ,5 + ,5 + ,5 + ,1 + ,4 + ,4 + ,15 + ,11 + ,8 + ,4 + ,6 + ,2 + ,2 + ,4 + ,4 + ,14 + ,4 + ,7 + ,3 + ,6 + ,4 + ,2 + ,3 + ,4 + ,11 + ,9 + ,11 + ,3 + ,6 + ,5 + ,1 + ,3 + ,3 + ,9 + ,5 + ,13 + ,3 + ,1 + ,1 + ,1 + ,1 + ,4 + ,18 + ,4 + ,9 + ,2 + ,3 + ,2 + ,1 + ,4 + ,4) + ,dim=c(9 + ,145) + ,dimnames=list(c('Depression' + ,'CriticParents' + ,'ExpecParents' + ,'FutureWorrying' + ,'SleepDepri' + ,'ChangesLastYear' + ,'FreqSmoking' + ,'FreqHighAlc' + ,'FreqBeerOrWine') + ,1:145)) > y <- array(NA,dim=c(9,145),dimnames=list(c('Depression','CriticParents','ExpecParents','FutureWorrying','SleepDepri','ChangesLastYear','FreqSmoking','FreqHighAlc','FreqBeerOrWine'),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 1 2 2 2 2 2 4 1 2 2 3 7 4 3 4 4 3 1 2 3 5 7 5 4 4 6 2 1 2 3 7 7 1 2 3 8 2 1 3 4 9 1 1 2 3 10 2 1 2 4 11 6 2 3 3 12 1 1 2 2 13 1 3 3 3 14 1 1 1 3 15 2 1 3 3 16 2 1 1 2 17 2 1 3 3 18 1 1 2 2 19 7 2 3 4 20 1 4 4 5 21 2 1 3 3 22 4 2 3 3 23 2 1 1 1 24 1 2 2 4 25 1 3 1 3 26 5 1 3 4 27 2 1 3 3 28 1 1 2 3 29 3 1 2 1 30 1 1 3 4 31 2 2 2 4 32 5 1 2 2 33 2 1 2 2 34 6 1 1 1 35 4 1 2 3 36 1 1 3 4 37 3 1 1 1 38 6 1 2 3 39 7 2 3 3 40 4 1 2 2 41 1 2 1 4 42 5 1 1 3 43 3 1 3 3 44 2 2 3 2 45 2 1 3 3 46 2 1 3 2 47 2 1 2 1 48 1 1 3 3 49 2 1 2 3 50 1 4 3 5 51 2 2 4 1 52 2 1 3 3 53 5 1 3 4 54 5 4 3 3 55 2 2 3 4 56 1 1 2 2 57 1 1 3 3 58 2 1 3 4 59 3 1 1 1 60 7 1 1 1 61 4 1 1 1 62 4 2 4 4 63 1 1 3 2 64 2 1 2 3 65 2 2 3 4 66 2 1 1 2 67 5 2 4 5 68 1 2 3 3 69 6 4 2 3 70 2 1 3 3 71 2 1 3 4 72 4 3 3 4 73 6 1 2 3 74 2 1 1 1 75 2 1 1 3 76 2 1 1 1 77 1 1 3 3 78 1 1 4 5 79 2 1 2 3 80 2 1 2 3 81 3 4 2 4 82 3 1 2 5 83 5 1 3 4 84 2 2 4 4 85 5 1 2 4 86 3 1 3 4 87 1 1 3 4 88 2 1 2 3 89 2 1 2 4 90 1 1 3 3 91 2 1 3 3 92 2 1 3 3 93 5 1 3 4 94 5 1 3 3 95 2 1 3 4 96 3 1 2 2 97 5 5 3 5 98 5 1 3 3 99 6 1 2 4 100 2 1 1 2 101 7 3 3 4 102 1 1 2 3 103 1 1 2 4 104 6 1 3 3 105 6 1 1 1 106 2 1 3 4 107 1 1 2 4 108 2 1 2 2 109 1 4 2 5 110 2 4 2 4 111 1 1 2 4 112 3 1 3 3 113 3 1 3 4 114 6 4 3 4 115 4 2 3 4 116 1 1 3 3 117 2 1 1 5 118 5 1 3 3 119 6 1 4 4 120 3 1 2 4 121 5 1 2 4 122 3 2 4 4 123 2 4 3 4 124 3 4 2 5 125 2 1 3 3 126 5 1 1 1 127 5 1 2 4 128 7 2 4 4 129 4 1 3 3 130 4 1 3 4 131 5 1 3 4 132 1 3 2 4 133 4 2 4 4 134 1 2 1 4 135 4 1 3 4 136 6 1 1 3 137 7 2 2 5 138 1 3 1 3 139 3 1 2 4 140 5 1 4 4 141 2 2 4 4 142 4 2 3 4 143 5 1 3 3 144 1 1 1 4 145 2 1 4 4 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) CriticParents ExpecParents FutureWorrying 7.49201 0.04090 -0.06691 0.58676 SleepDepri ChangesLastYear FreqSmoking FreqHighAlc 0.20217 0.35635 -0.12134 0.26471 FreqBeerOrWine 0.29259 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -6.2147 -2.0897 -0.1981 1.3630 9.2560 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 7.49201 1.44524 5.184 7.69e-07 *** CriticParents 0.04090 0.11575 0.353 0.724412 ExpecParents -0.06691 0.08658 -0.773 0.441000 FutureWorrying 0.58676 0.16826 3.487 0.000658 *** SleepDepri 0.20217 0.14121 1.432 0.154525 ChangesLastYear 0.35635 0.13492 2.641 0.009230 ** FreqSmoking -0.12134 0.27349 -0.444 0.657980 FreqHighAlc 0.26471 0.31460 0.841 0.401593 FreqBeerOrWine 0.29259 0.27853 1.050 0.295364 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 2.9 on 136 degrees of freedom Multiple R-squared: 0.2056, Adjusted R-squared: 0.1589 F-statistic: 4.4 on 8 and 136 DF, p-value: 9.39e-05 > if (n > n25) { + kp3 <- k + 3 + nmkm3 <- n - k - 3 + gqarr <- array(NA, dim=c(nmkm3-kp3+1,3)) + numgqtests <- 0 + numsignificant1 <- 0 + numsignificant5 <- 0 + numsignificant10 <- 0 + for (mypoint in kp3:nmkm3) { + j <- 0 + numgqtests <- numgqtests + 1 + for (myalt in c('greater', 'two.sided', 'less')) { + j <- j + 1 + gqarr[mypoint-kp3+1,j] <- gqtest(mylm, point=mypoint, alternative=myalt)$p.value + } + if (gqarr[mypoint-kp3+1,2] < 0.01) numsignificant1 <- numsignificant1 + 1 + if (gqarr[mypoint-kp3+1,2] < 0.05) numsignificant5 <- numsignificant5 + 1 + if (gqarr[mypoint-kp3+1,2] < 0.10) numsignificant10 <- numsignificant10 + 1 + } + gqarr + } [,1] [,2] [,3] [1,] 0.19262592 0.38525183 0.8073741 [2,] 0.29917855 0.59835711 0.7008214 [3,] 0.45582602 0.91165203 0.5441740 [4,] 0.40085223 0.80170446 0.5991478 [5,] 0.55342592 0.89314816 0.4465741 [6,] 0.46928856 0.93857711 0.5307114 [7,] 0.38343901 0.76687802 0.6165610 [8,] 0.48998776 0.97997552 0.5100122 [9,] 0.41933597 0.83867194 0.5806640 [10,] 0.35231785 0.70463570 0.6476822 [11,] 0.39822723 0.79645446 0.6017728 [12,] 0.44437930 0.88875860 0.5556207 [13,] 0.37231151 0.74462301 0.6276885 [14,] 0.31564633 0.63129266 0.6843537 [15,] 0.27439594 0.54879188 0.7256041 [16,] 0.22456711 0.44913423 0.7754329 [17,] 0.18936491 0.37872983 0.8106351 [18,] 0.24797096 0.49594193 0.7520290 [19,] 0.20794026 0.41588052 0.7920597 [20,] 0.17097625 0.34195250 0.8290237 [21,] 0.13419174 0.26838349 0.8658083 [22,] 0.12933158 0.25866317 0.8706684 [23,] 0.14663303 0.29326607 0.8533670 [24,] 0.14907559 0.29815118 0.8509244 [25,] 0.15413378 0.30826757 0.8458662 [26,] 0.19441837 0.38883675 0.8055816 [27,] 0.24676815 0.49353630 0.7532319 [28,] 0.27039157 0.54078315 0.7296084 [29,] 0.26399261 0.52798522 0.7360074 [30,] 0.27565756 0.55131512 0.7243424 [31,] 0.24471346 0.48942692 0.7552865 [32,] 0.24397447 0.48794895 0.7560255 [33,] 0.20806844 0.41613688 0.7919316 [34,] 0.17312952 0.34625905 0.8268705 [35,] 0.15164881 0.30329763 0.8483512 [36,] 0.15838464 0.31676928 0.8416154 [37,] 0.25905798 0.51811597 0.7409420 [38,] 0.24297578 0.48595157 0.7570242 [39,] 0.21484090 0.42968180 0.7851591 [40,] 0.18169442 0.36338883 0.8183056 [41,] 0.14829862 0.29659724 0.8517014 [42,] 0.21210297 0.42420593 0.7878970 [43,] 0.20464331 0.40928663 0.7953567 [44,] 0.18720565 0.37441131 0.8127943 [45,] 0.27981092 0.55962185 0.7201891 [46,] 0.24140225 0.48280450 0.7585978 [47,] 0.20923962 0.41847924 0.7907604 [48,] 0.19512712 0.39025424 0.8048729 [49,] 0.20859603 0.41719206 0.7914040 [50,] 0.25958765 0.51917530 0.7404124 [51,] 0.29740819 0.59481637 0.7025918 [52,] 0.25534143 0.51068286 0.7446586 [53,] 0.21681131 0.43362263 0.7831887 [54,] 0.18277090 0.36554179 0.8172291 [55,] 0.17040667 0.34081335 0.8295933 [56,] 0.14623353 0.29246705 0.8537665 [57,] 0.12244049 0.24488099 0.8775595 [58,] 0.13140714 0.26281429 0.8685929 [59,] 0.10650688 0.21301377 0.8934931 [60,] 0.08521512 0.17043023 0.9147849 [61,] 0.09157829 0.18315658 0.9084217 [62,] 0.07266565 0.14533129 0.9273344 [63,] 0.07298038 0.14596076 0.9270196 [64,] 0.06020302 0.12040605 0.9397970 [65,] 0.04826575 0.09653150 0.9517343 [66,] 0.04192889 0.08385779 0.9580711 [67,] 0.03234286 0.06468572 0.9676571 [68,] 0.02456126 0.04912252 0.9754387 [69,] 0.01872881 0.03745762 0.9812712 [70,] 0.01458481 0.02916962 0.9854152 [71,] 0.07723046 0.15446092 0.9227695 [72,] 0.06179379 0.12358757 0.9382062 [73,] 0.04958237 0.09916473 0.9504176 [74,] 0.03951006 0.07902012 0.9604899 [75,] 0.04045340 0.08090680 0.9595466 [76,] 0.03380603 0.06761205 0.9661940 [77,] 0.02529067 0.05058134 0.9747093 [78,] 0.02184436 0.04368873 0.9781556 [79,] 0.01711022 0.03422044 0.9828898 [80,] 0.01400762 0.02801525 0.9859924 [81,] 0.01354034 0.02708068 0.9864597 [82,] 0.01943072 0.03886145 0.9805693 [83,] 0.01564936 0.03129873 0.9843506 [84,] 0.01225480 0.02450960 0.9877452 [85,] 0.01278846 0.02557691 0.9872115 [86,] 0.01131223 0.02262446 0.9886878 [87,] 0.01789570 0.03579140 0.9821043 [88,] 0.02021784 0.04043568 0.9797822 [89,] 0.01662352 0.03324704 0.9833765 [90,] 0.08264664 0.16529327 0.9173534 [91,] 0.07564854 0.15129708 0.9243515 [92,] 0.06203921 0.12407842 0.9379608 [93,] 0.06222811 0.12445623 0.9377719 [94,] 0.05084742 0.10169484 0.9491526 [95,] 0.03914887 0.07829774 0.9608511 [96,] 0.03333963 0.06667926 0.9666604 [97,] 0.02401552 0.04803103 0.9759845 [98,] 0.02232476 0.04464953 0.9776752 [99,] 0.03234147 0.06468294 0.9676585 [100,] 0.04323080 0.08646159 0.9567692 [101,] 0.03233701 0.06467403 0.9676630 [102,] 0.03164265 0.06328529 0.9683574 [103,] 0.05828248 0.11656497 0.9417175 [104,] 0.06003746 0.12007493 0.9399625 [105,] 0.09508092 0.19016183 0.9049191 [106,] 0.07326606 0.14653211 0.9267339 [107,] 0.06089460 0.12178919 0.9391054 [108,] 0.04420526 0.08841052 0.9557947 [109,] 0.05323290 0.10646579 0.9467671 [110,] 0.21778096 0.43556192 0.7822190 [111,] 0.24441920 0.48883840 0.7555808 [112,] 0.18984655 0.37969310 0.8101534 [113,] 0.16603430 0.33206861 0.8339657 [114,] 0.58113190 0.83773620 0.4188681 [115,] 0.86592112 0.26815775 0.1340789 [116,] 0.85803509 0.28392983 0.1419649 [117,] 0.79514555 0.40970890 0.2048544 [118,] 0.73276889 0.53446221 0.2672311 [119,] 0.71097626 0.57804747 0.2890237 [120,] 0.70649892 0.58700216 0.2935011 [121,] 0.61328444 0.77343112 0.3867156 [122,] 0.77936760 0.44126480 0.2206324 > postscript(file="/var/www/html/rcomp/tmp/1302j1290533238.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/2302j1290533238.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/3vr2m1290533238.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/4vr2m1290533238.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/5vr2m1290533238.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.08056284 -0.92350690 -1.40944156 0.12824941 4.83816905 -1.40466172 7 8 9 10 11 12 6.79188265 -2.29482497 -2.30799789 0.02674168 -3.75757170 -4.29792453 13 14 15 16 17 18 0.56654528 -2.20599713 1.15561594 3.60462142 -1.98771818 -2.98943027 19 20 21 22 23 24 -1.53405604 -3.85308541 -1.96302185 1.04771092 -1.37663561 -2.45212379 25 26 27 28 29 30 -1.16260050 1.43132696 -0.19813285 -0.75538644 4.80857086 -2.75605578 31 32 33 34 35 36 0.07625634 1.42871943 -2.60860372 6.16029690 -1.19944263 -0.47593988 37 38 39 40 41 42 -2.33062781 -3.74492628 -0.86479408 -3.07253704 1.91586242 -1.56798641 43 44 45 46 47 48 1.63613531 -1.11223479 -0.98228388 -2.13294379 3.40575983 4.20801971 49 50 51 52 53 54 1.41027407 -2.15586635 0.76088058 -0.18325023 -4.97927535 -2.31042282 55 56 57 58 59 60 1.36298354 5.89980239 0.29656176 -0.11990544 2.74852173 -1.92181631 61 62 63 64 65 66 -3.27595040 3.68519646 -0.12227011 0.15608144 0.15937560 2.30611291 67 68 69 70 71 72 1.01651573 1.10739352 -3.60500172 -0.29543372 0.16669402 2.86653144 73 74 75 76 77 78 0.05434818 -2.84619561 -1.35729457 -0.09363732 -1.19967366 0.54502432 79 80 81 82 83 84 -0.41984096 0.72024490 0.63749648 7.35101340 1.00431115 1.33416012 85 86 87 88 89 90 -1.18580421 3.35986909 -1.61143891 0.21090052 1.86469179 -0.89930228 91 92 93 94 95 96 -1.29996473 -2.55559856 -4.52030825 1.95812471 -1.31114879 -2.67685382 97 98 99 100 101 102 1.68503518 4.13836129 -3.87957576 2.47893609 7.67852192 2.48809755 103 104 105 106 107 108 1.55326985 -3.74047447 1.77018355 -0.79130120 -0.69504027 0.35695041 109 110 111 112 113 114 -3.74245357 4.53079318 5.31579343 1.15463138 -3.08151798 -6.21466277 115 116 117 118 119 120 -3.10808850 -3.61876471 -1.28769932 -2.42964415 -0.99242750 -2.68640812 121 122 123 124 125 126 7.31400263 -2.08972208 1.25494972 1.59423758 9.25600661 1.35813012 127 128 129 130 131 132 0.90114504 -2.29356340 -1.97917572 -3.51887698 0.27635849 2.35399657 133 134 135 136 137 138 -1.47751591 0.97608043 -0.25355252 -2.61471920 0.74812708 -1.16260050 139 140 141 142 143 144 -1.51544782 4.04170722 1.33416012 0.69229666 -2.42964415 -1.45918861 145 6.34600955 > postscript(file="/var/www/html/rcomp/tmp/6oij71290533238.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.08056284 NA 1 -0.92350690 -0.08056284 2 -1.40944156 -0.92350690 3 0.12824941 -1.40944156 4 4.83816905 0.12824941 5 -1.40466172 4.83816905 6 6.79188265 -1.40466172 7 -2.29482497 6.79188265 8 -2.30799789 -2.29482497 9 0.02674168 -2.30799789 10 -3.75757170 0.02674168 11 -4.29792453 -3.75757170 12 0.56654528 -4.29792453 13 -2.20599713 0.56654528 14 1.15561594 -2.20599713 15 3.60462142 1.15561594 16 -1.98771818 3.60462142 17 -2.98943027 -1.98771818 18 -1.53405604 -2.98943027 19 -3.85308541 -1.53405604 20 -1.96302185 -3.85308541 21 1.04771092 -1.96302185 22 -1.37663561 1.04771092 23 -2.45212379 -1.37663561 24 -1.16260050 -2.45212379 25 1.43132696 -1.16260050 26 -0.19813285 1.43132696 27 -0.75538644 -0.19813285 28 4.80857086 -0.75538644 29 -2.75605578 4.80857086 30 0.07625634 -2.75605578 31 1.42871943 0.07625634 32 -2.60860372 1.42871943 33 6.16029690 -2.60860372 34 -1.19944263 6.16029690 35 -0.47593988 -1.19944263 36 -2.33062781 -0.47593988 37 -3.74492628 -2.33062781 38 -0.86479408 -3.74492628 39 -3.07253704 -0.86479408 40 1.91586242 -3.07253704 41 -1.56798641 1.91586242 42 1.63613531 -1.56798641 43 -1.11223479 1.63613531 44 -0.98228388 -1.11223479 45 -2.13294379 -0.98228388 46 3.40575983 -2.13294379 47 4.20801971 3.40575983 48 1.41027407 4.20801971 49 -2.15586635 1.41027407 50 0.76088058 -2.15586635 51 -0.18325023 0.76088058 52 -4.97927535 -0.18325023 53 -2.31042282 -4.97927535 54 1.36298354 -2.31042282 55 5.89980239 1.36298354 56 0.29656176 5.89980239 57 -0.11990544 0.29656176 58 2.74852173 -0.11990544 59 -1.92181631 2.74852173 60 -3.27595040 -1.92181631 61 3.68519646 -3.27595040 62 -0.12227011 3.68519646 63 0.15608144 -0.12227011 64 0.15937560 0.15608144 65 2.30611291 0.15937560 66 1.01651573 2.30611291 67 1.10739352 1.01651573 68 -3.60500172 1.10739352 69 -0.29543372 -3.60500172 70 0.16669402 -0.29543372 71 2.86653144 0.16669402 72 0.05434818 2.86653144 73 -2.84619561 0.05434818 74 -1.35729457 -2.84619561 75 -0.09363732 -1.35729457 76 -1.19967366 -0.09363732 77 0.54502432 -1.19967366 78 -0.41984096 0.54502432 79 0.72024490 -0.41984096 80 0.63749648 0.72024490 81 7.35101340 0.63749648 82 1.00431115 7.35101340 83 1.33416012 1.00431115 84 -1.18580421 1.33416012 85 3.35986909 -1.18580421 86 -1.61143891 3.35986909 87 0.21090052 -1.61143891 88 1.86469179 0.21090052 89 -0.89930228 1.86469179 90 -1.29996473 -0.89930228 91 -2.55559856 -1.29996473 92 -4.52030825 -2.55559856 93 1.95812471 -4.52030825 94 -1.31114879 1.95812471 95 -2.67685382 -1.31114879 96 1.68503518 -2.67685382 97 4.13836129 1.68503518 98 -3.87957576 4.13836129 99 2.47893609 -3.87957576 100 7.67852192 2.47893609 101 2.48809755 7.67852192 102 1.55326985 2.48809755 103 -3.74047447 1.55326985 104 1.77018355 -3.74047447 105 -0.79130120 1.77018355 106 -0.69504027 -0.79130120 107 0.35695041 -0.69504027 108 -3.74245357 0.35695041 109 4.53079318 -3.74245357 110 5.31579343 4.53079318 111 1.15463138 5.31579343 112 -3.08151798 1.15463138 113 -6.21466277 -3.08151798 114 -3.10808850 -6.21466277 115 -3.61876471 -3.10808850 116 -1.28769932 -3.61876471 117 -2.42964415 -1.28769932 118 -0.99242750 -2.42964415 119 -2.68640812 -0.99242750 120 7.31400263 -2.68640812 121 -2.08972208 7.31400263 122 1.25494972 -2.08972208 123 1.59423758 1.25494972 124 9.25600661 1.59423758 125 1.35813012 9.25600661 126 0.90114504 1.35813012 127 -2.29356340 0.90114504 128 -1.97917572 -2.29356340 129 -3.51887698 -1.97917572 130 0.27635849 -3.51887698 131 2.35399657 0.27635849 132 -1.47751591 2.35399657 133 0.97608043 -1.47751591 134 -0.25355252 0.97608043 135 -2.61471920 -0.25355252 136 0.74812708 -2.61471920 137 -1.16260050 0.74812708 138 -1.51544782 -1.16260050 139 4.04170722 -1.51544782 140 1.33416012 4.04170722 141 0.69229666 1.33416012 142 -2.42964415 0.69229666 143 -1.45918861 -2.42964415 144 6.34600955 -1.45918861 145 NA 6.34600955 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -0.92350690 -0.08056284 [2,] -1.40944156 -0.92350690 [3,] 0.12824941 -1.40944156 [4,] 4.83816905 0.12824941 [5,] -1.40466172 4.83816905 [6,] 6.79188265 -1.40466172 [7,] -2.29482497 6.79188265 [8,] -2.30799789 -2.29482497 [9,] 0.02674168 -2.30799789 [10,] -3.75757170 0.02674168 [11,] -4.29792453 -3.75757170 [12,] 0.56654528 -4.29792453 [13,] -2.20599713 0.56654528 [14,] 1.15561594 -2.20599713 [15,] 3.60462142 1.15561594 [16,] -1.98771818 3.60462142 [17,] -2.98943027 -1.98771818 [18,] -1.53405604 -2.98943027 [19,] -3.85308541 -1.53405604 [20,] -1.96302185 -3.85308541 [21,] 1.04771092 -1.96302185 [22,] -1.37663561 1.04771092 [23,] -2.45212379 -1.37663561 [24,] -1.16260050 -2.45212379 [25,] 1.43132696 -1.16260050 [26,] -0.19813285 1.43132696 [27,] -0.75538644 -0.19813285 [28,] 4.80857086 -0.75538644 [29,] -2.75605578 4.80857086 [30,] 0.07625634 -2.75605578 [31,] 1.42871943 0.07625634 [32,] -2.60860372 1.42871943 [33,] 6.16029690 -2.60860372 [34,] -1.19944263 6.16029690 [35,] -0.47593988 -1.19944263 [36,] -2.33062781 -0.47593988 [37,] -3.74492628 -2.33062781 [38,] -0.86479408 -3.74492628 [39,] -3.07253704 -0.86479408 [40,] 1.91586242 -3.07253704 [41,] -1.56798641 1.91586242 [42,] 1.63613531 -1.56798641 [43,] -1.11223479 1.63613531 [44,] -0.98228388 -1.11223479 [45,] -2.13294379 -0.98228388 [46,] 3.40575983 -2.13294379 [47,] 4.20801971 3.40575983 [48,] 1.41027407 4.20801971 [49,] -2.15586635 1.41027407 [50,] 0.76088058 -2.15586635 [51,] -0.18325023 0.76088058 [52,] -4.97927535 -0.18325023 [53,] -2.31042282 -4.97927535 [54,] 1.36298354 -2.31042282 [55,] 5.89980239 1.36298354 [56,] 0.29656176 5.89980239 [57,] -0.11990544 0.29656176 [58,] 2.74852173 -0.11990544 [59,] -1.92181631 2.74852173 [60,] -3.27595040 -1.92181631 [61,] 3.68519646 -3.27595040 [62,] -0.12227011 3.68519646 [63,] 0.15608144 -0.12227011 [64,] 0.15937560 0.15608144 [65,] 2.30611291 0.15937560 [66,] 1.01651573 2.30611291 [67,] 1.10739352 1.01651573 [68,] -3.60500172 1.10739352 [69,] -0.29543372 -3.60500172 [70,] 0.16669402 -0.29543372 [71,] 2.86653144 0.16669402 [72,] 0.05434818 2.86653144 [73,] -2.84619561 0.05434818 [74,] -1.35729457 -2.84619561 [75,] -0.09363732 -1.35729457 [76,] -1.19967366 -0.09363732 [77,] 0.54502432 -1.19967366 [78,] -0.41984096 0.54502432 [79,] 0.72024490 -0.41984096 [80,] 0.63749648 0.72024490 [81,] 7.35101340 0.63749648 [82,] 1.00431115 7.35101340 [83,] 1.33416012 1.00431115 [84,] -1.18580421 1.33416012 [85,] 3.35986909 -1.18580421 [86,] -1.61143891 3.35986909 [87,] 0.21090052 -1.61143891 [88,] 1.86469179 0.21090052 [89,] -0.89930228 1.86469179 [90,] -1.29996473 -0.89930228 [91,] -2.55559856 -1.29996473 [92,] -4.52030825 -2.55559856 [93,] 1.95812471 -4.52030825 [94,] -1.31114879 1.95812471 [95,] -2.67685382 -1.31114879 [96,] 1.68503518 -2.67685382 [97,] 4.13836129 1.68503518 [98,] -3.87957576 4.13836129 [99,] 2.47893609 -3.87957576 [100,] 7.67852192 2.47893609 [101,] 2.48809755 7.67852192 [102,] 1.55326985 2.48809755 [103,] -3.74047447 1.55326985 [104,] 1.77018355 -3.74047447 [105,] -0.79130120 1.77018355 [106,] -0.69504027 -0.79130120 [107,] 0.35695041 -0.69504027 [108,] -3.74245357 0.35695041 [109,] 4.53079318 -3.74245357 [110,] 5.31579343 4.53079318 [111,] 1.15463138 5.31579343 [112,] -3.08151798 1.15463138 [113,] -6.21466277 -3.08151798 [114,] -3.10808850 -6.21466277 [115,] -3.61876471 -3.10808850 [116,] -1.28769932 -3.61876471 [117,] -2.42964415 -1.28769932 [118,] -0.99242750 -2.42964415 [119,] -2.68640812 -0.99242750 [120,] 7.31400263 -2.68640812 [121,] -2.08972208 7.31400263 [122,] 1.25494972 -2.08972208 [123,] 1.59423758 1.25494972 [124,] 9.25600661 1.59423758 [125,] 1.35813012 9.25600661 [126,] 0.90114504 1.35813012 [127,] -2.29356340 0.90114504 [128,] -1.97917572 -2.29356340 [129,] -3.51887698 -1.97917572 [130,] 0.27635849 -3.51887698 [131,] 2.35399657 0.27635849 [132,] -1.47751591 2.35399657 [133,] 0.97608043 -1.47751591 [134,] -0.25355252 0.97608043 [135,] -2.61471920 -0.25355252 [136,] 0.74812708 -2.61471920 [137,] -1.16260050 0.74812708 [138,] -1.51544782 -1.16260050 [139,] 4.04170722 -1.51544782 [140,] 1.33416012 4.04170722 [141,] 0.69229666 1.33416012 [142,] -2.42964415 0.69229666 [143,] -1.45918861 -2.42964415 [144,] 6.34600955 -1.45918861 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -0.92350690 -0.08056284 2 -1.40944156 -0.92350690 3 0.12824941 -1.40944156 4 4.83816905 0.12824941 5 -1.40466172 4.83816905 6 6.79188265 -1.40466172 7 -2.29482497 6.79188265 8 -2.30799789 -2.29482497 9 0.02674168 -2.30799789 10 -3.75757170 0.02674168 11 -4.29792453 -3.75757170 12 0.56654528 -4.29792453 13 -2.20599713 0.56654528 14 1.15561594 -2.20599713 15 3.60462142 1.15561594 16 -1.98771818 3.60462142 17 -2.98943027 -1.98771818 18 -1.53405604 -2.98943027 19 -3.85308541 -1.53405604 20 -1.96302185 -3.85308541 21 1.04771092 -1.96302185 22 -1.37663561 1.04771092 23 -2.45212379 -1.37663561 24 -1.16260050 -2.45212379 25 1.43132696 -1.16260050 26 -0.19813285 1.43132696 27 -0.75538644 -0.19813285 28 4.80857086 -0.75538644 29 -2.75605578 4.80857086 30 0.07625634 -2.75605578 31 1.42871943 0.07625634 32 -2.60860372 1.42871943 33 6.16029690 -2.60860372 34 -1.19944263 6.16029690 35 -0.47593988 -1.19944263 36 -2.33062781 -0.47593988 37 -3.74492628 -2.33062781 38 -0.86479408 -3.74492628 39 -3.07253704 -0.86479408 40 1.91586242 -3.07253704 41 -1.56798641 1.91586242 42 1.63613531 -1.56798641 43 -1.11223479 1.63613531 44 -0.98228388 -1.11223479 45 -2.13294379 -0.98228388 46 3.40575983 -2.13294379 47 4.20801971 3.40575983 48 1.41027407 4.20801971 49 -2.15586635 1.41027407 50 0.76088058 -2.15586635 51 -0.18325023 0.76088058 52 -4.97927535 -0.18325023 53 -2.31042282 -4.97927535 54 1.36298354 -2.31042282 55 5.89980239 1.36298354 56 0.29656176 5.89980239 57 -0.11990544 0.29656176 58 2.74852173 -0.11990544 59 -1.92181631 2.74852173 60 -3.27595040 -1.92181631 61 3.68519646 -3.27595040 62 -0.12227011 3.68519646 63 0.15608144 -0.12227011 64 0.15937560 0.15608144 65 2.30611291 0.15937560 66 1.01651573 2.30611291 67 1.10739352 1.01651573 68 -3.60500172 1.10739352 69 -0.29543372 -3.60500172 70 0.16669402 -0.29543372 71 2.86653144 0.16669402 72 0.05434818 2.86653144 73 -2.84619561 0.05434818 74 -1.35729457 -2.84619561 75 -0.09363732 -1.35729457 76 -1.19967366 -0.09363732 77 0.54502432 -1.19967366 78 -0.41984096 0.54502432 79 0.72024490 -0.41984096 80 0.63749648 0.72024490 81 7.35101340 0.63749648 82 1.00431115 7.35101340 83 1.33416012 1.00431115 84 -1.18580421 1.33416012 85 3.35986909 -1.18580421 86 -1.61143891 3.35986909 87 0.21090052 -1.61143891 88 1.86469179 0.21090052 89 -0.89930228 1.86469179 90 -1.29996473 -0.89930228 91 -2.55559856 -1.29996473 92 -4.52030825 -2.55559856 93 1.95812471 -4.52030825 94 -1.31114879 1.95812471 95 -2.67685382 -1.31114879 96 1.68503518 -2.67685382 97 4.13836129 1.68503518 98 -3.87957576 4.13836129 99 2.47893609 -3.87957576 100 7.67852192 2.47893609 101 2.48809755 7.67852192 102 1.55326985 2.48809755 103 -3.74047447 1.55326985 104 1.77018355 -3.74047447 105 -0.79130120 1.77018355 106 -0.69504027 -0.79130120 107 0.35695041 -0.69504027 108 -3.74245357 0.35695041 109 4.53079318 -3.74245357 110 5.31579343 4.53079318 111 1.15463138 5.31579343 112 -3.08151798 1.15463138 113 -6.21466277 -3.08151798 114 -3.10808850 -6.21466277 115 -3.61876471 -3.10808850 116 -1.28769932 -3.61876471 117 -2.42964415 -1.28769932 118 -0.99242750 -2.42964415 119 -2.68640812 -0.99242750 120 7.31400263 -2.68640812 121 -2.08972208 7.31400263 122 1.25494972 -2.08972208 123 1.59423758 1.25494972 124 9.25600661 1.59423758 125 1.35813012 9.25600661 126 0.90114504 1.35813012 127 -2.29356340 0.90114504 128 -1.97917572 -2.29356340 129 -3.51887698 -1.97917572 130 0.27635849 -3.51887698 131 2.35399657 0.27635849 132 -1.47751591 2.35399657 133 0.97608043 -1.47751591 134 -0.25355252 0.97608043 135 -2.61471920 -0.25355252 136 0.74812708 -2.61471920 137 -1.16260050 0.74812708 138 -1.51544782 -1.16260050 139 4.04170722 -1.51544782 140 1.33416012 4.04170722 141 0.69229666 1.33416012 142 -2.42964415 0.69229666 143 -1.45918861 -2.42964415 144 6.34600955 -1.45918861 > 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/7za0a1290533238.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/8za0a1290533238.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/9za0a1290533238.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/102t281290533239.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/115t0w1290533239.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/129czk1290533239.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/13n4xs1290533239.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/14xvev1290533239.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/151du11290533239.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/16fnaa1290533239.tab") + } > > try(system("convert tmp/1302j1290533238.ps tmp/1302j1290533238.png",intern=TRUE)) character(0) > try(system("convert tmp/2302j1290533238.ps tmp/2302j1290533238.png",intern=TRUE)) character(0) > try(system("convert tmp/3vr2m1290533238.ps tmp/3vr2m1290533238.png",intern=TRUE)) character(0) > try(system("convert tmp/4vr2m1290533238.ps tmp/4vr2m1290533238.png",intern=TRUE)) character(0) > try(system("convert tmp/5vr2m1290533238.ps tmp/5vr2m1290533238.png",intern=TRUE)) character(0) > try(system("convert tmp/6oij71290533238.ps tmp/6oij71290533238.png",intern=TRUE)) character(0) > try(system("convert tmp/7za0a1290533238.ps tmp/7za0a1290533238.png",intern=TRUE)) character(0) > try(system("convert tmp/8za0a1290533238.ps tmp/8za0a1290533238.png",intern=TRUE)) character(0) > try(system("convert tmp/9za0a1290533238.ps tmp/9za0a1290533238.png",intern=TRUE)) character(0) > try(system("convert tmp/102t281290533239.ps tmp/102t281290533239.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 3.923 1.673 8.701