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,0,696,0,825,0,677,0,656,0,785,0,412,0,352,0,839,0,729,0,696,0,641,0,695,0,638,0,762,0,635,0,721,0,854,0,418,0,367,0,824,0,687,0,601,0,676,0,740,0,691,0,683,0,594,0,729,0,731,0,386,0,331,0,707,0,715,0,657,0,653,0,642,0,643,0,718,0,654,0,632,0,731,0,392,1,344,1,792,1,852,1,649,1,629,1,685,1,617,1,715,1,715,1,629,1,916,1,531,1,357,1,917,1,828,1,708,1,858,1,775,1,785,1,1006,1,789,1,734,1,906,1,532,1,387,1,991,1,841,1),dim=c(2,70),dimnames=list(c('Y','X'),1:70)) > y <- array(NA,dim=c(2,70),dimnames=list(c('Y','X'),1:70)) > 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 627 0 1 0 0 0 0 0 0 0 0 0 0 1 2 696 0 0 1 0 0 0 0 0 0 0 0 0 2 3 825 0 0 0 1 0 0 0 0 0 0 0 0 3 4 677 0 0 0 0 1 0 0 0 0 0 0 0 4 5 656 0 0 0 0 0 1 0 0 0 0 0 0 5 6 785 0 0 0 0 0 0 1 0 0 0 0 0 6 7 412 0 0 0 0 0 0 0 1 0 0 0 0 7 8 352 0 0 0 0 0 0 0 0 1 0 0 0 8 9 839 0 0 0 0 0 0 0 0 0 1 0 0 9 10 729 0 0 0 0 0 0 0 0 0 0 1 0 10 11 696 0 0 0 0 0 0 0 0 0 0 0 1 11 12 641 0 0 0 0 0 0 0 0 0 0 0 0 12 13 695 0 1 0 0 0 0 0 0 0 0 0 0 13 14 638 0 0 1 0 0 0 0 0 0 0 0 0 14 15 762 0 0 0 1 0 0 0 0 0 0 0 0 15 16 635 0 0 0 0 1 0 0 0 0 0 0 0 16 17 721 0 0 0 0 0 1 0 0 0 0 0 0 17 18 854 0 0 0 0 0 0 1 0 0 0 0 0 18 19 418 0 0 0 0 0 0 0 1 0 0 0 0 19 20 367 0 0 0 0 0 0 0 0 1 0 0 0 20 21 824 0 0 0 0 0 0 0 0 0 1 0 0 21 22 687 0 0 0 0 0 0 0 0 0 0 1 0 22 23 601 0 0 0 0 0 0 0 0 0 0 0 1 23 24 676 0 0 0 0 0 0 0 0 0 0 0 0 24 25 740 0 1 0 0 0 0 0 0 0 0 0 0 25 26 691 0 0 1 0 0 0 0 0 0 0 0 0 26 27 683 0 0 0 1 0 0 0 0 0 0 0 0 27 28 594 0 0 0 0 1 0 0 0 0 0 0 0 28 29 729 0 0 0 0 0 1 0 0 0 0 0 0 29 30 731 0 0 0 0 0 0 1 0 0 0 0 0 30 31 386 0 0 0 0 0 0 0 1 0 0 0 0 31 32 331 0 0 0 0 0 0 0 0 1 0 0 0 32 33 707 0 0 0 0 0 0 0 0 0 1 0 0 33 34 715 0 0 0 0 0 0 0 0 0 0 1 0 34 35 657 0 0 0 0 0 0 0 0 0 0 0 1 35 36 653 0 0 0 0 0 0 0 0 0 0 0 0 36 37 642 0 1 0 0 0 0 0 0 0 0 0 0 37 38 643 0 0 1 0 0 0 0 0 0 0 0 0 38 39 718 0 0 0 1 0 0 0 0 0 0 0 0 39 40 654 0 0 0 0 1 0 0 0 0 0 0 0 40 41 632 0 0 0 0 0 1 0 0 0 0 0 0 41 42 731 0 0 0 0 0 0 1 0 0 0 0 0 42 43 392 1 0 0 0 0 0 0 1 0 0 0 0 43 44 344 1 0 0 0 0 0 0 0 1 0 0 0 44 45 792 1 0 0 0 0 0 0 0 0 1 0 0 45 46 852 1 0 0 0 0 0 0 0 0 0 1 0 46 47 649 1 0 0 0 0 0 0 0 0 0 0 1 47 48 629 1 0 0 0 0 0 0 0 0 0 0 0 48 49 685 1 1 0 0 0 0 0 0 0 0 0 0 49 50 617 1 0 1 0 0 0 0 0 0 0 0 0 50 51 715 1 0 0 1 0 0 0 0 0 0 0 0 51 52 715 1 0 0 0 1 0 0 0 0 0 0 0 52 53 629 1 0 0 0 0 1 0 0 0 0 0 0 53 54 916 1 0 0 0 0 0 1 0 0 0 0 0 54 55 531 1 0 0 0 0 0 0 1 0 0 0 0 55 56 357 1 0 0 0 0 0 0 0 1 0 0 0 56 57 917 1 0 0 0 0 0 0 0 0 1 0 0 57 58 828 1 0 0 0 0 0 0 0 0 0 1 0 58 59 708 1 0 0 0 0 0 0 0 0 0 0 1 59 60 858 1 0 0 0 0 0 0 0 0 0 0 0 60 61 775 1 1 0 0 0 0 0 0 0 0 0 0 61 62 785 1 0 1 0 0 0 0 0 0 0 0 0 62 63 1006 1 0 0 1 0 0 0 0 0 0 0 0 63 64 789 1 0 0 0 1 0 0 0 0 0 0 0 64 65 734 1 0 0 0 0 1 0 0 0 0 0 0 65 66 906 1 0 0 0 0 0 1 0 0 0 0 0 66 67 532 1 0 0 0 0 0 0 1 0 0 0 0 67 68 387 1 0 0 0 0 0 0 0 1 0 0 0 68 69 991 1 0 0 0 0 0 0 0 0 1 0 0 69 70 841 1 0 0 0 0 0 0 0 0 0 1 0 70 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) X M1 M2 M3 M4 653.402 62.233 8.569 -7.462 98.674 -9.190 M5 M6 M7 M8 M9 M10 -3.387 133.249 -252.821 -342.018 146.285 76.254 M11 t -28.836 0.364 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -117.874 -34.861 1.944 37.287 168.757 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 653.4020 33.0565 19.766 < 2e-16 *** X 62.2332 29.6488 2.099 0.040337 * M1 8.5690 38.5024 0.223 0.824690 M2 -7.4617 38.4736 -0.194 0.846922 M3 98.6743 38.4581 2.566 0.012999 * M4 -9.1897 38.4560 -0.239 0.812003 M5 -3.3871 38.4672 -0.088 0.930150 M6 133.2489 38.4918 3.462 0.001035 ** M7 -252.8207 38.5150 -6.564 1.81e-08 *** M8 -342.0180 38.4882 -8.886 2.75e-12 *** M9 146.2846 38.4747 3.802 0.000356 *** M10 76.2539 38.4745 1.982 0.052403 . M11 -28.8360 40.1567 -0.718 0.475689 t 0.3640 0.7165 0.508 0.613424 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 63.48 on 56 degrees of freedom Multiple R-squared: 0.8659, Adjusted R-squared: 0.8348 F-statistic: 27.82 on 13 and 56 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.408441754 0.816883509 0.5915582 [2,] 0.363053789 0.726107577 0.6369462 [3,] 0.231306040 0.462612080 0.7686940 [4,] 0.155798615 0.311597230 0.8442014 [5,] 0.100414443 0.200828885 0.8995856 [6,] 0.067594180 0.135188361 0.9324058 [7,] 0.084441196 0.168882391 0.9155588 [8,] 0.059368222 0.118736444 0.9406318 [9,] 0.095228105 0.190456211 0.9047719 [10,] 0.079513326 0.159026651 0.9204867 [11,] 0.150210817 0.300421634 0.8497892 [12,] 0.122079875 0.244159750 0.8779201 [13,] 0.211878624 0.423757248 0.7881214 [14,] 0.212712585 0.425425170 0.7872874 [15,] 0.155632147 0.311264294 0.8443679 [16,] 0.144785212 0.289570423 0.8552148 [17,] 0.202236548 0.404473096 0.7977635 [18,] 0.152118915 0.304237830 0.8478811 [19,] 0.132041396 0.264082792 0.8679586 [20,] 0.091631686 0.183263373 0.9083683 [21,] 0.062061542 0.124123084 0.9379385 [22,] 0.044170186 0.088340372 0.9558298 [23,] 0.028195523 0.056391046 0.9718045 [24,] 0.020063449 0.040126898 0.9799366 [25,] 0.020945087 0.041890174 0.9790549 [26,] 0.012736240 0.025472480 0.9872638 [27,] 0.007339215 0.014678431 0.9926608 [28,] 0.006010403 0.012020805 0.9939896 [29,] 0.003605741 0.007211483 0.9963943 [30,] 0.028332536 0.056665072 0.9716675 [31,] 0.017742163 0.035484326 0.9822578 [32,] 0.034275506 0.068551013 0.9657245 [33,] 0.018339506 0.036679012 0.9816605 [34,] 0.019382034 0.038764069 0.9806180 [35,] 0.686882899 0.626234202 0.3131171 [36,] 0.622328941 0.755342119 0.3776711 [37,] 0.772988575 0.454022850 0.2270114 > postscript(file="/var/www/html/rcomp/tmp/1qo151260388488.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/2guyk1260388488.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/3rrw81260388488.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/4u4kn1260388488.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/5rho01260388488.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 = 70 Frequency = 1 1 2 3 4 5 6 -35.3350112 49.3316555 71.8316555 31.3316555 4.1649888 -3.8350112 7 8 9 10 11 12 8.8705257 37.7038591 36.0371924 -4.2961409 67.4297539 -16.7702461 13 14 15 16 17 18 28.2967562 -13.0365772 4.4634228 -15.0365772 64.7967562 60.7967562 19 20 21 22 23 24 10.5022931 48.3356264 16.6689597 -50.6643736 -31.9384787 13.8615213 25 26 27 28 29 30 68.9285235 35.5951902 -78.9048098 -60.4048098 68.4285235 -66.5714765 31 32 33 34 35 36 -25.8659396 7.9673937 -104.6992729 -27.0326063 19.6932886 -13.5067114 37 38 39 40 41 42 -33.4397092 -16.7730425 -48.2730425 -4.7730425 -32.9397092 -70.9397092 43 44 45 46 47 48 -86.4673937 -45.6340604 -86.3007271 43.3659396 -54.9081655 -104.1081655 49 50 51 52 53 54 -57.0411633 -109.3744966 -117.8744966 -10.3744966 -102.5411633 47.4588367 55 56 57 58 59 60 48.1643736 -37.0022931 34.3310403 14.9977069 -0.2763982 120.5236018 61 62 63 64 65 66 28.5906040 54.2572707 168.7572707 59.2572707 -1.9093960 33.0906040 67 68 69 70 44.7961409 -11.3705257 103.9628076 23.6294743 > postscript(file="/var/www/html/rcomp/tmp/6ux531260388488.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 = 70 Frequency = 1 lag(myerror, k = 1) myerror 0 -35.3350112 NA 1 49.3316555 -35.3350112 2 71.8316555 49.3316555 3 31.3316555 71.8316555 4 4.1649888 31.3316555 5 -3.8350112 4.1649888 6 8.8705257 -3.8350112 7 37.7038591 8.8705257 8 36.0371924 37.7038591 9 -4.2961409 36.0371924 10 67.4297539 -4.2961409 11 -16.7702461 67.4297539 12 28.2967562 -16.7702461 13 -13.0365772 28.2967562 14 4.4634228 -13.0365772 15 -15.0365772 4.4634228 16 64.7967562 -15.0365772 17 60.7967562 64.7967562 18 10.5022931 60.7967562 19 48.3356264 10.5022931 20 16.6689597 48.3356264 21 -50.6643736 16.6689597 22 -31.9384787 -50.6643736 23 13.8615213 -31.9384787 24 68.9285235 13.8615213 25 35.5951902 68.9285235 26 -78.9048098 35.5951902 27 -60.4048098 -78.9048098 28 68.4285235 -60.4048098 29 -66.5714765 68.4285235 30 -25.8659396 -66.5714765 31 7.9673937 -25.8659396 32 -104.6992729 7.9673937 33 -27.0326063 -104.6992729 34 19.6932886 -27.0326063 35 -13.5067114 19.6932886 36 -33.4397092 -13.5067114 37 -16.7730425 -33.4397092 38 -48.2730425 -16.7730425 39 -4.7730425 -48.2730425 40 -32.9397092 -4.7730425 41 -70.9397092 -32.9397092 42 -86.4673937 -70.9397092 43 -45.6340604 -86.4673937 44 -86.3007271 -45.6340604 45 43.3659396 -86.3007271 46 -54.9081655 43.3659396 47 -104.1081655 -54.9081655 48 -57.0411633 -104.1081655 49 -109.3744966 -57.0411633 50 -117.8744966 -109.3744966 51 -10.3744966 -117.8744966 52 -102.5411633 -10.3744966 53 47.4588367 -102.5411633 54 48.1643736 47.4588367 55 -37.0022931 48.1643736 56 34.3310403 -37.0022931 57 14.9977069 34.3310403 58 -0.2763982 14.9977069 59 120.5236018 -0.2763982 60 28.5906040 120.5236018 61 54.2572707 28.5906040 62 168.7572707 54.2572707 63 59.2572707 168.7572707 64 -1.9093960 59.2572707 65 33.0906040 -1.9093960 66 44.7961409 33.0906040 67 -11.3705257 44.7961409 68 103.9628076 -11.3705257 69 23.6294743 103.9628076 70 NA 23.6294743 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] 49.3316555 -35.3350112 [2,] 71.8316555 49.3316555 [3,] 31.3316555 71.8316555 [4,] 4.1649888 31.3316555 [5,] -3.8350112 4.1649888 [6,] 8.8705257 -3.8350112 [7,] 37.7038591 8.8705257 [8,] 36.0371924 37.7038591 [9,] -4.2961409 36.0371924 [10,] 67.4297539 -4.2961409 [11,] -16.7702461 67.4297539 [12,] 28.2967562 -16.7702461 [13,] -13.0365772 28.2967562 [14,] 4.4634228 -13.0365772 [15,] -15.0365772 4.4634228 [16,] 64.7967562 -15.0365772 [17,] 60.7967562 64.7967562 [18,] 10.5022931 60.7967562 [19,] 48.3356264 10.5022931 [20,] 16.6689597 48.3356264 [21,] -50.6643736 16.6689597 [22,] -31.9384787 -50.6643736 [23,] 13.8615213 -31.9384787 [24,] 68.9285235 13.8615213 [25,] 35.5951902 68.9285235 [26,] -78.9048098 35.5951902 [27,] -60.4048098 -78.9048098 [28,] 68.4285235 -60.4048098 [29,] -66.5714765 68.4285235 [30,] -25.8659396 -66.5714765 [31,] 7.9673937 -25.8659396 [32,] -104.6992729 7.9673937 [33,] -27.0326063 -104.6992729 [34,] 19.6932886 -27.0326063 [35,] -13.5067114 19.6932886 [36,] -33.4397092 -13.5067114 [37,] -16.7730425 -33.4397092 [38,] -48.2730425 -16.7730425 [39,] -4.7730425 -48.2730425 [40,] -32.9397092 -4.7730425 [41,] -70.9397092 -32.9397092 [42,] -86.4673937 -70.9397092 [43,] -45.6340604 -86.4673937 [44,] -86.3007271 -45.6340604 [45,] 43.3659396 -86.3007271 [46,] -54.9081655 43.3659396 [47,] -104.1081655 -54.9081655 [48,] -57.0411633 -104.1081655 [49,] -109.3744966 -57.0411633 [50,] -117.8744966 -109.3744966 [51,] -10.3744966 -117.8744966 [52,] -102.5411633 -10.3744966 [53,] 47.4588367 -102.5411633 [54,] 48.1643736 47.4588367 [55,] -37.0022931 48.1643736 [56,] 34.3310403 -37.0022931 [57,] 14.9977069 34.3310403 [58,] -0.2763982 14.9977069 [59,] 120.5236018 -0.2763982 [60,] 28.5906040 120.5236018 [61,] 54.2572707 28.5906040 [62,] 168.7572707 54.2572707 [63,] 59.2572707 168.7572707 [64,] -1.9093960 59.2572707 [65,] 33.0906040 -1.9093960 [66,] 44.7961409 33.0906040 [67,] -11.3705257 44.7961409 [68,] 103.9628076 -11.3705257 [69,] 23.6294743 103.9628076 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 49.3316555 -35.3350112 2 71.8316555 49.3316555 3 31.3316555 71.8316555 4 4.1649888 31.3316555 5 -3.8350112 4.1649888 6 8.8705257 -3.8350112 7 37.7038591 8.8705257 8 36.0371924 37.7038591 9 -4.2961409 36.0371924 10 67.4297539 -4.2961409 11 -16.7702461 67.4297539 12 28.2967562 -16.7702461 13 -13.0365772 28.2967562 14 4.4634228 -13.0365772 15 -15.0365772 4.4634228 16 64.7967562 -15.0365772 17 60.7967562 64.7967562 18 10.5022931 60.7967562 19 48.3356264 10.5022931 20 16.6689597 48.3356264 21 -50.6643736 16.6689597 22 -31.9384787 -50.6643736 23 13.8615213 -31.9384787 24 68.9285235 13.8615213 25 35.5951902 68.9285235 26 -78.9048098 35.5951902 27 -60.4048098 -78.9048098 28 68.4285235 -60.4048098 29 -66.5714765 68.4285235 30 -25.8659396 -66.5714765 31 7.9673937 -25.8659396 32 -104.6992729 7.9673937 33 -27.0326063 -104.6992729 34 19.6932886 -27.0326063 35 -13.5067114 19.6932886 36 -33.4397092 -13.5067114 37 -16.7730425 -33.4397092 38 -48.2730425 -16.7730425 39 -4.7730425 -48.2730425 40 -32.9397092 -4.7730425 41 -70.9397092 -32.9397092 42 -86.4673937 -70.9397092 43 -45.6340604 -86.4673937 44 -86.3007271 -45.6340604 45 43.3659396 -86.3007271 46 -54.9081655 43.3659396 47 -104.1081655 -54.9081655 48 -57.0411633 -104.1081655 49 -109.3744966 -57.0411633 50 -117.8744966 -109.3744966 51 -10.3744966 -117.8744966 52 -102.5411633 -10.3744966 53 47.4588367 -102.5411633 54 48.1643736 47.4588367 55 -37.0022931 48.1643736 56 34.3310403 -37.0022931 57 14.9977069 34.3310403 58 -0.2763982 14.9977069 59 120.5236018 -0.2763982 60 28.5906040 120.5236018 61 54.2572707 28.5906040 62 168.7572707 54.2572707 63 59.2572707 168.7572707 64 -1.9093960 59.2572707 65 33.0906040 -1.9093960 66 44.7961409 33.0906040 67 -11.3705257 44.7961409 68 103.9628076 -11.3705257 69 23.6294743 103.9628076 > 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/7hmbx1260388488.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/825u11260388488.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/9w01l1260388488.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/104olp1260388488.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/11h5ec1260388489.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/12ra3v1260388489.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/13i6bl1260388489.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/14gmlf1260388489.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/15p5fi1260388489.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/16fuww1260388489.tab") + } > > system("convert tmp/1qo151260388488.ps tmp/1qo151260388488.png") > system("convert tmp/2guyk1260388488.ps tmp/2guyk1260388488.png") > system("convert tmp/3rrw81260388488.ps tmp/3rrw81260388488.png") > system("convert tmp/4u4kn1260388488.ps tmp/4u4kn1260388488.png") > system("convert tmp/5rho01260388488.ps tmp/5rho01260388488.png") > system("convert tmp/6ux531260388488.ps tmp/6ux531260388488.png") > system("convert tmp/7hmbx1260388488.ps tmp/7hmbx1260388488.png") > system("convert tmp/825u11260388488.ps tmp/825u11260388488.png") > system("convert tmp/9w01l1260388488.ps tmp/9w01l1260388488.png") > system("convert tmp/104olp1260388488.ps tmp/104olp1260388488.png") > > > proc.time() user system elapsed 2.566 1.595 3.413