R version 2.12.0 (2010-10-15) Copyright (C) 2010 The R Foundation for Statistical Computing ISBN 3-900051-07-0 Platform: i486-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(9 + ,13 + ,13 + ,14 + ,13 + ,3 + ,1 + ,1 + ,0 + ,9 + ,12 + ,12 + ,8 + ,13 + ,5 + ,1 + ,0 + ,0 + ,9 + ,15 + ,10 + ,12 + ,16 + ,6 + ,0 + ,0 + ,0 + ,9 + ,12 + ,9 + ,7 + ,12 + ,6 + ,2 + ,0 + ,1 + ,9 + ,10 + ,10 + ,10 + ,11 + ,5 + ,0 + ,1 + ,2 + ,9 + ,12 + ,12 + ,7 + ,12 + ,3 + ,0 + ,0 + ,1 + ,9 + ,15 + ,13 + ,16 + ,18 + ,8 + ,1 + ,1 + ,1 + ,9 + ,9 + ,12 + ,11 + ,11 + ,4 + ,1 + ,0 + ,0 + ,9 + ,12 + ,12 + ,14 + ,14 + ,4 + ,4 + ,0 + ,0 + ,9 + ,11 + ,6 + ,6 + ,9 + ,4 + ,0 + ,0 + ,0 + ,9 + ,11 + ,5 + ,16 + ,14 + ,6 + ,0 + ,2 + ,1 + ,9 + ,11 + ,12 + ,11 + ,12 + ,6 + ,2 + ,0 + ,0 + ,9 + ,15 + ,11 + ,16 + ,11 + ,5 + ,0 + ,2 + ,2 + ,9 + ,7 + ,14 + ,12 + ,12 + ,4 + ,1 + ,1 + ,1 + ,9 + ,11 + ,14 + ,7 + ,13 + ,6 + ,0 + ,1 + ,0 + ,9 + ,11 + ,12 + ,13 + ,11 + ,4 + ,0 + ,0 + ,1 + ,9 + ,10 + ,12 + ,11 + ,12 + ,6 + ,1 + ,1 + ,0 + ,9 + ,14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 + ,10 + ,15 + ,11 + ,12 + ,13 + ,6 + ,1 + ,0 + ,2 + ,10 + ,10 + ,12 + ,8 + ,16 + ,4 + ,0 + ,1 + ,0 + ,10 + ,13 + ,13 + ,11 + ,15 + ,6 + ,0 + ,2 + ,4 + ,10 + ,15 + ,12 + ,13 + ,14 + ,6 + ,0 + ,2 + ,0 + ,10 + ,12 + ,12 + ,9 + ,13 + ,4 + ,0 + ,1 + ,0 + ,10 + ,14 + ,11 + ,15 + ,14 + ,6 + ,0 + ,3 + ,0 + ,10 + ,7 + ,12 + ,13 + ,12 + ,3 + ,1 + ,0 + ,0 + ,10 + ,19 + ,12 + ,15 + ,15 + ,6 + ,1 + ,1 + ,0 + ,10 + ,12 + ,10 + ,14 + ,14 + ,5 + ,2 + ,1 + ,1 + ,10 + ,12 + ,11 + ,16 + ,13 + ,4 + ,1 + ,0 + ,0 + ,10 + ,13 + ,12 + ,14 + ,14 + ,6 + ,0 + ,1 + ,1 + ,10 + ,15 + ,12 + ,14 + ,16 + ,4 + ,0 + ,0 + ,0 + ,10 + ,8 + ,10 + ,10 + ,6 + ,4 + ,2 + ,1 + ,2 + ,10 + ,12 + ,12 + ,10 + ,13 + ,4 + ,1 + ,0 + ,1 + ,10 + ,10 + ,13 + ,4 + ,13 + ,6 + ,0 + ,1 + ,0 + ,10 + ,8 + ,12 + ,8 + ,14 + ,5 + ,1 + ,0 + ,0 + ,10 + ,10 + ,15 + ,15 + ,15 + ,6 + ,2 + ,2 + ,0 + ,10 + ,15 + ,11 + ,16 + ,14 + ,6 + ,2 + ,0 + ,1 + ,10 + ,16 + ,12 + ,12 + ,15 + ,8 + ,0 + ,0 + ,0 + ,10 + ,13 + ,11 + ,12 + ,13 + ,7 + ,1 + ,1 + ,1 + ,10 + ,16 + ,12 + ,15 + ,16 + ,7 + ,2 + ,1 + ,0 + ,10 + ,9 + ,11 + ,9 + ,12 + ,4 + ,0 + ,0 + ,0 + ,10 + ,14 + ,10 + ,12 + ,15 + ,6 + ,1 + ,0 + ,1 + ,10 + ,14 + ,11 + ,14 + ,12 + ,6 + ,2 + ,1 + ,2 + ,10 + ,12 + ,11 + ,11 + ,14 + ,2 + ,1 + ,1 + ,0) + ,dim=c(9 + ,156) + ,dimnames=list(c('month' + ,'Popularity' + ,'FindingFriends' + ,'KnowingPeople' + ,'Liked' + ,'Celebrity' + ,'bestfriend' + ,'secondbestfriend' + ,'thirdbestfriend') + ,1:156)) > y <- array(NA,dim=c(9,156),dimnames=list(c('month','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 = 'Linear Trend' > par2 = 'Do not include Seasonal Dummies' > par1 = '2' > 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 Popularity month FindingFriends KnowingPeople Liked Celebrity bestfriend 1 13 9 13 14 13 3 1 2 12 9 12 8 13 5 1 3 15 9 10 12 16 6 0 4 12 9 9 7 12 6 2 5 10 9 10 10 11 5 0 6 12 9 12 7 12 3 0 7 15 9 13 16 18 8 1 8 9 9 12 11 11 4 1 9 12 9 12 14 14 4 4 10 11 9 6 6 9 4 0 11 11 9 5 16 14 6 0 12 11 9 12 11 12 6 2 13 15 9 11 16 11 5 0 14 7 9 14 12 12 4 1 15 11 9 14 7 13 6 0 16 11 9 12 13 11 4 0 17 10 9 12 11 12 6 1 18 14 9 11 15 16 6 2 19 10 9 11 7 9 4 1 20 6 9 7 9 11 4 1 21 11 9 9 7 13 2 0 22 15 9 11 14 15 7 1 23 11 9 11 15 10 5 1 24 12 9 12 7 11 4 2 25 14 9 12 15 13 6 1 26 15 9 11 17 16 6 1 27 9 9 11 15 15 7 1 28 13 9 8 14 14 5 2 29 13 9 9 14 14 6 0 30 16 9 12 8 14 4 1 31 13 9 10 8 8 4 0 32 12 9 10 14 13 7 1 33 14 9 12 14 15 7 1 34 11 9 8 8 13 4 0 35 9 9 12 11 11 4 1 36 16 9 11 16 15 6 2 37 12 9 12 10 15 6 1 38 10 9 7 8 9 5 1 39 13 9 11 14 13 6 1 40 16 9 11 16 16 7 1 41 14 9 12 13 13 6 0 42 15 9 9 5 11 3 1 43 5 9 15 8 12 3 1 44 8 9 11 10 12 4 1 45 11 9 11 8 12 6 0 46 16 9 11 13 14 7 2 47 17 9 11 15 14 5 1 48 9 9 15 6 8 4 0 49 9 9 11 12 13 5 0 50 13 9 12 16 16 6 1 51 10 9 12 5 13 6 1 52 6 9 9 15 11 6 0 53 12 9 12 12 14 5 0 54 8 9 12 8 13 4 0 55 14 9 13 13 13 5 0 56 12 9 11 14 13 5 1 57 11 10 9 12 12 4 0 58 16 10 9 16 16 6 0 59 8 10 11 10 15 2 1 60 15 10 11 15 15 8 0 61 7 10 12 8 12 3 0 62 16 10 12 16 14 6 2 63 14 10 9 19 12 6 0 64 16 10 11 14 15 6 0 65 9 10 9 6 12 5 1 66 14 10 12 13 13 5 2 67 11 10 12 15 12 6 3 68 13 10 12 7 12 5 1 69 15 10 12 13 13 6 1 70 5 10 14 4 5 2 2 71 15 10 11 14 13 5 1 72 13 10 12 13 13 5 1 73 11 10 11 11 14 5 2 74 11 10 6 14 17 6 1 75 12 10 10 12 13 6 0 76 12 10 12 15 13 6 1 77 12 10 13 14 12 5 1 78 12 10 8 13 13 5 0 79 14 10 12 8 14 4 2 80 6 10 12 6 11 2 1 81 7 10 12 7 12 4 0 82 14 10 6 13 12 6 3 83 14 10 11 13 16 6 1 84 10 10 10 11 12 5 1 85 13 10 12 5 12 3 3 86 12 10 13 12 12 6 2 87 9 10 11 8 10 4 1 88 12 10 7 11 15 5 0 89 16 10 11 14 15 8 1 90 10 10 11 9 12 4 2 91 14 10 11 10 16 6 1 92 10 10 11 13 15 6 1 93 16 10 12 16 16 7 0 94 15 10 10 16 13 6 2 95 12 10 11 11 12 5 1 96 10 10 12 8 11 4 0 97 8 10 7 4 13 6 0 98 8 10 13 7 10 3 1 99 11 10 8 14 15 5 1 100 13 10 12 11 13 6 1 101 16 10 11 17 16 7 1 102 16 10 12 15 15 7 1 103 14 10 14 17 18 6 0 104 11 10 10 5 13 3 0 105 4 10 10 4 10 2 1 106 14 10 13 10 16 8 2 107 9 10 10 11 13 3 1 108 14 10 11 15 15 8 1 109 8 10 10 10 14 3 0 110 8 10 7 9 15 4 0 111 11 10 10 12 14 5 1 112 12 10 8 15 13 7 1 113 11 10 12 7 13 6 0 114 14 10 12 13 15 6 0 115 15 10 12 12 16 7 2 116 16 10 11 14 14 6 2 117 16 10 12 14 14 6 0 118 11 10 12 8 16 6 1 119 14 10 12 15 14 6 0 120 14 10 11 12 12 4 2 121 12 10 12 12 13 4 1 122 14 10 11 16 12 5 0 123 8 10 11 9 12 4 1 124 13 10 13 15 14 6 1 125 16 10 12 15 14 6 2 126 12 10 12 6 14 5 0 127 16 10 12 14 16 8 2 128 12 10 12 15 13 6 0 129 11 10 8 10 14 5 1 130 4 10 8 6 4 4 0 131 16 10 12 14 16 8 3 132 15 10 11 12 13 6 1 133 10 10 12 8 16 4 0 134 13 10 13 11 15 6 0 135 15 10 12 13 14 6 0 136 12 10 12 9 13 4 0 137 14 10 11 15 14 6 0 138 7 10 12 13 12 3 1 139 19 10 12 15 15 6 1 140 12 10 10 14 14 5 2 141 12 10 11 16 13 4 1 142 13 10 12 14 14 6 0 143 15 10 12 14 16 4 0 144 8 10 10 10 6 4 2 145 12 10 12 10 13 4 1 146 10 10 13 4 13 6 0 147 8 10 12 8 14 5 1 148 10 10 15 15 15 6 2 149 15 10 11 16 14 6 2 150 16 10 12 12 15 8 0 151 13 10 11 12 13 7 1 152 16 10 12 15 16 7 2 153 9 10 11 9 12 4 0 154 14 10 10 12 15 6 1 155 14 10 11 14 12 6 2 156 12 10 11 11 14 2 1 secondbestfriend thirdbestfriend t 1 1 0 1 2 0 0 2 3 0 0 3 4 0 1 4 5 1 2 5 6 0 1 6 7 1 1 7 8 0 0 8 9 0 0 9 10 0 0 10 11 2 1 11 12 0 0 12 13 2 2 13 14 1 1 14 15 1 0 15 16 0 1 16 17 1 0 17 18 0 1 18 19 0 0 19 20 0 0 20 21 1 1 21 22 2 0 22 23 2 1 23 24 0 0 24 25 0 0 25 26 1 0 26 27 1 0 27 28 2 0 28 29 0 2 29 30 1 1 30 31 1 2 31 32 1 1 32 33 2 1 33 34 2 0 34 35 1 0 35 36 2 0 36 37 1 1 37 38 1 2 38 39 0 1 39 40 3 1 40 41 1 2 41 42 0 0 42 43 0 0 43 44 0 0 44 45 1 1 45 46 0 1 46 47 4 4 47 48 0 0 48 49 0 0 49 50 0 1 50 51 1 0 51 52 2 1 52 53 1 0 53 54 1 1 54 55 0 0 55 56 2 2 56 57 0 2 57 58 3 1 58 59 2 0 59 60 0 0 60 61 0 0 61 62 2 0 62 63 1 0 63 64 0 1 64 65 2 1 65 66 0 0 66 67 1 0 67 68 0 0 68 69 2 1 69 70 0 0 70 71 2 2 71 72 3 0 72 73 0 2 73 74 2 1 74 75 3 1 75 76 1 1 76 77 0 2 77 78 1 2 78 79 0 0 79 80 0 0 80 81 1 0 81 82 1 1 82 83 2 1 83 84 1 0 84 85 0 0 85 86 0 0 86 87 1 0 87 88 0 2 88 89 0 1 89 90 0 1 90 91 1 0 91 92 1 1 92 93 3 1 93 94 1 0 94 95 1 1 95 96 0 0 96 97 0 1 97 98 1 0 98 99 1 0 99 100 0 2 100 101 1 2 101 102 1 2 102 103 0 1 103 104 1 1 104 105 0 1 105 106 1 0 106 107 1 1 107 108 1 1 108 109 1 0 109 110 1 0 110 111 0 0 111 112 0 0 112 113 0 0 113 114 1 0 114 115 1 0 115 116 1 0 116 117 0 0 117 118 1 0 118 119 4 1 119 120 0 0 120 121 1 1 121 122 0 3 122 123 2 2 123 124 1 2 124 125 0 2 125 126 0 0 126 127 0 1 127 128 0 0 128 129 1 0 129 130 0 0 130 131 2 1 131 132 0 2 132 133 1 0 133 134 2 4 134 135 2 0 135 136 1 0 136 137 3 0 137 138 0 0 138 139 1 0 139 140 1 1 140 141 0 0 141 142 1 1 142 143 0 0 143 144 1 2 144 145 0 1 145 146 1 0 146 147 0 0 147 148 2 0 148 149 0 1 149 150 0 0 150 151 1 1 151 152 1 0 152 153 0 0 153 154 0 1 154 155 1 2 155 156 1 0 156 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) month FindingFriends KnowingPeople -0.98336 0.08938 0.10438 0.21162 Liked Celebrity bestfriend secondbestfriend 0.38519 0.59441 0.30765 -0.03240 thirdbestfriend t 0.41155 -0.00181 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -5.9910 -1.2524 -0.0601 1.3753 6.9294 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) -0.983357 6.011657 -0.164 0.870292 month 0.089381 0.640842 0.139 0.889267 FindingFriends 0.104378 0.098559 1.059 0.291327 KnowingPeople 0.211623 0.064050 3.304 0.001199 ** Liked 0.385194 0.099038 3.889 0.000152 *** Celebrity 0.594410 0.156961 3.787 0.000222 *** bestfriend 0.307650 0.211991 1.451 0.148859 secondbestfriend -0.032400 0.202360 -0.160 0.873014 thirdbestfriend 0.411553 0.214612 1.918 0.057107 . t -0.001810 0.006864 -0.264 0.792389 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 2.103 on 146 degrees of freedom Multiple R-squared: 0.5171, Adjusted R-squared: 0.4873 F-statistic: 17.37 on 9 and 146 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.8360018 0.32799642 0.163998208 [2,] 0.9019584 0.19608321 0.098041606 [3,] 0.8792406 0.24151888 0.120759442 [4,] 0.8086168 0.38276641 0.191383206 [5,] 0.7265852 0.54682968 0.273414838 [6,] 0.6667970 0.66640592 0.333202962 [7,] 0.6079103 0.78417931 0.392089653 [8,] 0.7021284 0.59574329 0.297871643 [9,] 0.6941923 0.61161543 0.305807713 [10,] 0.7453161 0.50936776 0.254683880 [11,] 0.6834184 0.63316315 0.316581576 [12,] 0.7077771 0.58444574 0.292222868 [13,] 0.6845358 0.63092845 0.315464225 [14,] 0.6260798 0.74784047 0.373920236 [15,] 0.8061672 0.38766567 0.193832837 [16,] 0.7709757 0.45804869 0.229024347 [17,] 0.7170351 0.56592977 0.282964883 [18,] 0.8186239 0.36275218 0.181376090 [19,] 0.8601566 0.27968676 0.139843380 [20,] 0.8296662 0.34066758 0.170333789 [21,] 0.7873126 0.42537481 0.212687407 [22,] 0.7549054 0.49018918 0.245094589 [23,] 0.7364121 0.52717586 0.263587932 [24,] 0.7567195 0.48656107 0.243280537 [25,] 0.7400780 0.51984393 0.259921964 [26,] 0.6964622 0.60707562 0.303537811 [27,] 0.6463023 0.70739531 0.353697656 [28,] 0.6025817 0.79483663 0.397418313 [29,] 0.5526456 0.89470872 0.447354360 [30,] 0.8431763 0.31364740 0.156823699 [31,] 0.9708149 0.05837016 0.029185082 [32,] 0.9717545 0.05649105 0.028245524 [33,] 0.9631161 0.07376786 0.036883931 [34,] 0.9686958 0.06260831 0.031304154 [35,] 0.9750191 0.04996173 0.024980863 [36,] 0.9715922 0.05681560 0.028407799 [37,] 0.9680591 0.06388174 0.031940869 [38,] 0.9594328 0.08113448 0.040567241 [39,] 0.9527291 0.09454171 0.047270857 [40,] 0.9892727 0.02145455 0.010727273 [41,] 0.9858034 0.02839315 0.014196574 [42,] 0.9891549 0.02169017 0.010845085 [43,] 0.9927679 0.01446422 0.007232109 [44,] 0.9902117 0.01957656 0.009788281 [45,] 0.9865132 0.02697369 0.013486846 [46,] 0.9858478 0.02830434 0.014152169 [47,] 0.9890596 0.02188084 0.010940421 [48,] 0.9878590 0.02428193 0.012140966 [49,] 0.9877983 0.02440334 0.012201668 [50,] 0.9894472 0.02110556 0.010552781 [51,] 0.9878856 0.02422885 0.012114425 [52,] 0.9882874 0.02342512 0.011712559 [53,] 0.9876599 0.02468020 0.012340102 [54,] 0.9856703 0.02865938 0.014329692 [55,] 0.9873147 0.02537057 0.012685284 [56,] 0.9888699 0.02226019 0.011130094 [57,] 0.9882981 0.02340382 0.011701909 [58,] 0.9850824 0.02983529 0.014917645 [59,] 0.9855569 0.02888612 0.014443059 [60,] 0.9821643 0.03567137 0.017835683 [61,] 0.9824988 0.03500242 0.017501208 [62,] 0.9874030 0.02519398 0.012596990 [63,] 0.9833495 0.03330093 0.016650464 [64,] 0.9801562 0.03968752 0.019843758 [65,] 0.9742931 0.05141377 0.025706883 [66,] 0.9666617 0.06667654 0.033338268 [67,] 0.9756401 0.04871974 0.024359872 [68,] 0.9739943 0.05201140 0.026005701 [69,] 0.9749669 0.05006611 0.025033056 [70,] 0.9729835 0.05403303 0.027016517 [71,] 0.9644489 0.07110211 0.035551055 [72,] 0.9552106 0.08957884 0.044789419 [73,] 0.9819981 0.03600385 0.018001926 [74,] 0.9760141 0.04797185 0.023985925 [75,] 0.9687225 0.06255498 0.031277489 [76,] 0.9597490 0.08050210 0.040251050 [77,] 0.9510082 0.09798364 0.048991821 [78,] 0.9384758 0.12304839 0.061524195 [79,] 0.9306312 0.13873764 0.069368822 [80,] 0.9547721 0.09045584 0.045227922 [81,] 0.9451513 0.10969748 0.054848740 [82,] 0.9434308 0.11313849 0.056569244 [83,] 0.9320032 0.13599367 0.067996833 [84,] 0.9197028 0.16059440 0.080297199 [85,] 0.9127614 0.17447721 0.087238604 [86,] 0.8944600 0.21108008 0.105540038 [87,] 0.8789282 0.24214355 0.121071775 [88,] 0.8530227 0.29395459 0.146977293 [89,] 0.8222659 0.35546822 0.177734111 [90,] 0.7957130 0.40857395 0.204286977 [91,] 0.8081799 0.38364027 0.191820133 [92,] 0.8644359 0.27112825 0.135564125 [93,] 0.8618594 0.27628122 0.138140608 [94,] 0.8298873 0.34022549 0.170112744 [95,] 0.7974679 0.40506430 0.202532148 [96,] 0.7836564 0.43268725 0.216343627 [97,] 0.7648546 0.47029075 0.235145374 [98,] 0.7841433 0.43171338 0.215856691 [99,] 0.7690454 0.46190923 0.230954614 [100,] 0.8343243 0.33135149 0.165675744 [101,] 0.7972502 0.40549959 0.202749796 [102,] 0.7663322 0.46733567 0.233667837 [103,] 0.7229761 0.55404774 0.277023870 [104,] 0.7321701 0.53565974 0.267829868 [105,] 0.7443748 0.51125035 0.255625177 [106,] 0.7256230 0.54875406 0.274377029 [107,] 0.6753799 0.64924016 0.324620082 [108,] 0.7713185 0.45736291 0.228681453 [109,] 0.7409584 0.51808329 0.259041646 [110,] 0.6882524 0.62349516 0.311747581 [111,] 0.6743284 0.65134328 0.325671638 [112,] 0.6314835 0.73703293 0.368516463 [113,] 0.6121769 0.77564624 0.387823122 [114,] 0.6125528 0.77489436 0.387447181 [115,] 0.5460357 0.90792866 0.453964329 [116,] 0.5048787 0.99024254 0.495121271 [117,] 0.4829941 0.96598828 0.517005862 [118,] 0.4650093 0.93001850 0.534990750 [119,] 0.3929231 0.78584620 0.607076898 [120,] 0.3714623 0.74292451 0.628537747 [121,] 0.3256673 0.65133467 0.674332666 [122,] 0.2813238 0.56264765 0.718676176 [123,] 0.2375462 0.47509230 0.762453848 [124,] 0.2190692 0.43813830 0.780930849 [125,] 0.1843067 0.36861338 0.815693311 [126,] 0.1975809 0.39516182 0.802419092 [127,] 0.6160697 0.76786051 0.383930255 [128,] 0.5261505 0.94769896 0.473849482 [129,] 0.4055699 0.81113973 0.594430137 [130,] 0.4008517 0.80170336 0.599148318 [131,] 0.2780890 0.55617801 0.721910994 > postscript(file="/var/www/rcomp/tmp/1ezme1321998735.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/www/rcomp/tmp/2pij51321998735.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/www/rcomp/tmp/35y8m1321998735.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/www/rcomp/tmp/422r41321998735.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/www/rcomp/tmp/5yzt81321998735.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.79509733 0.94980238 1.87153577 0.54976103 -0.97192460 2.63877668 7 8 9 10 11 12 -1.92686083 -1.30940794 -1.02099786 3.45663378 -2.01494858 -1.18383172 13 14 15 16 17 18 2.70084073 -4.48327347 -0.27816030 0.17792392 -1.83473119 -0.86741282 19 20 21 22 23 24 1.43176030 -3.34255000 2.22067907 0.92623737 -0.58033883 2.25839475 25 26 27 28 29 30 0.91566386 0.47542513 -5.30873535 0.51659678 -0.45298795 4.83054800 31 32 33 34 35 36 4.24837473 -1.62484908 -0.56978303 1.39209830 -1.22813575 1.81509285 37 38 39 40 41 42 -1.15404134 0.28692610 -0.15454691 0.77122638 0.88481507 6.92941668 43 44 45 46 47 48 -4.71510529 -2.31343802 -0.14870526 1.78249253 2.75246916 0.97120603 49 50 51 52 53 54 -2.39958743 -1.81784166 -0.88864535 -5.99104422 0.15048096 -2.43316644 55 56 57 58 59 60 2.19089361 -0.87611803 -0.10923356 1.82524294 -2.27762915 0.34245529 61 62 63 64 65 66 -2.15112060 2.05358897 1.08695261 2.33858579 -1.25072250 1.61050142 67 68 69 70 71 72 -2.29540026 2.57670256 1.98241895 -0.82162780 2.06165169 1.02621245 73 74 75 76 77 78 -2.05750378 -3.13465937 -0.24629106 -1.46055649 -0.81585098 -0.12567040 79 80 81 82 83 84 2.90136299 -2.02152943 -2.46530619 1.36971323 -0.04344332 -0.99967099 85 86 87 88 89 90 3.60423992 -0.45526880 -0.09895259 -0.38273359 0.88736740 -0.82713604 91 92 93 94 95 96 0.98505859 -3.67435902 0.98105057 1.67306147 0.50430862 0.70301568 97 98 99 100 101 102 -2.29755236 -0.48176532 -1.55421352 -0.01457641 0.10428325 0.81015464 103 104 105 106 107 108 -1.69440630 2.00599111 -3.37063442 -0.69301706 -1.56596582 -1.25746386 109 110 111 112 113 114 -2.01671378 -2.46975003 -0.96520980 -1.19313822 -0.01379818 0.98028720 115 116 117 118 119 120 0.59881626 2.64655670 3.12688819 -1.64720197 0.63693340 3.00385049 121 122 123 124 125 126 0.44458568 0.94721013 -2.80650618 -1.27479802 1.49134015 1.43057192 127 128 129 130 131 132 0.15892812 -0.67963002 -0.26822600 -1.69832608 -0.07668110 1.93610133 133 134 135 136 137 138 -1.12358065 -1.27845537 2.43589280 1.82580825 1.15304570 -3.37750924 139 140 141 142 143 144 5.29464335 -1.02276607 0.11782665 -0.20701270 2.59238266 -0.90462629 145 146 147 148 149 150 0.87887295 -0.39117521 -3.26231222 -4.27745052 0.83909024 2.03585222 151 152 153 154 155 156 -0.17996427 1.03092037 -0.68624860 0.72146643 0.66443140 2.03911872 > postscript(file="/var/www/rcomp/tmp/6su341321998735.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.79509733 NA 1 0.94980238 1.79509733 2 1.87153577 0.94980238 3 0.54976103 1.87153577 4 -0.97192460 0.54976103 5 2.63877668 -0.97192460 6 -1.92686083 2.63877668 7 -1.30940794 -1.92686083 8 -1.02099786 -1.30940794 9 3.45663378 -1.02099786 10 -2.01494858 3.45663378 11 -1.18383172 -2.01494858 12 2.70084073 -1.18383172 13 -4.48327347 2.70084073 14 -0.27816030 -4.48327347 15 0.17792392 -0.27816030 16 -1.83473119 0.17792392 17 -0.86741282 -1.83473119 18 1.43176030 -0.86741282 19 -3.34255000 1.43176030 20 2.22067907 -3.34255000 21 0.92623737 2.22067907 22 -0.58033883 0.92623737 23 2.25839475 -0.58033883 24 0.91566386 2.25839475 25 0.47542513 0.91566386 26 -5.30873535 0.47542513 27 0.51659678 -5.30873535 28 -0.45298795 0.51659678 29 4.83054800 -0.45298795 30 4.24837473 4.83054800 31 -1.62484908 4.24837473 32 -0.56978303 -1.62484908 33 1.39209830 -0.56978303 34 -1.22813575 1.39209830 35 1.81509285 -1.22813575 36 -1.15404134 1.81509285 37 0.28692610 -1.15404134 38 -0.15454691 0.28692610 39 0.77122638 -0.15454691 40 0.88481507 0.77122638 41 6.92941668 0.88481507 42 -4.71510529 6.92941668 43 -2.31343802 -4.71510529 44 -0.14870526 -2.31343802 45 1.78249253 -0.14870526 46 2.75246916 1.78249253 47 0.97120603 2.75246916 48 -2.39958743 0.97120603 49 -1.81784166 -2.39958743 50 -0.88864535 -1.81784166 51 -5.99104422 -0.88864535 52 0.15048096 -5.99104422 53 -2.43316644 0.15048096 54 2.19089361 -2.43316644 55 -0.87611803 2.19089361 56 -0.10923356 -0.87611803 57 1.82524294 -0.10923356 58 -2.27762915 1.82524294 59 0.34245529 -2.27762915 60 -2.15112060 0.34245529 61 2.05358897 -2.15112060 62 1.08695261 2.05358897 63 2.33858579 1.08695261 64 -1.25072250 2.33858579 65 1.61050142 -1.25072250 66 -2.29540026 1.61050142 67 2.57670256 -2.29540026 68 1.98241895 2.57670256 69 -0.82162780 1.98241895 70 2.06165169 -0.82162780 71 1.02621245 2.06165169 72 -2.05750378 1.02621245 73 -3.13465937 -2.05750378 74 -0.24629106 -3.13465937 75 -1.46055649 -0.24629106 76 -0.81585098 -1.46055649 77 -0.12567040 -0.81585098 78 2.90136299 -0.12567040 79 -2.02152943 2.90136299 80 -2.46530619 -2.02152943 81 1.36971323 -2.46530619 82 -0.04344332 1.36971323 83 -0.99967099 -0.04344332 84 3.60423992 -0.99967099 85 -0.45526880 3.60423992 86 -0.09895259 -0.45526880 87 -0.38273359 -0.09895259 88 0.88736740 -0.38273359 89 -0.82713604 0.88736740 90 0.98505859 -0.82713604 91 -3.67435902 0.98505859 92 0.98105057 -3.67435902 93 1.67306147 0.98105057 94 0.50430862 1.67306147 95 0.70301568 0.50430862 96 -2.29755236 0.70301568 97 -0.48176532 -2.29755236 98 -1.55421352 -0.48176532 99 -0.01457641 -1.55421352 100 0.10428325 -0.01457641 101 0.81015464 0.10428325 102 -1.69440630 0.81015464 103 2.00599111 -1.69440630 104 -3.37063442 2.00599111 105 -0.69301706 -3.37063442 106 -1.56596582 -0.69301706 107 -1.25746386 -1.56596582 108 -2.01671378 -1.25746386 109 -2.46975003 -2.01671378 110 -0.96520980 -2.46975003 111 -1.19313822 -0.96520980 112 -0.01379818 -1.19313822 113 0.98028720 -0.01379818 114 0.59881626 0.98028720 115 2.64655670 0.59881626 116 3.12688819 2.64655670 117 -1.64720197 3.12688819 118 0.63693340 -1.64720197 119 3.00385049 0.63693340 120 0.44458568 3.00385049 121 0.94721013 0.44458568 122 -2.80650618 0.94721013 123 -1.27479802 -2.80650618 124 1.49134015 -1.27479802 125 1.43057192 1.49134015 126 0.15892812 1.43057192 127 -0.67963002 0.15892812 128 -0.26822600 -0.67963002 129 -1.69832608 -0.26822600 130 -0.07668110 -1.69832608 131 1.93610133 -0.07668110 132 -1.12358065 1.93610133 133 -1.27845537 -1.12358065 134 2.43589280 -1.27845537 135 1.82580825 2.43589280 136 1.15304570 1.82580825 137 -3.37750924 1.15304570 138 5.29464335 -3.37750924 139 -1.02276607 5.29464335 140 0.11782665 -1.02276607 141 -0.20701270 0.11782665 142 2.59238266 -0.20701270 143 -0.90462629 2.59238266 144 0.87887295 -0.90462629 145 -0.39117521 0.87887295 146 -3.26231222 -0.39117521 147 -4.27745052 -3.26231222 148 0.83909024 -4.27745052 149 2.03585222 0.83909024 150 -0.17996427 2.03585222 151 1.03092037 -0.17996427 152 -0.68624860 1.03092037 153 0.72146643 -0.68624860 154 0.66443140 0.72146643 155 2.03911872 0.66443140 156 NA 2.03911872 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] 0.94980238 1.79509733 [2,] 1.87153577 0.94980238 [3,] 0.54976103 1.87153577 [4,] -0.97192460 0.54976103 [5,] 2.63877668 -0.97192460 [6,] -1.92686083 2.63877668 [7,] -1.30940794 -1.92686083 [8,] -1.02099786 -1.30940794 [9,] 3.45663378 -1.02099786 [10,] -2.01494858 3.45663378 [11,] -1.18383172 -2.01494858 [12,] 2.70084073 -1.18383172 [13,] -4.48327347 2.70084073 [14,] -0.27816030 -4.48327347 [15,] 0.17792392 -0.27816030 [16,] -1.83473119 0.17792392 [17,] -0.86741282 -1.83473119 [18,] 1.43176030 -0.86741282 [19,] -3.34255000 1.43176030 [20,] 2.22067907 -3.34255000 [21,] 0.92623737 2.22067907 [22,] -0.58033883 0.92623737 [23,] 2.25839475 -0.58033883 [24,] 0.91566386 2.25839475 [25,] 0.47542513 0.91566386 [26,] -5.30873535 0.47542513 [27,] 0.51659678 -5.30873535 [28,] -0.45298795 0.51659678 [29,] 4.83054800 -0.45298795 [30,] 4.24837473 4.83054800 [31,] -1.62484908 4.24837473 [32,] -0.56978303 -1.62484908 [33,] 1.39209830 -0.56978303 [34,] -1.22813575 1.39209830 [35,] 1.81509285 -1.22813575 [36,] -1.15404134 1.81509285 [37,] 0.28692610 -1.15404134 [38,] -0.15454691 0.28692610 [39,] 0.77122638 -0.15454691 [40,] 0.88481507 0.77122638 [41,] 6.92941668 0.88481507 [42,] -4.71510529 6.92941668 [43,] -2.31343802 -4.71510529 [44,] -0.14870526 -2.31343802 [45,] 1.78249253 -0.14870526 [46,] 2.75246916 1.78249253 [47,] 0.97120603 2.75246916 [48,] -2.39958743 0.97120603 [49,] -1.81784166 -2.39958743 [50,] -0.88864535 -1.81784166 [51,] -5.99104422 -0.88864535 [52,] 0.15048096 -5.99104422 [53,] -2.43316644 0.15048096 [54,] 2.19089361 -2.43316644 [55,] -0.87611803 2.19089361 [56,] -0.10923356 -0.87611803 [57,] 1.82524294 -0.10923356 [58,] -2.27762915 1.82524294 [59,] 0.34245529 -2.27762915 [60,] -2.15112060 0.34245529 [61,] 2.05358897 -2.15112060 [62,] 1.08695261 2.05358897 [63,] 2.33858579 1.08695261 [64,] -1.25072250 2.33858579 [65,] 1.61050142 -1.25072250 [66,] -2.29540026 1.61050142 [67,] 2.57670256 -2.29540026 [68,] 1.98241895 2.57670256 [69,] -0.82162780 1.98241895 [70,] 2.06165169 -0.82162780 [71,] 1.02621245 2.06165169 [72,] -2.05750378 1.02621245 [73,] -3.13465937 -2.05750378 [74,] -0.24629106 -3.13465937 [75,] -1.46055649 -0.24629106 [76,] -0.81585098 -1.46055649 [77,] -0.12567040 -0.81585098 [78,] 2.90136299 -0.12567040 [79,] -2.02152943 2.90136299 [80,] -2.46530619 -2.02152943 [81,] 1.36971323 -2.46530619 [82,] -0.04344332 1.36971323 [83,] -0.99967099 -0.04344332 [84,] 3.60423992 -0.99967099 [85,] -0.45526880 3.60423992 [86,] -0.09895259 -0.45526880 [87,] -0.38273359 -0.09895259 [88,] 0.88736740 -0.38273359 [89,] -0.82713604 0.88736740 [90,] 0.98505859 -0.82713604 [91,] -3.67435902 0.98505859 [92,] 0.98105057 -3.67435902 [93,] 1.67306147 0.98105057 [94,] 0.50430862 1.67306147 [95,] 0.70301568 0.50430862 [96,] -2.29755236 0.70301568 [97,] -0.48176532 -2.29755236 [98,] -1.55421352 -0.48176532 [99,] -0.01457641 -1.55421352 [100,] 0.10428325 -0.01457641 [101,] 0.81015464 0.10428325 [102,] -1.69440630 0.81015464 [103,] 2.00599111 -1.69440630 [104,] -3.37063442 2.00599111 [105,] -0.69301706 -3.37063442 [106,] -1.56596582 -0.69301706 [107,] -1.25746386 -1.56596582 [108,] -2.01671378 -1.25746386 [109,] -2.46975003 -2.01671378 [110,] -0.96520980 -2.46975003 [111,] -1.19313822 -0.96520980 [112,] -0.01379818 -1.19313822 [113,] 0.98028720 -0.01379818 [114,] 0.59881626 0.98028720 [115,] 2.64655670 0.59881626 [116,] 3.12688819 2.64655670 [117,] -1.64720197 3.12688819 [118,] 0.63693340 -1.64720197 [119,] 3.00385049 0.63693340 [120,] 0.44458568 3.00385049 [121,] 0.94721013 0.44458568 [122,] -2.80650618 0.94721013 [123,] -1.27479802 -2.80650618 [124,] 1.49134015 -1.27479802 [125,] 1.43057192 1.49134015 [126,] 0.15892812 1.43057192 [127,] -0.67963002 0.15892812 [128,] -0.26822600 -0.67963002 [129,] -1.69832608 -0.26822600 [130,] -0.07668110 -1.69832608 [131,] 1.93610133 -0.07668110 [132,] -1.12358065 1.93610133 [133,] -1.27845537 -1.12358065 [134,] 2.43589280 -1.27845537 [135,] 1.82580825 2.43589280 [136,] 1.15304570 1.82580825 [137,] -3.37750924 1.15304570 [138,] 5.29464335 -3.37750924 [139,] -1.02276607 5.29464335 [140,] 0.11782665 -1.02276607 [141,] -0.20701270 0.11782665 [142,] 2.59238266 -0.20701270 [143,] -0.90462629 2.59238266 [144,] 0.87887295 -0.90462629 [145,] -0.39117521 0.87887295 [146,] -3.26231222 -0.39117521 [147,] -4.27745052 -3.26231222 [148,] 0.83909024 -4.27745052 [149,] 2.03585222 0.83909024 [150,] -0.17996427 2.03585222 [151,] 1.03092037 -0.17996427 [152,] -0.68624860 1.03092037 [153,] 0.72146643 -0.68624860 [154,] 0.66443140 0.72146643 [155,] 2.03911872 0.66443140 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 0.94980238 1.79509733 2 1.87153577 0.94980238 3 0.54976103 1.87153577 4 -0.97192460 0.54976103 5 2.63877668 -0.97192460 6 -1.92686083 2.63877668 7 -1.30940794 -1.92686083 8 -1.02099786 -1.30940794 9 3.45663378 -1.02099786 10 -2.01494858 3.45663378 11 -1.18383172 -2.01494858 12 2.70084073 -1.18383172 13 -4.48327347 2.70084073 14 -0.27816030 -4.48327347 15 0.17792392 -0.27816030 16 -1.83473119 0.17792392 17 -0.86741282 -1.83473119 18 1.43176030 -0.86741282 19 -3.34255000 1.43176030 20 2.22067907 -3.34255000 21 0.92623737 2.22067907 22 -0.58033883 0.92623737 23 2.25839475 -0.58033883 24 0.91566386 2.25839475 25 0.47542513 0.91566386 26 -5.30873535 0.47542513 27 0.51659678 -5.30873535 28 -0.45298795 0.51659678 29 4.83054800 -0.45298795 30 4.24837473 4.83054800 31 -1.62484908 4.24837473 32 -0.56978303 -1.62484908 33 1.39209830 -0.56978303 34 -1.22813575 1.39209830 35 1.81509285 -1.22813575 36 -1.15404134 1.81509285 37 0.28692610 -1.15404134 38 -0.15454691 0.28692610 39 0.77122638 -0.15454691 40 0.88481507 0.77122638 41 6.92941668 0.88481507 42 -4.71510529 6.92941668 43 -2.31343802 -4.71510529 44 -0.14870526 -2.31343802 45 1.78249253 -0.14870526 46 2.75246916 1.78249253 47 0.97120603 2.75246916 48 -2.39958743 0.97120603 49 -1.81784166 -2.39958743 50 -0.88864535 -1.81784166 51 -5.99104422 -0.88864535 52 0.15048096 -5.99104422 53 -2.43316644 0.15048096 54 2.19089361 -2.43316644 55 -0.87611803 2.19089361 56 -0.10923356 -0.87611803 57 1.82524294 -0.10923356 58 -2.27762915 1.82524294 59 0.34245529 -2.27762915 60 -2.15112060 0.34245529 61 2.05358897 -2.15112060 62 1.08695261 2.05358897 63 2.33858579 1.08695261 64 -1.25072250 2.33858579 65 1.61050142 -1.25072250 66 -2.29540026 1.61050142 67 2.57670256 -2.29540026 68 1.98241895 2.57670256 69 -0.82162780 1.98241895 70 2.06165169 -0.82162780 71 1.02621245 2.06165169 72 -2.05750378 1.02621245 73 -3.13465937 -2.05750378 74 -0.24629106 -3.13465937 75 -1.46055649 -0.24629106 76 -0.81585098 -1.46055649 77 -0.12567040 -0.81585098 78 2.90136299 -0.12567040 79 -2.02152943 2.90136299 80 -2.46530619 -2.02152943 81 1.36971323 -2.46530619 82 -0.04344332 1.36971323 83 -0.99967099 -0.04344332 84 3.60423992 -0.99967099 85 -0.45526880 3.60423992 86 -0.09895259 -0.45526880 87 -0.38273359 -0.09895259 88 0.88736740 -0.38273359 89 -0.82713604 0.88736740 90 0.98505859 -0.82713604 91 -3.67435902 0.98505859 92 0.98105057 -3.67435902 93 1.67306147 0.98105057 94 0.50430862 1.67306147 95 0.70301568 0.50430862 96 -2.29755236 0.70301568 97 -0.48176532 -2.29755236 98 -1.55421352 -0.48176532 99 -0.01457641 -1.55421352 100 0.10428325 -0.01457641 101 0.81015464 0.10428325 102 -1.69440630 0.81015464 103 2.00599111 -1.69440630 104 -3.37063442 2.00599111 105 -0.69301706 -3.37063442 106 -1.56596582 -0.69301706 107 -1.25746386 -1.56596582 108 -2.01671378 -1.25746386 109 -2.46975003 -2.01671378 110 -0.96520980 -2.46975003 111 -1.19313822 -0.96520980 112 -0.01379818 -1.19313822 113 0.98028720 -0.01379818 114 0.59881626 0.98028720 115 2.64655670 0.59881626 116 3.12688819 2.64655670 117 -1.64720197 3.12688819 118 0.63693340 -1.64720197 119 3.00385049 0.63693340 120 0.44458568 3.00385049 121 0.94721013 0.44458568 122 -2.80650618 0.94721013 123 -1.27479802 -2.80650618 124 1.49134015 -1.27479802 125 1.43057192 1.49134015 126 0.15892812 1.43057192 127 -0.67963002 0.15892812 128 -0.26822600 -0.67963002 129 -1.69832608 -0.26822600 130 -0.07668110 -1.69832608 131 1.93610133 -0.07668110 132 -1.12358065 1.93610133 133 -1.27845537 -1.12358065 134 2.43589280 -1.27845537 135 1.82580825 2.43589280 136 1.15304570 1.82580825 137 -3.37750924 1.15304570 138 5.29464335 -3.37750924 139 -1.02276607 5.29464335 140 0.11782665 -1.02276607 141 -0.20701270 0.11782665 142 2.59238266 -0.20701270 143 -0.90462629 2.59238266 144 0.87887295 -0.90462629 145 -0.39117521 0.87887295 146 -3.26231222 -0.39117521 147 -4.27745052 -3.26231222 148 0.83909024 -4.27745052 149 2.03585222 0.83909024 150 -0.17996427 2.03585222 151 1.03092037 -0.17996427 152 -0.68624860 1.03092037 153 0.72146643 -0.68624860 154 0.66443140 0.72146643 155 2.03911872 0.66443140 > 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/7crmv1321998735.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/www/rcomp/tmp/8jvmx1321998735.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/www/rcomp/tmp/9u8ck1321998735.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/www/rcomp/tmp/10rwqw1321998735.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/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/11vziy1321998735.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/1219201321998735.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/139w811321998735.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/14qc631321998735.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/153syn1321998735.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/16nlli1321998735.tab") + } > > try(system("convert tmp/1ezme1321998735.ps tmp/1ezme1321998735.png",intern=TRUE)) character(0) > try(system("convert tmp/2pij51321998735.ps tmp/2pij51321998735.png",intern=TRUE)) character(0) > try(system("convert tmp/35y8m1321998735.ps tmp/35y8m1321998735.png",intern=TRUE)) character(0) > try(system("convert tmp/422r41321998735.ps tmp/422r41321998735.png",intern=TRUE)) character(0) > try(system("convert tmp/5yzt81321998735.ps tmp/5yzt81321998735.png",intern=TRUE)) character(0) > try(system("convert tmp/6su341321998735.ps tmp/6su341321998735.png",intern=TRUE)) character(0) > try(system("convert tmp/7crmv1321998735.ps tmp/7crmv1321998735.png",intern=TRUE)) character(0) > try(system("convert tmp/8jvmx1321998735.ps tmp/8jvmx1321998735.png",intern=TRUE)) character(0) > try(system("convert tmp/9u8ck1321998735.ps tmp/9u8ck1321998735.png",intern=TRUE)) character(0) > try(system("convert tmp/10rwqw1321998735.ps tmp/10rwqw1321998735.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 6.070 0.400 6.455