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(589,130,595,139,584,127,591,135,573,122,589,130,567,117,584,127,569,112,573,122,621,113,567,117,629,149,569,112,628,157,621,113,612,157,629,149,595,147,628,157,597,137,612,157,593,132,595,147,590,125,597,137,580,123,593,132,574,117,590,125,573,114,580,123,573,111,574,117,620,112,573,114,626,144,573,111,620,150,620,112,588,149,626,144,566,134,620,150,557,123,588,149,561,116,566,134,549,117,557,123,532,111,561,116,526,105,549,117,511,102,532,111,499,95,526,105,555,93,511,102,565,124,499,95,542,130,555,93,527,124,565,124,510,115,542,130,514,106,527,124,517,105,510,115,508,105,514,106,493,101,517,105,490,95,508,105,469,93,493,101,478,84,490,95,528,87,469,93,534,116,478,84,518,120,528,87,506,117,534,116,502,109,518,120,516,105,506,117,528,107,502,109,533,109,516,105,536,109,528,107,537,108,533,109,524,107,536,109,536,99,537,108,587,103,524,107,597,131,536,99,581,137,587,103,564,135,597,131),dim=c(4,57),dimnames=list(c('Y','X','Y1','Y2'),1:57)) > y <- array(NA,dim=c(4,57),dimnames=list(c('Y','X','Y1','Y2'),1:57)) > 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 Y1 Y2 M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t 1 589 130 595 139 1 0 0 0 0 0 0 0 0 0 0 1 2 584 127 591 135 0 1 0 0 0 0 0 0 0 0 0 2 3 573 122 589 130 0 0 1 0 0 0 0 0 0 0 0 3 4 567 117 584 127 0 0 0 1 0 0 0 0 0 0 0 4 5 569 112 573 122 0 0 0 0 1 0 0 0 0 0 0 5 6 621 113 567 117 0 0 0 0 0 1 0 0 0 0 0 6 7 629 149 569 112 0 0 0 0 0 0 1 0 0 0 0 7 8 628 157 621 113 0 0 0 0 0 0 0 1 0 0 0 8 9 612 157 629 149 0 0 0 0 0 0 0 0 1 0 0 9 10 595 147 628 157 0 0 0 0 0 0 0 0 0 1 0 10 11 597 137 612 157 0 0 0 0 0 0 0 0 0 0 1 11 12 593 132 595 147 0 0 0 0 0 0 0 0 0 0 0 12 13 590 125 597 137 1 0 0 0 0 0 0 0 0 0 0 13 14 580 123 593 132 0 1 0 0 0 0 0 0 0 0 0 14 15 574 117 590 125 0 0 1 0 0 0 0 0 0 0 0 15 16 573 114 580 123 0 0 0 1 0 0 0 0 0 0 0 16 17 573 111 574 117 0 0 0 0 1 0 0 0 0 0 0 17 18 620 112 573 114 0 0 0 0 0 1 0 0 0 0 0 18 19 626 144 573 111 0 0 0 0 0 0 1 0 0 0 0 19 20 620 150 620 112 0 0 0 0 0 0 0 1 0 0 0 20 21 588 149 626 144 0 0 0 0 0 0 0 0 1 0 0 21 22 566 134 620 150 0 0 0 0 0 0 0 0 0 1 0 22 23 557 123 588 149 0 0 0 0 0 0 0 0 0 0 1 23 24 561 116 566 134 0 0 0 0 0 0 0 0 0 0 0 24 25 549 117 557 123 1 0 0 0 0 0 0 0 0 0 0 25 26 532 111 561 116 0 1 0 0 0 0 0 0 0 0 0 26 27 526 105 549 117 0 0 1 0 0 0 0 0 0 0 0 27 28 511 102 532 111 0 0 0 1 0 0 0 0 0 0 0 28 29 499 95 526 105 0 0 0 0 1 0 0 0 0 0 0 29 30 555 93 511 102 0 0 0 0 0 1 0 0 0 0 0 30 31 565 124 499 95 0 0 0 0 0 0 1 0 0 0 0 31 32 542 130 555 93 0 0 0 0 0 0 0 1 0 0 0 32 33 527 124 565 124 0 0 0 0 0 0 0 0 1 0 0 33 34 510 115 542 130 0 0 0 0 0 0 0 0 0 1 0 34 35 514 106 527 124 0 0 0 0 0 0 0 0 0 0 1 35 36 517 105 510 115 0 0 0 0 0 0 0 0 0 0 0 36 37 508 105 514 106 1 0 0 0 0 0 0 0 0 0 0 37 38 493 101 517 105 0 1 0 0 0 0 0 0 0 0 0 38 39 490 95 508 105 0 0 1 0 0 0 0 0 0 0 0 39 40 469 93 493 101 0 0 0 1 0 0 0 0 0 0 0 40 41 478 84 490 95 0 0 0 0 1 0 0 0 0 0 0 41 42 528 87 469 93 0 0 0 0 0 1 0 0 0 0 0 42 43 534 116 478 84 0 0 0 0 0 0 1 0 0 0 0 43 44 518 120 528 87 0 0 0 0 0 0 0 1 0 0 0 44 45 506 117 534 116 0 0 0 0 0 0 0 0 1 0 0 45 46 502 109 518 120 0 0 0 0 0 0 0 0 0 1 0 46 47 516 105 506 117 0 0 0 0 0 0 0 0 0 0 1 47 48 528 107 502 109 0 0 0 0 0 0 0 0 0 0 0 48 49 533 109 516 105 1 0 0 0 0 0 0 0 0 0 0 49 50 536 109 528 107 0 1 0 0 0 0 0 0 0 0 0 50 51 537 108 533 109 0 0 1 0 0 0 0 0 0 0 0 51 52 524 107 536 109 0 0 0 1 0 0 0 0 0 0 0 52 53 536 99 537 108 0 0 0 0 1 0 0 0 0 0 0 53 54 587 103 524 107 0 0 0 0 0 1 0 0 0 0 0 54 55 597 131 536 99 0 0 0 0 0 0 1 0 0 0 0 55 56 581 137 587 103 0 0 0 0 0 0 0 1 0 0 0 56 57 564 135 597 131 0 0 0 0 0 0 0 0 1 0 0 57 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) X Y1 Y2 M1 M2 74.8462 2.1938 0.5838 -0.7846 -10.6853 -16.6926 M3 M4 M5 M6 M7 M8 -10.2731 -12.6972 2.5456 54.8658 -12.0358 -66.5419 M9 M10 M11 t -60.0193 -40.3834 -10.1517 0.1505 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -15.8711 -4.0143 0.2656 4.1184 16.2423 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 74.8462 30.3515 2.466 0.017937 * X 2.1938 0.3322 6.604 5.99e-08 *** Y1 0.5838 0.1457 4.007 0.000253 *** Y2 -0.7846 0.4230 -1.855 0.070814 . M1 -10.6853 6.2605 -1.707 0.095425 . M2 -16.6926 7.2326 -2.308 0.026123 * M3 -10.2731 7.5977 -1.352 0.183740 M4 -12.6972 7.7273 -1.643 0.107996 M5 2.5456 9.1672 0.278 0.782647 M6 54.8658 8.5830 6.392 1.20e-07 *** M7 -12.0358 13.8133 -0.871 0.388653 M8 -66.5419 17.0990 -3.892 0.000359 *** M9 -60.0193 6.9789 -8.600 1.01e-10 *** M10 -40.3834 5.8120 -6.948 1.95e-08 *** M11 -10.1517 6.1607 -1.648 0.107037 t 0.1505 0.1101 1.366 0.179311 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 7.746 on 41 degrees of freedom Multiple R-squared: 0.9743, Adjusted R-squared: 0.9649 F-statistic: 103.7 on 15 and 41 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.02837689 0.056753786 0.971623107 [2,] 0.04479219 0.089584376 0.955207812 [3,] 0.30917010 0.618340200 0.690829900 [4,] 0.22562822 0.451256443 0.774371778 [5,] 0.26509404 0.530188080 0.734905960 [6,] 0.32480487 0.649609733 0.675195133 [7,] 0.36911457 0.738229140 0.630885430 [8,] 0.36363182 0.727263635 0.636368183 [9,] 0.28357887 0.567157749 0.716421125 [10,] 0.40908882 0.818177632 0.590911184 [11,] 0.64770234 0.704595326 0.352297663 [12,] 0.82904663 0.341906748 0.170953374 [13,] 0.91948345 0.161033106 0.080516553 [14,] 0.87464227 0.250715466 0.125357733 [15,] 0.96723017 0.065539661 0.032769831 [16,] 0.96307591 0.073848188 0.036924094 [17,] 0.97008005 0.059839903 0.029919952 [18,] 0.96780978 0.064380441 0.032190221 [19,] 0.99588871 0.008222579 0.004111289 [20,] 0.99544504 0.009109921 0.004554960 > postscript(file="/var/www/html/rcomp/tmp/15c8u1258745565.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/20r521258745565.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/3mpg81258745565.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/4r1j81258745565.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/5vl7f1258745565.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 = 57 Frequency = 1 1 2 3 4 5 6 1.1829346 7.8180313 -1.5382365 6.2695457 6.3442610 3.2598648 7 8 9 10 11 12 -6.0550559 0.1765284 1.0774225 -6.9109038 -4.0143259 -5.2684307 13 14 15 16 17 18 8.6094461 7.2662060 4.1183828 16.2422866 6.2258120 -3.2085304 19 20 21 22 23 24 -3.0116089 5.5265954 -9.3493883 -10.0189330 -7.3720830 2.7575831 25 26 27 28 29 30 -4.2772574 -10.0851064 -1.7020164 -2.6296716 -15.8710780 -1.5506786 31 32 33 34 35 36 8.7075368 -7.3623230 2.6106901 3.7034350 1.1150098 -1.1295935 37 38 39 40 41 42 -8.9911506 -11.8952976 -3.0482290 -11.7681460 -1.3734698 0.2655672 43 44 45 46 47 48 -2.9179836 -0.1745572 6.9832838 13.2264018 10.2713991 3.6404412 49 50 51 52 53 54 3.4760272 6.8961668 2.1700992 -8.1140148 4.6744748 1.2337770 55 56 57 3.2771115 1.8337565 -1.3220081 > postscript(file="/var/www/html/rcomp/tmp/6f0du1258745565.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 = 57 Frequency = 1 lag(myerror, k = 1) myerror 0 1.1829346 NA 1 7.8180313 1.1829346 2 -1.5382365 7.8180313 3 6.2695457 -1.5382365 4 6.3442610 6.2695457 5 3.2598648 6.3442610 6 -6.0550559 3.2598648 7 0.1765284 -6.0550559 8 1.0774225 0.1765284 9 -6.9109038 1.0774225 10 -4.0143259 -6.9109038 11 -5.2684307 -4.0143259 12 8.6094461 -5.2684307 13 7.2662060 8.6094461 14 4.1183828 7.2662060 15 16.2422866 4.1183828 16 6.2258120 16.2422866 17 -3.2085304 6.2258120 18 -3.0116089 -3.2085304 19 5.5265954 -3.0116089 20 -9.3493883 5.5265954 21 -10.0189330 -9.3493883 22 -7.3720830 -10.0189330 23 2.7575831 -7.3720830 24 -4.2772574 2.7575831 25 -10.0851064 -4.2772574 26 -1.7020164 -10.0851064 27 -2.6296716 -1.7020164 28 -15.8710780 -2.6296716 29 -1.5506786 -15.8710780 30 8.7075368 -1.5506786 31 -7.3623230 8.7075368 32 2.6106901 -7.3623230 33 3.7034350 2.6106901 34 1.1150098 3.7034350 35 -1.1295935 1.1150098 36 -8.9911506 -1.1295935 37 -11.8952976 -8.9911506 38 -3.0482290 -11.8952976 39 -11.7681460 -3.0482290 40 -1.3734698 -11.7681460 41 0.2655672 -1.3734698 42 -2.9179836 0.2655672 43 -0.1745572 -2.9179836 44 6.9832838 -0.1745572 45 13.2264018 6.9832838 46 10.2713991 13.2264018 47 3.6404412 10.2713991 48 3.4760272 3.6404412 49 6.8961668 3.4760272 50 2.1700992 6.8961668 51 -8.1140148 2.1700992 52 4.6744748 -8.1140148 53 1.2337770 4.6744748 54 3.2771115 1.2337770 55 1.8337565 3.2771115 56 -1.3220081 1.8337565 57 NA -1.3220081 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] 7.8180313 1.1829346 [2,] -1.5382365 7.8180313 [3,] 6.2695457 -1.5382365 [4,] 6.3442610 6.2695457 [5,] 3.2598648 6.3442610 [6,] -6.0550559 3.2598648 [7,] 0.1765284 -6.0550559 [8,] 1.0774225 0.1765284 [9,] -6.9109038 1.0774225 [10,] -4.0143259 -6.9109038 [11,] -5.2684307 -4.0143259 [12,] 8.6094461 -5.2684307 [13,] 7.2662060 8.6094461 [14,] 4.1183828 7.2662060 [15,] 16.2422866 4.1183828 [16,] 6.2258120 16.2422866 [17,] -3.2085304 6.2258120 [18,] -3.0116089 -3.2085304 [19,] 5.5265954 -3.0116089 [20,] -9.3493883 5.5265954 [21,] -10.0189330 -9.3493883 [22,] -7.3720830 -10.0189330 [23,] 2.7575831 -7.3720830 [24,] -4.2772574 2.7575831 [25,] -10.0851064 -4.2772574 [26,] -1.7020164 -10.0851064 [27,] -2.6296716 -1.7020164 [28,] -15.8710780 -2.6296716 [29,] -1.5506786 -15.8710780 [30,] 8.7075368 -1.5506786 [31,] -7.3623230 8.7075368 [32,] 2.6106901 -7.3623230 [33,] 3.7034350 2.6106901 [34,] 1.1150098 3.7034350 [35,] -1.1295935 1.1150098 [36,] -8.9911506 -1.1295935 [37,] -11.8952976 -8.9911506 [38,] -3.0482290 -11.8952976 [39,] -11.7681460 -3.0482290 [40,] -1.3734698 -11.7681460 [41,] 0.2655672 -1.3734698 [42,] -2.9179836 0.2655672 [43,] -0.1745572 -2.9179836 [44,] 6.9832838 -0.1745572 [45,] 13.2264018 6.9832838 [46,] 10.2713991 13.2264018 [47,] 3.6404412 10.2713991 [48,] 3.4760272 3.6404412 [49,] 6.8961668 3.4760272 [50,] 2.1700992 6.8961668 [51,] -8.1140148 2.1700992 [52,] 4.6744748 -8.1140148 [53,] 1.2337770 4.6744748 [54,] 3.2771115 1.2337770 [55,] 1.8337565 3.2771115 [56,] -1.3220081 1.8337565 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 7.8180313 1.1829346 2 -1.5382365 7.8180313 3 6.2695457 -1.5382365 4 6.3442610 6.2695457 5 3.2598648 6.3442610 6 -6.0550559 3.2598648 7 0.1765284 -6.0550559 8 1.0774225 0.1765284 9 -6.9109038 1.0774225 10 -4.0143259 -6.9109038 11 -5.2684307 -4.0143259 12 8.6094461 -5.2684307 13 7.2662060 8.6094461 14 4.1183828 7.2662060 15 16.2422866 4.1183828 16 6.2258120 16.2422866 17 -3.2085304 6.2258120 18 -3.0116089 -3.2085304 19 5.5265954 -3.0116089 20 -9.3493883 5.5265954 21 -10.0189330 -9.3493883 22 -7.3720830 -10.0189330 23 2.7575831 -7.3720830 24 -4.2772574 2.7575831 25 -10.0851064 -4.2772574 26 -1.7020164 -10.0851064 27 -2.6296716 -1.7020164 28 -15.8710780 -2.6296716 29 -1.5506786 -15.8710780 30 8.7075368 -1.5506786 31 -7.3623230 8.7075368 32 2.6106901 -7.3623230 33 3.7034350 2.6106901 34 1.1150098 3.7034350 35 -1.1295935 1.1150098 36 -8.9911506 -1.1295935 37 -11.8952976 -8.9911506 38 -3.0482290 -11.8952976 39 -11.7681460 -3.0482290 40 -1.3734698 -11.7681460 41 0.2655672 -1.3734698 42 -2.9179836 0.2655672 43 -0.1745572 -2.9179836 44 6.9832838 -0.1745572 45 13.2264018 6.9832838 46 10.2713991 13.2264018 47 3.6404412 10.2713991 48 3.4760272 3.6404412 49 6.8961668 3.4760272 50 2.1700992 6.8961668 51 -8.1140148 2.1700992 52 4.6744748 -8.1140148 53 1.2337770 4.6744748 54 3.2771115 1.2337770 55 1.8337565 3.2771115 56 -1.3220081 1.8337565 > 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/7zpzk1258745565.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/8euxh1258745565.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/922s81258745565.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/103js61258745565.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/11mhwf1258745565.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/12fafo1258745565.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/13shzj1258745565.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/14pl251258745565.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/15qes71258745565.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/16i5p51258745566.tab") + } > > system("convert tmp/15c8u1258745565.ps tmp/15c8u1258745565.png") > system("convert tmp/20r521258745565.ps tmp/20r521258745565.png") > system("convert tmp/3mpg81258745565.ps tmp/3mpg81258745565.png") > system("convert tmp/4r1j81258745565.ps tmp/4r1j81258745565.png") > system("convert tmp/5vl7f1258745565.ps tmp/5vl7f1258745565.png") > system("convert tmp/6f0du1258745565.ps tmp/6f0du1258745565.png") > system("convert tmp/7zpzk1258745565.ps tmp/7zpzk1258745565.png") > system("convert tmp/8euxh1258745565.ps tmp/8euxh1258745565.png") > system("convert tmp/922s81258745565.ps tmp/922s81258745565.png") > system("convert tmp/103js61258745565.ps tmp/103js61258745565.png") > > > proc.time() user system elapsed 2.366 1.582 2.751