R version 2.15.2 (2012-10-26) -- "Trick or Treat" Copyright (C) 2012 The R Foundation for Statistical Computing ISBN 3-900051-07-0 Platform: i686-pc-linux-gnu (32-bit) R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > x <- array(list(13 + ,13 + ,14 + ,13 + ,3 + ,1 + ,1 + ,0 + ,12 + ,12 + ,8 + ,13 + ,5 + ,1 + ,0 + ,0 + ,15 + ,10 + ,12 + ,16 + ,6 + ,0 + ,0 + ,0 + ,12 + ,9 + ,7 + ,12 + ,6 + ,2 + ,0 + ,1 + ,10 + ,10 + ,10 + ,11 + ,5 + ,0 + ,1 + ,2 + ,12 + ,12 + ,7 + ,12 + ,3 + ,0 + ,0 + ,1 + ,15 + ,13 + ,16 + ,18 + ,8 + ,1 + ,1 + ,1 + ,9 + ,12 + ,11 + ,11 + ,4 + ,1 + ,0 + ,0 + ,12 + ,12 + ,14 + ,14 + ,4 + ,4 + ,0 + ,0 + ,11 + ,6 + ,6 + ,9 + ,4 + ,0 + ,0 + ,0 + ,11 + ,5 + ,16 + ,14 + ,6 + ,0 + ,2 + ,1 + ,11 + ,12 + ,11 + ,12 + ,6 + ,2 + ,0 + ,0 + ,15 + ,11 + ,16 + ,11 + ,5 + ,0 + ,2 + ,2 + ,7 + ,14 + ,12 + ,12 + ,4 + ,1 + ,1 + ,1 + ,11 + ,14 + ,7 + ,13 + ,6 + ,0 + ,1 + ,0 + ,11 + ,12 + ,13 + ,11 + ,4 + ,0 + ,0 + ,1 + ,10 + ,12 + ,11 + ,12 + ,6 + ,1 + ,1 + ,0 + ,14 + ,11 + ,15 + ,16 + ,6 + ,2 + ,0 + ,1 + ,10 + ,11 + ,7 + ,9 + ,4 + ,1 + ,0 + ,0 + ,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10 + ,15 + ,15 + ,15 + ,6 + ,2 + ,2 + ,0 + ,15 + ,11 + ,16 + ,14 + ,6 + ,2 + ,0 + ,1 + ,16 + ,12 + ,12 + ,15 + ,8 + ,0 + ,0 + ,0 + ,13 + ,11 + ,12 + ,13 + ,7 + ,1 + ,1 + ,1 + ,16 + ,12 + ,15 + ,16 + ,7 + ,2 + ,1 + ,0 + ,9 + ,11 + ,9 + ,12 + ,4 + ,0 + ,0 + ,0 + ,14 + ,10 + ,12 + ,15 + ,6 + ,1 + ,0 + ,1 + ,14 + ,11 + ,14 + ,12 + ,6 + ,2 + ,1 + ,2 + ,12 + ,11 + ,11 + ,14 + ,2 + ,1 + ,1 + ,0) + ,dim=c(8 + ,156) + ,dimnames=list(c('Popularity' + ,'FindingFriends' + ,'KnowingPeople' + ,'Liked' + ,'Celebrity' + ,'bestfriend' + ,'secondbestfriend' + ,'thirdbestfriend') + ,1:156)) > y <- array(NA,dim=c(8,156),dimnames=list(c('Popularity','FindingFriends','KnowingPeople','Liked','Celebrity','bestfriend','secondbestfriend','thirdbestfriend'),1:156)) > for (i in 1:dim(x)[1]) + { + for (j in 1:dim(x)[2]) + { + y[i,j] <- as.numeric(x[i,j]) + } + } > par20 = '' > par19 = '' > par18 = '' > par17 = '' > par16 = '' > par15 = '' > par14 = '' > par13 = '' > par12 = '' > par11 = '' > par10 = '' > par9 = '' > par8 = '' > par7 = '' > par6 = '' > par5 = '' > par4 = '' > par3 = 'No Linear Trend' > par2 = 'Do not include Seasonal Dummies' > par1 = '1' > library(lattice) > library(lmtest) Loading required package: zoo Attaching package: 'zoo' The following object(s) are masked from 'package:base': as.Date, 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 Popularity FindingFriends KnowingPeople Liked Celebrity bestfriend 1 13 13 14 13 3 1 2 12 12 8 13 5 1 3 15 10 12 16 6 0 4 12 9 7 12 6 2 5 10 10 10 11 5 0 6 12 12 7 12 3 0 7 15 13 16 18 8 1 8 9 12 11 11 4 1 9 12 12 14 14 4 4 10 11 6 6 9 4 0 11 11 5 16 14 6 0 12 11 12 11 12 6 2 13 15 11 16 11 5 0 14 7 14 12 12 4 1 15 11 14 7 13 6 0 16 11 12 13 11 4 0 17 10 12 11 12 6 1 18 14 11 15 16 6 2 19 10 11 7 9 4 1 20 6 7 9 11 4 1 21 11 9 7 13 2 0 22 15 11 14 15 7 1 23 11 11 15 10 5 1 24 12 12 7 11 4 2 25 14 12 15 13 6 1 26 15 11 17 16 6 1 27 9 11 15 15 7 1 28 13 8 14 14 5 2 29 13 9 14 14 6 0 30 16 12 8 14 4 1 31 13 10 8 8 4 0 32 12 10 14 13 7 1 33 14 12 14 15 7 1 34 11 8 8 13 4 0 35 9 12 11 11 4 1 36 16 11 16 15 6 2 37 12 12 10 15 6 1 38 10 7 8 9 5 1 39 13 11 14 13 6 1 40 16 11 16 16 7 1 41 14 12 13 13 6 0 42 15 9 5 11 3 1 43 5 15 8 12 3 1 44 8 11 10 12 4 1 45 11 11 8 12 6 0 46 16 11 13 14 7 2 47 17 11 15 14 5 1 48 9 15 6 8 4 0 49 9 11 12 13 5 0 50 13 12 16 16 6 1 51 10 12 5 13 6 1 52 6 9 15 11 6 0 53 12 12 12 14 5 0 54 8 12 8 13 4 0 55 14 13 13 13 5 0 56 12 11 14 13 5 1 57 11 9 12 12 4 0 58 16 9 16 16 6 0 59 8 11 10 15 2 1 60 15 11 15 15 8 0 61 7 12 8 12 3 0 62 16 12 16 14 6 2 63 14 9 19 12 6 0 64 16 11 14 15 6 0 65 9 9 6 12 5 1 66 14 12 13 13 5 2 67 11 12 15 12 6 3 68 13 12 7 12 5 1 69 15 12 13 13 6 1 70 5 14 4 5 2 2 71 15 11 14 13 5 1 72 13 12 13 13 5 1 73 11 11 11 14 5 2 74 11 6 14 17 6 1 75 12 10 12 13 6 0 76 12 12 15 13 6 1 77 12 13 14 12 5 1 78 12 8 13 13 5 0 79 14 12 8 14 4 2 80 6 12 6 11 2 1 81 7 12 7 12 4 0 82 14 6 13 12 6 3 83 14 11 13 16 6 1 84 10 10 11 12 5 1 85 13 12 5 12 3 3 86 12 13 12 12 6 2 87 9 11 8 10 4 1 88 12 7 11 15 5 0 89 16 11 14 15 8 1 90 10 11 9 12 4 2 91 14 11 10 16 6 1 92 10 11 13 15 6 1 93 16 12 16 16 7 0 94 15 10 16 13 6 2 95 12 11 11 12 5 1 96 10 12 8 11 4 0 97 8 7 4 13 6 0 98 8 13 7 10 3 1 99 11 8 14 15 5 1 100 13 12 11 13 6 1 101 16 11 17 16 7 1 102 16 12 15 15 7 1 103 14 14 17 18 6 0 104 11 10 5 13 3 0 105 4 10 4 10 2 1 106 14 13 10 16 8 2 107 9 10 11 13 3 1 108 14 11 15 15 8 1 109 8 10 10 14 3 0 110 8 7 9 15 4 0 111 11 10 12 14 5 1 112 12 8 15 13 7 1 113 11 12 7 13 6 0 114 14 12 13 15 6 0 115 15 12 12 16 7 2 116 16 11 14 14 6 2 117 16 12 14 14 6 0 118 11 12 8 16 6 1 119 14 12 15 14 6 0 120 14 11 12 12 4 2 121 12 12 12 13 4 1 122 14 11 16 12 5 0 123 8 11 9 12 4 1 124 13 13 15 14 6 1 125 16 12 15 14 6 2 126 12 12 6 14 5 0 127 16 12 14 16 8 2 128 12 12 15 13 6 0 129 11 8 10 14 5 1 130 4 8 6 4 4 0 131 16 12 14 16 8 3 132 15 11 12 13 6 1 133 10 12 8 16 4 0 134 13 13 11 15 6 0 135 15 12 13 14 6 0 136 12 12 9 13 4 0 137 14 11 15 14 6 0 138 7 12 13 12 3 1 139 19 12 15 15 6 1 140 12 10 14 14 5 2 141 12 11 16 13 4 1 142 13 12 14 14 6 0 143 15 12 14 16 4 0 144 8 10 10 6 4 2 145 12 12 10 13 4 1 146 10 13 4 13 6 0 147 8 12 8 14 5 1 148 10 15 15 15 6 2 149 15 11 16 14 6 2 150 16 12 12 15 8 0 151 13 11 12 13 7 1 152 16 12 15 16 7 2 153 9 11 9 12 4 0 154 14 10 12 15 6 1 155 14 11 14 12 6 2 156 12 11 11 14 2 1 secondbestfriend thirdbestfriend 1 1 0 2 0 0 3 0 0 4 0 1 5 1 2 6 0 1 7 1 1 8 0 0 9 0 0 10 0 0 11 2 1 12 0 0 13 2 2 14 1 1 15 1 0 16 0 1 17 1 0 18 0 1 19 0 0 20 0 0 21 1 1 22 2 0 23 2 1 24 0 0 25 0 0 26 1 0 27 1 0 28 2 0 29 0 2 30 1 1 31 1 2 32 1 1 33 2 1 34 2 0 35 1 0 36 2 0 37 1 1 38 1 2 39 0 1 40 3 1 41 1 2 42 0 0 43 0 0 44 0 0 45 1 1 46 0 1 47 4 4 48 0 0 49 0 0 50 0 1 51 1 0 52 2 1 53 1 0 54 1 1 55 0 0 56 2 2 57 0 2 58 3 1 59 2 0 60 0 0 61 0 0 62 2 0 63 1 0 64 0 1 65 2 1 66 0 0 67 1 0 68 0 0 69 2 1 70 0 0 71 2 2 72 3 0 73 0 2 74 2 1 75 3 1 76 1 1 77 0 2 78 1 2 79 0 0 80 0 0 81 1 0 82 1 1 83 2 1 84 1 0 85 0 0 86 0 0 87 1 0 88 0 2 89 0 1 90 0 1 91 1 0 92 1 1 93 3 1 94 1 0 95 1 1 96 0 0 97 0 1 98 1 0 99 1 0 100 0 2 101 1 2 102 1 2 103 0 1 104 1 1 105 0 1 106 1 0 107 1 1 108 1 1 109 1 0 110 1 0 111 0 0 112 0 0 113 0 0 114 1 0 115 1 0 116 1 0 117 0 0 118 1 0 119 4 1 120 0 0 121 1 1 122 0 3 123 2 2 124 1 2 125 0 2 126 0 0 127 0 1 128 0 0 129 1 0 130 0 0 131 2 1 132 0 2 133 1 0 134 2 4 135 2 0 136 1 0 137 3 0 138 0 0 139 1 0 140 1 1 141 0 0 142 1 1 143 0 0 144 1 2 145 0 1 146 1 0 147 0 0 148 2 0 149 0 1 150 0 0 151 1 1 152 1 0 153 0 0 154 0 1 155 1 2 156 1 0 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) FindingFriends KnowingPeople Liked -0.17879 0.10025 0.21218 0.38229 Celebrity bestfriend secondbestfriend thirdbestfriend 0.59228 0.31037 -0.02887 0.40872 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -6.0161 -1.2348 -0.0384 1.3723 6.9232 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) -0.17879 1.43271 -0.125 0.900857 FindingFriends 0.10025 0.09669 1.037 0.301521 KnowingPeople 0.21218 0.06360 3.336 0.001073 ** Liked 0.38229 0.09726 3.931 0.000130 *** Celebrity 0.59228 0.15554 3.808 0.000205 *** bestfriend 0.31037 0.20944 1.482 0.140490 secondbestfriend -0.02887 0.20071 -0.144 0.885836 thirdbestfriend 0.40872 0.21301 1.919 0.056940 . --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 2.089 on 148 degrees of freedom Multiple R-squared: 0.5168, Adjusted R-squared: 0.494 F-statistic: 22.61 on 7 and 148 DF, p-value: < 2.2e-16 > 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.2614611 0.52292226 0.738538871 [2,] 0.1388830 0.27776598 0.861117011 [3,] 0.6133160 0.77336806 0.386684031 [4,] 0.8647090 0.27058190 0.135290951 [5,] 0.8059182 0.38816355 0.194081777 [6,] 0.7401203 0.51975947 0.259879734 [7,] 0.6636767 0.67264668 0.336323342 [8,] 0.5733743 0.85325133 0.426625665 [9,] 0.4940434 0.98808676 0.505956621 [10,] 0.7440426 0.51191483 0.255957414 [11,] 0.6837722 0.63245556 0.316227778 [12,] 0.6851570 0.62968610 0.314843049 [13,] 0.6158861 0.76822788 0.384113942 [14,] 0.6129406 0.77411874 0.387059369 [15,] 0.5772857 0.84542858 0.422714292 [16,] 0.5164352 0.96712964 0.483564819 [17,] 0.7425610 0.51487790 0.257438950 [18,] 0.6997984 0.60040330 0.300201649 [19,] 0.6388799 0.72224011 0.361120056 [20,] 0.7566081 0.48678376 0.243391881 [21,] 0.8207687 0.35846262 0.179231309 [22,] 0.7846075 0.43078497 0.215392487 [23,] 0.7378283 0.52434346 0.262171732 [24,] 0.6987411 0.60251785 0.301258926 [25,] 0.6735364 0.65292710 0.326463551 [26,] 0.7045437 0.59091260 0.295456299 [27,] 0.6820522 0.63589564 0.317947819 [28,] 0.6343645 0.73127092 0.365635459 [29,] 0.5849390 0.83012193 0.415060964 [30,] 0.5418096 0.91638088 0.458190438 [31,] 0.4933899 0.98677982 0.506610089 [32,] 0.8201510 0.35969796 0.179848978 [33,] 0.9575032 0.08499361 0.042496807 [34,] 0.9615094 0.07698121 0.038490605 [35,] 0.9506264 0.09874714 0.049373571 [36,] 0.9543590 0.09128190 0.045640951 [37,] 0.9552881 0.08942373 0.044711863 [38,] 0.9460721 0.10785571 0.053927855 [39,] 0.9467459 0.10650816 0.053254080 [40,] 0.9410485 0.11790291 0.058951454 [41,] 0.9330309 0.13393820 0.066969098 [42,] 0.9891537 0.02169256 0.010846280 [43,] 0.9852450 0.02950999 0.014754997 [44,] 0.9901901 0.01961989 0.009809945 [45,] 0.9924166 0.01516672 0.007583359 [46,] 0.9903107 0.01937865 0.009689327 [47,] 0.9872027 0.02559463 0.012797317 [48,] 0.9866800 0.02664006 0.013320029 [49,] 0.9904729 0.01905426 0.009527128 [50,] 0.9885698 0.02286046 0.011430228 [51,] 0.9889989 0.02200224 0.011001120 [52,] 0.9901637 0.01967270 0.009836349 [53,] 0.9889803 0.02203945 0.011019724 [54,] 0.9902365 0.01952701 0.009763505 [55,] 0.9888001 0.02239980 0.011199902 [56,] 0.9873683 0.02526338 0.012631688 [57,] 0.9886331 0.02273383 0.011366915 [58,] 0.9906036 0.01879272 0.009396360 [59,] 0.9906699 0.01866014 0.009330070 [60,] 0.9877282 0.02454363 0.012271817 [61,] 0.9883790 0.02324192 0.011620958 [62,] 0.9856647 0.02867063 0.014335316 [63,] 0.9855911 0.02881772 0.014408859 [64,] 0.9900150 0.01996995 0.009984977 [65,] 0.9866018 0.02679635 0.013398173 [66,] 0.9843433 0.03131345 0.015656726 [67,] 0.9797632 0.04047359 0.020236796 [68,] 0.9736679 0.05266413 0.026332066 [69,] 0.9800620 0.03987600 0.019938002 [70,] 0.9796434 0.04071327 0.020356637 [71,] 0.9812641 0.03747171 0.018735855 [72,] 0.9791878 0.04162449 0.020812246 [73,] 0.9723500 0.05530002 0.027650012 [74,] 0.9654918 0.06901646 0.034508230 [75,] 0.9855485 0.02890304 0.014451522 [76,] 0.9809440 0.03811205 0.019056025 [77,] 0.9747809 0.05043811 0.025219056 [78,] 0.9676508 0.06469845 0.032349225 [79,] 0.9594274 0.08114517 0.040572585 [80,] 0.9492634 0.10147329 0.050736644 [81,] 0.9402980 0.11940402 0.059702008 [82,] 0.9662564 0.06748727 0.033743635 [83,] 0.9577096 0.08458072 0.042290359 [84,] 0.9531608 0.09367846 0.046839232 [85,] 0.9415400 0.11692000 0.058459998 [86,] 0.9276961 0.14460770 0.072303851 [87,] 0.9241705 0.15165893 0.075829464 [88,] 0.9057815 0.18843696 0.094218482 [89,] 0.8973089 0.20538219 0.102691093 [90,] 0.8726998 0.25460044 0.127300219 [91,] 0.8452521 0.30949576 0.154747882 [92,] 0.8161083 0.36778330 0.183891650 [93,] 0.8440160 0.31196805 0.155984027 [94,] 0.8844485 0.23110310 0.115551548 [95,] 0.8918024 0.21639515 0.108197577 [96,] 0.8671749 0.26565013 0.132825066 [97,] 0.8456961 0.30860782 0.154303912 [98,] 0.8408456 0.31830874 0.159154370 [99,] 0.8326763 0.33464736 0.167323679 [100,] 0.8545955 0.29080907 0.145404533 [101,] 0.8422002 0.31559953 0.157799767 [102,] 0.8861604 0.22767922 0.113839612 [103,] 0.8564507 0.28709853 0.143549263 [104,] 0.8256502 0.34869967 0.174349833 [105,] 0.7878217 0.42435661 0.212178305 [106,] 0.7993282 0.40134351 0.200671756 [107,] 0.8083615 0.38327703 0.191638513 [108,] 0.7908367 0.41832659 0.209163293 [109,] 0.7486765 0.50264691 0.251323456 [110,] 0.8295179 0.34096423 0.170482113 [111,] 0.7989138 0.40217239 0.201086195 [112,] 0.7531781 0.49364387 0.246821934 [113,] 0.7535118 0.49297641 0.246488203 [114,] 0.7221348 0.55573033 0.277865163 [115,] 0.6979772 0.60404556 0.302022779 [116,] 0.6816893 0.63662135 0.318310675 [117,] 0.6190851 0.76182987 0.380914933 [118,] 0.6040983 0.79180336 0.395901680 [119,] 0.5950871 0.80982574 0.404912872 [120,] 0.5839168 0.83216645 0.416083223 [121,] 0.5170329 0.96593426 0.482967130 [122,] 0.4881460 0.97629201 0.511853997 [123,] 0.4536106 0.90722123 0.546389386 [124,] 0.4094418 0.81888357 0.590558216 [125,] 0.3609713 0.72194255 0.639028723 [126,] 0.3372529 0.67450574 0.662747128 [127,] 0.3042139 0.60842780 0.695786101 [128,] 0.3352764 0.67055287 0.664723566 [129,] 0.7298269 0.54034629 0.270173147 [130,] 0.7275974 0.54480516 0.272402580 [131,] 0.6359700 0.72806004 0.364030018 [132,] 0.6347135 0.73057297 0.365286487 [133,] 0.5128198 0.97436037 0.487180186 [134,] 0.3956039 0.79120786 0.604396070 [135,] 0.3507750 0.70155000 0.649225001 > postscript(file="/var/fisher/rcomp/tmp/15glr1353440088.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > plot(x[,1], type='l', main='Actuals and Interpolation', ylab='value of Actuals and Interpolation (dots)', xlab='time or index') > points(x[,1]-mysum$resid) > grid() > dev.off() null device 1 > postscript(file="/var/fisher/rcomp/tmp/2sjbh1353440088.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > plot(mysum$resid, type='b', pch=19, main='Residuals', ylab='value of Residuals', xlab='time or index') > grid() > dev.off() null device 1 > postscript(file="/var/fisher/rcomp/tmp/3paha1353440088.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > hist(mysum$resid, main='Residual Histogram', xlab='values of Residuals') > grid() > dev.off() null device 1 > postscript(file="/var/fisher/rcomp/tmp/4mvdo1353440088.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > densityplot(~mysum$resid,col='black',main='Residual Density Plot', xlab='values of Residuals') > dev.off() null device 1 > postscript(file="/var/fisher/rcomp/tmp/5zung1353440088.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > qqnorm(mysum$resid, main='Residual Normal Q-Q Plot') > qqline(mysum$resid) > grid() > dev.off() null device 1 > (myerror <- as.ts(mysum$resid)) Time Series: Start = 1 End = 156 Frequency = 1 1 2 3 4 5 6 1.876784689 1.036717954 1.959696191 0.620587047 -0.900769782 2.717392576 7 8 9 10 11 12 -1.829161144 -1.242967610 -0.957498466 3.494420258 -1.974177002 -1.120181935 13 14 15 16 17 18 2.754742702 -4.417807303 -0.204648453 0.234308151 -1.780949396 -0.806562575 19 20 21 22 23 24 1.470607200 -3.317337107 2.257000214 0.972460043 -0.552422632 2.295400472 25 26 27 28 29 30 0.959156010 0.517026121 -5.268589941 0.529700216 -0.417276766 4.866844297 31 32 33 34 35 36 4.262756354 -1.600289014 -0.536515886 1.398104787 -1.214101172 1.830003978 37 38 39 40 41 42 -1.124371018 0.278577203 -0.137131010 0.785942171 0.905309145 6.923168835 43 44 45 46 47 48 -4.697191869 -2.312825356 -0.142503225 1.790115337 2.749964610 0.974440089 49 50 51 52 53 54 -2.401397446 -1.808632703 -0.890142097 -6.016122266 0.144922337 -2.440495630 55 56 57 58 59 60 2.185913644 -0.895844254 -0.043767477 1.889090761 -2.217420147 0.420632594 61 62 63 64 65 66 -2.086067722 2.112045269 1.132706388 2.408647144 -1.206853305 1.665434127 67 68 69 70 71 72 -2.250415777 2.631195472 2.032532731 -0.790236166 2.104155746 1.062399543 73 74 75 76 77 78 -2.009686568 -3.107310613 -0.215545820 -1.420700799 -0.771788523 -0.101403000 79 80 81 82 83 84 2.936335006 -1.997495632 -2.437294863 1.366744161 -0.014096506 -0.988166906 85 86 87 88 89 90 3.619384615 -0.432618163 -0.095003880 -0.370237612 0.913726793 -0.819731158 91 92 93 94 95 96 1.002310939 -3.660668972 0.996055588 1.665978169 0.502857164 0.703949126 97 98 99 100 101 102 -2.303918726 -0.491048573 -1.571094097 -0.009556303 0.107302500 0.813710882 103 104 105 106 107 108 -1.675543460 1.988837497 -3.399052450 -0.693114777 -1.594629875 -1.269590314 109 110 111 112 113 114 -2.045650956 -2.507280462 -0.993804836 -1.232110386 -0.033009527 0.958167693 115 116 117 118 119 120 0.575047940 2.607798604 3.099411682 -1.673574653 0.593970644 2.952441454 121 122 123 124 125 126 0.400404089 0.905992603 -2.860355428 -1.311970702 1.449049442 1.389157171 127 128 129 130 131 132 0.120814037 -0.730477890 -0.340065942 -1.794615241 -0.131819185 1.878512834 133 134 135 136 137 138 -1.178654302 -1.323744450 2.369328105 1.756044072 1.074080136 -3.457351549 139 140 141 142 143 144 5.223434502 -1.108394836 0.031779398 -0.280445127 2.519377987 -1.017754990 145 146 147 148 149 150 0.795904741 -0.467845134 -3.345576020 -4.358823206 0.745841827 1.956930548 151 152 153 154 155 156 -0.276174605 0.938497304 -0.790275711 0.622900817 0.554940055 1.923823842 > postscript(file="/var/fisher/rcomp/tmp/6pa1j1353440088.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > dum <- cbind(lag(myerror,k=1),myerror) > dum Time Series: Start = 0 End = 156 Frequency = 1 lag(myerror, k = 1) myerror 0 1.876784689 NA 1 1.036717954 1.876784689 2 1.959696191 1.036717954 3 0.620587047 1.959696191 4 -0.900769782 0.620587047 5 2.717392576 -0.900769782 6 -1.829161144 2.717392576 7 -1.242967610 -1.829161144 8 -0.957498466 -1.242967610 9 3.494420258 -0.957498466 10 -1.974177002 3.494420258 11 -1.120181935 -1.974177002 12 2.754742702 -1.120181935 13 -4.417807303 2.754742702 14 -0.204648453 -4.417807303 15 0.234308151 -0.204648453 16 -1.780949396 0.234308151 17 -0.806562575 -1.780949396 18 1.470607200 -0.806562575 19 -3.317337107 1.470607200 20 2.257000214 -3.317337107 21 0.972460043 2.257000214 22 -0.552422632 0.972460043 23 2.295400472 -0.552422632 24 0.959156010 2.295400472 25 0.517026121 0.959156010 26 -5.268589941 0.517026121 27 0.529700216 -5.268589941 28 -0.417276766 0.529700216 29 4.866844297 -0.417276766 30 4.262756354 4.866844297 31 -1.600289014 4.262756354 32 -0.536515886 -1.600289014 33 1.398104787 -0.536515886 34 -1.214101172 1.398104787 35 1.830003978 -1.214101172 36 -1.124371018 1.830003978 37 0.278577203 -1.124371018 38 -0.137131010 0.278577203 39 0.785942171 -0.137131010 40 0.905309145 0.785942171 41 6.923168835 0.905309145 42 -4.697191869 6.923168835 43 -2.312825356 -4.697191869 44 -0.142503225 -2.312825356 45 1.790115337 -0.142503225 46 2.749964610 1.790115337 47 0.974440089 2.749964610 48 -2.401397446 0.974440089 49 -1.808632703 -2.401397446 50 -0.890142097 -1.808632703 51 -6.016122266 -0.890142097 52 0.144922337 -6.016122266 53 -2.440495630 0.144922337 54 2.185913644 -2.440495630 55 -0.895844254 2.185913644 56 -0.043767477 -0.895844254 57 1.889090761 -0.043767477 58 -2.217420147 1.889090761 59 0.420632594 -2.217420147 60 -2.086067722 0.420632594 61 2.112045269 -2.086067722 62 1.132706388 2.112045269 63 2.408647144 1.132706388 64 -1.206853305 2.408647144 65 1.665434127 -1.206853305 66 -2.250415777 1.665434127 67 2.631195472 -2.250415777 68 2.032532731 2.631195472 69 -0.790236166 2.032532731 70 2.104155746 -0.790236166 71 1.062399543 2.104155746 72 -2.009686568 1.062399543 73 -3.107310613 -2.009686568 74 -0.215545820 -3.107310613 75 -1.420700799 -0.215545820 76 -0.771788523 -1.420700799 77 -0.101403000 -0.771788523 78 2.936335006 -0.101403000 79 -1.997495632 2.936335006 80 -2.437294863 -1.997495632 81 1.366744161 -2.437294863 82 -0.014096506 1.366744161 83 -0.988166906 -0.014096506 84 3.619384615 -0.988166906 85 -0.432618163 3.619384615 86 -0.095003880 -0.432618163 87 -0.370237612 -0.095003880 88 0.913726793 -0.370237612 89 -0.819731158 0.913726793 90 1.002310939 -0.819731158 91 -3.660668972 1.002310939 92 0.996055588 -3.660668972 93 1.665978169 0.996055588 94 0.502857164 1.665978169 95 0.703949126 0.502857164 96 -2.303918726 0.703949126 97 -0.491048573 -2.303918726 98 -1.571094097 -0.491048573 99 -0.009556303 -1.571094097 100 0.107302500 -0.009556303 101 0.813710882 0.107302500 102 -1.675543460 0.813710882 103 1.988837497 -1.675543460 104 -3.399052450 1.988837497 105 -0.693114777 -3.399052450 106 -1.594629875 -0.693114777 107 -1.269590314 -1.594629875 108 -2.045650956 -1.269590314 109 -2.507280462 -2.045650956 110 -0.993804836 -2.507280462 111 -1.232110386 -0.993804836 112 -0.033009527 -1.232110386 113 0.958167693 -0.033009527 114 0.575047940 0.958167693 115 2.607798604 0.575047940 116 3.099411682 2.607798604 117 -1.673574653 3.099411682 118 0.593970644 -1.673574653 119 2.952441454 0.593970644 120 0.400404089 2.952441454 121 0.905992603 0.400404089 122 -2.860355428 0.905992603 123 -1.311970702 -2.860355428 124 1.449049442 -1.311970702 125 1.389157171 1.449049442 126 0.120814037 1.389157171 127 -0.730477890 0.120814037 128 -0.340065942 -0.730477890 129 -1.794615241 -0.340065942 130 -0.131819185 -1.794615241 131 1.878512834 -0.131819185 132 -1.178654302 1.878512834 133 -1.323744450 -1.178654302 134 2.369328105 -1.323744450 135 1.756044072 2.369328105 136 1.074080136 1.756044072 137 -3.457351549 1.074080136 138 5.223434502 -3.457351549 139 -1.108394836 5.223434502 140 0.031779398 -1.108394836 141 -0.280445127 0.031779398 142 2.519377987 -0.280445127 143 -1.017754990 2.519377987 144 0.795904741 -1.017754990 145 -0.467845134 0.795904741 146 -3.345576020 -0.467845134 147 -4.358823206 -3.345576020 148 0.745841827 -4.358823206 149 1.956930548 0.745841827 150 -0.276174605 1.956930548 151 0.938497304 -0.276174605 152 -0.790275711 0.938497304 153 0.622900817 -0.790275711 154 0.554940055 0.622900817 155 1.923823842 0.554940055 156 NA 1.923823842 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] 1.036717954 1.876784689 [2,] 1.959696191 1.036717954 [3,] 0.620587047 1.959696191 [4,] -0.900769782 0.620587047 [5,] 2.717392576 -0.900769782 [6,] -1.829161144 2.717392576 [7,] -1.242967610 -1.829161144 [8,] -0.957498466 -1.242967610 [9,] 3.494420258 -0.957498466 [10,] -1.974177002 3.494420258 [11,] -1.120181935 -1.974177002 [12,] 2.754742702 -1.120181935 [13,] -4.417807303 2.754742702 [14,] -0.204648453 -4.417807303 [15,] 0.234308151 -0.204648453 [16,] -1.780949396 0.234308151 [17,] -0.806562575 -1.780949396 [18,] 1.470607200 -0.806562575 [19,] -3.317337107 1.470607200 [20,] 2.257000214 -3.317337107 [21,] 0.972460043 2.257000214 [22,] -0.552422632 0.972460043 [23,] 2.295400472 -0.552422632 [24,] 0.959156010 2.295400472 [25,] 0.517026121 0.959156010 [26,] -5.268589941 0.517026121 [27,] 0.529700216 -5.268589941 [28,] -0.417276766 0.529700216 [29,] 4.866844297 -0.417276766 [30,] 4.262756354 4.866844297 [31,] -1.600289014 4.262756354 [32,] -0.536515886 -1.600289014 [33,] 1.398104787 -0.536515886 [34,] -1.214101172 1.398104787 [35,] 1.830003978 -1.214101172 [36,] -1.124371018 1.830003978 [37,] 0.278577203 -1.124371018 [38,] -0.137131010 0.278577203 [39,] 0.785942171 -0.137131010 [40,] 0.905309145 0.785942171 [41,] 6.923168835 0.905309145 [42,] -4.697191869 6.923168835 [43,] -2.312825356 -4.697191869 [44,] -0.142503225 -2.312825356 [45,] 1.790115337 -0.142503225 [46,] 2.749964610 1.790115337 [47,] 0.974440089 2.749964610 [48,] -2.401397446 0.974440089 [49,] -1.808632703 -2.401397446 [50,] -0.890142097 -1.808632703 [51,] -6.016122266 -0.890142097 [52,] 0.144922337 -6.016122266 [53,] -2.440495630 0.144922337 [54,] 2.185913644 -2.440495630 [55,] -0.895844254 2.185913644 [56,] -0.043767477 -0.895844254 [57,] 1.889090761 -0.043767477 [58,] -2.217420147 1.889090761 [59,] 0.420632594 -2.217420147 [60,] -2.086067722 0.420632594 [61,] 2.112045269 -2.086067722 [62,] 1.132706388 2.112045269 [63,] 2.408647144 1.132706388 [64,] -1.206853305 2.408647144 [65,] 1.665434127 -1.206853305 [66,] -2.250415777 1.665434127 [67,] 2.631195472 -2.250415777 [68,] 2.032532731 2.631195472 [69,] -0.790236166 2.032532731 [70,] 2.104155746 -0.790236166 [71,] 1.062399543 2.104155746 [72,] -2.009686568 1.062399543 [73,] -3.107310613 -2.009686568 [74,] -0.215545820 -3.107310613 [75,] -1.420700799 -0.215545820 [76,] -0.771788523 -1.420700799 [77,] -0.101403000 -0.771788523 [78,] 2.936335006 -0.101403000 [79,] -1.997495632 2.936335006 [80,] -2.437294863 -1.997495632 [81,] 1.366744161 -2.437294863 [82,] -0.014096506 1.366744161 [83,] -0.988166906 -0.014096506 [84,] 3.619384615 -0.988166906 [85,] -0.432618163 3.619384615 [86,] -0.095003880 -0.432618163 [87,] -0.370237612 -0.095003880 [88,] 0.913726793 -0.370237612 [89,] -0.819731158 0.913726793 [90,] 1.002310939 -0.819731158 [91,] -3.660668972 1.002310939 [92,] 0.996055588 -3.660668972 [93,] 1.665978169 0.996055588 [94,] 0.502857164 1.665978169 [95,] 0.703949126 0.502857164 [96,] -2.303918726 0.703949126 [97,] -0.491048573 -2.303918726 [98,] -1.571094097 -0.491048573 [99,] -0.009556303 -1.571094097 [100,] 0.107302500 -0.009556303 [101,] 0.813710882 0.107302500 [102,] -1.675543460 0.813710882 [103,] 1.988837497 -1.675543460 [104,] -3.399052450 1.988837497 [105,] -0.693114777 -3.399052450 [106,] -1.594629875 -0.693114777 [107,] -1.269590314 -1.594629875 [108,] -2.045650956 -1.269590314 [109,] -2.507280462 -2.045650956 [110,] -0.993804836 -2.507280462 [111,] -1.232110386 -0.993804836 [112,] -0.033009527 -1.232110386 [113,] 0.958167693 -0.033009527 [114,] 0.575047940 0.958167693 [115,] 2.607798604 0.575047940 [116,] 3.099411682 2.607798604 [117,] -1.673574653 3.099411682 [118,] 0.593970644 -1.673574653 [119,] 2.952441454 0.593970644 [120,] 0.400404089 2.952441454 [121,] 0.905992603 0.400404089 [122,] -2.860355428 0.905992603 [123,] -1.311970702 -2.860355428 [124,] 1.449049442 -1.311970702 [125,] 1.389157171 1.449049442 [126,] 0.120814037 1.389157171 [127,] -0.730477890 0.120814037 [128,] -0.340065942 -0.730477890 [129,] -1.794615241 -0.340065942 [130,] -0.131819185 -1.794615241 [131,] 1.878512834 -0.131819185 [132,] -1.178654302 1.878512834 [133,] -1.323744450 -1.178654302 [134,] 2.369328105 -1.323744450 [135,] 1.756044072 2.369328105 [136,] 1.074080136 1.756044072 [137,] -3.457351549 1.074080136 [138,] 5.223434502 -3.457351549 [139,] -1.108394836 5.223434502 [140,] 0.031779398 -1.108394836 [141,] -0.280445127 0.031779398 [142,] 2.519377987 -0.280445127 [143,] -1.017754990 2.519377987 [144,] 0.795904741 -1.017754990 [145,] -0.467845134 0.795904741 [146,] -3.345576020 -0.467845134 [147,] -4.358823206 -3.345576020 [148,] 0.745841827 -4.358823206 [149,] 1.956930548 0.745841827 [150,] -0.276174605 1.956930548 [151,] 0.938497304 -0.276174605 [152,] -0.790275711 0.938497304 [153,] 0.622900817 -0.790275711 [154,] 0.554940055 0.622900817 [155,] 1.923823842 0.554940055 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 1.036717954 1.876784689 2 1.959696191 1.036717954 3 0.620587047 1.959696191 4 -0.900769782 0.620587047 5 2.717392576 -0.900769782 6 -1.829161144 2.717392576 7 -1.242967610 -1.829161144 8 -0.957498466 -1.242967610 9 3.494420258 -0.957498466 10 -1.974177002 3.494420258 11 -1.120181935 -1.974177002 12 2.754742702 -1.120181935 13 -4.417807303 2.754742702 14 -0.204648453 -4.417807303 15 0.234308151 -0.204648453 16 -1.780949396 0.234308151 17 -0.806562575 -1.780949396 18 1.470607200 -0.806562575 19 -3.317337107 1.470607200 20 2.257000214 -3.317337107 21 0.972460043 2.257000214 22 -0.552422632 0.972460043 23 2.295400472 -0.552422632 24 0.959156010 2.295400472 25 0.517026121 0.959156010 26 -5.268589941 0.517026121 27 0.529700216 -5.268589941 28 -0.417276766 0.529700216 29 4.866844297 -0.417276766 30 4.262756354 4.866844297 31 -1.600289014 4.262756354 32 -0.536515886 -1.600289014 33 1.398104787 -0.536515886 34 -1.214101172 1.398104787 35 1.830003978 -1.214101172 36 -1.124371018 1.830003978 37 0.278577203 -1.124371018 38 -0.137131010 0.278577203 39 0.785942171 -0.137131010 40 0.905309145 0.785942171 41 6.923168835 0.905309145 42 -4.697191869 6.923168835 43 -2.312825356 -4.697191869 44 -0.142503225 -2.312825356 45 1.790115337 -0.142503225 46 2.749964610 1.790115337 47 0.974440089 2.749964610 48 -2.401397446 0.974440089 49 -1.808632703 -2.401397446 50 -0.890142097 -1.808632703 51 -6.016122266 -0.890142097 52 0.144922337 -6.016122266 53 -2.440495630 0.144922337 54 2.185913644 -2.440495630 55 -0.895844254 2.185913644 56 -0.043767477 -0.895844254 57 1.889090761 -0.043767477 58 -2.217420147 1.889090761 59 0.420632594 -2.217420147 60 -2.086067722 0.420632594 61 2.112045269 -2.086067722 62 1.132706388 2.112045269 63 2.408647144 1.132706388 64 -1.206853305 2.408647144 65 1.665434127 -1.206853305 66 -2.250415777 1.665434127 67 2.631195472 -2.250415777 68 2.032532731 2.631195472 69 -0.790236166 2.032532731 70 2.104155746 -0.790236166 71 1.062399543 2.104155746 72 -2.009686568 1.062399543 73 -3.107310613 -2.009686568 74 -0.215545820 -3.107310613 75 -1.420700799 -0.215545820 76 -0.771788523 -1.420700799 77 -0.101403000 -0.771788523 78 2.936335006 -0.101403000 79 -1.997495632 2.936335006 80 -2.437294863 -1.997495632 81 1.366744161 -2.437294863 82 -0.014096506 1.366744161 83 -0.988166906 -0.014096506 84 3.619384615 -0.988166906 85 -0.432618163 3.619384615 86 -0.095003880 -0.432618163 87 -0.370237612 -0.095003880 88 0.913726793 -0.370237612 89 -0.819731158 0.913726793 90 1.002310939 -0.819731158 91 -3.660668972 1.002310939 92 0.996055588 -3.660668972 93 1.665978169 0.996055588 94 0.502857164 1.665978169 95 0.703949126 0.502857164 96 -2.303918726 0.703949126 97 -0.491048573 -2.303918726 98 -1.571094097 -0.491048573 99 -0.009556303 -1.571094097 100 0.107302500 -0.009556303 101 0.813710882 0.107302500 102 -1.675543460 0.813710882 103 1.988837497 -1.675543460 104 -3.399052450 1.988837497 105 -0.693114777 -3.399052450 106 -1.594629875 -0.693114777 107 -1.269590314 -1.594629875 108 -2.045650956 -1.269590314 109 -2.507280462 -2.045650956 110 -0.993804836 -2.507280462 111 -1.232110386 -0.993804836 112 -0.033009527 -1.232110386 113 0.958167693 -0.033009527 114 0.575047940 0.958167693 115 2.607798604 0.575047940 116 3.099411682 2.607798604 117 -1.673574653 3.099411682 118 0.593970644 -1.673574653 119 2.952441454 0.593970644 120 0.400404089 2.952441454 121 0.905992603 0.400404089 122 -2.860355428 0.905992603 123 -1.311970702 -2.860355428 124 1.449049442 -1.311970702 125 1.389157171 1.449049442 126 0.120814037 1.389157171 127 -0.730477890 0.120814037 128 -0.340065942 -0.730477890 129 -1.794615241 -0.340065942 130 -0.131819185 -1.794615241 131 1.878512834 -0.131819185 132 -1.178654302 1.878512834 133 -1.323744450 -1.178654302 134 2.369328105 -1.323744450 135 1.756044072 2.369328105 136 1.074080136 1.756044072 137 -3.457351549 1.074080136 138 5.223434502 -3.457351549 139 -1.108394836 5.223434502 140 0.031779398 -1.108394836 141 -0.280445127 0.031779398 142 2.519377987 -0.280445127 143 -1.017754990 2.519377987 144 0.795904741 -1.017754990 145 -0.467845134 0.795904741 146 -3.345576020 -0.467845134 147 -4.358823206 -3.345576020 148 0.745841827 -4.358823206 149 1.956930548 0.745841827 150 -0.276174605 1.956930548 151 0.938497304 -0.276174605 152 -0.790275711 0.938497304 153 0.622900817 -0.790275711 154 0.554940055 0.622900817 155 1.923823842 0.554940055 > 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/fisher/rcomp/tmp/7kob41353440088.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > acf(mysum$resid, lag.max=length(mysum$resid)/2, main='Residual Autocorrelation Function') > grid() > dev.off() null device 1 > postscript(file="/var/fisher/rcomp/tmp/8cxk81353440088.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > pacf(mysum$resid, lag.max=length(mysum$resid)/2, main='Residual Partial Autocorrelation Function') > grid() > dev.off() null device 1 > postscript(file="/var/fisher/rcomp/tmp/9nsqm1353440088.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > opar <- par(mfrow = c(2,2), oma = c(0, 0, 1.1, 0)) > plot(mylm, las = 1, sub='Residual Diagnostics') > par(opar) > dev.off() null device 1 > if (n > n25) { + postscript(file="/var/fisher/rcomp/tmp/1030co1353440088.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) + plot(kp3:nmkm3,gqarr[,2], main='Goldfeld-Quandt test',ylab='2-sided p-value',xlab='breakpoint') + grid() + dev.off() + } null device 1 > > #Note: the /var/fisher/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/fisher/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/fisher/rcomp/tmp/11fbuy1353440088.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/fisher/rcomp/tmp/121gif1353440088.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/fisher/rcomp/tmp/13brwb1353440088.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/fisher/rcomp/tmp/14t9fp1353440088.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/fisher/rcomp/tmp/15ytxh1353440088.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/fisher/rcomp/tmp/16iicq1353440088.tab") + } > > try(system("convert tmp/15glr1353440088.ps tmp/15glr1353440088.png",intern=TRUE)) character(0) > try(system("convert tmp/2sjbh1353440088.ps tmp/2sjbh1353440088.png",intern=TRUE)) character(0) > try(system("convert tmp/3paha1353440088.ps tmp/3paha1353440088.png",intern=TRUE)) character(0) > try(system("convert tmp/4mvdo1353440088.ps tmp/4mvdo1353440088.png",intern=TRUE)) character(0) > try(system("convert tmp/5zung1353440088.ps tmp/5zung1353440088.png",intern=TRUE)) character(0) > try(system("convert tmp/6pa1j1353440088.ps tmp/6pa1j1353440088.png",intern=TRUE)) character(0) > try(system("convert tmp/7kob41353440088.ps tmp/7kob41353440088.png",intern=TRUE)) character(0) > try(system("convert tmp/8cxk81353440088.ps tmp/8cxk81353440088.png",intern=TRUE)) character(0) > try(system("convert tmp/9nsqm1353440088.ps tmp/9nsqm1353440088.png",intern=TRUE)) character(0) > try(system("convert tmp/1030co1353440088.ps tmp/1030co1353440088.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 8.108 1.326 9.447