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(627,356,696,386,825,444,677,387,656,327,785,448,412,225,352,182,839,460,729,411,696,342,641,361,695,377,638,331,762,428,635,340,721,352,854,461,418,221,367,198,824,422,687,329,601,320,676,375,740,364,691,351,683,380,594,319,729,322,731,386,386,221,331,187,707,344,715,342,657,365,653,313,642,356,643,337,718,389,654,326,632,343,731,357,392,220,344,228,792,391,852,425,649,332,629,298,685,360,617,326,715,325,715,393,629,301,916,426,531,265,357,210,917,429,828,440,708,357,858,431),dim=c(2,60),dimnames=list(c('Y','X'),1:60)) > y <- array(NA,dim=c(2,60),dimnames=list(c('Y','X'),1:60)) > 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 = '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 1 627 356 1 0 0 0 0 0 0 0 0 0 0 2 696 386 0 1 0 0 0 0 0 0 0 0 0 3 825 444 0 0 1 0 0 0 0 0 0 0 0 4 677 387 0 0 0 1 0 0 0 0 0 0 0 5 656 327 0 0 0 0 1 0 0 0 0 0 0 6 785 448 0 0 0 0 0 1 0 0 0 0 0 7 412 225 0 0 0 0 0 0 1 0 0 0 0 8 352 182 0 0 0 0 0 0 0 1 0 0 0 9 839 460 0 0 0 0 0 0 0 0 1 0 0 10 729 411 0 0 0 0 0 0 0 0 0 1 0 11 696 342 0 0 0 0 0 0 0 0 0 0 1 12 641 361 0 0 0 0 0 0 0 0 0 0 0 13 695 377 1 0 0 0 0 0 0 0 0 0 0 14 638 331 0 1 0 0 0 0 0 0 0 0 0 15 762 428 0 0 1 0 0 0 0 0 0 0 0 16 635 340 0 0 0 1 0 0 0 0 0 0 0 17 721 352 0 0 0 0 1 0 0 0 0 0 0 18 854 461 0 0 0 0 0 1 0 0 0 0 0 19 418 221 0 0 0 0 0 0 1 0 0 0 0 20 367 198 0 0 0 0 0 0 0 1 0 0 0 21 824 422 0 0 0 0 0 0 0 0 1 0 0 22 687 329 0 0 0 0 0 0 0 0 0 1 0 23 601 320 0 0 0 0 0 0 0 0 0 0 1 24 676 375 0 0 0 0 0 0 0 0 0 0 0 25 740 364 1 0 0 0 0 0 0 0 0 0 0 26 691 351 0 1 0 0 0 0 0 0 0 0 0 27 683 380 0 0 1 0 0 0 0 0 0 0 0 28 594 319 0 0 0 1 0 0 0 0 0 0 0 29 729 322 0 0 0 0 1 0 0 0 0 0 0 30 731 386 0 0 0 0 0 1 0 0 0 0 0 31 386 221 0 0 0 0 0 0 1 0 0 0 0 32 331 187 0 0 0 0 0 0 0 1 0 0 0 33 707 344 0 0 0 0 0 0 0 0 1 0 0 34 715 342 0 0 0 0 0 0 0 0 0 1 0 35 657 365 0 0 0 0 0 0 0 0 0 0 1 36 653 313 0 0 0 0 0 0 0 0 0 0 0 37 642 356 1 0 0 0 0 0 0 0 0 0 0 38 643 337 0 1 0 0 0 0 0 0 0 0 0 39 718 389 0 0 1 0 0 0 0 0 0 0 0 40 654 326 0 0 0 1 0 0 0 0 0 0 0 41 632 343 0 0 0 0 1 0 0 0 0 0 0 42 731 357 0 0 0 0 0 1 0 0 0 0 0 43 392 220 0 0 0 0 0 0 1 0 0 0 0 44 344 228 0 0 0 0 0 0 0 1 0 0 0 45 792 391 0 0 0 0 0 0 0 0 1 0 0 46 852 425 0 0 0 0 0 0 0 0 0 1 0 47 649 332 0 0 0 0 0 0 0 0 0 0 1 48 629 298 0 0 0 0 0 0 0 0 0 0 0 49 685 360 1 0 0 0 0 0 0 0 0 0 0 50 617 326 0 1 0 0 0 0 0 0 0 0 0 51 715 325 0 0 1 0 0 0 0 0 0 0 0 52 715 393 0 0 0 1 0 0 0 0 0 0 0 53 629 301 0 0 0 0 1 0 0 0 0 0 0 54 916 426 0 0 0 0 0 1 0 0 0 0 0 55 531 265 0 0 0 0 0 0 1 0 0 0 0 56 357 210 0 0 0 0 0 0 0 1 0 0 0 57 917 429 0 0 0 0 0 0 0 0 1 0 0 58 828 440 0 0 0 0 0 0 0 0 0 1 0 59 708 357 0 0 0 0 0 0 0 0 0 0 1 60 858 431 0 0 0 0 0 0 0 0 0 0 0 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) X M1 M2 M3 M4 236.299 1.280 -22.559 -22.370 1.079 -33.072 M5 M6 M7 M8 M9 M10 16.043 35.211 -103.367 -143.341 55.802 27.542 M11 -13.330 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -60.844 -23.692 -1.754 18.470 99.290 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 236.2987 61.4692 3.844 0.000362 *** X 1.2798 0.1654 7.739 6.27e-10 *** M1 -22.5587 25.3284 -0.891 0.377654 M2 -22.3698 25.3496 -0.882 0.382025 M3 1.0791 26.0548 0.041 0.967141 M4 -33.0725 25.3055 -1.307 0.197596 M5 16.0430 25.6815 0.625 0.535194 M6 35.2113 27.1780 1.296 0.201448 M7 -103.3675 32.6939 -3.162 0.002746 ** M8 -143.3410 35.9704 -3.985 0.000234 *** M9 55.8021 26.8097 2.081 0.042869 * M10 27.5423 25.9120 1.063 0.293250 M11 -13.3303 25.3849 -0.525 0.601962 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 40.01 on 47 degrees of freedom Multiple R-squared: 0.9392, Adjusted R-squared: 0.9237 F-statistic: 60.49 on 12 and 47 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.24859878 0.49719756 0.7514012 [2,] 0.16927703 0.33855406 0.8307230 [3,] 0.18325465 0.36650931 0.8167453 [4,] 0.10277232 0.20554464 0.8972277 [5,] 0.05623777 0.11247555 0.9437622 [6,] 0.04607619 0.09215238 0.9539238 [7,] 0.04540917 0.09081834 0.9545908 [8,] 0.08155684 0.16311367 0.9184432 [9,] 0.07212305 0.14424609 0.9278770 [10,] 0.19100046 0.38200093 0.8089995 [11,] 0.15423204 0.30846407 0.8457680 [12,] 0.18037166 0.36074332 0.8196283 [13,] 0.12644593 0.25289187 0.8735541 [14,] 0.24736471 0.49472943 0.7526353 [15,] 0.28645938 0.57291875 0.7135406 [16,] 0.25501126 0.51002252 0.7449887 [17,] 0.21142697 0.42285393 0.7885730 [18,] 0.17755078 0.35510157 0.8224492 [19,] 0.14876788 0.29753577 0.8512321 [20,] 0.15299030 0.30598060 0.8470097 [21,] 0.13969740 0.27939480 0.8603026 [22,] 0.11674783 0.23349565 0.8832522 [23,] 0.07391860 0.14783720 0.9260814 [24,] 0.15744621 0.31489243 0.8425538 [25,] 0.19232202 0.38464403 0.8076780 [26,] 0.39979594 0.79959187 0.6002041 [27,] 0.38477526 0.76955053 0.6152247 [28,] 0.41489952 0.82979903 0.5851005 [29,] 0.40708525 0.81417050 0.5929147 > postscript(file="/var/www/html/rcomp/tmp/1fq1y1258566673.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/242mv1258566673.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/32q7c1258566673.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/4vj9r1258566673.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/5gjj91258566673.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 = 60 Frequency = 1 1 2 3 4 5 6 -42.3532379 -11.9365350 19.3855282 -21.5136229 -14.8403751 -59.8659230 7 8 9 10 11 12 -8.8890128 26.1164363 -41.8144718 -60.8439487 35.3357749 -57.3109872 13 14 15 16 17 18 -1.2292991 0.4531491 -23.1374728 -3.3624383 18.1643139 -7.5034847 19 20 21 22 23 24 2.2302369 20.6394373 -8.1815992 2.1006712 -31.5083514 -40.2283613 25 26 27 28 29 30 60.4082626 27.8569003 -40.7064758 -17.4863771 64.5586871 -34.5175518 31 32 33 34 35 36 -29.7697631 -1.2826259 -25.3562291 13.4631095 -33.0999111 16.1200098 37 38 39 40 41 42 -27.3532379 -2.2257256 -17.2247878 33.5549358 -59.3173741 2.5970088 43 44 45 46 47 48 -22.4899506 -40.7549358 -0.5074136 44.2386772 1.1338993 11.3171964 49 50 51 52 53 54 10.5275123 -14.1477888 61.6832082 8.8075025 -8.5652517 99.2899506 55 56 57 58 59 60 58.9184897 -4.7183119 75.8597137 1.0414907 28.1385884 70.1021422 > postscript(file="/var/www/html/rcomp/tmp/6snc11258566673.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 = 60 Frequency = 1 lag(myerror, k = 1) myerror 0 -42.3532379 NA 1 -11.9365350 -42.3532379 2 19.3855282 -11.9365350 3 -21.5136229 19.3855282 4 -14.8403751 -21.5136229 5 -59.8659230 -14.8403751 6 -8.8890128 -59.8659230 7 26.1164363 -8.8890128 8 -41.8144718 26.1164363 9 -60.8439487 -41.8144718 10 35.3357749 -60.8439487 11 -57.3109872 35.3357749 12 -1.2292991 -57.3109872 13 0.4531491 -1.2292991 14 -23.1374728 0.4531491 15 -3.3624383 -23.1374728 16 18.1643139 -3.3624383 17 -7.5034847 18.1643139 18 2.2302369 -7.5034847 19 20.6394373 2.2302369 20 -8.1815992 20.6394373 21 2.1006712 -8.1815992 22 -31.5083514 2.1006712 23 -40.2283613 -31.5083514 24 60.4082626 -40.2283613 25 27.8569003 60.4082626 26 -40.7064758 27.8569003 27 -17.4863771 -40.7064758 28 64.5586871 -17.4863771 29 -34.5175518 64.5586871 30 -29.7697631 -34.5175518 31 -1.2826259 -29.7697631 32 -25.3562291 -1.2826259 33 13.4631095 -25.3562291 34 -33.0999111 13.4631095 35 16.1200098 -33.0999111 36 -27.3532379 16.1200098 37 -2.2257256 -27.3532379 38 -17.2247878 -2.2257256 39 33.5549358 -17.2247878 40 -59.3173741 33.5549358 41 2.5970088 -59.3173741 42 -22.4899506 2.5970088 43 -40.7549358 -22.4899506 44 -0.5074136 -40.7549358 45 44.2386772 -0.5074136 46 1.1338993 44.2386772 47 11.3171964 1.1338993 48 10.5275123 11.3171964 49 -14.1477888 10.5275123 50 61.6832082 -14.1477888 51 8.8075025 61.6832082 52 -8.5652517 8.8075025 53 99.2899506 -8.5652517 54 58.9184897 99.2899506 55 -4.7183119 58.9184897 56 75.8597137 -4.7183119 57 1.0414907 75.8597137 58 28.1385884 1.0414907 59 70.1021422 28.1385884 60 NA 70.1021422 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -11.9365350 -42.3532379 [2,] 19.3855282 -11.9365350 [3,] -21.5136229 19.3855282 [4,] -14.8403751 -21.5136229 [5,] -59.8659230 -14.8403751 [6,] -8.8890128 -59.8659230 [7,] 26.1164363 -8.8890128 [8,] -41.8144718 26.1164363 [9,] -60.8439487 -41.8144718 [10,] 35.3357749 -60.8439487 [11,] -57.3109872 35.3357749 [12,] -1.2292991 -57.3109872 [13,] 0.4531491 -1.2292991 [14,] -23.1374728 0.4531491 [15,] -3.3624383 -23.1374728 [16,] 18.1643139 -3.3624383 [17,] -7.5034847 18.1643139 [18,] 2.2302369 -7.5034847 [19,] 20.6394373 2.2302369 [20,] -8.1815992 20.6394373 [21,] 2.1006712 -8.1815992 [22,] -31.5083514 2.1006712 [23,] -40.2283613 -31.5083514 [24,] 60.4082626 -40.2283613 [25,] 27.8569003 60.4082626 [26,] -40.7064758 27.8569003 [27,] -17.4863771 -40.7064758 [28,] 64.5586871 -17.4863771 [29,] -34.5175518 64.5586871 [30,] -29.7697631 -34.5175518 [31,] -1.2826259 -29.7697631 [32,] -25.3562291 -1.2826259 [33,] 13.4631095 -25.3562291 [34,] -33.0999111 13.4631095 [35,] 16.1200098 -33.0999111 [36,] -27.3532379 16.1200098 [37,] -2.2257256 -27.3532379 [38,] -17.2247878 -2.2257256 [39,] 33.5549358 -17.2247878 [40,] -59.3173741 33.5549358 [41,] 2.5970088 -59.3173741 [42,] -22.4899506 2.5970088 [43,] -40.7549358 -22.4899506 [44,] -0.5074136 -40.7549358 [45,] 44.2386772 -0.5074136 [46,] 1.1338993 44.2386772 [47,] 11.3171964 1.1338993 [48,] 10.5275123 11.3171964 [49,] -14.1477888 10.5275123 [50,] 61.6832082 -14.1477888 [51,] 8.8075025 61.6832082 [52,] -8.5652517 8.8075025 [53,] 99.2899506 -8.5652517 [54,] 58.9184897 99.2899506 [55,] -4.7183119 58.9184897 [56,] 75.8597137 -4.7183119 [57,] 1.0414907 75.8597137 [58,] 28.1385884 1.0414907 [59,] 70.1021422 28.1385884 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -11.9365350 -42.3532379 2 19.3855282 -11.9365350 3 -21.5136229 19.3855282 4 -14.8403751 -21.5136229 5 -59.8659230 -14.8403751 6 -8.8890128 -59.8659230 7 26.1164363 -8.8890128 8 -41.8144718 26.1164363 9 -60.8439487 -41.8144718 10 35.3357749 -60.8439487 11 -57.3109872 35.3357749 12 -1.2292991 -57.3109872 13 0.4531491 -1.2292991 14 -23.1374728 0.4531491 15 -3.3624383 -23.1374728 16 18.1643139 -3.3624383 17 -7.5034847 18.1643139 18 2.2302369 -7.5034847 19 20.6394373 2.2302369 20 -8.1815992 20.6394373 21 2.1006712 -8.1815992 22 -31.5083514 2.1006712 23 -40.2283613 -31.5083514 24 60.4082626 -40.2283613 25 27.8569003 60.4082626 26 -40.7064758 27.8569003 27 -17.4863771 -40.7064758 28 64.5586871 -17.4863771 29 -34.5175518 64.5586871 30 -29.7697631 -34.5175518 31 -1.2826259 -29.7697631 32 -25.3562291 -1.2826259 33 13.4631095 -25.3562291 34 -33.0999111 13.4631095 35 16.1200098 -33.0999111 36 -27.3532379 16.1200098 37 -2.2257256 -27.3532379 38 -17.2247878 -2.2257256 39 33.5549358 -17.2247878 40 -59.3173741 33.5549358 41 2.5970088 -59.3173741 42 -22.4899506 2.5970088 43 -40.7549358 -22.4899506 44 -0.5074136 -40.7549358 45 44.2386772 -0.5074136 46 1.1338993 44.2386772 47 11.3171964 1.1338993 48 10.5275123 11.3171964 49 -14.1477888 10.5275123 50 61.6832082 -14.1477888 51 8.8075025 61.6832082 52 -8.5652517 8.8075025 53 99.2899506 -8.5652517 54 58.9184897 99.2899506 55 -4.7183119 58.9184897 56 75.8597137 -4.7183119 57 1.0414907 75.8597137 58 28.1385884 1.0414907 59 70.1021422 28.1385884 > 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/7ege41258566673.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/859h51258566673.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/9uwm91258566673.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/10ifqd1258566673.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/11mx9z1258566673.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/12sh7j1258566673.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/13hyqk1258566673.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/14ofls1258566673.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/15gi711258566673.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/166t0j1258566674.tab") + } > > system("convert tmp/1fq1y1258566673.ps tmp/1fq1y1258566673.png") > system("convert tmp/242mv1258566673.ps tmp/242mv1258566673.png") > system("convert tmp/32q7c1258566673.ps tmp/32q7c1258566673.png") > system("convert tmp/4vj9r1258566673.ps tmp/4vj9r1258566673.png") > system("convert tmp/5gjj91258566673.ps tmp/5gjj91258566673.png") > system("convert tmp/6snc11258566673.ps tmp/6snc11258566673.png") > system("convert tmp/7ege41258566673.ps tmp/7ege41258566673.png") > system("convert tmp/859h51258566673.ps tmp/859h51258566673.png") > system("convert tmp/9uwm91258566673.ps tmp/9uwm91258566673.png") > system("convert tmp/10ifqd1258566673.ps tmp/10ifqd1258566673.png") > > > proc.time() user system elapsed 2.412 1.583 2.859