R version 2.9.0 (2009-04-17) Copyright (C) 2009 The R Foundation for Statistical Computing ISBN 3-900051-07-0 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > x <- array(list(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 = 'No Linear Trend' > par2 = 'Do not include Seasonal Dummies' > par1 = '1' > #'GNU S' R Code compiled by R2WASP v. 1.0.44 () > #Author: Prof. Dr. P. Wessa > #To cite this work: AUTHOR(S), (YEAR), YOUR SOFTWARE TITLE (vNUMBER) in Free Statistics Software (v$_version), Office for Research Development and Education, URL http://www.wessa.net/rwasp_YOURPAGE.wasp/ > #Source of accompanying publication: Office for Research, Development, and Education > #Technical description: Write here your technical program description (don't use hard returns!) > library(lattice) > library(lmtest) Loading required package: zoo Attaching package: 'zoo' The following object(s) are masked from package:base : as.Date.numeric > n25 <- 25 #minimum number of obs. for Goldfeld-Quandt test > par1 <- as.numeric(par1) > x <- t(y) > k <- length(x[1,]) > n <- length(x[,1]) > x1 <- cbind(x[,par1], x[,1:k!=par1]) > mycolnames <- c(colnames(x)[par1], colnames(x)[1:k!=par1]) > colnames(x1) <- mycolnames #colnames(x)[par1] > x <- x1 > if (par3 == 'First Differences'){ + x2 <- array(0, dim=c(n-1,k), dimnames=list(1:(n-1), paste('(1-B)',colnames(x),sep=''))) + for (i in 1:n-1) { + for (j in 1:k) { + x2[i,j] <- x[i+1,j] - x[i,j] + } + } + x <- x2 + } > if (par2 == 'Include Monthly Dummies'){ + x2 <- array(0, dim=c(n,11), dimnames=list(1:n, paste('M', seq(1:11), sep =''))) + for (i in 1:11){ + x2[seq(i,n,12),i] <- 1 + } + x <- cbind(x, x2) + } > if (par2 == 'Include Quarterly Dummies'){ + x2 <- array(0, dim=c(n,3), dimnames=list(1:n, paste('Q', seq(1:3), sep =''))) + for (i in 1:3){ + x2[seq(i,n,4),i] <- 1 + } + x <- cbind(x, x2) + } > k <- length(x[1,]) > if (par3 == 'Linear Trend'){ + x <- cbind(x, c(1:n)) + colnames(x)[k+1] <- 't' + } > x Y X 1 1579 0 2 2146 0 3 2462 0 4 3695 0 5 4831 0 6 5134 0 7 6250 0 8 5760 0 9 6249 0 10 2917 0 11 1741 0 12 2359 0 13 1511 1 14 2059 0 15 2635 0 16 2867 0 17 4403 0 18 5720 0 19 4502 0 20 5749 0 21 5627 0 22 2846 0 23 1762 0 24 2429 0 25 1169 0 26 2154 1 27 2249 0 28 2687 0 29 4359 0 30 5382 0 31 4459 0 32 6398 0 33 4596 0 34 3024 0 35 1887 0 36 2070 0 37 1351 0 38 2218 0 39 2461 1 40 3028 0 41 4784 0 42 4975 0 43 4607 0 44 6249 0 45 4809 0 46 3157 0 47 1910 0 48 2228 0 49 1594 0 50 2467 0 51 2222 0 52 3607 1 53 4685 0 54 4962 0 55 5770 0 56 5480 0 57 5000 0 58 3228 0 59 1993 0 60 2288 0 61 1580 0 62 2111 0 63 2192 0 64 3601 0 65 4665 1 66 4876 0 67 5813 0 68 5589 0 69 5331 0 70 3075 0 71 2002 0 72 2306 0 73 1507 0 74 1992 0 75 2487 0 76 3490 0 77 4647 0 78 5594 1 79 5611 0 80 5788 0 81 6204 0 82 3013 0 83 1931 0 84 2549 0 85 1504 0 86 2090 0 87 2702 0 88 2939 0 89 4500 0 90 6208 0 91 6415 1 92 5657 0 93 5964 0 94 3163 0 95 1997 0 96 2422 0 97 1376 0 98 2202 0 99 2683 0 100 3303 0 101 5202 0 102 5231 0 103 4880 0 104 7998 1 105 4977 0 106 3531 0 107 2025 0 108 2205 0 109 1442 0 110 2238 0 111 2179 0 112 3218 0 113 5139 0 114 4990 0 115 4914 0 116 6084 0 117 5672 1 118 3548 0 119 1793 0 120 2086 0 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) X 3559.4 893.6 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -2942.0 -1370.7 -443.4 1416.1 3545.0 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 3559.4 153.1 23.256 <2e-16 *** X 893.6 558.9 1.599 0.113 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 1613 on 118 degrees of freedom Multiple R-squared: 0.02121, Adjusted R-squared: 0.01291 F-statistic: 2.557 on 1 and 118 DF, p-value: 0.1125 > 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.5393774 0.9212453 0.4606226 [2,] 0.6042868 0.7914263 0.3957132 [3,] 0.7728707 0.4542586 0.2271293 [4,] 0.7852053 0.4295894 0.2147947 [5,] 0.8228507 0.3542986 0.1771493 [6,] 0.7833802 0.4332397 0.2166198 [7,] 0.8213717 0.3572567 0.1786283 [8,] 0.7994928 0.4010144 0.2005072 [9,] 0.7578599 0.4842801 0.2421401 [10,] 0.7511083 0.4977834 0.2488917 [11,] 0.7034644 0.5930712 0.2965356 [12,] 0.6414744 0.7170512 0.3585256 [13,] 0.5857619 0.8284762 0.4142381 [14,] 0.6334934 0.7330131 0.3665066 [15,] 0.5786723 0.8426554 0.4213277 [16,] 0.6150754 0.7698492 0.3849246 [17,] 0.6309274 0.7381452 0.3690726 [18,] 0.5887004 0.8225992 0.4112996 [19,] 0.6239289 0.7521423 0.3760711 [20,] 0.5990956 0.8018087 0.4009044 [21,] 0.6791165 0.6417671 0.3208835 [22,] 0.6638568 0.6722864 0.3361432 [23,] 0.6449326 0.7101348 0.3550674 [24,] 0.6019685 0.7960630 0.3980315 [25,] 0.5560805 0.8878391 0.4439195 [26,] 0.5724098 0.8551803 0.4275902 [27,] 0.5286918 0.9426164 0.4713082 [28,] 0.6439407 0.7121186 0.3560593 [29,] 0.6059896 0.7880207 0.3940104 [30,] 0.5583216 0.8833569 0.4416784 [31,] 0.5721427 0.8557145 0.4278573 [32,] 0.5693327 0.8613346 0.4306673 [33,] 0.6230772 0.7538456 0.3769228 [34,] 0.6069130 0.7861741 0.3930870 [35,] 0.6187764 0.7624473 0.3812236 [36,] 0.5700883 0.8598233 0.4299117 [37,] 0.5487735 0.9024530 0.4512265 [38,] 0.5378990 0.9242019 0.4621010 [39,] 0.5062921 0.9874157 0.4937079 [40,] 0.6072469 0.7855062 0.3927531 [41,] 0.5852446 0.8295108 0.4147554 [42,] 0.5363963 0.9272073 0.4636037 [43,] 0.5459107 0.9081785 0.4540893 [44,] 0.5328715 0.9342569 0.4671285 [45,] 0.5648427 0.8703146 0.4351573 [46,] 0.5377121 0.9245758 0.4622879 [47,] 0.5231179 0.9537641 0.4768821 [48,] 0.5402513 0.9194974 0.4597487 [49,] 0.5151040 0.9697920 0.4848960 [50,] 0.5050348 0.9899304 0.4949652 [51,] 0.5581762 0.8836477 0.4418238 [52,] 0.5848686 0.8302628 0.4151314 [53,] 0.5773410 0.8453181 0.4226590 [54,] 0.5278471 0.9443057 0.4721529 [55,] 0.5292950 0.9414100 0.4707050 [56,] 0.5120356 0.9759289 0.4879644 [57,] 0.5446351 0.9107298 0.4553649 [58,] 0.5376110 0.9247780 0.4623890 [59,] 0.5257269 0.9485461 0.4742731 [60,] 0.4729462 0.9458924 0.5270538 [61,] 0.4891066 0.9782132 0.5108934 [62,] 0.4737957 0.9475914 0.5262043 [63,] 0.5321354 0.9357291 0.4678646 [64,] 0.5707753 0.8584493 0.4292247 [65,] 0.5892117 0.8215765 0.4107883 [66,] 0.5409990 0.9180021 0.4590010 [67,] 0.5389521 0.9220957 0.4610479 [68,] 0.5186192 0.9627616 0.4813808 [69,] 0.5568746 0.8862509 0.4431254 [70,] 0.5575721 0.8848557 0.4424279 [71,] 0.5296314 0.9407372 0.4703686 [72,] 0.4750564 0.9501129 0.5249436 [73,] 0.4461937 0.8923875 0.5538063 [74,] 0.4528615 0.9057230 0.5471385 [75,] 0.4917888 0.9835776 0.5082112 [76,] 0.5519723 0.8960554 0.4480277 [77,] 0.6632536 0.6734928 0.3367464 [78,] 0.6142905 0.7714189 0.3857095 [79,] 0.6136309 0.7727383 0.3863691 [80,] 0.5780631 0.8438737 0.4219369 [81,] 0.6162124 0.7675753 0.3837876 [82,] 0.6095121 0.7809758 0.3904879 [83,] 0.5695834 0.8608331 0.4304166 [84,] 0.5202148 0.9595704 0.4797852 [85,] 0.4796024 0.9592047 0.5203976 [86,] 0.5942482 0.8115037 0.4057518 [87,] 0.5801998 0.8396004 0.4198002 [88,] 0.6354868 0.7290264 0.3645132 [89,] 0.7333799 0.5332402 0.2666201 [90,] 0.6776321 0.6447358 0.3223679 [91,] 0.6662555 0.6674890 0.3337445 [92,] 0.6296013 0.7407973 0.3703987 [93,] 0.6830921 0.6338158 0.3169079 [94,] 0.6674714 0.6650572 0.3325286 [95,] 0.6232807 0.7534386 0.3767193 [96,] 0.5546725 0.8906550 0.4453275 [97,] 0.5570151 0.8859699 0.4429849 [98,] 0.5710504 0.8578991 0.4289496 [99,] 0.5593702 0.8812597 0.4406298 [100,] 0.6116985 0.7766030 0.3883015 [101,] 0.6180744 0.7638512 0.3819256 [102,] 0.5346925 0.9306149 0.4653075 [103,] 0.5004003 0.9991994 0.4995997 [104,] 0.4555282 0.9110564 0.5444718 [105,] 0.5163778 0.9672444 0.4836222 [106,] 0.4942856 0.9885711 0.5057144 [107,] 0.5002797 0.9994406 0.4997203 [108,] 0.4087047 0.8174094 0.5912953 [109,] 0.3447712 0.6895424 0.6552288 [110,] 0.2788510 0.5577021 0.7211490 [111,] 0.2237614 0.4475228 0.7762386 > postscript(file="/var/www/html/rcomp/tmp/16xg01290865899.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/rcomp/tmp/2hpx21290865899.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/rcomp/tmp/3hpx21290865899.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/rcomp/tmp/4hpx21290865899.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/rcomp/tmp/5rye51290865899.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 -1980.40541 -1413.40541 -1097.40541 135.59459 1271.59459 1574.59459 7 8 9 10 11 12 2690.59459 2200.59459 2689.59459 -642.40541 -1818.40541 -1200.40541 13 14 15 16 17 18 -2942.00000 -1500.40541 -924.40541 -692.40541 843.59459 2160.59459 19 20 21 22 23 24 942.59459 2189.59459 2067.59459 -713.40541 -1797.40541 -1130.40541 25 26 27 28 29 30 -2390.40541 -2299.00000 -1310.40541 -872.40541 799.59459 1822.59459 31 32 33 34 35 36 899.59459 2838.59459 1036.59459 -535.40541 -1672.40541 -1489.40541 37 38 39 40 41 42 -2208.40541 -1341.40541 -1992.00000 -531.40541 1224.59459 1415.59459 43 44 45 46 47 48 1047.59459 2689.59459 1249.59459 -402.40541 -1649.40541 -1331.40541 49 50 51 52 53 54 -1965.40541 -1092.40541 -1337.40541 -846.00000 1125.59459 1402.59459 55 56 57 58 59 60 2210.59459 1920.59459 1440.59459 -331.40541 -1566.40541 -1271.40541 61 62 63 64 65 66 -1979.40541 -1448.40541 -1367.40541 41.59459 212.00000 1316.59459 67 68 69 70 71 72 2253.59459 2029.59459 1771.59459 -484.40541 -1557.40541 -1253.40541 73 74 75 76 77 78 -2052.40541 -1567.40541 -1072.40541 -69.40541 1087.59459 1141.00000 79 80 81 82 83 84 2051.59459 2228.59459 2644.59459 -546.40541 -1628.40541 -1010.40541 85 86 87 88 89 90 -2055.40541 -1469.40541 -857.40541 -620.40541 940.59459 2648.59459 91 92 93 94 95 96 1962.00000 2097.59459 2404.59459 -396.40541 -1562.40541 -1137.40541 97 98 99 100 101 102 -2183.40541 -1357.40541 -876.40541 -256.40541 1642.59459 1671.59459 103 104 105 106 107 108 1320.59459 3545.00000 1417.59459 -28.40541 -1534.40541 -1354.40541 109 110 111 112 113 114 -2117.40541 -1321.40541 -1380.40541 -341.40541 1579.59459 1430.59459 115 116 117 118 119 120 1354.59459 2524.59459 1219.00000 -11.40541 -1766.40541 -1473.40541 > postscript(file="/var/www/html/rcomp/tmp/6rye51290865899.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 -1980.40541 NA 1 -1413.40541 -1980.40541 2 -1097.40541 -1413.40541 3 135.59459 -1097.40541 4 1271.59459 135.59459 5 1574.59459 1271.59459 6 2690.59459 1574.59459 7 2200.59459 2690.59459 8 2689.59459 2200.59459 9 -642.40541 2689.59459 10 -1818.40541 -642.40541 11 -1200.40541 -1818.40541 12 -2942.00000 -1200.40541 13 -1500.40541 -2942.00000 14 -924.40541 -1500.40541 15 -692.40541 -924.40541 16 843.59459 -692.40541 17 2160.59459 843.59459 18 942.59459 2160.59459 19 2189.59459 942.59459 20 2067.59459 2189.59459 21 -713.40541 2067.59459 22 -1797.40541 -713.40541 23 -1130.40541 -1797.40541 24 -2390.40541 -1130.40541 25 -2299.00000 -2390.40541 26 -1310.40541 -2299.00000 27 -872.40541 -1310.40541 28 799.59459 -872.40541 29 1822.59459 799.59459 30 899.59459 1822.59459 31 2838.59459 899.59459 32 1036.59459 2838.59459 33 -535.40541 1036.59459 34 -1672.40541 -535.40541 35 -1489.40541 -1672.40541 36 -2208.40541 -1489.40541 37 -1341.40541 -2208.40541 38 -1992.00000 -1341.40541 39 -531.40541 -1992.00000 40 1224.59459 -531.40541 41 1415.59459 1224.59459 42 1047.59459 1415.59459 43 2689.59459 1047.59459 44 1249.59459 2689.59459 45 -402.40541 1249.59459 46 -1649.40541 -402.40541 47 -1331.40541 -1649.40541 48 -1965.40541 -1331.40541 49 -1092.40541 -1965.40541 50 -1337.40541 -1092.40541 51 -846.00000 -1337.40541 52 1125.59459 -846.00000 53 1402.59459 1125.59459 54 2210.59459 1402.59459 55 1920.59459 2210.59459 56 1440.59459 1920.59459 57 -331.40541 1440.59459 58 -1566.40541 -331.40541 59 -1271.40541 -1566.40541 60 -1979.40541 -1271.40541 61 -1448.40541 -1979.40541 62 -1367.40541 -1448.40541 63 41.59459 -1367.40541 64 212.00000 41.59459 65 1316.59459 212.00000 66 2253.59459 1316.59459 67 2029.59459 2253.59459 68 1771.59459 2029.59459 69 -484.40541 1771.59459 70 -1557.40541 -484.40541 71 -1253.40541 -1557.40541 72 -2052.40541 -1253.40541 73 -1567.40541 -2052.40541 74 -1072.40541 -1567.40541 75 -69.40541 -1072.40541 76 1087.59459 -69.40541 77 1141.00000 1087.59459 78 2051.59459 1141.00000 79 2228.59459 2051.59459 80 2644.59459 2228.59459 81 -546.40541 2644.59459 82 -1628.40541 -546.40541 83 -1010.40541 -1628.40541 84 -2055.40541 -1010.40541 85 -1469.40541 -2055.40541 86 -857.40541 -1469.40541 87 -620.40541 -857.40541 88 940.59459 -620.40541 89 2648.59459 940.59459 90 1962.00000 2648.59459 91 2097.59459 1962.00000 92 2404.59459 2097.59459 93 -396.40541 2404.59459 94 -1562.40541 -396.40541 95 -1137.40541 -1562.40541 96 -2183.40541 -1137.40541 97 -1357.40541 -2183.40541 98 -876.40541 -1357.40541 99 -256.40541 -876.40541 100 1642.59459 -256.40541 101 1671.59459 1642.59459 102 1320.59459 1671.59459 103 3545.00000 1320.59459 104 1417.59459 3545.00000 105 -28.40541 1417.59459 106 -1534.40541 -28.40541 107 -1354.40541 -1534.40541 108 -2117.40541 -1354.40541 109 -1321.40541 -2117.40541 110 -1380.40541 -1321.40541 111 -341.40541 -1380.40541 112 1579.59459 -341.40541 113 1430.59459 1579.59459 114 1354.59459 1430.59459 115 2524.59459 1354.59459 116 1219.00000 2524.59459 117 -11.40541 1219.00000 118 -1766.40541 -11.40541 119 -1473.40541 -1766.40541 120 NA -1473.40541 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -1413.40541 -1980.40541 [2,] -1097.40541 -1413.40541 [3,] 135.59459 -1097.40541 [4,] 1271.59459 135.59459 [5,] 1574.59459 1271.59459 [6,] 2690.59459 1574.59459 [7,] 2200.59459 2690.59459 [8,] 2689.59459 2200.59459 [9,] -642.40541 2689.59459 [10,] -1818.40541 -642.40541 [11,] -1200.40541 -1818.40541 [12,] -2942.00000 -1200.40541 [13,] -1500.40541 -2942.00000 [14,] -924.40541 -1500.40541 [15,] -692.40541 -924.40541 [16,] 843.59459 -692.40541 [17,] 2160.59459 843.59459 [18,] 942.59459 2160.59459 [19,] 2189.59459 942.59459 [20,] 2067.59459 2189.59459 [21,] -713.40541 2067.59459 [22,] -1797.40541 -713.40541 [23,] -1130.40541 -1797.40541 [24,] -2390.40541 -1130.40541 [25,] -2299.00000 -2390.40541 [26,] -1310.40541 -2299.00000 [27,] -872.40541 -1310.40541 [28,] 799.59459 -872.40541 [29,] 1822.59459 799.59459 [30,] 899.59459 1822.59459 [31,] 2838.59459 899.59459 [32,] 1036.59459 2838.59459 [33,] -535.40541 1036.59459 [34,] -1672.40541 -535.40541 [35,] -1489.40541 -1672.40541 [36,] -2208.40541 -1489.40541 [37,] -1341.40541 -2208.40541 [38,] -1992.00000 -1341.40541 [39,] -531.40541 -1992.00000 [40,] 1224.59459 -531.40541 [41,] 1415.59459 1224.59459 [42,] 1047.59459 1415.59459 [43,] 2689.59459 1047.59459 [44,] 1249.59459 2689.59459 [45,] -402.40541 1249.59459 [46,] -1649.40541 -402.40541 [47,] -1331.40541 -1649.40541 [48,] -1965.40541 -1331.40541 [49,] -1092.40541 -1965.40541 [50,] -1337.40541 -1092.40541 [51,] -846.00000 -1337.40541 [52,] 1125.59459 -846.00000 [53,] 1402.59459 1125.59459 [54,] 2210.59459 1402.59459 [55,] 1920.59459 2210.59459 [56,] 1440.59459 1920.59459 [57,] -331.40541 1440.59459 [58,] -1566.40541 -331.40541 [59,] -1271.40541 -1566.40541 [60,] -1979.40541 -1271.40541 [61,] -1448.40541 -1979.40541 [62,] -1367.40541 -1448.40541 [63,] 41.59459 -1367.40541 [64,] 212.00000 41.59459 [65,] 1316.59459 212.00000 [66,] 2253.59459 1316.59459 [67,] 2029.59459 2253.59459 [68,] 1771.59459 2029.59459 [69,] -484.40541 1771.59459 [70,] -1557.40541 -484.40541 [71,] -1253.40541 -1557.40541 [72,] -2052.40541 -1253.40541 [73,] -1567.40541 -2052.40541 [74,] -1072.40541 -1567.40541 [75,] -69.40541 -1072.40541 [76,] 1087.59459 -69.40541 [77,] 1141.00000 1087.59459 [78,] 2051.59459 1141.00000 [79,] 2228.59459 2051.59459 [80,] 2644.59459 2228.59459 [81,] -546.40541 2644.59459 [82,] -1628.40541 -546.40541 [83,] -1010.40541 -1628.40541 [84,] -2055.40541 -1010.40541 [85,] -1469.40541 -2055.40541 [86,] -857.40541 -1469.40541 [87,] -620.40541 -857.40541 [88,] 940.59459 -620.40541 [89,] 2648.59459 940.59459 [90,] 1962.00000 2648.59459 [91,] 2097.59459 1962.00000 [92,] 2404.59459 2097.59459 [93,] -396.40541 2404.59459 [94,] -1562.40541 -396.40541 [95,] -1137.40541 -1562.40541 [96,] -2183.40541 -1137.40541 [97,] -1357.40541 -2183.40541 [98,] -876.40541 -1357.40541 [99,] -256.40541 -876.40541 [100,] 1642.59459 -256.40541 [101,] 1671.59459 1642.59459 [102,] 1320.59459 1671.59459 [103,] 3545.00000 1320.59459 [104,] 1417.59459 3545.00000 [105,] -28.40541 1417.59459 [106,] -1534.40541 -28.40541 [107,] -1354.40541 -1534.40541 [108,] -2117.40541 -1354.40541 [109,] -1321.40541 -2117.40541 [110,] -1380.40541 -1321.40541 [111,] -341.40541 -1380.40541 [112,] 1579.59459 -341.40541 [113,] 1430.59459 1579.59459 [114,] 1354.59459 1430.59459 [115,] 2524.59459 1354.59459 [116,] 1219.00000 2524.59459 [117,] -11.40541 1219.00000 [118,] -1766.40541 -11.40541 [119,] -1473.40541 -1766.40541 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -1413.40541 -1980.40541 2 -1097.40541 -1413.40541 3 135.59459 -1097.40541 4 1271.59459 135.59459 5 1574.59459 1271.59459 6 2690.59459 1574.59459 7 2200.59459 2690.59459 8 2689.59459 2200.59459 9 -642.40541 2689.59459 10 -1818.40541 -642.40541 11 -1200.40541 -1818.40541 12 -2942.00000 -1200.40541 13 -1500.40541 -2942.00000 14 -924.40541 -1500.40541 15 -692.40541 -924.40541 16 843.59459 -692.40541 17 2160.59459 843.59459 18 942.59459 2160.59459 19 2189.59459 942.59459 20 2067.59459 2189.59459 21 -713.40541 2067.59459 22 -1797.40541 -713.40541 23 -1130.40541 -1797.40541 24 -2390.40541 -1130.40541 25 -2299.00000 -2390.40541 26 -1310.40541 -2299.00000 27 -872.40541 -1310.40541 28 799.59459 -872.40541 29 1822.59459 799.59459 30 899.59459 1822.59459 31 2838.59459 899.59459 32 1036.59459 2838.59459 33 -535.40541 1036.59459 34 -1672.40541 -535.40541 35 -1489.40541 -1672.40541 36 -2208.40541 -1489.40541 37 -1341.40541 -2208.40541 38 -1992.00000 -1341.40541 39 -531.40541 -1992.00000 40 1224.59459 -531.40541 41 1415.59459 1224.59459 42 1047.59459 1415.59459 43 2689.59459 1047.59459 44 1249.59459 2689.59459 45 -402.40541 1249.59459 46 -1649.40541 -402.40541 47 -1331.40541 -1649.40541 48 -1965.40541 -1331.40541 49 -1092.40541 -1965.40541 50 -1337.40541 -1092.40541 51 -846.00000 -1337.40541 52 1125.59459 -846.00000 53 1402.59459 1125.59459 54 2210.59459 1402.59459 55 1920.59459 2210.59459 56 1440.59459 1920.59459 57 -331.40541 1440.59459 58 -1566.40541 -331.40541 59 -1271.40541 -1566.40541 60 -1979.40541 -1271.40541 61 -1448.40541 -1979.40541 62 -1367.40541 -1448.40541 63 41.59459 -1367.40541 64 212.00000 41.59459 65 1316.59459 212.00000 66 2253.59459 1316.59459 67 2029.59459 2253.59459 68 1771.59459 2029.59459 69 -484.40541 1771.59459 70 -1557.40541 -484.40541 71 -1253.40541 -1557.40541 72 -2052.40541 -1253.40541 73 -1567.40541 -2052.40541 74 -1072.40541 -1567.40541 75 -69.40541 -1072.40541 76 1087.59459 -69.40541 77 1141.00000 1087.59459 78 2051.59459 1141.00000 79 2228.59459 2051.59459 80 2644.59459 2228.59459 81 -546.40541 2644.59459 82 -1628.40541 -546.40541 83 -1010.40541 -1628.40541 84 -2055.40541 -1010.40541 85 -1469.40541 -2055.40541 86 -857.40541 -1469.40541 87 -620.40541 -857.40541 88 940.59459 -620.40541 89 2648.59459 940.59459 90 1962.00000 2648.59459 91 2097.59459 1962.00000 92 2404.59459 2097.59459 93 -396.40541 2404.59459 94 -1562.40541 -396.40541 95 -1137.40541 -1562.40541 96 -2183.40541 -1137.40541 97 -1357.40541 -2183.40541 98 -876.40541 -1357.40541 99 -256.40541 -876.40541 100 1642.59459 -256.40541 101 1671.59459 1642.59459 102 1320.59459 1671.59459 103 3545.00000 1320.59459 104 1417.59459 3545.00000 105 -28.40541 1417.59459 106 -1534.40541 -28.40541 107 -1354.40541 -1534.40541 108 -2117.40541 -1354.40541 109 -1321.40541 -2117.40541 110 -1380.40541 -1321.40541 111 -341.40541 -1380.40541 112 1579.59459 -341.40541 113 1430.59459 1579.59459 114 1354.59459 1430.59459 115 2524.59459 1354.59459 116 1219.00000 2524.59459 117 -11.40541 1219.00000 118 -1766.40541 -11.40541 119 -1473.40541 -1766.40541 > 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/rcomp/tmp/727eq1290865899.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/rcomp/tmp/827eq1290865899.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/rcomp/tmp/9vgdt1290865899.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/rcomp/tmp/10vgdt1290865899.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/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/html/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/rcomp/tmp/11yzuh1290865899.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/rcomp/tmp/12kzan1290865899.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/rcomp/tmp/13yr8w1290865899.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/rcomp/tmp/14jsok1290865899.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/rcomp/tmp/154anp1290865899.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/rcomp/tmp/16qtlv1290865899.tab") + } > > try(system("convert tmp/16xg01290865899.ps tmp/16xg01290865899.png",intern=TRUE)) character(0) > try(system("convert tmp/2hpx21290865899.ps tmp/2hpx21290865899.png",intern=TRUE)) character(0) > try(system("convert tmp/3hpx21290865899.ps tmp/3hpx21290865899.png",intern=TRUE)) character(0) > try(system("convert tmp/4hpx21290865899.ps tmp/4hpx21290865899.png",intern=TRUE)) character(0) > try(system("convert tmp/5rye51290865899.ps tmp/5rye51290865899.png",intern=TRUE)) character(0) > try(system("convert tmp/6rye51290865899.ps tmp/6rye51290865899.png",intern=TRUE)) character(0) > try(system("convert tmp/727eq1290865899.ps tmp/727eq1290865899.png",intern=TRUE)) character(0) > try(system("convert tmp/827eq1290865899.ps tmp/827eq1290865899.png",intern=TRUE)) character(0) > try(system("convert tmp/9vgdt1290865899.ps tmp/9vgdt1290865899.png",intern=TRUE)) character(0) > try(system("convert tmp/10vgdt1290865899.ps tmp/10vgdt1290865899.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 3.371 1.791 8.893