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(1579,0,2146,0,2462,0,3695,0,4831,0,5134,0,6250,0,5760,0,6249,0,2917,0,1741,0,2359,0,1511,1,2059,0,2635,0,2867,0,4403,0,5720,0,4502,0,5749,0,5627,0,2846,0,1762,0,2429,0,1169,0,2154,1,2249,0,2687,0,4359,0,5382,0,4459,0,6398,0,4596,0,3024,0,1887,0,2070,0,1351,0,2218,0,2461,1,3028,0,4784,0,4975,0,4607,0,6249,0,4809,0,3157,0,1910,0,2228,0,1594,0,2467,0,2222,0,3607,1,4685,0,4962,0,5770,0,5480,0,5000,0,3228,0,1993,0,2288,0,1580,0,2111,0,2192,0,3601,0,4665,1,4876,0,5813,0,5589,0,5331,0,3075,0,2002,0,2306,0,1507,0,1992,0,2487,0,3490,0,4647,0,5594,1,5611,0,5788,0,6204,0,3013,0,1931,0,2549,0,1504,0,2090,0,2702,0,2939,0,4500,0,6208,0,6415,1,5657,0,5964,0,3163,0,1997,0,2422,0,1376,0,2202,0,2683,0,3303,0,5202,0,5231,0,4880,0,7998,1,4977,0,3531,0,2025,0,2205,0,1442,0,2238,0,2179,0,3218,0,5139,0,4990,0,4914,0,6084,0,5672,1,3548,0,1793,0,2086,0),dim=c(2,120),dimnames=list(c('Y','X'),1:120)) > y <- array(NA,dim=c(2,120),dimnames=list(c('Y','X'),1:120)) > 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 = 'Include Monthly 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 Y X M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t 1 1579 0 1 0 0 0 0 0 0 0 0 0 0 1 2 2146 0 0 1 0 0 0 0 0 0 0 0 0 2 3 2462 0 0 0 1 0 0 0 0 0 0 0 0 3 4 3695 0 0 0 0 1 0 0 0 0 0 0 0 4 5 4831 0 0 0 0 0 1 0 0 0 0 0 0 5 6 5134 0 0 0 0 0 0 1 0 0 0 0 0 6 7 6250 0 0 0 0 0 0 0 1 0 0 0 0 7 8 5760 0 0 0 0 0 0 0 0 1 0 0 0 8 9 6249 0 0 0 0 0 0 0 0 0 1 0 0 9 10 2917 0 0 0 0 0 0 0 0 0 0 1 0 10 11 1741 0 0 0 0 0 0 0 0 0 0 0 1 11 12 2359 0 0 0 0 0 0 0 0 0 0 0 0 12 13 1511 1 1 0 0 0 0 0 0 0 0 0 0 13 14 2059 0 0 1 0 0 0 0 0 0 0 0 0 14 15 2635 0 0 0 1 0 0 0 0 0 0 0 0 15 16 2867 0 0 0 0 1 0 0 0 0 0 0 0 16 17 4403 0 0 0 0 0 1 0 0 0 0 0 0 17 18 5720 0 0 0 0 0 0 1 0 0 0 0 0 18 19 4502 0 0 0 0 0 0 0 1 0 0 0 0 19 20 5749 0 0 0 0 0 0 0 0 1 0 0 0 20 21 5627 0 0 0 0 0 0 0 0 0 1 0 0 21 22 2846 0 0 0 0 0 0 0 0 0 0 1 0 22 23 1762 0 0 0 0 0 0 0 0 0 0 0 1 23 24 2429 0 0 0 0 0 0 0 0 0 0 0 0 24 25 1169 0 1 0 0 0 0 0 0 0 0 0 0 25 26 2154 1 0 1 0 0 0 0 0 0 0 0 0 26 27 2249 0 0 0 1 0 0 0 0 0 0 0 0 27 28 2687 0 0 0 0 1 0 0 0 0 0 0 0 28 29 4359 0 0 0 0 0 1 0 0 0 0 0 0 29 30 5382 0 0 0 0 0 0 1 0 0 0 0 0 30 31 4459 0 0 0 0 0 0 0 1 0 0 0 0 31 32 6398 0 0 0 0 0 0 0 0 1 0 0 0 32 33 4596 0 0 0 0 0 0 0 0 0 1 0 0 33 34 3024 0 0 0 0 0 0 0 0 0 0 1 0 34 35 1887 0 0 0 0 0 0 0 0 0 0 0 1 35 36 2070 0 0 0 0 0 0 0 0 0 0 0 0 36 37 1351 0 1 0 0 0 0 0 0 0 0 0 0 37 38 2218 0 0 1 0 0 0 0 0 0 0 0 0 38 39 2461 1 0 0 1 0 0 0 0 0 0 0 0 39 40 3028 0 0 0 0 1 0 0 0 0 0 0 0 40 41 4784 0 0 0 0 0 1 0 0 0 0 0 0 41 42 4975 0 0 0 0 0 0 1 0 0 0 0 0 42 43 4607 0 0 0 0 0 0 0 1 0 0 0 0 43 44 6249 0 0 0 0 0 0 0 0 1 0 0 0 44 45 4809 0 0 0 0 0 0 0 0 0 1 0 0 45 46 3157 0 0 0 0 0 0 0 0 0 0 1 0 46 47 1910 0 0 0 0 0 0 0 0 0 0 0 1 47 48 2228 0 0 0 0 0 0 0 0 0 0 0 0 48 49 1594 0 1 0 0 0 0 0 0 0 0 0 0 49 50 2467 0 0 1 0 0 0 0 0 0 0 0 0 50 51 2222 0 0 0 1 0 0 0 0 0 0 0 0 51 52 3607 1 0 0 0 1 0 0 0 0 0 0 0 52 53 4685 0 0 0 0 0 1 0 0 0 0 0 0 53 54 4962 0 0 0 0 0 0 1 0 0 0 0 0 54 55 5770 0 0 0 0 0 0 0 1 0 0 0 0 55 56 5480 0 0 0 0 0 0 0 0 1 0 0 0 56 57 5000 0 0 0 0 0 0 0 0 0 1 0 0 57 58 3228 0 0 0 0 0 0 0 0 0 0 1 0 58 59 1993 0 0 0 0 0 0 0 0 0 0 0 1 59 60 2288 0 0 0 0 0 0 0 0 0 0 0 0 60 61 1580 0 1 0 0 0 0 0 0 0 0 0 0 61 62 2111 0 0 1 0 0 0 0 0 0 0 0 0 62 63 2192 0 0 0 1 0 0 0 0 0 0 0 0 63 64 3601 0 0 0 0 1 0 0 0 0 0 0 0 64 65 4665 1 0 0 0 0 1 0 0 0 0 0 0 65 66 4876 0 0 0 0 0 0 1 0 0 0 0 0 66 67 5813 0 0 0 0 0 0 0 1 0 0 0 0 67 68 5589 0 0 0 0 0 0 0 0 1 0 0 0 68 69 5331 0 0 0 0 0 0 0 0 0 1 0 0 69 70 3075 0 0 0 0 0 0 0 0 0 0 1 0 70 71 2002 0 0 0 0 0 0 0 0 0 0 0 1 71 72 2306 0 0 0 0 0 0 0 0 0 0 0 0 72 73 1507 0 1 0 0 0 0 0 0 0 0 0 0 73 74 1992 0 0 1 0 0 0 0 0 0 0 0 0 74 75 2487 0 0 0 1 0 0 0 0 0 0 0 0 75 76 3490 0 0 0 0 1 0 0 0 0 0 0 0 76 77 4647 0 0 0 0 0 1 0 0 0 0 0 0 77 78 5594 1 0 0 0 0 0 1 0 0 0 0 0 78 79 5611 0 0 0 0 0 0 0 1 0 0 0 0 79 80 5788 0 0 0 0 0 0 0 0 1 0 0 0 80 81 6204 0 0 0 0 0 0 0 0 0 1 0 0 81 82 3013 0 0 0 0 0 0 0 0 0 0 1 0 82 83 1931 0 0 0 0 0 0 0 0 0 0 0 1 83 84 2549 0 0 0 0 0 0 0 0 0 0 0 0 84 85 1504 0 1 0 0 0 0 0 0 0 0 0 0 85 86 2090 0 0 1 0 0 0 0 0 0 0 0 0 86 87 2702 0 0 0 1 0 0 0 0 0 0 0 0 87 88 2939 0 0 0 0 1 0 0 0 0 0 0 0 88 89 4500 0 0 0 0 0 1 0 0 0 0 0 0 89 90 6208 0 0 0 0 0 0 1 0 0 0 0 0 90 91 6415 1 0 0 0 0 0 0 1 0 0 0 0 91 92 5657 0 0 0 0 0 0 0 0 1 0 0 0 92 93 5964 0 0 0 0 0 0 0 0 0 1 0 0 93 94 3163 0 0 0 0 0 0 0 0 0 0 1 0 94 95 1997 0 0 0 0 0 0 0 0 0 0 0 1 95 96 2422 0 0 0 0 0 0 0 0 0 0 0 0 96 97 1376 0 1 0 0 0 0 0 0 0 0 0 0 97 98 2202 0 0 1 0 0 0 0 0 0 0 0 0 98 99 2683 0 0 0 1 0 0 0 0 0 0 0 0 99 100 3303 0 0 0 0 1 0 0 0 0 0 0 0 100 101 5202 0 0 0 0 0 1 0 0 0 0 0 0 101 102 5231 0 0 0 0 0 0 1 0 0 0 0 0 102 103 4880 0 0 0 0 0 0 0 1 0 0 0 0 103 104 7998 1 0 0 0 0 0 0 0 1 0 0 0 104 105 4977 0 0 0 0 0 0 0 0 0 1 0 0 105 106 3531 0 0 0 0 0 0 0 0 0 0 1 0 106 107 2025 0 0 0 0 0 0 0 0 0 0 0 1 107 108 2205 0 0 0 0 0 0 0 0 0 0 0 0 108 109 1442 0 1 0 0 0 0 0 0 0 0 0 0 109 110 2238 0 0 1 0 0 0 0 0 0 0 0 0 110 111 2179 0 0 0 1 0 0 0 0 0 0 0 0 111 112 3218 0 0 0 0 1 0 0 0 0 0 0 0 112 113 5139 0 0 0 0 0 1 0 0 0 0 0 0 113 114 4990 0 0 0 0 0 0 1 0 0 0 0 0 114 115 4914 0 0 0 0 0 0 0 1 0 0 0 0 115 116 6084 0 0 0 0 0 0 0 0 1 0 0 0 116 117 5672 1 0 0 0 0 0 0 0 0 1 0 0 117 118 3548 0 0 0 0 0 0 0 0 0 0 1 0 118 119 1793 0 0 0 0 0 0 0 0 0 0 0 1 119 120 2086 0 0 0 0 0 0 0 0 0 0 0 0 120 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) X M1 M2 M3 M4 2187.301 471.721 -862.256 -157.475 100.405 915.085 M5 M6 M7 M8 M9 M10 2391.466 2975.546 2988.826 3740.307 3106.387 859.239 M11 t -388.480 1.620 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -767.34 -213.98 -34.88 175.32 1430.22 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 2187.301 138.566 15.785 < 2e-16 *** X 471.721 134.877 3.497 0.000688 *** M1 -862.256 172.390 -5.002 2.26e-06 *** M2 -157.475 172.323 -0.914 0.362877 M3 100.405 172.262 0.583 0.561225 M4 915.085 172.207 5.314 5.98e-07 *** M5 2391.466 172.158 13.891 < 2e-16 *** M6 2975.546 172.115 17.288 < 2e-16 *** M7 2988.826 172.078 17.369 < 2e-16 *** M8 3740.307 172.047 21.740 < 2e-16 *** M9 3106.387 172.022 18.058 < 2e-16 *** M10 859.239 171.466 5.011 2.18e-06 *** M11 -388.480 171.457 -2.266 0.025498 * t 1.620 1.017 1.593 0.114112 --- Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 Residual standard error: 383.4 on 106 degrees of freedom Multiple R-squared: 0.9503, Adjusted R-squared: 0.9442 F-statistic: 155.9 on 13 and 106 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.4430246 0.886049153 0.556975424 [2,] 0.6489999 0.702000298 0.351000149 [3,] 0.9700142 0.059971587 0.029985794 [4,] 0.9525852 0.094829662 0.047414831 [5,] 0.9331170 0.133765978 0.066882989 [6,] 0.9025211 0.194957743 0.097478871 [7,] 0.8685980 0.262803991 0.131401996 [8,] 0.8372525 0.325494975 0.162747488 [9,] 0.7778063 0.444387459 0.222193730 [10,] 0.7299192 0.540161681 0.270080840 [11,] 0.6555706 0.688858808 0.344429404 [12,] 0.6031227 0.793754517 0.396877258 [13,] 0.5293024 0.941395154 0.470697577 [14,] 0.4896208 0.979241526 0.510379237 [15,] 0.5556421 0.888715887 0.444357944 [16,] 0.7529634 0.494073268 0.247036634 [17,] 0.8810162 0.237967508 0.118983754 [18,] 0.8725819 0.254836235 0.127418117 [19,] 0.8587881 0.282423800 0.141211900 [20,] 0.8173269 0.365346171 0.182673085 [21,] 0.7937867 0.412426578 0.206213289 [22,] 0.7830900 0.433819996 0.216909998 [23,] 0.7584545 0.483090932 0.241545466 [24,] 0.7153910 0.569218051 0.284609026 [25,] 0.7105549 0.578890287 0.289445144 [26,] 0.6619424 0.676115277 0.338057639 [27,] 0.6756364 0.648727288 0.324363644 [28,] 0.6835403 0.632919400 0.316459700 [29,] 0.6944498 0.611100379 0.305550189 [30,] 0.6775314 0.644937150 0.322468575 [31,] 0.6401266 0.719746756 0.359873378 [32,] 0.5851095 0.829781069 0.414890534 [33,] 0.5684748 0.863050407 0.431525203 [34,] 0.5842718 0.831456349 0.415728174 [35,] 0.5277215 0.944556903 0.472278451 [36,] 0.5439740 0.912051945 0.456025973 [37,] 0.4938233 0.987646641 0.506176679 [38,] 0.4481248 0.896249561 0.551875220 [39,] 0.5657745 0.868451062 0.434225531 [40,] 0.5817728 0.836454454 0.418227227 [41,] 0.5598882 0.880223523 0.440111761 [42,] 0.5208872 0.958225526 0.479112763 [43,] 0.4735649 0.947129874 0.526435063 [44,] 0.4166517 0.833303366 0.583348317 [45,] 0.3741026 0.748205241 0.625897379 [46,] 0.3193449 0.638689799 0.680655100 [47,] 0.2800552 0.560110405 0.719944797 [48,] 0.2870117 0.574023333 0.712988333 [49,] 0.3749946 0.749989180 0.625005410 [50,] 0.3608570 0.721714089 0.639142956 [51,] 0.4375488 0.875097667 0.562451166 [52,] 0.4536674 0.907334896 0.546332552 [53,] 0.4046509 0.809301897 0.595349052 [54,] 0.3653599 0.730719886 0.634640057 [55,] 0.3143176 0.628635261 0.685682369 [56,] 0.2643447 0.528689316 0.735655342 [57,] 0.2179283 0.435856645 0.782071677 [58,] 0.1853379 0.370675792 0.814662104 [59,] 0.1512382 0.302476440 0.848761780 [60,] 0.1294742 0.258948435 0.870525782 [61,] 0.1124702 0.224940381 0.887529810 [62,] 0.2116069 0.423213833 0.788393084 [63,] 0.2087915 0.417583056 0.791208472 [64,] 0.2152460 0.430491997 0.784754002 [65,] 0.4226030 0.845205902 0.577397049 [66,] 0.4368593 0.873718600 0.563140700 [67,] 0.3811553 0.762310596 0.618844702 [68,] 0.3263957 0.652791474 0.673604263 [69,] 0.2667710 0.533542065 0.733228968 [70,] 0.2272814 0.454562882 0.772718559 [71,] 0.1853599 0.370719714 0.814640143 [72,] 0.1869523 0.373904605 0.813047698 [73,] 0.3016789 0.603357873 0.698321063 [74,] 0.5336512 0.932697691 0.466348846 [75,] 0.5140028 0.971994319 0.485997159 [76,] 0.8174063 0.365187409 0.182593704 [77,] 0.9847695 0.030460951 0.015230476 [78,] 0.9966254 0.006749238 0.003374619 [79,] 0.9942922 0.011415629 0.005707814 [80,] 0.9876674 0.024665294 0.012332647 [81,] 0.9827501 0.034499710 0.017249855 [82,] 0.9752652 0.049469599 0.024734800 [83,] 0.9661598 0.067680455 0.033840228 [84,] 0.9354732 0.129053512 0.064526756 [85,] 0.8922769 0.215446236 0.107723118 [86,] 0.7950499 0.409900117 0.204950059 [87,] 0.7386031 0.522793753 0.261396876 > postscript(file="/var/www/html/freestat/rcomp/tmp/19lii1290867543.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/29lii1290867543.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/39lii1290867543.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/4jvz31290867543.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/5jvz31290867543.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 = 120 Frequency = 1 1 2 3 4 5 6 252.334599 112.934599 169.434599 586.134599 244.134599 -38.565401 7 8 9 10 11 12 1062.534599 -180.565401 940.734599 -145.737468 -75.637468 152.262532 13 14 15 16 17 18 -306.822194 6.498481 322.998481 -261.301519 -203.301519 527.998481 19 20 21 22 23 24 -704.901519 -211.001519 299.298481 -236.173586 -74.073586 202.826414 25 26 27 28 29 30 -196.537637 -389.658312 -82.437637 -460.737637 -266.737637 170.562363 31 32 33 34 35 36 -767.337637 418.562363 -751.137637 -77.609705 31.490295 -175.609705 37 38 39 40 41 42 -33.973755 126.626245 -361.594430 -139.173755 138.826245 -255.873755 43 44 45 46 47 48 -638.773755 250.126245 -557.573755 35.954177 35.054177 -37.045823 49 50 51 52 53 54 189.590127 356.190127 -148.309873 -51.330549 20.390127 -288.309873 55 56 57 58 59 60 504.790127 -538.309873 -386.009873 87.518059 98.618059 3.518059 61 62 63 64 65 66 156.154008 -19.245992 -197.745992 394.954008 -490.766667 -393.745992 67 68 69 70 71 72 528.354008 -448.745992 -74.445992 -84.918059 88.181941 2.081941 73 74 75 76 77 78 63.717890 -157.682110 77.817890 264.517890 -56.482110 -166.902785 79 80 81 82 83 84 306.917890 -269.182110 779.117890 -166.354177 -2.254177 225.645823 85 86 87 88 89 90 41.281772 -79.118228 273.381772 -305.918228 -222.918228 899.381772 91 92 93 94 95 96 619.761097 -419.618228 519.681772 -35.790295 44.309705 79.209705 97 98 99 100 101 102 -106.154346 13.445654 234.945654 38.645654 459.645654 -97.054346 103 104 105 106 107 108 -462.954346 1430.224979 -486.754346 312.773586 52.873586 -157.226414 109 110 111 112 113 114 -59.590464 30.009536 -288.490464 -65.790464 377.209536 -357.490464 115 116 117 118 119 120 -448.390464 -31.490464 -282.911139 310.337468 -198.562532 -295.662532 > postscript(file="/var/www/html/freestat/rcomp/tmp/6c4y51290867543.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 = 120 Frequency = 1 lag(myerror, k = 1) myerror 0 252.334599 NA 1 112.934599 252.334599 2 169.434599 112.934599 3 586.134599 169.434599 4 244.134599 586.134599 5 -38.565401 244.134599 6 1062.534599 -38.565401 7 -180.565401 1062.534599 8 940.734599 -180.565401 9 -145.737468 940.734599 10 -75.637468 -145.737468 11 152.262532 -75.637468 12 -306.822194 152.262532 13 6.498481 -306.822194 14 322.998481 6.498481 15 -261.301519 322.998481 16 -203.301519 -261.301519 17 527.998481 -203.301519 18 -704.901519 527.998481 19 -211.001519 -704.901519 20 299.298481 -211.001519 21 -236.173586 299.298481 22 -74.073586 -236.173586 23 202.826414 -74.073586 24 -196.537637 202.826414 25 -389.658312 -196.537637 26 -82.437637 -389.658312 27 -460.737637 -82.437637 28 -266.737637 -460.737637 29 170.562363 -266.737637 30 -767.337637 170.562363 31 418.562363 -767.337637 32 -751.137637 418.562363 33 -77.609705 -751.137637 34 31.490295 -77.609705 35 -175.609705 31.490295 36 -33.973755 -175.609705 37 126.626245 -33.973755 38 -361.594430 126.626245 39 -139.173755 -361.594430 40 138.826245 -139.173755 41 -255.873755 138.826245 42 -638.773755 -255.873755 43 250.126245 -638.773755 44 -557.573755 250.126245 45 35.954177 -557.573755 46 35.054177 35.954177 47 -37.045823 35.054177 48 189.590127 -37.045823 49 356.190127 189.590127 50 -148.309873 356.190127 51 -51.330549 -148.309873 52 20.390127 -51.330549 53 -288.309873 20.390127 54 504.790127 -288.309873 55 -538.309873 504.790127 56 -386.009873 -538.309873 57 87.518059 -386.009873 58 98.618059 87.518059 59 3.518059 98.618059 60 156.154008 3.518059 61 -19.245992 156.154008 62 -197.745992 -19.245992 63 394.954008 -197.745992 64 -490.766667 394.954008 65 -393.745992 -490.766667 66 528.354008 -393.745992 67 -448.745992 528.354008 68 -74.445992 -448.745992 69 -84.918059 -74.445992 70 88.181941 -84.918059 71 2.081941 88.181941 72 63.717890 2.081941 73 -157.682110 63.717890 74 77.817890 -157.682110 75 264.517890 77.817890 76 -56.482110 264.517890 77 -166.902785 -56.482110 78 306.917890 -166.902785 79 -269.182110 306.917890 80 779.117890 -269.182110 81 -166.354177 779.117890 82 -2.254177 -166.354177 83 225.645823 -2.254177 84 41.281772 225.645823 85 -79.118228 41.281772 86 273.381772 -79.118228 87 -305.918228 273.381772 88 -222.918228 -305.918228 89 899.381772 -222.918228 90 619.761097 899.381772 91 -419.618228 619.761097 92 519.681772 -419.618228 93 -35.790295 519.681772 94 44.309705 -35.790295 95 79.209705 44.309705 96 -106.154346 79.209705 97 13.445654 -106.154346 98 234.945654 13.445654 99 38.645654 234.945654 100 459.645654 38.645654 101 -97.054346 459.645654 102 -462.954346 -97.054346 103 1430.224979 -462.954346 104 -486.754346 1430.224979 105 312.773586 -486.754346 106 52.873586 312.773586 107 -157.226414 52.873586 108 -59.590464 -157.226414 109 30.009536 -59.590464 110 -288.490464 30.009536 111 -65.790464 -288.490464 112 377.209536 -65.790464 113 -357.490464 377.209536 114 -448.390464 -357.490464 115 -31.490464 -448.390464 116 -282.911139 -31.490464 117 310.337468 -282.911139 118 -198.562532 310.337468 119 -295.662532 -198.562532 120 NA -295.662532 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] 112.934599 252.334599 [2,] 169.434599 112.934599 [3,] 586.134599 169.434599 [4,] 244.134599 586.134599 [5,] -38.565401 244.134599 [6,] 1062.534599 -38.565401 [7,] -180.565401 1062.534599 [8,] 940.734599 -180.565401 [9,] -145.737468 940.734599 [10,] -75.637468 -145.737468 [11,] 152.262532 -75.637468 [12,] -306.822194 152.262532 [13,] 6.498481 -306.822194 [14,] 322.998481 6.498481 [15,] -261.301519 322.998481 [16,] -203.301519 -261.301519 [17,] 527.998481 -203.301519 [18,] -704.901519 527.998481 [19,] -211.001519 -704.901519 [20,] 299.298481 -211.001519 [21,] -236.173586 299.298481 [22,] -74.073586 -236.173586 [23,] 202.826414 -74.073586 [24,] -196.537637 202.826414 [25,] -389.658312 -196.537637 [26,] -82.437637 -389.658312 [27,] -460.737637 -82.437637 [28,] -266.737637 -460.737637 [29,] 170.562363 -266.737637 [30,] -767.337637 170.562363 [31,] 418.562363 -767.337637 [32,] -751.137637 418.562363 [33,] -77.609705 -751.137637 [34,] 31.490295 -77.609705 [35,] -175.609705 31.490295 [36,] -33.973755 -175.609705 [37,] 126.626245 -33.973755 [38,] -361.594430 126.626245 [39,] -139.173755 -361.594430 [40,] 138.826245 -139.173755 [41,] -255.873755 138.826245 [42,] -638.773755 -255.873755 [43,] 250.126245 -638.773755 [44,] -557.573755 250.126245 [45,] 35.954177 -557.573755 [46,] 35.054177 35.954177 [47,] -37.045823 35.054177 [48,] 189.590127 -37.045823 [49,] 356.190127 189.590127 [50,] -148.309873 356.190127 [51,] -51.330549 -148.309873 [52,] 20.390127 -51.330549 [53,] -288.309873 20.390127 [54,] 504.790127 -288.309873 [55,] -538.309873 504.790127 [56,] -386.009873 -538.309873 [57,] 87.518059 -386.009873 [58,] 98.618059 87.518059 [59,] 3.518059 98.618059 [60,] 156.154008 3.518059 [61,] -19.245992 156.154008 [62,] -197.745992 -19.245992 [63,] 394.954008 -197.745992 [64,] -490.766667 394.954008 [65,] -393.745992 -490.766667 [66,] 528.354008 -393.745992 [67,] -448.745992 528.354008 [68,] -74.445992 -448.745992 [69,] -84.918059 -74.445992 [70,] 88.181941 -84.918059 [71,] 2.081941 88.181941 [72,] 63.717890 2.081941 [73,] -157.682110 63.717890 [74,] 77.817890 -157.682110 [75,] 264.517890 77.817890 [76,] -56.482110 264.517890 [77,] -166.902785 -56.482110 [78,] 306.917890 -166.902785 [79,] -269.182110 306.917890 [80,] 779.117890 -269.182110 [81,] -166.354177 779.117890 [82,] -2.254177 -166.354177 [83,] 225.645823 -2.254177 [84,] 41.281772 225.645823 [85,] -79.118228 41.281772 [86,] 273.381772 -79.118228 [87,] -305.918228 273.381772 [88,] -222.918228 -305.918228 [89,] 899.381772 -222.918228 [90,] 619.761097 899.381772 [91,] -419.618228 619.761097 [92,] 519.681772 -419.618228 [93,] -35.790295 519.681772 [94,] 44.309705 -35.790295 [95,] 79.209705 44.309705 [96,] -106.154346 79.209705 [97,] 13.445654 -106.154346 [98,] 234.945654 13.445654 [99,] 38.645654 234.945654 [100,] 459.645654 38.645654 [101,] -97.054346 459.645654 [102,] -462.954346 -97.054346 [103,] 1430.224979 -462.954346 [104,] -486.754346 1430.224979 [105,] 312.773586 -486.754346 [106,] 52.873586 312.773586 [107,] -157.226414 52.873586 [108,] -59.590464 -157.226414 [109,] 30.009536 -59.590464 [110,] -288.490464 30.009536 [111,] -65.790464 -288.490464 [112,] 377.209536 -65.790464 [113,] -357.490464 377.209536 [114,] -448.390464 -357.490464 [115,] -31.490464 -448.390464 [116,] -282.911139 -31.490464 [117,] 310.337468 -282.911139 [118,] -198.562532 310.337468 [119,] -295.662532 -198.562532 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 112.934599 252.334599 2 169.434599 112.934599 3 586.134599 169.434599 4 244.134599 586.134599 5 -38.565401 244.134599 6 1062.534599 -38.565401 7 -180.565401 1062.534599 8 940.734599 -180.565401 9 -145.737468 940.734599 10 -75.637468 -145.737468 11 152.262532 -75.637468 12 -306.822194 152.262532 13 6.498481 -306.822194 14 322.998481 6.498481 15 -261.301519 322.998481 16 -203.301519 -261.301519 17 527.998481 -203.301519 18 -704.901519 527.998481 19 -211.001519 -704.901519 20 299.298481 -211.001519 21 -236.173586 299.298481 22 -74.073586 -236.173586 23 202.826414 -74.073586 24 -196.537637 202.826414 25 -389.658312 -196.537637 26 -82.437637 -389.658312 27 -460.737637 -82.437637 28 -266.737637 -460.737637 29 170.562363 -266.737637 30 -767.337637 170.562363 31 418.562363 -767.337637 32 -751.137637 418.562363 33 -77.609705 -751.137637 34 31.490295 -77.609705 35 -175.609705 31.490295 36 -33.973755 -175.609705 37 126.626245 -33.973755 38 -361.594430 126.626245 39 -139.173755 -361.594430 40 138.826245 -139.173755 41 -255.873755 138.826245 42 -638.773755 -255.873755 43 250.126245 -638.773755 44 -557.573755 250.126245 45 35.954177 -557.573755 46 35.054177 35.954177 47 -37.045823 35.054177 48 189.590127 -37.045823 49 356.190127 189.590127 50 -148.309873 356.190127 51 -51.330549 -148.309873 52 20.390127 -51.330549 53 -288.309873 20.390127 54 504.790127 -288.309873 55 -538.309873 504.790127 56 -386.009873 -538.309873 57 87.518059 -386.009873 58 98.618059 87.518059 59 3.518059 98.618059 60 156.154008 3.518059 61 -19.245992 156.154008 62 -197.745992 -19.245992 63 394.954008 -197.745992 64 -490.766667 394.954008 65 -393.745992 -490.766667 66 528.354008 -393.745992 67 -448.745992 528.354008 68 -74.445992 -448.745992 69 -84.918059 -74.445992 70 88.181941 -84.918059 71 2.081941 88.181941 72 63.717890 2.081941 73 -157.682110 63.717890 74 77.817890 -157.682110 75 264.517890 77.817890 76 -56.482110 264.517890 77 -166.902785 -56.482110 78 306.917890 -166.902785 79 -269.182110 306.917890 80 779.117890 -269.182110 81 -166.354177 779.117890 82 -2.254177 -166.354177 83 225.645823 -2.254177 84 41.281772 225.645823 85 -79.118228 41.281772 86 273.381772 -79.118228 87 -305.918228 273.381772 88 -222.918228 -305.918228 89 899.381772 -222.918228 90 619.761097 899.381772 91 -419.618228 619.761097 92 519.681772 -419.618228 93 -35.790295 519.681772 94 44.309705 -35.790295 95 79.209705 44.309705 96 -106.154346 79.209705 97 13.445654 -106.154346 98 234.945654 13.445654 99 38.645654 234.945654 100 459.645654 38.645654 101 -97.054346 459.645654 102 -462.954346 -97.054346 103 1430.224979 -462.954346 104 -486.754346 1430.224979 105 312.773586 -486.754346 106 52.873586 312.773586 107 -157.226414 52.873586 108 -59.590464 -157.226414 109 30.009536 -59.590464 110 -288.490464 30.009536 111 -65.790464 -288.490464 112 377.209536 -65.790464 113 -357.490464 377.209536 114 -448.390464 -357.490464 115 -31.490464 -448.390464 116 -282.911139 -31.490464 117 310.337468 -282.911139 118 -198.562532 310.337468 119 -295.662532 -198.562532 > 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/7c4y51290867543.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/85dfq1290867543.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/95dfq1290867543.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/10xmxt1290867543.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/1115vz1290867543.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/12m5un1290867543.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/13if9w1290867543.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/14myqk1290867543.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/15pgo81290867543.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/16bz5v1290867543.tab") + } > > try(system("convert tmp/19lii1290867543.ps tmp/19lii1290867543.png",intern=TRUE)) character(0) > try(system("convert tmp/29lii1290867543.ps tmp/29lii1290867543.png",intern=TRUE)) character(0) > try(system("convert tmp/39lii1290867543.ps tmp/39lii1290867543.png",intern=TRUE)) character(0) > try(system("convert tmp/4jvz31290867543.ps tmp/4jvz31290867543.png",intern=TRUE)) character(0) > try(system("convert tmp/5jvz31290867543.ps tmp/5jvz31290867543.png",intern=TRUE)) character(0) > try(system("convert tmp/6c4y51290867543.ps tmp/6c4y51290867543.png",intern=TRUE)) character(0) > try(system("convert tmp/7c4y51290867543.ps tmp/7c4y51290867543.png",intern=TRUE)) character(0) > try(system("convert tmp/85dfq1290867543.ps tmp/85dfq1290867543.png",intern=TRUE)) character(0) > try(system("convert tmp/95dfq1290867543.ps tmp/95dfq1290867543.png",intern=TRUE)) character(0) > try(system("convert tmp/10xmxt1290867543.ps tmp/10xmxt1290867543.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 5.022 2.711 5.534