R version 2.8.0 (2008-10-20) Copyright (C) 2008 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. Natural language support but running in an English locale 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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 + ,11 + ,1 + ,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 = '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\r t 1 2 2 2 2 1 2 4 1 2 2 2 3 7 4 3 4 3 4 3 1 2 3 4 5 7 5 4 4 5 6 2 1 2 3 6 7 7 1 2 3 7 8 2 1 3 4 8 9 1 1 2 3 9 10 2 1 2 4 10 11 6 2 3 3 11 12 1 1 2 2 12 13 1 3 3 3 13 14 1 1 1 3 14 15 2 1 3 3 15 16 2 1 1 2 16 17 2 1 3 3 17 18 1 1 2 2 18 19 7 2 3 4 19 20 1 4 4 5 20 21 2 1 3 3 21 22 4 2 3 3 22 23 2 1 1 1 23 24 1 2 2 4 24 25 1 3 1 3 25 26 5 1 3 4 26 27 2 1 3 3 27 28 1 1 2 3 28 29 3 1 2 1 29 30 1 1 3 4 30 31 2 2 2 4 31 32 5 1 2 2 32 33 2 1 2 2 33 34 6 1 1 1 34 35 4 1 2 3 35 36 1 1 3 4 36 37 3 1 1 1 37 38 6 1 2 3 38 39 7 2 3 3 39 40 4 1 2 2 40 41 1 2 1 4 41 42 5 1 1 3 42 43 3 1 3 3 43 44 2 2 3 2 44 45 2 1 3 3 45 46 2 1 3 2 46 47 2 1 2 1 47 48 1 1 3 3 48 49 2 1 2 3 49 50 1 4 3 5 50 51 2 2 4 1 51 52 2 1 3 3 52 53 5 1 3 4 53 54 5 4 3 3 54 55 2 2 3 4 55 56 1 1 2 2 56 57 1 1 3 3 57 58 2 1 3 4 58 59 3 1 1 1 59 60 7 1 1 1 60 61 4 1 1 1 61 62 4 2 4 4 62 63 1 1 3 2 63 64 2 1 2 3 64 65 2 2 3 4 65 66 2 1 1 2 66 67 5 2 4 5 67 68 1 2 3 3 68 69 6 4 2 3 69 70 2 1 3 3 70 71 2 1 3 4 71 72 4 3 3 4 72 73 6 1 2 3 73 74 2 1 1 1 74 75 2 1 1 3 75 76 2 1 1 1 76 77 1 1 3 3 77 78 1 1 4 5 78 79 2 1 2 3 79 80 2 1 2 3 80 81 3 4 2 4 81 82 3 1 2 5 82 83 5 1 3 4 83 84 2 2 4 4 84 85 5 1 2 4 85 86 3 1 3 4 86 87 1 1 3 4 87 88 2 1 2 3 88 89 2 1 2 4 89 90 1 1 3 3 90 91 2 1 3 3 91 92 2 1 3 3 92 93 5 1 3 4 93 94 5 1 3 3 94 95 2 1 3 4 95 96 3 1 2 2 96 97 5 5 3 5 97 98 5 1 3 3 98 99 6 1 2 4 99 100 2 1 1 2 100 101 7 3 3 4 101 102 1 1 2 3 102 103 1 1 2 4 103 104 6 1 3 3 104 105 6 1 1 1 105 106 2 1 3 4 106 107 1 1 2 4 107 108 2 1 2 2 108 109 1 4 2 5 109 110 2 4 2 4 110 111 1 1 2 4 111 112 3 1 3 3 112 113 3 1 3 4 113 114 6 4 3 4 114 115 4 2 3 4 115 116 1 1 3 3 116 117 2 1 1 5 117 118 5 1 3 3 118 119 6 1 4 4 119 120 3 1 2 4 120 121 5 1 2 4 121 122 3 2 4 4 122 123 2 4 3 4 123 124 3 4 2 5 124 125 2 1 3 3 125 126 5 1 1 1 126 127 5 1 2 4 127 128 7 2 4 4 128 129 4 1 3 3 129 130 4 1 3 4 130 131 5 1 3 4 131 132 1 3 2 4 132 133 4 2 4 4 133 134 1 2 1 4 134 135 4 1 3 4 135 136 6 1 1 3 136 137 7 2 2 5 137 138 1 3 1 3 138 139 3 1 2 4 139 140 5 1 4 4 140 141 2 2 4 4 141 142 4 2 3 4 142 143 5 1 3 3 143 144 1 1 1 4 144 145 2 1 4 4 145 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) CriticParents ExpecParents FutureWorrying 7.132034 0.046797 -0.061062 0.586113 SleepDepri ChangesLastYear FreqSmoking FreqHighAlc 0.214968 0.335210 -0.086418 0.284315 `FreqBeerOrWine\r` t 0.192320 0.006456 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -6.4198 -1.9342 -0.2082 1.3473 8.8749 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 7.132034 1.486388 4.798 4.18e-06 *** CriticParents 0.046797 0.115867 0.404 0.686934 ExpecParents -0.061062 0.086747 -0.704 0.482700 FutureWorrying 0.586113 0.168218 3.484 0.000666 *** SleepDepri 0.214968 0.141718 1.517 0.131638 ChangesLastYear 0.335210 0.136435 2.457 0.015282 * FreqSmoking -0.086418 0.275507 -0.314 0.754258 FreqHighAlc 0.284315 0.315102 0.902 0.368507 `FreqBeerOrWine\r` 0.192320 0.294925 0.652 0.515447 t 0.006456 0.006255 1.032 0.303860 --- Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 Residual standard error: 2.899 on 135 degrees of freedom Multiple R-squared: 0.2118, Adjusted R-squared: 0.1593 F-statistic: 4.032 on 9 and 135 DF, p-value: 0.0001363 > 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.40267112 0.80534225 0.5973289 [2,] 0.53327041 0.93345917 0.4667296 [3,] 0.51658008 0.96683984 0.4834199 [4,] 0.64049874 0.71900252 0.3595013 [5,] 0.53105046 0.93789908 0.4689495 [6,] 0.44100493 0.88200986 0.5589951 [7,] 0.58119052 0.83761896 0.4188095 [8,] 0.50489013 0.99021975 0.4951099 [9,] 0.42780879 0.85561758 0.5721912 [10,] 0.45683756 0.91367513 0.5431624 [11,] 0.51199515 0.97600969 0.4880048 [12,] 0.43369630 0.86739261 0.5663037 [13,] 0.36433555 0.72867109 0.6356645 [14,] 0.32905886 0.65811772 0.6709411 [15,] 0.27327502 0.54655004 0.7267250 [16,] 0.23082407 0.46164814 0.7691759 [17,] 0.28346386 0.56692773 0.7165361 [18,] 0.24116168 0.48232337 0.7588383 [19,] 0.19524552 0.39049104 0.8047545 [20,] 0.15753836 0.31507673 0.8424616 [21,] 0.15460319 0.30920638 0.8453968 [22,] 0.17032015 0.34064030 0.8296799 [23,] 0.17767879 0.35535758 0.8223212 [24,] 0.17541509 0.35083017 0.8245849 [25,] 0.22481333 0.44962666 0.7751867 [26,] 0.26953219 0.53906439 0.7304678 [27,] 0.27468995 0.54937991 0.7253100 [28,] 0.24839818 0.49679635 0.7516018 [29,] 0.29062855 0.58125710 0.7093714 [30,] 0.25398043 0.50796086 0.7460196 [31,] 0.26373945 0.52747890 0.7362605 [32,] 0.22177307 0.44354613 0.7782269 [33,] 0.18652214 0.37304427 0.8134779 [34,] 0.16215171 0.32430341 0.8378483 [35,] 0.17241064 0.34482128 0.8275894 [36,] 0.27325342 0.54650683 0.7267466 [37,] 0.24799895 0.49599790 0.7520010 [38,] 0.22308005 0.44616010 0.7769200 [39,] 0.18719383 0.37438767 0.8128062 [40,] 0.15288660 0.30577320 0.8471134 [41,] 0.22773714 0.45547427 0.7722629 [42,] 0.22005546 0.44011092 0.7799445 [43,] 0.20144384 0.40288769 0.7985562 [44,] 0.28879335 0.57758671 0.7112066 [45,] 0.24758268 0.49516537 0.7524173 [46,] 0.21295413 0.42590825 0.7870459 [47,] 0.19435716 0.38871432 0.8056428 [48,] 0.21691994 0.43383987 0.7830801 [49,] 0.26989740 0.53979479 0.7301026 [50,] 0.30516403 0.61032805 0.6948360 [51,] 0.26248124 0.52496249 0.7375188 [52,] 0.22269374 0.44538749 0.7773063 [53,] 0.18723352 0.37446703 0.8127665 [54,] 0.17248563 0.34497126 0.8275144 [55,] 0.14612636 0.29225272 0.8538736 [56,] 0.12199531 0.24399062 0.8780047 [57,] 0.13398499 0.26796998 0.8660150 [58,] 0.10870505 0.21741010 0.8912949 [59,] 0.08699157 0.17398315 0.9130084 [60,] 0.08924237 0.17848473 0.9107576 [61,] 0.07087559 0.14175118 0.9291244 [62,] 0.07245922 0.14491845 0.9275408 [63,] 0.05987882 0.11975763 0.9401212 [64,] 0.04776085 0.09552169 0.9522392 [65,] 0.04187450 0.08374901 0.9581255 [66,] 0.03201875 0.06403750 0.9679812 [67,] 0.02441824 0.04883648 0.9755818 [68,] 0.01840519 0.03681037 0.9815948 [69,] 0.01390458 0.02780917 0.9860954 [70,] 0.06599974 0.13199949 0.9340003 [71,] 0.05181384 0.10362769 0.9481862 [72,] 0.04032174 0.08064349 0.9596783 [73,] 0.03281519 0.06563039 0.9671848 [74,] 0.03342417 0.06684834 0.9665758 [75,] 0.02857051 0.05714102 0.9714295 [76,] 0.02118539 0.04237077 0.9788146 [77,] 0.01848967 0.03697934 0.9815103 [78,] 0.01444005 0.02888009 0.9855600 [79,] 0.01168604 0.02337207 0.9883140 [80,] 0.01156855 0.02313709 0.9884315 [81,] 0.01761451 0.03522902 0.9823855 [82,] 0.01376000 0.02752000 0.9862400 [83,] 0.01083373 0.02166747 0.9891663 [84,] 0.01182017 0.02364035 0.9881798 [85,] 0.00997517 0.01995034 0.9900248 [86,] 0.01518251 0.03036502 0.9848175 [87,] 0.01782035 0.03564070 0.9821796 [88,] 0.01414809 0.02829617 0.9858519 [89,] 0.06901551 0.13803103 0.9309845 [90,] 0.06206004 0.12412009 0.9379400 [91,] 0.05165275 0.10330549 0.9483473 [92,] 0.05308532 0.10617063 0.9469147 [93,] 0.04453327 0.08906653 0.9554667 [94,] 0.03336501 0.06673003 0.9666350 [95,] 0.02633835 0.05267669 0.9736617 [96,] 0.01909600 0.03819200 0.9809040 [97,] 0.01789819 0.03579638 0.9821018 [98,] 0.02701689 0.05403378 0.9729831 [99,] 0.04154556 0.08309112 0.9584544 [100,] 0.03414268 0.06828536 0.9658573 [101,] 0.03020782 0.06041565 0.9697922 [102,] 0.05397846 0.10795693 0.9460215 [103,] 0.05063610 0.10127220 0.9493639 [104,] 0.07608492 0.15216984 0.9239151 [105,] 0.05807168 0.11614337 0.9419283 [106,] 0.05057874 0.10115749 0.9494213 [107,] 0.03804939 0.07609878 0.9619506 [108,] 0.07877794 0.15755588 0.9212221 [109,] 0.18105710 0.36211420 0.8189429 [110,] 0.37918805 0.75837611 0.6208119 [111,] 0.33099522 0.66199045 0.6690048 [112,] 0.25836488 0.51672976 0.7416351 [113,] 0.50272659 0.99454683 0.4972734 [114,] 0.82820967 0.34358066 0.1717903 [115,] 0.78732026 0.42535948 0.2126797 [116,] 0.70462235 0.59075531 0.2953777 [117,] 0.63435969 0.73128062 0.3656403 [118,] 0.59224888 0.81550224 0.4077511 [119,] 0.56924857 0.86150286 0.4307514 [120,] 0.46662273 0.93324545 0.5333773 > postscript(file="/var/www/html/freestat/rcomp/tmp/1vzn21290541725.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/freestat/rcomp/tmp/26q451290541725.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/freestat/rcomp/tmp/36q451290541725.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/freestat/rcomp/tmp/46q451290541725.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/freestat/rcomp/tmp/5y0lq1290541725.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.196579142 -0.550666215 -0.963260718 0.610339342 5.276349768 -1.024133341 7 8 9 10 11 12 7.260811264 -1.763191548 -1.941264685 0.460436323 -3.344348557 -4.045095915 13 14 15 16 17 18 0.780720613 -1.889181895 1.557626875 3.879252922 -1.755331674 -2.942215143 19 20 21 22 23 24 -1.101242058 -3.471230259 -1.663809734 1.274056070 -1.301537352 -2.107424439 25 26 27 28 29 30 -0.938773847 1.871519711 0.046964496 -0.510038302 4.906678309 -2.413844515 31 32 33 34 35 36 0.452140016 1.659698364 -2.417207639 6.359688117 -0.882278086 -0.169192096 37 38 39 40 41 42 -2.259898338 -3.457878349 -0.575619736 -2.960123559 2.158191384 -1.365453250 43 44 45 46 47 48 1.810992493 -1.109871492 -0.818446422 -2.146618777 3.389656530 4.277338646 49 50 51 52 53 54 1.513587385 -1.967037210 0.575328023 -0.081913328 -4.688213919 -2.239040789 55 56 57 58 59 60 1.516033137 5.890227011 0.327407812 0.015432839 2.663179541 -1.934206336 61 62 63 64 65 66 -3.333956792 3.823198731 -0.208212720 0.173243478 0.204721071 2.271660438 67 68 69 70 71 72 1.204597033 1.089061239 -3.567750132 -0.273139122 0.268537928 2.860296377 73 74 75 76 77 78 0.132960195 -3.054946634 -1.339704090 -0.296775205 -1.305897250 0.715859899 79 80 81 82 83 84 -0.434877510 0.636266345 0.576500847 7.487779059 1.079409253 1.260970437 85 86 87 88 89 90 -1.101501153 3.405359735 -1.687458675 0.124945776 1.816208964 -1.042583393 91 92 93 94 95 96 -1.425524194 -2.707258800 -4.562091010 1.774427662 -1.389211291 -2.918542658 97 98 99 100 101 102 1.578947453 4.009560939 -3.895973668 2.232740307 7.428410277 2.304647311 103 104 105 106 107 108 1.347322372 -3.917914261 1.438101158 -0.935180854 -0.847792244 0.002849802 109 110 111 112 113 114 -3.908992394 4.279839731 5.201220530 0.833143260 -3.220524329 -6.419776332 115 116 117 118 119 120 -3.311786302 -3.896364593 -1.326013818 -2.711064009 -1.159741032 -2.853755881 121 122 123 124 125 126 7.225435051 -2.296996574 0.929858182 1.323795876 8.874920967 0.861436485 127 128 129 130 131 132 0.654076474 -2.561702182 -2.374851374 -3.793086710 0.083464794 2.004484738 133 134 135 136 137 138 -1.835156607 0.632638451 -0.553272550 -2.920044361 0.537160133 -1.668347467 139 140 141 142 143 144 -1.858304763 3.713000644 0.892955426 0.353026973 -2.872474102 -1.777627068 145 5.986485684 > postscript(file="/var/www/html/freestat/rcomp/tmp/6y0lq1290541725.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.196579142 NA 1 -0.550666215 0.196579142 2 -0.963260718 -0.550666215 3 0.610339342 -0.963260718 4 5.276349768 0.610339342 5 -1.024133341 5.276349768 6 7.260811264 -1.024133341 7 -1.763191548 7.260811264 8 -1.941264685 -1.763191548 9 0.460436323 -1.941264685 10 -3.344348557 0.460436323 11 -4.045095915 -3.344348557 12 0.780720613 -4.045095915 13 -1.889181895 0.780720613 14 1.557626875 -1.889181895 15 3.879252922 1.557626875 16 -1.755331674 3.879252922 17 -2.942215143 -1.755331674 18 -1.101242058 -2.942215143 19 -3.471230259 -1.101242058 20 -1.663809734 -3.471230259 21 1.274056070 -1.663809734 22 -1.301537352 1.274056070 23 -2.107424439 -1.301537352 24 -0.938773847 -2.107424439 25 1.871519711 -0.938773847 26 0.046964496 1.871519711 27 -0.510038302 0.046964496 28 4.906678309 -0.510038302 29 -2.413844515 4.906678309 30 0.452140016 -2.413844515 31 1.659698364 0.452140016 32 -2.417207639 1.659698364 33 6.359688117 -2.417207639 34 -0.882278086 6.359688117 35 -0.169192096 -0.882278086 36 -2.259898338 -0.169192096 37 -3.457878349 -2.259898338 38 -0.575619736 -3.457878349 39 -2.960123559 -0.575619736 40 2.158191384 -2.960123559 41 -1.365453250 2.158191384 42 1.810992493 -1.365453250 43 -1.109871492 1.810992493 44 -0.818446422 -1.109871492 45 -2.146618777 -0.818446422 46 3.389656530 -2.146618777 47 4.277338646 3.389656530 48 1.513587385 4.277338646 49 -1.967037210 1.513587385 50 0.575328023 -1.967037210 51 -0.081913328 0.575328023 52 -4.688213919 -0.081913328 53 -2.239040789 -4.688213919 54 1.516033137 -2.239040789 55 5.890227011 1.516033137 56 0.327407812 5.890227011 57 0.015432839 0.327407812 58 2.663179541 0.015432839 59 -1.934206336 2.663179541 60 -3.333956792 -1.934206336 61 3.823198731 -3.333956792 62 -0.208212720 3.823198731 63 0.173243478 -0.208212720 64 0.204721071 0.173243478 65 2.271660438 0.204721071 66 1.204597033 2.271660438 67 1.089061239 1.204597033 68 -3.567750132 1.089061239 69 -0.273139122 -3.567750132 70 0.268537928 -0.273139122 71 2.860296377 0.268537928 72 0.132960195 2.860296377 73 -3.054946634 0.132960195 74 -1.339704090 -3.054946634 75 -0.296775205 -1.339704090 76 -1.305897250 -0.296775205 77 0.715859899 -1.305897250 78 -0.434877510 0.715859899 79 0.636266345 -0.434877510 80 0.576500847 0.636266345 81 7.487779059 0.576500847 82 1.079409253 7.487779059 83 1.260970437 1.079409253 84 -1.101501153 1.260970437 85 3.405359735 -1.101501153 86 -1.687458675 3.405359735 87 0.124945776 -1.687458675 88 1.816208964 0.124945776 89 -1.042583393 1.816208964 90 -1.425524194 -1.042583393 91 -2.707258800 -1.425524194 92 -4.562091010 -2.707258800 93 1.774427662 -4.562091010 94 -1.389211291 1.774427662 95 -2.918542658 -1.389211291 96 1.578947453 -2.918542658 97 4.009560939 1.578947453 98 -3.895973668 4.009560939 99 2.232740307 -3.895973668 100 7.428410277 2.232740307 101 2.304647311 7.428410277 102 1.347322372 2.304647311 103 -3.917914261 1.347322372 104 1.438101158 -3.917914261 105 -0.935180854 1.438101158 106 -0.847792244 -0.935180854 107 0.002849802 -0.847792244 108 -3.908992394 0.002849802 109 4.279839731 -3.908992394 110 5.201220530 4.279839731 111 0.833143260 5.201220530 112 -3.220524329 0.833143260 113 -6.419776332 -3.220524329 114 -3.311786302 -6.419776332 115 -3.896364593 -3.311786302 116 -1.326013818 -3.896364593 117 -2.711064009 -1.326013818 118 -1.159741032 -2.711064009 119 -2.853755881 -1.159741032 120 7.225435051 -2.853755881 121 -2.296996574 7.225435051 122 0.929858182 -2.296996574 123 1.323795876 0.929858182 124 8.874920967 1.323795876 125 0.861436485 8.874920967 126 0.654076474 0.861436485 127 -2.561702182 0.654076474 128 -2.374851374 -2.561702182 129 -3.793086710 -2.374851374 130 0.083464794 -3.793086710 131 2.004484738 0.083464794 132 -1.835156607 2.004484738 133 0.632638451 -1.835156607 134 -0.553272550 0.632638451 135 -2.920044361 -0.553272550 136 0.537160133 -2.920044361 137 -1.668347467 0.537160133 138 -1.858304763 -1.668347467 139 3.713000644 -1.858304763 140 0.892955426 3.713000644 141 0.353026973 0.892955426 142 -2.872474102 0.353026973 143 -1.777627068 -2.872474102 144 5.986485684 -1.777627068 145 NA 5.986485684 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -0.550666215 0.196579142 [2,] -0.963260718 -0.550666215 [3,] 0.610339342 -0.963260718 [4,] 5.276349768 0.610339342 [5,] -1.024133341 5.276349768 [6,] 7.260811264 -1.024133341 [7,] -1.763191548 7.260811264 [8,] -1.941264685 -1.763191548 [9,] 0.460436323 -1.941264685 [10,] -3.344348557 0.460436323 [11,] -4.045095915 -3.344348557 [12,] 0.780720613 -4.045095915 [13,] -1.889181895 0.780720613 [14,] 1.557626875 -1.889181895 [15,] 3.879252922 1.557626875 [16,] -1.755331674 3.879252922 [17,] -2.942215143 -1.755331674 [18,] -1.101242058 -2.942215143 [19,] -3.471230259 -1.101242058 [20,] -1.663809734 -3.471230259 [21,] 1.274056070 -1.663809734 [22,] -1.301537352 1.274056070 [23,] -2.107424439 -1.301537352 [24,] -0.938773847 -2.107424439 [25,] 1.871519711 -0.938773847 [26,] 0.046964496 1.871519711 [27,] -0.510038302 0.046964496 [28,] 4.906678309 -0.510038302 [29,] -2.413844515 4.906678309 [30,] 0.452140016 -2.413844515 [31,] 1.659698364 0.452140016 [32,] -2.417207639 1.659698364 [33,] 6.359688117 -2.417207639 [34,] -0.882278086 6.359688117 [35,] -0.169192096 -0.882278086 [36,] -2.259898338 -0.169192096 [37,] -3.457878349 -2.259898338 [38,] -0.575619736 -3.457878349 [39,] -2.960123559 -0.575619736 [40,] 2.158191384 -2.960123559 [41,] -1.365453250 2.158191384 [42,] 1.810992493 -1.365453250 [43,] -1.109871492 1.810992493 [44,] -0.818446422 -1.109871492 [45,] -2.146618777 -0.818446422 [46,] 3.389656530 -2.146618777 [47,] 4.277338646 3.389656530 [48,] 1.513587385 4.277338646 [49,] -1.967037210 1.513587385 [50,] 0.575328023 -1.967037210 [51,] -0.081913328 0.575328023 [52,] -4.688213919 -0.081913328 [53,] -2.239040789 -4.688213919 [54,] 1.516033137 -2.239040789 [55,] 5.890227011 1.516033137 [56,] 0.327407812 5.890227011 [57,] 0.015432839 0.327407812 [58,] 2.663179541 0.015432839 [59,] -1.934206336 2.663179541 [60,] -3.333956792 -1.934206336 [61,] 3.823198731 -3.333956792 [62,] -0.208212720 3.823198731 [63,] 0.173243478 -0.208212720 [64,] 0.204721071 0.173243478 [65,] 2.271660438 0.204721071 [66,] 1.204597033 2.271660438 [67,] 1.089061239 1.204597033 [68,] -3.567750132 1.089061239 [69,] -0.273139122 -3.567750132 [70,] 0.268537928 -0.273139122 [71,] 2.860296377 0.268537928 [72,] 0.132960195 2.860296377 [73,] -3.054946634 0.132960195 [74,] -1.339704090 -3.054946634 [75,] -0.296775205 -1.339704090 [76,] -1.305897250 -0.296775205 [77,] 0.715859899 -1.305897250 [78,] -0.434877510 0.715859899 [79,] 0.636266345 -0.434877510 [80,] 0.576500847 0.636266345 [81,] 7.487779059 0.576500847 [82,] 1.079409253 7.487779059 [83,] 1.260970437 1.079409253 [84,] -1.101501153 1.260970437 [85,] 3.405359735 -1.101501153 [86,] -1.687458675 3.405359735 [87,] 0.124945776 -1.687458675 [88,] 1.816208964 0.124945776 [89,] -1.042583393 1.816208964 [90,] -1.425524194 -1.042583393 [91,] -2.707258800 -1.425524194 [92,] -4.562091010 -2.707258800 [93,] 1.774427662 -4.562091010 [94,] -1.389211291 1.774427662 [95,] -2.918542658 -1.389211291 [96,] 1.578947453 -2.918542658 [97,] 4.009560939 1.578947453 [98,] -3.895973668 4.009560939 [99,] 2.232740307 -3.895973668 [100,] 7.428410277 2.232740307 [101,] 2.304647311 7.428410277 [102,] 1.347322372 2.304647311 [103,] -3.917914261 1.347322372 [104,] 1.438101158 -3.917914261 [105,] -0.935180854 1.438101158 [106,] -0.847792244 -0.935180854 [107,] 0.002849802 -0.847792244 [108,] -3.908992394 0.002849802 [109,] 4.279839731 -3.908992394 [110,] 5.201220530 4.279839731 [111,] 0.833143260 5.201220530 [112,] -3.220524329 0.833143260 [113,] -6.419776332 -3.220524329 [114,] -3.311786302 -6.419776332 [115,] -3.896364593 -3.311786302 [116,] -1.326013818 -3.896364593 [117,] -2.711064009 -1.326013818 [118,] -1.159741032 -2.711064009 [119,] -2.853755881 -1.159741032 [120,] 7.225435051 -2.853755881 [121,] -2.296996574 7.225435051 [122,] 0.929858182 -2.296996574 [123,] 1.323795876 0.929858182 [124,] 8.874920967 1.323795876 [125,] 0.861436485 8.874920967 [126,] 0.654076474 0.861436485 [127,] -2.561702182 0.654076474 [128,] -2.374851374 -2.561702182 [129,] -3.793086710 -2.374851374 [130,] 0.083464794 -3.793086710 [131,] 2.004484738 0.083464794 [132,] -1.835156607 2.004484738 [133,] 0.632638451 -1.835156607 [134,] -0.553272550 0.632638451 [135,] -2.920044361 -0.553272550 [136,] 0.537160133 -2.920044361 [137,] -1.668347467 0.537160133 [138,] -1.858304763 -1.668347467 [139,] 3.713000644 -1.858304763 [140,] 0.892955426 3.713000644 [141,] 0.353026973 0.892955426 [142,] -2.872474102 0.353026973 [143,] -1.777627068 -2.872474102 [144,] 5.986485684 -1.777627068 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -0.550666215 0.196579142 2 -0.963260718 -0.550666215 3 0.610339342 -0.963260718 4 5.276349768 0.610339342 5 -1.024133341 5.276349768 6 7.260811264 -1.024133341 7 -1.763191548 7.260811264 8 -1.941264685 -1.763191548 9 0.460436323 -1.941264685 10 -3.344348557 0.460436323 11 -4.045095915 -3.344348557 12 0.780720613 -4.045095915 13 -1.889181895 0.780720613 14 1.557626875 -1.889181895 15 3.879252922 1.557626875 16 -1.755331674 3.879252922 17 -2.942215143 -1.755331674 18 -1.101242058 -2.942215143 19 -3.471230259 -1.101242058 20 -1.663809734 -3.471230259 21 1.274056070 -1.663809734 22 -1.301537352 1.274056070 23 -2.107424439 -1.301537352 24 -0.938773847 -2.107424439 25 1.871519711 -0.938773847 26 0.046964496 1.871519711 27 -0.510038302 0.046964496 28 4.906678309 -0.510038302 29 -2.413844515 4.906678309 30 0.452140016 -2.413844515 31 1.659698364 0.452140016 32 -2.417207639 1.659698364 33 6.359688117 -2.417207639 34 -0.882278086 6.359688117 35 -0.169192096 -0.882278086 36 -2.259898338 -0.169192096 37 -3.457878349 -2.259898338 38 -0.575619736 -3.457878349 39 -2.960123559 -0.575619736 40 2.158191384 -2.960123559 41 -1.365453250 2.158191384 42 1.810992493 -1.365453250 43 -1.109871492 1.810992493 44 -0.818446422 -1.109871492 45 -2.146618777 -0.818446422 46 3.389656530 -2.146618777 47 4.277338646 3.389656530 48 1.513587385 4.277338646 49 -1.967037210 1.513587385 50 0.575328023 -1.967037210 51 -0.081913328 0.575328023 52 -4.688213919 -0.081913328 53 -2.239040789 -4.688213919 54 1.516033137 -2.239040789 55 5.890227011 1.516033137 56 0.327407812 5.890227011 57 0.015432839 0.327407812 58 2.663179541 0.015432839 59 -1.934206336 2.663179541 60 -3.333956792 -1.934206336 61 3.823198731 -3.333956792 62 -0.208212720 3.823198731 63 0.173243478 -0.208212720 64 0.204721071 0.173243478 65 2.271660438 0.204721071 66 1.204597033 2.271660438 67 1.089061239 1.204597033 68 -3.567750132 1.089061239 69 -0.273139122 -3.567750132 70 0.268537928 -0.273139122 71 2.860296377 0.268537928 72 0.132960195 2.860296377 73 -3.054946634 0.132960195 74 -1.339704090 -3.054946634 75 -0.296775205 -1.339704090 76 -1.305897250 -0.296775205 77 0.715859899 -1.305897250 78 -0.434877510 0.715859899 79 0.636266345 -0.434877510 80 0.576500847 0.636266345 81 7.487779059 0.576500847 82 1.079409253 7.487779059 83 1.260970437 1.079409253 84 -1.101501153 1.260970437 85 3.405359735 -1.101501153 86 -1.687458675 3.405359735 87 0.124945776 -1.687458675 88 1.816208964 0.124945776 89 -1.042583393 1.816208964 90 -1.425524194 -1.042583393 91 -2.707258800 -1.425524194 92 -4.562091010 -2.707258800 93 1.774427662 -4.562091010 94 -1.389211291 1.774427662 95 -2.918542658 -1.389211291 96 1.578947453 -2.918542658 97 4.009560939 1.578947453 98 -3.895973668 4.009560939 99 2.232740307 -3.895973668 100 7.428410277 2.232740307 101 2.304647311 7.428410277 102 1.347322372 2.304647311 103 -3.917914261 1.347322372 104 1.438101158 -3.917914261 105 -0.935180854 1.438101158 106 -0.847792244 -0.935180854 107 0.002849802 -0.847792244 108 -3.908992394 0.002849802 109 4.279839731 -3.908992394 110 5.201220530 4.279839731 111 0.833143260 5.201220530 112 -3.220524329 0.833143260 113 -6.419776332 -3.220524329 114 -3.311786302 -6.419776332 115 -3.896364593 -3.311786302 116 -1.326013818 -3.896364593 117 -2.711064009 -1.326013818 118 -1.159741032 -2.711064009 119 -2.853755881 -1.159741032 120 7.225435051 -2.853755881 121 -2.296996574 7.225435051 122 0.929858182 -2.296996574 123 1.323795876 0.929858182 124 8.874920967 1.323795876 125 0.861436485 8.874920967 126 0.654076474 0.861436485 127 -2.561702182 0.654076474 128 -2.374851374 -2.561702182 129 -3.793086710 -2.374851374 130 0.083464794 -3.793086710 131 2.004484738 0.083464794 132 -1.835156607 2.004484738 133 0.632638451 -1.835156607 134 -0.553272550 0.632638451 135 -2.920044361 -0.553272550 136 0.537160133 -2.920044361 137 -1.668347467 0.537160133 138 -1.858304763 -1.668347467 139 3.713000644 -1.858304763 140 0.892955426 3.713000644 141 0.353026973 0.892955426 142 -2.872474102 0.353026973 143 -1.777627068 -2.872474102 144 5.986485684 -1.777627068 > 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/freestat/rcomp/tmp/7rrlt1290541725.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/freestat/rcomp/tmp/82ikw1290541725.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/freestat/rcomp/tmp/92ikw1290541725.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/freestat/rcomp/tmp/10ds1h1290541725.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/freestat/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/html/freestat/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/freestat/rcomp/tmp/11ys041290541725.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/freestat/rcomp/tmp/12rjz81290541725.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/freestat/rcomp/tmp/13xkwj1290541725.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/freestat/rcomp/tmp/141lvp1290541725.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/freestat/rcomp/tmp/15buus1290541725.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/freestat/rcomp/tmp/16q4s11290541725.tab") + } > > try(system("convert tmp/1vzn21290541725.ps tmp/1vzn21290541725.png",intern=TRUE)) character(0) > try(system("convert tmp/26q451290541725.ps tmp/26q451290541725.png",intern=TRUE)) character(0) > try(system("convert tmp/36q451290541725.ps tmp/36q451290541725.png",intern=TRUE)) character(0) > try(system("convert tmp/46q451290541725.ps tmp/46q451290541725.png",intern=TRUE)) character(0) > try(system("convert tmp/5y0lq1290541725.ps tmp/5y0lq1290541725.png",intern=TRUE)) character(0) > try(system("convert tmp/6y0lq1290541725.ps tmp/6y0lq1290541725.png",intern=TRUE)) character(0) > try(system("convert tmp/7rrlt1290541725.ps tmp/7rrlt1290541725.png",intern=TRUE)) character(0) > try(system("convert tmp/82ikw1290541725.ps tmp/82ikw1290541725.png",intern=TRUE)) character(0) > try(system("convert tmp/92ikw1290541725.ps tmp/92ikw1290541725.png",intern=TRUE)) character(0) > try(system("convert tmp/10ds1h1290541725.ps tmp/10ds1h1290541725.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 5.871 2.701 24.932