R version 2.11.1 (2010-05-31) Copyright (C) 2010 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 = '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 > 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 t 1 2 2 2 2 9 1 2 4 1 2 2 9 2 3 7 4 3 4 9 3 4 3 1 2 3 9 4 5 7 5 4 4 9 5 6 2 1 2 3 9 6 7 7 1 2 3 9 7 8 2 1 3 4 9 8 9 1 1 2 3 9 9 10 2 1 2 4 9 10 11 6 2 3 3 9 11 12 1 1 2 2 9 12 13 1 3 3 3 9 13 14 1 1 1 3 9 14 15 2 1 3 3 9 15 16 2 1 1 2 9 16 17 2 1 3 3 9 17 18 1 1 2 2 9 18 19 7 2 3 4 9 19 20 1 4 4 5 9 20 21 2 1 3 3 9 21 22 4 2 3 3 9 22 23 2 1 1 1 9 23 24 1 2 2 4 9 24 25 1 3 1 3 9 25 26 5 1 3 4 9 26 27 2 1 3 3 9 27 28 1 1 2 3 9 28 29 3 1 2 1 9 29 30 1 1 3 4 9 30 31 2 2 2 4 9 31 32 5 1 2 2 9 32 33 2 1 2 2 9 33 34 6 1 1 1 9 34 35 4 1 2 3 9 35 36 1 1 3 4 9 36 37 3 1 1 1 9 37 38 6 1 2 3 9 38 39 7 2 3 3 9 39 40 4 1 2 2 9 40 41 1 2 1 4 9 41 42 5 1 1 3 9 42 43 3 1 3 3 9 43 44 2 2 3 2 9 44 45 2 1 3 3 9 45 46 2 1 3 2 9 46 47 2 1 2 1 9 47 48 1 1 3 3 9 48 49 2 1 2 3 9 49 50 1 4 3 5 9 50 51 2 2 4 1 9 51 52 2 1 3 3 9 52 53 5 1 3 4 9 53 54 5 4 3 3 9 54 55 2 2 3 4 9 55 56 1 1 2 2 9 56 57 1 1 3 3 9 57 58 2 1 3 4 9 58 59 3 1 1 1 9 59 60 7 1 1 1 9 60 61 4 1 1 1 10 61 62 4 2 4 4 10 62 63 1 1 3 2 10 63 64 2 1 2 3 10 64 65 2 2 3 4 10 65 66 2 1 1 2 10 66 67 5 2 4 5 10 67 68 1 2 3 3 10 68 69 6 4 2 3 10 69 70 2 1 3 3 10 70 71 2 1 3 4 10 71 72 4 3 3 4 10 72 73 6 1 2 3 10 73 74 2 1 1 1 10 74 75 2 1 1 3 10 75 76 2 1 1 1 10 76 77 1 1 3 3 10 77 78 1 1 4 5 10 78 79 2 1 2 3 10 79 80 2 1 2 3 10 80 81 3 4 2 4 10 81 82 3 1 2 5 10 82 83 5 1 3 4 10 83 84 2 2 4 4 10 84 85 5 1 2 4 10 85 86 3 1 3 4 10 86 87 1 1 3 4 10 87 88 2 1 2 3 10 88 89 2 1 2 4 10 89 90 1 1 3 3 10 90 91 2 1 3 3 10 91 92 2 1 3 3 10 92 93 5 1 3 4 10 93 94 5 1 3 3 10 94 95 2 1 3 4 10 95 96 3 1 2 2 10 96 97 5 5 3 5 10 97 98 5 1 3 3 10 98 99 6 1 2 4 10 99 100 2 1 1 2 10 100 101 7 3 3 4 10 101 102 1 1 2 3 10 102 103 1 1 2 4 10 103 104 6 1 3 3 10 104 105 6 1 1 1 10 105 106 2 1 3 4 10 106 107 1 1 2 4 10 107 108 2 1 2 2 10 108 109 1 4 2 5 10 109 110 2 4 2 4 10 110 111 1 1 2 4 10 111 112 3 1 3 3 10 112 113 3 1 3 4 10 113 114 6 4 3 4 10 114 115 4 2 3 4 10 115 116 1 1 3 3 10 116 117 2 1 1 5 10 117 118 5 1 3 3 10 118 119 6 1 4 4 10 119 120 3 1 2 4 10 120 121 5 1 2 4 10 121 122 3 2 4 4 10 122 123 2 4 3 4 10 123 124 3 4 2 5 10 124 125 2 1 3 3 10 125 126 5 1 1 1 10 126 127 5 1 2 4 10 127 128 7 2 4 4 10 128 129 4 1 3 3 10 129 130 4 1 3 4 10 130 131 5 1 3 4 10 131 132 1 3 2 4 10 132 133 4 2 4 4 10 133 134 1 2 1 4 10 134 135 4 1 3 4 10 135 136 6 1 1 3 10 136 137 7 2 2 5 10 137 138 1 3 1 3 9 138 139 3 1 2 4 10 139 140 5 1 4 4 9 140 141 2 2 4 4 10 141 142 4 2 3 4 10 142 143 5 1 3 3 10 143 144 1 1 1 4 10 144 145 2 1 4 4 10 145 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) CriticParents ExpecParents FutureWorrying 7.114274 0.046818 -0.061072 0.586102 SleepDepri ChangesLastYear FreqSmoking FreqHighAlc 0.214964 0.335216 -0.086396 0.284326 FreqBeerOrWine Month t 0.192260 0.002011 0.006438 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -6.4199 -1.9334 -0.2093 1.3471 8.8751 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 7.114274 7.483087 0.951 0.343461 CriticParents 0.046818 0.116614 0.401 0.688707 ExpecParents -0.061072 0.087154 -0.701 0.484685 FutureWorrying 0.586102 0.168914 3.470 0.000701 *** SleepDepri 0.214964 0.142253 1.511 0.133107 ChangesLastYear 0.335216 0.136964 2.447 0.015681 * FreqSmoking -0.086396 0.276683 -0.312 0.755332 FreqHighAlc 0.284326 0.316307 0.899 0.370322 FreqBeerOrWine 0.192260 0.297069 0.647 0.518617 Month 0.002011 0.830247 0.002 0.998071 t 0.006438 0.009936 0.648 0.518125 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 2.91 on 134 degrees of freedom Multiple R-squared: 0.2118, Adjusted R-squared: 0.153 F-statistic: 3.602 on 10 and 134 DF, p-value: 0.0002913 > 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.68311728 0.63376544 0.31688272 [2,] 0.64768638 0.70462724 0.35231362 [3,] 0.74095533 0.51808933 0.25904467 [4,] 0.63479671 0.73040657 0.36520329 [5,] 0.54027387 0.91945226 0.45972613 [6,] 0.66502947 0.66994105 0.33497053 [7,] 0.58788329 0.82423342 0.41211671 [8,] 0.50723166 0.98553668 0.49276834 [9,] 0.53107511 0.93784979 0.46892489 [10,] 0.58052719 0.83894562 0.41947281 [11,] 0.50007083 0.99985835 0.49992917 [12,] 0.42643383 0.85286766 0.57356617 [13,] 0.38676496 0.77352993 0.61323504 [14,] 0.32520347 0.65040694 0.67479653 [15,] 0.27715487 0.55430975 0.72284513 [16,] 0.33116925 0.66233850 0.66883075 [17,] 0.28417813 0.56835626 0.71582187 [18,] 0.23261708 0.46523415 0.76738292 [19,] 0.18945085 0.37890169 0.81054915 [20,] 0.18492290 0.36984580 0.81507710 [21,] 0.20071539 0.40143079 0.79928461 [22,] 0.20744876 0.41489752 0.79255124 [23,] 0.20378804 0.40757608 0.79621196 [24,] 0.25558002 0.51116004 0.74441998 [25,] 0.30164547 0.60329094 0.69835453 [26,] 0.30557336 0.61114672 0.69442664 [27,] 0.27744161 0.55488323 0.72255839 [28,] 0.31983721 0.63967442 0.68016279 [29,] 0.28153537 0.56307075 0.71846463 [30,] 0.29021798 0.58043596 0.70978202 [31,] 0.24584979 0.49169959 0.75415021 [32,] 0.20852565 0.41705129 0.79147435 [33,] 0.18373691 0.36747381 0.81626309 [34,] 0.19197939 0.38395878 0.80802061 [35,] 0.29475249 0.58950498 0.70524751 [36,] 0.26770114 0.53540229 0.73229886 [37,] 0.24273042 0.48546085 0.75726958 [38,] 0.20460513 0.40921025 0.79539487 [39,] 0.16836777 0.33673554 0.83163223 [40,] 0.25623297 0.51246593 0.74376703 [41,] 0.25444630 0.50889261 0.74555370 [42,] 0.23446477 0.46892955 0.76553523 [43,] 0.30857082 0.61714164 0.69142918 [44,] 0.26758618 0.53517236 0.73241382 [45,] 0.23814316 0.47628631 0.76185684 [46,] 0.20848488 0.41696977 0.79151512 [47,] 0.23563256 0.47126512 0.76436744 [48,] 0.20036091 0.40072182 0.79963909 [49,] 0.32134038 0.64268076 0.67865962 [50,] 0.27606000 0.55212000 0.72394000 [51,] 0.23634562 0.47269124 0.76365438 [52,] 0.20008085 0.40016170 0.79991915 [53,] 0.18418714 0.36837428 0.81581286 [54,] 0.15535483 0.31070965 0.84464517 [55,] 0.12976795 0.25953589 0.87023205 [56,] 0.14305223 0.28610445 0.85694777 [57,] 0.11630248 0.23260496 0.88369752 [58,] 0.09319604 0.18639208 0.90680396 [59,] 0.09499810 0.18999619 0.90500190 [60,] 0.07546007 0.15092014 0.92453993 [61,] 0.07648789 0.15297577 0.92351211 [62,] 0.06321419 0.12642838 0.93678581 [63,] 0.05051232 0.10102464 0.94948768 [64,] 0.04452400 0.08904800 0.95547600 [65,] 0.03404895 0.06809790 0.96595105 [66,] 0.02599383 0.05198766 0.97400617 [67,] 0.01963392 0.03926785 0.98036608 [68,] 0.01483490 0.02966979 0.98516510 [69,] 0.06788011 0.13576023 0.93211989 [70,] 0.05306352 0.10612704 0.94693648 [71,] 0.04127527 0.08255055 0.95872473 [72,] 0.03357542 0.06715085 0.96642458 [73,] 0.03360835 0.06721669 0.96639165 [74,] 0.02879964 0.05759928 0.97120036 [75,] 0.02127360 0.04254720 0.97872640 [76,] 0.01845977 0.03691954 0.98154023 [77,] 0.01439521 0.02879041 0.98560479 [78,] 0.01164000 0.02328001 0.98836000 [79,] 0.01152213 0.02304426 0.98847787 [80,] 0.01782286 0.03564573 0.98217714 [81,] 0.01375589 0.02751178 0.98624411 [82,] 0.01086319 0.02172639 0.98913681 [83,] 0.01169790 0.02339581 0.98830210 [84,] 0.00981310 0.01962620 0.99018690 [85,] 0.01466812 0.02933625 0.98533188 [86,] 0.01748879 0.03497759 0.98251121 [87,] 0.01387276 0.02774553 0.98612724 [88,] 0.06661063 0.13322126 0.93338937 [89,] 0.05921331 0.11842662 0.94078669 [90,] 0.04895446 0.09790892 0.95104554 [91,] 0.05053498 0.10106996 0.94946502 [92,] 0.04182678 0.08365356 0.95817322 [93,] 0.03118546 0.06237092 0.96881454 [94,] 0.02494519 0.04989038 0.97505481 [95,] 0.01807416 0.03614831 0.98192584 [96,] 0.01658436 0.03316873 0.98341564 [97,] 0.02494335 0.04988669 0.97505665 [98,] 0.03635726 0.07271451 0.96364274 [99,] 0.02927812 0.05855624 0.97072188 [100,] 0.02562922 0.05125844 0.97437078 [101,] 0.04498449 0.08996898 0.95501551 [102,] 0.04141445 0.08282890 0.95858555 [103,] 0.06197242 0.12394484 0.93802758 [104,] 0.04687732 0.09375464 0.95312268 [105,] 0.04060988 0.08121975 0.95939012 [106,] 0.03061688 0.06123376 0.96938312 [107,] 0.06779286 0.13558572 0.93220714 [108,] 0.14510988 0.29021976 0.85489012 [109,] 0.36688392 0.73376784 0.63311608 [110,] 0.31038719 0.62077438 0.68961281 [111,] 0.23821627 0.47643255 0.76178373 [112,] 0.48825140 0.97650280 0.51174860 [113,] 0.91401626 0.17196748 0.08598374 [114,] 0.86617786 0.26764427 0.13382214 [115,] 0.79735691 0.40528617 0.20264309 [116,] 0.74574545 0.50850910 0.25425455 [117,] 0.67984312 0.64031375 0.32015688 [118,] 0.61044567 0.77910866 0.38955433 > postscript(file="/var/www/rcomp/tmp/1u3ww1290542328.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/rcomp/tmp/2u3ww1290542328.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/rcomp/tmp/3u3ww1290542328.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/rcomp/tmp/4u3ww1290542328.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/rcomp/tmp/54ceh1290542328.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.196389332 -0.550845616 -0.963519201 0.610168613 5.276195073 -1.024225783 7 8 9 10 11 12 7.260858966 -1.763185332 -1.941287234 0.460485921 -3.344437841 -4.045192124 13 14 15 16 17 18 0.780661691 -1.889044936 1.557678696 3.879293622 -1.755212174 -2.942243753 19 20 21 22 23 24 -1.100975562 -3.471036383 -1.663658763 1.274105662 -1.301382848 -2.107096120 25 26 27 28 29 30 -0.938534837 1.871816059 0.047255258 -0.509756782 4.906788491 -2.413427112 31 32 33 34 35 36 0.452513132 1.659984673 -2.416946578 6.360017023 -0.881856256 -0.168719309 37 38 39 40 41 42 -2.259527071 -3.457373727 -0.575143180 -2.959569442 2.158832820 -1.364978122 43 44 45 46 47 48 1.811522024 -1.109315902 -0.817854051 -2.146050268 3.390187999 4.278066336 49 50 51 52 53 54 1.514270145 -1.966254981 0.575860163 -0.081124040 -4.687394143 -2.238328235 55 56 57 58 59 60 1.516847340 5.891072945 0.328327163 0.016365802 2.663970964 -1.933449801 61 62 63 64 65 66 -3.335080336 3.822149244 -0.209334840 0.172221511 0.203745522 2.270627996 67 68 69 70 71 72 1.203693871 1.088063304 -3.568729027 -0.274029037 0.267772155 2.859412492 73 74 75 76 77 78 0.132078866 -3.055979618 -1.340512090 -0.297762145 -1.306732077 0.715218197 79 80 81 82 83 84 -0.435625171 0.635542896 0.575780978 7.487257837 1.078758010 1.260244611 85 86 87 88 89 90 -1.102087045 3.404741641 -1.687938799 0.124450918 1.815776482 -1.043118102 91 92 93 94 95 96 -1.426067220 -2.707725487 -4.562485305 1.773987221 -1.389594453 -2.919017180 97 98 99 100 101 102 1.578524884 4.009203596 -3.896288070 2.232368169 7.427961547 2.304409501 103 104 105 106 107 108 1.347095819 -3.918176089 1.437782454 -0.935379934 -0.847922759 0.002653299 109 110 111 112 113 114 -3.909059135 4.279615213 5.201147350 0.832977453 -3.220558125 -6.419919053 115 116 117 118 119 120 -3.311827039 -3.896376743 -1.325876080 -2.711143039 -1.159710366 -2.853630218 121 122 123 124 125 126 7.225524546 -2.296926646 0.929909076 1.323942643 8.875061114 0.861500695 127 128 129 130 131 132 0.654258121 -2.561572008 -2.374658797 -3.792882008 0.083670681 2.004655318 133 134 135 136 137 138 -1.834826461 0.632931495 -0.552893634 -2.919680822 0.537549174 -1.666000948 139 140 141 142 143 144 -1.857861488 3.715412546 0.893292679 0.353506372 -2.872086869 -1.777031822 145 5.987040184 > postscript(file="/var/www/rcomp/tmp/64ceh1290542328.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.196389332 NA 1 -0.550845616 0.196389332 2 -0.963519201 -0.550845616 3 0.610168613 -0.963519201 4 5.276195073 0.610168613 5 -1.024225783 5.276195073 6 7.260858966 -1.024225783 7 -1.763185332 7.260858966 8 -1.941287234 -1.763185332 9 0.460485921 -1.941287234 10 -3.344437841 0.460485921 11 -4.045192124 -3.344437841 12 0.780661691 -4.045192124 13 -1.889044936 0.780661691 14 1.557678696 -1.889044936 15 3.879293622 1.557678696 16 -1.755212174 3.879293622 17 -2.942243753 -1.755212174 18 -1.100975562 -2.942243753 19 -3.471036383 -1.100975562 20 -1.663658763 -3.471036383 21 1.274105662 -1.663658763 22 -1.301382848 1.274105662 23 -2.107096120 -1.301382848 24 -0.938534837 -2.107096120 25 1.871816059 -0.938534837 26 0.047255258 1.871816059 27 -0.509756782 0.047255258 28 4.906788491 -0.509756782 29 -2.413427112 4.906788491 30 0.452513132 -2.413427112 31 1.659984673 0.452513132 32 -2.416946578 1.659984673 33 6.360017023 -2.416946578 34 -0.881856256 6.360017023 35 -0.168719309 -0.881856256 36 -2.259527071 -0.168719309 37 -3.457373727 -2.259527071 38 -0.575143180 -3.457373727 39 -2.959569442 -0.575143180 40 2.158832820 -2.959569442 41 -1.364978122 2.158832820 42 1.811522024 -1.364978122 43 -1.109315902 1.811522024 44 -0.817854051 -1.109315902 45 -2.146050268 -0.817854051 46 3.390187999 -2.146050268 47 4.278066336 3.390187999 48 1.514270145 4.278066336 49 -1.966254981 1.514270145 50 0.575860163 -1.966254981 51 -0.081124040 0.575860163 52 -4.687394143 -0.081124040 53 -2.238328235 -4.687394143 54 1.516847340 -2.238328235 55 5.891072945 1.516847340 56 0.328327163 5.891072945 57 0.016365802 0.328327163 58 2.663970964 0.016365802 59 -1.933449801 2.663970964 60 -3.335080336 -1.933449801 61 3.822149244 -3.335080336 62 -0.209334840 3.822149244 63 0.172221511 -0.209334840 64 0.203745522 0.172221511 65 2.270627996 0.203745522 66 1.203693871 2.270627996 67 1.088063304 1.203693871 68 -3.568729027 1.088063304 69 -0.274029037 -3.568729027 70 0.267772155 -0.274029037 71 2.859412492 0.267772155 72 0.132078866 2.859412492 73 -3.055979618 0.132078866 74 -1.340512090 -3.055979618 75 -0.297762145 -1.340512090 76 -1.306732077 -0.297762145 77 0.715218197 -1.306732077 78 -0.435625171 0.715218197 79 0.635542896 -0.435625171 80 0.575780978 0.635542896 81 7.487257837 0.575780978 82 1.078758010 7.487257837 83 1.260244611 1.078758010 84 -1.102087045 1.260244611 85 3.404741641 -1.102087045 86 -1.687938799 3.404741641 87 0.124450918 -1.687938799 88 1.815776482 0.124450918 89 -1.043118102 1.815776482 90 -1.426067220 -1.043118102 91 -2.707725487 -1.426067220 92 -4.562485305 -2.707725487 93 1.773987221 -4.562485305 94 -1.389594453 1.773987221 95 -2.919017180 -1.389594453 96 1.578524884 -2.919017180 97 4.009203596 1.578524884 98 -3.896288070 4.009203596 99 2.232368169 -3.896288070 100 7.427961547 2.232368169 101 2.304409501 7.427961547 102 1.347095819 2.304409501 103 -3.918176089 1.347095819 104 1.437782454 -3.918176089 105 -0.935379934 1.437782454 106 -0.847922759 -0.935379934 107 0.002653299 -0.847922759 108 -3.909059135 0.002653299 109 4.279615213 -3.909059135 110 5.201147350 4.279615213 111 0.832977453 5.201147350 112 -3.220558125 0.832977453 113 -6.419919053 -3.220558125 114 -3.311827039 -6.419919053 115 -3.896376743 -3.311827039 116 -1.325876080 -3.896376743 117 -2.711143039 -1.325876080 118 -1.159710366 -2.711143039 119 -2.853630218 -1.159710366 120 7.225524546 -2.853630218 121 -2.296926646 7.225524546 122 0.929909076 -2.296926646 123 1.323942643 0.929909076 124 8.875061114 1.323942643 125 0.861500695 8.875061114 126 0.654258121 0.861500695 127 -2.561572008 0.654258121 128 -2.374658797 -2.561572008 129 -3.792882008 -2.374658797 130 0.083670681 -3.792882008 131 2.004655318 0.083670681 132 -1.834826461 2.004655318 133 0.632931495 -1.834826461 134 -0.552893634 0.632931495 135 -2.919680822 -0.552893634 136 0.537549174 -2.919680822 137 -1.666000948 0.537549174 138 -1.857861488 -1.666000948 139 3.715412546 -1.857861488 140 0.893292679 3.715412546 141 0.353506372 0.893292679 142 -2.872086869 0.353506372 143 -1.777031822 -2.872086869 144 5.987040184 -1.777031822 145 NA 5.987040184 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -0.550845616 0.196389332 [2,] -0.963519201 -0.550845616 [3,] 0.610168613 -0.963519201 [4,] 5.276195073 0.610168613 [5,] -1.024225783 5.276195073 [6,] 7.260858966 -1.024225783 [7,] -1.763185332 7.260858966 [8,] -1.941287234 -1.763185332 [9,] 0.460485921 -1.941287234 [10,] -3.344437841 0.460485921 [11,] -4.045192124 -3.344437841 [12,] 0.780661691 -4.045192124 [13,] -1.889044936 0.780661691 [14,] 1.557678696 -1.889044936 [15,] 3.879293622 1.557678696 [16,] -1.755212174 3.879293622 [17,] -2.942243753 -1.755212174 [18,] -1.100975562 -2.942243753 [19,] -3.471036383 -1.100975562 [20,] -1.663658763 -3.471036383 [21,] 1.274105662 -1.663658763 [22,] -1.301382848 1.274105662 [23,] -2.107096120 -1.301382848 [24,] -0.938534837 -2.107096120 [25,] 1.871816059 -0.938534837 [26,] 0.047255258 1.871816059 [27,] -0.509756782 0.047255258 [28,] 4.906788491 -0.509756782 [29,] -2.413427112 4.906788491 [30,] 0.452513132 -2.413427112 [31,] 1.659984673 0.452513132 [32,] -2.416946578 1.659984673 [33,] 6.360017023 -2.416946578 [34,] -0.881856256 6.360017023 [35,] -0.168719309 -0.881856256 [36,] -2.259527071 -0.168719309 [37,] -3.457373727 -2.259527071 [38,] -0.575143180 -3.457373727 [39,] -2.959569442 -0.575143180 [40,] 2.158832820 -2.959569442 [41,] -1.364978122 2.158832820 [42,] 1.811522024 -1.364978122 [43,] -1.109315902 1.811522024 [44,] -0.817854051 -1.109315902 [45,] -2.146050268 -0.817854051 [46,] 3.390187999 -2.146050268 [47,] 4.278066336 3.390187999 [48,] 1.514270145 4.278066336 [49,] -1.966254981 1.514270145 [50,] 0.575860163 -1.966254981 [51,] -0.081124040 0.575860163 [52,] -4.687394143 -0.081124040 [53,] -2.238328235 -4.687394143 [54,] 1.516847340 -2.238328235 [55,] 5.891072945 1.516847340 [56,] 0.328327163 5.891072945 [57,] 0.016365802 0.328327163 [58,] 2.663970964 0.016365802 [59,] -1.933449801 2.663970964 [60,] -3.335080336 -1.933449801 [61,] 3.822149244 -3.335080336 [62,] -0.209334840 3.822149244 [63,] 0.172221511 -0.209334840 [64,] 0.203745522 0.172221511 [65,] 2.270627996 0.203745522 [66,] 1.203693871 2.270627996 [67,] 1.088063304 1.203693871 [68,] -3.568729027 1.088063304 [69,] -0.274029037 -3.568729027 [70,] 0.267772155 -0.274029037 [71,] 2.859412492 0.267772155 [72,] 0.132078866 2.859412492 [73,] -3.055979618 0.132078866 [74,] -1.340512090 -3.055979618 [75,] -0.297762145 -1.340512090 [76,] -1.306732077 -0.297762145 [77,] 0.715218197 -1.306732077 [78,] -0.435625171 0.715218197 [79,] 0.635542896 -0.435625171 [80,] 0.575780978 0.635542896 [81,] 7.487257837 0.575780978 [82,] 1.078758010 7.487257837 [83,] 1.260244611 1.078758010 [84,] -1.102087045 1.260244611 [85,] 3.404741641 -1.102087045 [86,] -1.687938799 3.404741641 [87,] 0.124450918 -1.687938799 [88,] 1.815776482 0.124450918 [89,] -1.043118102 1.815776482 [90,] -1.426067220 -1.043118102 [91,] -2.707725487 -1.426067220 [92,] -4.562485305 -2.707725487 [93,] 1.773987221 -4.562485305 [94,] -1.389594453 1.773987221 [95,] -2.919017180 -1.389594453 [96,] 1.578524884 -2.919017180 [97,] 4.009203596 1.578524884 [98,] -3.896288070 4.009203596 [99,] 2.232368169 -3.896288070 [100,] 7.427961547 2.232368169 [101,] 2.304409501 7.427961547 [102,] 1.347095819 2.304409501 [103,] -3.918176089 1.347095819 [104,] 1.437782454 -3.918176089 [105,] -0.935379934 1.437782454 [106,] -0.847922759 -0.935379934 [107,] 0.002653299 -0.847922759 [108,] -3.909059135 0.002653299 [109,] 4.279615213 -3.909059135 [110,] 5.201147350 4.279615213 [111,] 0.832977453 5.201147350 [112,] -3.220558125 0.832977453 [113,] -6.419919053 -3.220558125 [114,] -3.311827039 -6.419919053 [115,] -3.896376743 -3.311827039 [116,] -1.325876080 -3.896376743 [117,] -2.711143039 -1.325876080 [118,] -1.159710366 -2.711143039 [119,] -2.853630218 -1.159710366 [120,] 7.225524546 -2.853630218 [121,] -2.296926646 7.225524546 [122,] 0.929909076 -2.296926646 [123,] 1.323942643 0.929909076 [124,] 8.875061114 1.323942643 [125,] 0.861500695 8.875061114 [126,] 0.654258121 0.861500695 [127,] -2.561572008 0.654258121 [128,] -2.374658797 -2.561572008 [129,] -3.792882008 -2.374658797 [130,] 0.083670681 -3.792882008 [131,] 2.004655318 0.083670681 [132,] -1.834826461 2.004655318 [133,] 0.632931495 -1.834826461 [134,] -0.552893634 0.632931495 [135,] -2.919680822 -0.552893634 [136,] 0.537549174 -2.919680822 [137,] -1.666000948 0.537549174 [138,] -1.857861488 -1.666000948 [139,] 3.715412546 -1.857861488 [140,] 0.893292679 3.715412546 [141,] 0.353506372 0.893292679 [142,] -2.872086869 0.353506372 [143,] -1.777031822 -2.872086869 [144,] 5.987040184 -1.777031822 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -0.550845616 0.196389332 2 -0.963519201 -0.550845616 3 0.610168613 -0.963519201 4 5.276195073 0.610168613 5 -1.024225783 5.276195073 6 7.260858966 -1.024225783 7 -1.763185332 7.260858966 8 -1.941287234 -1.763185332 9 0.460485921 -1.941287234 10 -3.344437841 0.460485921 11 -4.045192124 -3.344437841 12 0.780661691 -4.045192124 13 -1.889044936 0.780661691 14 1.557678696 -1.889044936 15 3.879293622 1.557678696 16 -1.755212174 3.879293622 17 -2.942243753 -1.755212174 18 -1.100975562 -2.942243753 19 -3.471036383 -1.100975562 20 -1.663658763 -3.471036383 21 1.274105662 -1.663658763 22 -1.301382848 1.274105662 23 -2.107096120 -1.301382848 24 -0.938534837 -2.107096120 25 1.871816059 -0.938534837 26 0.047255258 1.871816059 27 -0.509756782 0.047255258 28 4.906788491 -0.509756782 29 -2.413427112 4.906788491 30 0.452513132 -2.413427112 31 1.659984673 0.452513132 32 -2.416946578 1.659984673 33 6.360017023 -2.416946578 34 -0.881856256 6.360017023 35 -0.168719309 -0.881856256 36 -2.259527071 -0.168719309 37 -3.457373727 -2.259527071 38 -0.575143180 -3.457373727 39 -2.959569442 -0.575143180 40 2.158832820 -2.959569442 41 -1.364978122 2.158832820 42 1.811522024 -1.364978122 43 -1.109315902 1.811522024 44 -0.817854051 -1.109315902 45 -2.146050268 -0.817854051 46 3.390187999 -2.146050268 47 4.278066336 3.390187999 48 1.514270145 4.278066336 49 -1.966254981 1.514270145 50 0.575860163 -1.966254981 51 -0.081124040 0.575860163 52 -4.687394143 -0.081124040 53 -2.238328235 -4.687394143 54 1.516847340 -2.238328235 55 5.891072945 1.516847340 56 0.328327163 5.891072945 57 0.016365802 0.328327163 58 2.663970964 0.016365802 59 -1.933449801 2.663970964 60 -3.335080336 -1.933449801 61 3.822149244 -3.335080336 62 -0.209334840 3.822149244 63 0.172221511 -0.209334840 64 0.203745522 0.172221511 65 2.270627996 0.203745522 66 1.203693871 2.270627996 67 1.088063304 1.203693871 68 -3.568729027 1.088063304 69 -0.274029037 -3.568729027 70 0.267772155 -0.274029037 71 2.859412492 0.267772155 72 0.132078866 2.859412492 73 -3.055979618 0.132078866 74 -1.340512090 -3.055979618 75 -0.297762145 -1.340512090 76 -1.306732077 -0.297762145 77 0.715218197 -1.306732077 78 -0.435625171 0.715218197 79 0.635542896 -0.435625171 80 0.575780978 0.635542896 81 7.487257837 0.575780978 82 1.078758010 7.487257837 83 1.260244611 1.078758010 84 -1.102087045 1.260244611 85 3.404741641 -1.102087045 86 -1.687938799 3.404741641 87 0.124450918 -1.687938799 88 1.815776482 0.124450918 89 -1.043118102 1.815776482 90 -1.426067220 -1.043118102 91 -2.707725487 -1.426067220 92 -4.562485305 -2.707725487 93 1.773987221 -4.562485305 94 -1.389594453 1.773987221 95 -2.919017180 -1.389594453 96 1.578524884 -2.919017180 97 4.009203596 1.578524884 98 -3.896288070 4.009203596 99 2.232368169 -3.896288070 100 7.427961547 2.232368169 101 2.304409501 7.427961547 102 1.347095819 2.304409501 103 -3.918176089 1.347095819 104 1.437782454 -3.918176089 105 -0.935379934 1.437782454 106 -0.847922759 -0.935379934 107 0.002653299 -0.847922759 108 -3.909059135 0.002653299 109 4.279615213 -3.909059135 110 5.201147350 4.279615213 111 0.832977453 5.201147350 112 -3.220558125 0.832977453 113 -6.419919053 -3.220558125 114 -3.311827039 -6.419919053 115 -3.896376743 -3.311827039 116 -1.325876080 -3.896376743 117 -2.711143039 -1.325876080 118 -1.159710366 -2.711143039 119 -2.853630218 -1.159710366 120 7.225524546 -2.853630218 121 -2.296926646 7.225524546 122 0.929909076 -2.296926646 123 1.323942643 0.929909076 124 8.875061114 1.323942643 125 0.861500695 8.875061114 126 0.654258121 0.861500695 127 -2.561572008 0.654258121 128 -2.374658797 -2.561572008 129 -3.792882008 -2.374658797 130 0.083670681 -3.792882008 131 2.004655318 0.083670681 132 -1.834826461 2.004655318 133 0.632931495 -1.834826461 134 -0.552893634 0.632931495 135 -2.919680822 -0.552893634 136 0.537549174 -2.919680822 137 -1.666000948 0.537549174 138 -1.857861488 -1.666000948 139 3.715412546 -1.857861488 140 0.893292679 3.715412546 141 0.353506372 0.893292679 142 -2.872086869 0.353506372 143 -1.777031822 -2.872086869 144 5.987040184 -1.777031822 > plot(z,main=paste('Residual Lag plot, lowess, and regression line'), ylab='values of Residuals', xlab='lagged values of Residuals') > lines(lowess(z)) > abline(lm(z)) > grid() > dev.off() null device 1 > postscript(file="/var/www/rcomp/tmp/7f3d21290542328.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/rcomp/tmp/8f3d21290542328.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/rcomp/tmp/9qvc51290542328.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/rcomp/tmp/10qvc51290542328.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/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/rcomp/createtable") > > a<-table.start() > a<-table.row.start(a) > a<-table.element(a, 'Multiple Linear Regression - Estimated Regression Equation', 1, TRUE) > a<-table.row.end(a) > myeq <- colnames(x)[1] > myeq <- paste(myeq, '[t] = ', sep='') > for (i in 1:k){ + if (mysum$coefficients[i,1] > 0) myeq <- paste(myeq, '+', '') + myeq <- paste(myeq, mysum$coefficients[i,1], sep=' ') + if (rownames(mysum$coefficients)[i] != '(Intercept)') { + myeq <- paste(myeq, rownames(mysum$coefficients)[i], sep='') + if (rownames(mysum$coefficients)[i] != 't') myeq <- paste(myeq, '[t]', sep='') + } + } > myeq <- paste(myeq, ' + e[t]') > a<-table.row.start(a) > a<-table.element(a, myeq) > a<-table.row.end(a) > a<-table.end(a) > table.save(a,file="/var/www/rcomp/tmp/11bvbb1290542328.tab") > a<-table.start() > a<-table.row.start(a) > a<-table.element(a,hyperlink('http://www.xycoon.com/ols1.htm','Multiple Linear Regression - Ordinary Least Squares',''), 6, TRUE) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,'Variable',header=TRUE) > a<-table.element(a,'Parameter',header=TRUE) > a<-table.element(a,'S.D.',header=TRUE) > a<-table.element(a,'T-STAT
H0: parameter = 0',header=TRUE) > a<-table.element(a,'2-tail p-value',header=TRUE) > a<-table.element(a,'1-tail p-value',header=TRUE) > a<-table.row.end(a) > for (i in 1:k){ + a<-table.row.start(a) + a<-table.element(a,rownames(mysum$coefficients)[i],header=TRUE) + a<-table.element(a,mysum$coefficients[i,1]) + a<-table.element(a, round(mysum$coefficients[i,2],6)) + a<-table.element(a, round(mysum$coefficients[i,3],4)) + a<-table.element(a, round(mysum$coefficients[i,4],6)) + a<-table.element(a, round(mysum$coefficients[i,4]/2,6)) + a<-table.row.end(a) + } > a<-table.end(a) > table.save(a,file="/var/www/rcomp/tmp/12we9z1290542328.tab") > a<-table.start() > a<-table.row.start(a) > a<-table.element(a, 'Multiple Linear Regression - Regression Statistics', 2, TRUE) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a, 'Multiple R',1,TRUE) > a<-table.element(a, sqrt(mysum$r.squared)) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a, 'R-squared',1,TRUE) > a<-table.element(a, mysum$r.squared) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a, 'Adjusted R-squared',1,TRUE) > a<-table.element(a, mysum$adj.r.squared) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a, 'F-TEST (value)',1,TRUE) > a<-table.element(a, mysum$fstatistic[1]) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a, 'F-TEST (DF numerator)',1,TRUE) > a<-table.element(a, mysum$fstatistic[2]) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a, 'F-TEST (DF denominator)',1,TRUE) > a<-table.element(a, mysum$fstatistic[3]) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a, 'p-value',1,TRUE) > a<-table.element(a, 1-pf(mysum$fstatistic[1],mysum$fstatistic[2],mysum$fstatistic[3])) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a, 'Multiple Linear Regression - Residual Statistics', 2, TRUE) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a, 'Residual Standard Deviation',1,TRUE) > a<-table.element(a, mysum$sigma) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a, 'Sum Squared Residuals',1,TRUE) > a<-table.element(a, sum(myerror*myerror)) > a<-table.row.end(a) > a<-table.end(a) > table.save(a,file="/var/www/rcomp/tmp/133x6s1290542328.tab") > a<-table.start() > a<-table.row.start(a) > a<-table.element(a, 'Multiple Linear Regression - Actuals, Interpolation, and Residuals', 4, TRUE) > a<-table.row.end(a) > a<-table.row.start(a) > a<-table.element(a, 'Time or Index', 1, TRUE) > a<-table.element(a, 'Actuals', 1, TRUE) > a<-table.element(a, 'Interpolation
Forecast', 1, TRUE) > a<-table.element(a, 'Residuals
Prediction Error', 1, TRUE) > a<-table.row.end(a) > for (i in 1:n) { + a<-table.row.start(a) + a<-table.element(a,i, 1, TRUE) + a<-table.element(a,x[i]) + a<-table.element(a,x[i]-mysum$resid[i]) + a<-table.element(a,mysum$resid[i]) + a<-table.row.end(a) + } > a<-table.end(a) > table.save(a,file="/var/www/rcomp/tmp/14e6nv1290542328.tab") > if (n > n25) { + a<-table.start() + a<-table.row.start(a) + a<-table.element(a,'Goldfeld-Quandt test for Heteroskedasticity',4,TRUE) + a<-table.row.end(a) + a<-table.row.start(a) + a<-table.element(a,'p-values',header=TRUE) + a<-table.element(a,'Alternative Hypothesis',3,header=TRUE) + a<-table.row.end(a) + a<-table.row.start(a) + a<-table.element(a,'breakpoint index',header=TRUE) + a<-table.element(a,'greater',header=TRUE) + a<-table.element(a,'2-sided',header=TRUE) + a<-table.element(a,'less',header=TRUE) + a<-table.row.end(a) + for (mypoint in kp3:nmkm3) { + a<-table.row.start(a) + a<-table.element(a,mypoint,header=TRUE) + a<-table.element(a,gqarr[mypoint-kp3+1,1]) + a<-table.element(a,gqarr[mypoint-kp3+1,2]) + a<-table.element(a,gqarr[mypoint-kp3+1,3]) + a<-table.row.end(a) + } + a<-table.end(a) + table.save(a,file="/var/www/rcomp/tmp/15sz7e1290542329.tab") + a<-table.start() + a<-table.row.start(a) + a<-table.element(a,'Meta Analysis of Goldfeld-Quandt test for Heteroskedasticity',4,TRUE) + a<-table.row.end(a) + a<-table.row.start(a) + a<-table.element(a,'Description',header=TRUE) + a<-table.element(a,'# significant tests',header=TRUE) + a<-table.element(a,'% significant tests',header=TRUE) + a<-table.element(a,'OK/NOK',header=TRUE) + a<-table.row.end(a) + a<-table.row.start(a) + a<-table.element(a,'1% type I error level',header=TRUE) + a<-table.element(a,numsignificant1) + a<-table.element(a,numsignificant1/numgqtests) + if (numsignificant1/numgqtests < 0.01) dum <- 'OK' else dum <- 'NOK' + a<-table.element(a,dum) + a<-table.row.end(a) + a<-table.row.start(a) + a<-table.element(a,'5% type I error level',header=TRUE) + a<-table.element(a,numsignificant5) + a<-table.element(a,numsignificant5/numgqtests) + if (numsignificant5/numgqtests < 0.05) dum <- 'OK' else dum <- 'NOK' + a<-table.element(a,dum) + a<-table.row.end(a) + a<-table.row.start(a) + a<-table.element(a,'10% type I error level',header=TRUE) + a<-table.element(a,numsignificant10) + a<-table.element(a,numsignificant10/numgqtests) + if (numsignificant10/numgqtests < 0.1) dum <- 'OK' else dum <- 'NOK' + a<-table.element(a,dum) + a<-table.row.end(a) + a<-table.end(a) + table.save(a,file="/var/www/rcomp/tmp/166q451290542329.tab") + } > > try(system("convert tmp/1u3ww1290542328.ps tmp/1u3ww1290542328.png",intern=TRUE)) character(0) > try(system("convert tmp/2u3ww1290542328.ps tmp/2u3ww1290542328.png",intern=TRUE)) character(0) > try(system("convert tmp/3u3ww1290542328.ps tmp/3u3ww1290542328.png",intern=TRUE)) character(0) > try(system("convert tmp/4u3ww1290542328.ps tmp/4u3ww1290542328.png",intern=TRUE)) character(0) > try(system("convert tmp/54ceh1290542328.ps tmp/54ceh1290542328.png",intern=TRUE)) character(0) > try(system("convert tmp/64ceh1290542328.ps tmp/64ceh1290542328.png",intern=TRUE)) character(0) > try(system("convert tmp/7f3d21290542328.ps tmp/7f3d21290542328.png",intern=TRUE)) character(0) > try(system("convert tmp/8f3d21290542328.ps tmp/8f3d21290542328.png",intern=TRUE)) character(0) > try(system("convert tmp/9qvc51290542328.ps tmp/9qvc51290542328.png",intern=TRUE)) character(0) > try(system("convert tmp/10qvc51290542328.ps tmp/10qvc51290542328.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 5.610 2.070 7.687