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(8031 + ,4871 + ,6820 + ,7291 + ,7862 + ,4649 + ,8031 + ,6820 + ,7357 + ,4922 + ,7862 + ,8031 + ,7213 + ,4879 + ,7357 + ,7862 + ,7079 + ,4853 + ,7213 + ,7357 + ,7012 + ,4545 + ,7079 + ,7213 + ,7319 + ,4733 + ,7012 + ,7079 + ,8148 + ,5191 + ,7319 + ,7012 + ,7599 + ,4983 + ,8148 + ,7319 + ,6908 + ,4593 + ,7599 + ,8148 + ,7878 + ,4656 + ,6908 + ,7599 + ,7407 + ,4513 + ,7878 + ,6908 + ,7911 + ,4857 + ,7407 + ,7878 + ,7323 + ,4681 + ,7911 + ,7407 + ,7179 + ,4897 + ,7323 + ,7911 + ,6758 + ,4547 + ,7179 + ,7323 + ,6934 + ,4692 + ,6758 + ,7179 + ,6696 + ,4390 + ,6934 + ,6758 + ,7688 + ,5341 + ,6696 + ,6934 + ,8296 + ,5415 + ,7688 + ,6696 + ,7697 + ,4890 + ,8296 + ,7688 + ,7907 + ,5120 + ,7697 + ,8296 + ,7592 + ,4422 + ,7907 + ,7697 + ,7710 + ,4797 + ,7592 + ,7907 + ,9011 + ,5689 + ,7710 + ,7592 + ,8225 + ,5171 + ,9011 + ,7710 + ,7733 + ,4265 + ,8225 + ,9011 + ,8062 + ,5215 + ,7733 + ,8225 + ,7859 + ,4874 + ,8062 + ,7733 + ,8221 + ,4590 + ,7859 + ,8062 + ,8330 + ,4994 + ,8221 + ,7859 + ,8868 + ,4988 + ,8330 + ,8221 + ,9053 + ,5110 + ,8868 + ,8330 + ,8811 + ,5141 + ,9053 + ,8868 + ,8120 + ,4395 + ,8811 + ,9053 + ,7953 + ,4523 + ,8120 + ,8811 + ,8878 + ,5306 + ,7953 + ,8120 + ,8601 + ,5365 + ,8878 + ,7953 + ,8361 + ,5496 + ,8601 + ,8878 + ,9116 + ,5647 + ,8361 + ,8601 + ,9310 + ,5443 + ,9116 + ,8361 + ,9891 + ,5546 + ,9310 + ,9116 + ,10147 + ,5912 + ,9891 + ,9310 + ,10317 + ,5665 + ,10147 + ,9891 + ,10682 + ,5963 + ,10317 + ,10147 + ,10276 + ,5861 + ,10682 + ,10317 + ,10614 + ,5366 + ,10276 + ,10682 + ,9413 + ,5619 + ,10614 + ,10276 + ,11068 + ,6721 + ,9413 + ,10614 + ,9772 + ,6054 + ,11068 + ,9413 + ,10350 + ,6619 + ,9772 + ,11068 + ,10541 + ,6856 + ,10350 + ,9772 + ,10049 + ,6193 + ,10541 + ,10350 + ,10714 + ,6317 + ,10049 + ,10541 + ,10759 + ,6618 + ,10714 + ,10049 + ,11684 + ,6585 + ,10759 + ,10714 + ,11462 + ,6852 + ,11684 + ,10759 + ,10485 + ,6586 + ,11462 + ,11684 + ,11056 + ,6154 + ,10485 + ,11462 + ,10184 + ,6193 + ,11056 + ,10485 + ,11082 + ,7606 + ,10184 + ,11056 + ,10554 + ,6588 + ,11082 + ,10184 + ,11315 + ,7143 + ,10554 + ,11082 + ,10847 + ,7629 + ,11315 + ,10554 + ,11104 + ,7041 + ,10847 + ,11315 + ,11026 + ,7146 + ,11104 + ,10847 + ,11073 + ,7200 + ,11026 + ,11104 + ,12073 + ,7739 + ,11073 + ,11026 + ,12328 + ,7953 + ,12073 + ,11073 + ,11172 + ,7082 + ,12328 + ,12073) + ,dim=c(4 + ,70) + ,dimnames=list(c('Y' + ,'X' + ,'Y1' + ,'Y2') + ,1:70)) > y <- array(NA,dim=c(4,70),dimnames=list(c('Y','X','Y1','Y2'),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 Y1 Y2 M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t 1 8031 4871 6820 7291 1 0 0 0 0 0 0 0 0 0 0 1 2 7862 4649 8031 6820 0 1 0 0 0 0 0 0 0 0 0 2 3 7357 4922 7862 8031 0 0 1 0 0 0 0 0 0 0 0 3 4 7213 4879 7357 7862 0 0 0 1 0 0 0 0 0 0 0 4 5 7079 4853 7213 7357 0 0 0 0 1 0 0 0 0 0 0 5 6 7012 4545 7079 7213 0 0 0 0 0 1 0 0 0 0 0 6 7 7319 4733 7012 7079 0 0 0 0 0 0 1 0 0 0 0 7 8 8148 5191 7319 7012 0 0 0 0 0 0 0 1 0 0 0 8 9 7599 4983 8148 7319 0 0 0 0 0 0 0 0 1 0 0 9 10 6908 4593 7599 8148 0 0 0 0 0 0 0 0 0 1 0 10 11 7878 4656 6908 7599 0 0 0 0 0 0 0 0 0 0 1 11 12 7407 4513 7878 6908 0 0 0 0 0 0 0 0 0 0 0 12 13 7911 4857 7407 7878 1 0 0 0 0 0 0 0 0 0 0 13 14 7323 4681 7911 7407 0 1 0 0 0 0 0 0 0 0 0 14 15 7179 4897 7323 7911 0 0 1 0 0 0 0 0 0 0 0 15 16 6758 4547 7179 7323 0 0 0 1 0 0 0 0 0 0 0 16 17 6934 4692 6758 7179 0 0 0 0 1 0 0 0 0 0 0 17 18 6696 4390 6934 6758 0 0 0 0 0 1 0 0 0 0 0 18 19 7688 5341 6696 6934 0 0 0 0 0 0 1 0 0 0 0 19 20 8296 5415 7688 6696 0 0 0 0 0 0 0 1 0 0 0 20 21 7697 4890 8296 7688 0 0 0 0 0 0 0 0 1 0 0 21 22 7907 5120 7697 8296 0 0 0 0 0 0 0 0 0 1 0 22 23 7592 4422 7907 7697 0 0 0 0 0 0 0 0 0 0 1 23 24 7710 4797 7592 7907 0 0 0 0 0 0 0 0 0 0 0 24 25 9011 5689 7710 7592 1 0 0 0 0 0 0 0 0 0 0 25 26 8225 5171 9011 7710 0 1 0 0 0 0 0 0 0 0 0 26 27 7733 4265 8225 9011 0 0 1 0 0 0 0 0 0 0 0 27 28 8062 5215 7733 8225 0 0 0 1 0 0 0 0 0 0 0 28 29 7859 4874 8062 7733 0 0 0 0 1 0 0 0 0 0 0 29 30 8221 4590 7859 8062 0 0 0 0 0 1 0 0 0 0 0 30 31 8330 4994 8221 7859 0 0 0 0 0 0 1 0 0 0 0 31 32 8868 4988 8330 8221 0 0 0 0 0 0 0 1 0 0 0 32 33 9053 5110 8868 8330 0 0 0 0 0 0 0 0 1 0 0 33 34 8811 5141 9053 8868 0 0 0 0 0 0 0 0 0 1 0 34 35 8120 4395 8811 9053 0 0 0 0 0 0 0 0 0 0 1 35 36 7953 4523 8120 8811 0 0 0 0 0 0 0 0 0 0 0 36 37 8878 5306 7953 8120 1 0 0 0 0 0 0 0 0 0 0 37 38 8601 5365 8878 7953 0 1 0 0 0 0 0 0 0 0 0 38 39 8361 5496 8601 8878 0 0 1 0 0 0 0 0 0 0 0 39 40 9116 5647 8361 8601 0 0 0 1 0 0 0 0 0 0 0 40 41 9310 5443 9116 8361 0 0 0 0 1 0 0 0 0 0 0 41 42 9891 5546 9310 9116 0 0 0 0 0 1 0 0 0 0 0 42 43 10147 5912 9891 9310 0 0 0 0 0 0 1 0 0 0 0 43 44 10317 5665 10147 9891 0 0 0 0 0 0 0 1 0 0 0 44 45 10682 5963 10317 10147 0 0 0 0 0 0 0 0 1 0 0 45 46 10276 5861 10682 10317 0 0 0 0 0 0 0 0 0 1 0 46 47 10614 5366 10276 10682 0 0 0 0 0 0 0 0 0 0 1 47 48 9413 5619 10614 10276 0 0 0 0 0 0 0 0 0 0 0 48 49 11068 6721 9413 10614 1 0 0 0 0 0 0 0 0 0 0 49 50 9772 6054 11068 9413 0 1 0 0 0 0 0 0 0 0 0 50 51 10350 6619 9772 11068 0 0 1 0 0 0 0 0 0 0 0 51 52 10541 6856 10350 9772 0 0 0 1 0 0 0 0 0 0 0 52 53 10049 6193 10541 10350 0 0 0 0 1 0 0 0 0 0 0 53 54 10714 6317 10049 10541 0 0 0 0 0 1 0 0 0 0 0 54 55 10759 6618 10714 10049 0 0 0 0 0 0 1 0 0 0 0 55 56 11684 6585 10759 10714 0 0 0 0 0 0 0 1 0 0 0 56 57 11462 6852 11684 10759 0 0 0 0 0 0 0 0 1 0 0 57 58 10485 6586 11462 11684 0 0 0 0 0 0 0 0 0 1 0 58 59 11056 6154 10485 11462 0 0 0 0 0 0 0 0 0 0 1 59 60 10184 6193 11056 10485 0 0 0 0 0 0 0 0 0 0 0 60 61 11082 7606 10184 11056 1 0 0 0 0 0 0 0 0 0 0 61 62 10554 6588 11082 10184 0 1 0 0 0 0 0 0 0 0 0 62 63 11315 7143 10554 11082 0 0 1 0 0 0 0 0 0 0 0 63 64 10847 7629 11315 10554 0 0 0 1 0 0 0 0 0 0 0 64 65 11104 7041 10847 11315 0 0 0 0 1 0 0 0 0 0 0 65 66 11026 7146 11104 10847 0 0 0 0 0 1 0 0 0 0 0 66 67 11073 7200 11026 11104 0 0 0 0 0 0 1 0 0 0 0 67 68 12073 7739 11073 11026 0 0 0 0 0 0 0 1 0 0 0 68 69 12328 7953 12073 11073 0 0 0 0 0 0 0 0 1 0 0 69 70 11172 7082 12328 12073 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 Y1 Y2 M1 M2 707.2475 0.4666 0.2947 0.2599 795.7533 187.1643 M3 M4 M5 M6 M7 M8 0.2153 76.4850 150.4361 385.0191 437.4980 902.7498 M9 M10 M11 t 506.8251 -91.7652 534.1266 12.7223 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -620.80 -233.28 -26.65 268.74 633.63 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 707.2475 648.6515 1.090 0.280407 X 0.4666 0.1202 3.881 0.000285 *** Y1 0.2947 0.1185 2.486 0.016033 * Y2 0.2599 0.1153 2.254 0.028248 * M1 795.7533 252.4878 3.152 0.002649 ** M2 187.1643 235.1473 0.796 0.429549 M3 0.2153 233.9516 0.001 0.999269 M4 76.4850 231.9075 0.330 0.742821 M5 150.4361 219.2069 0.686 0.495476 M6 385.0191 217.2466 1.772 0.081992 . M7 437.4980 227.3936 1.924 0.059636 . M8 902.7498 227.5853 3.967 0.000216 *** M9 506.8251 228.5441 2.218 0.030809 * M10 -91.7652 221.0477 -0.415 0.679686 M11 534.1266 229.0672 2.332 0.023474 * t 12.7223 7.1477 1.780 0.080718 . --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 346.6 on 54 degrees of freedom Multiple R-squared: 0.9618, Adjusted R-squared: 0.9511 F-statistic: 90.52 on 15 and 54 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.08747642 0.17495284 0.9125236 [2,] 0.02900723 0.05801446 0.9709928 [3,] 0.06173310 0.12346620 0.9382669 [4,] 0.14620342 0.29240684 0.8537966 [5,] 0.09606277 0.19212554 0.9039372 [6,] 0.05616802 0.11233604 0.9438320 [7,] 0.02926673 0.05853345 0.9707333 [8,] 0.01465739 0.02931478 0.9853426 [9,] 0.18953097 0.37906194 0.8104690 [10,] 0.18538848 0.37077696 0.8146115 [11,] 0.17068479 0.34136959 0.8293152 [12,] 0.22142081 0.44284162 0.7785792 [13,] 0.16534108 0.33068217 0.8346589 [14,] 0.12921947 0.25843895 0.8707805 [15,] 0.17838665 0.35677330 0.8216134 [16,] 0.14305783 0.28611566 0.8569422 [17,] 0.40543425 0.81086849 0.5945658 [18,] 0.34212801 0.68425603 0.6578720 [19,] 0.26715983 0.53431966 0.7328402 [20,] 0.22814875 0.45629749 0.7718513 [21,] 0.59322636 0.81354728 0.4067736 [22,] 0.61662662 0.76674676 0.3833734 [23,] 0.65804285 0.68391430 0.3419571 [24,] 0.59253319 0.81493361 0.4074668 [25,] 0.50970662 0.98058676 0.4902934 [26,] 0.65523752 0.68952497 0.3447625 [27,] 0.81163013 0.37673974 0.1883699 [28,] 0.72657772 0.54684456 0.2734223 [29,] 0.65132090 0.69735819 0.3486791 [30,] 0.68580362 0.62839277 0.3141964 [31,] 0.73296071 0.53407857 0.2670393 [32,] 0.66093738 0.67812524 0.3390626 [33,] 0.52403628 0.95192743 0.4759637 > postscript(file="/var/www/html/rcomp/tmp/10xa41258565825.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/2sexw1258565825.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/31vp31258565825.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/4ocqn1258565825.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/53zlh1258565825.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 337.613562 633.628174 -89.508636 -109.691526 -144.527698 -238.209971 7 8 9 10 11 12 -29.549664 34.735464 -358.112709 -334.993989 313.334977 324.235035 13 14 15 16 17 18 -254.089034 -190.194006 -218.482846 -369.893981 -186.725348 -473.555053 19 20 21 22 23 24 33.921674 -101.039792 -508.921679 198.106113 -336.020253 166.658348 25 26 27 28 29 30 290.112656 -72.396946 -74.022909 72.045628 -27.586772 193.913124 31 32 33 34 35 36 -4.689397 -68.084458 256.321937 391.359672 -566.969594 -5.752077 37 38 39 40 41 42 -25.717490 36.448305 -249.265718 489.019304 531.425093 563.636556 43 44 45 46 47 48 362.029819 -57.168577 435.354148 511.061547 466.161959 -325.542150 49 50 51 52 53 54 272.879358 -291.564083 148.756322 306.746576 -169.123987 286.052088 55 56 57 58 59 60 57.340284 333.639450 85.986487 -356.066100 123.492911 -159.599156 61 62 63 64 65 66 -620.799053 -115.921444 482.523787 -388.226002 -3.461287 -331.836744 67 68 69 70 -419.052716 -142.082087 89.371816 -409.467243 > postscript(file="/var/www/html/rcomp/tmp/6zn4q1258565825.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 337.613562 NA 1 633.628174 337.613562 2 -89.508636 633.628174 3 -109.691526 -89.508636 4 -144.527698 -109.691526 5 -238.209971 -144.527698 6 -29.549664 -238.209971 7 34.735464 -29.549664 8 -358.112709 34.735464 9 -334.993989 -358.112709 10 313.334977 -334.993989 11 324.235035 313.334977 12 -254.089034 324.235035 13 -190.194006 -254.089034 14 -218.482846 -190.194006 15 -369.893981 -218.482846 16 -186.725348 -369.893981 17 -473.555053 -186.725348 18 33.921674 -473.555053 19 -101.039792 33.921674 20 -508.921679 -101.039792 21 198.106113 -508.921679 22 -336.020253 198.106113 23 166.658348 -336.020253 24 290.112656 166.658348 25 -72.396946 290.112656 26 -74.022909 -72.396946 27 72.045628 -74.022909 28 -27.586772 72.045628 29 193.913124 -27.586772 30 -4.689397 193.913124 31 -68.084458 -4.689397 32 256.321937 -68.084458 33 391.359672 256.321937 34 -566.969594 391.359672 35 -5.752077 -566.969594 36 -25.717490 -5.752077 37 36.448305 -25.717490 38 -249.265718 36.448305 39 489.019304 -249.265718 40 531.425093 489.019304 41 563.636556 531.425093 42 362.029819 563.636556 43 -57.168577 362.029819 44 435.354148 -57.168577 45 511.061547 435.354148 46 466.161959 511.061547 47 -325.542150 466.161959 48 272.879358 -325.542150 49 -291.564083 272.879358 50 148.756322 -291.564083 51 306.746576 148.756322 52 -169.123987 306.746576 53 286.052088 -169.123987 54 57.340284 286.052088 55 333.639450 57.340284 56 85.986487 333.639450 57 -356.066100 85.986487 58 123.492911 -356.066100 59 -159.599156 123.492911 60 -620.799053 -159.599156 61 -115.921444 -620.799053 62 482.523787 -115.921444 63 -388.226002 482.523787 64 -3.461287 -388.226002 65 -331.836744 -3.461287 66 -419.052716 -331.836744 67 -142.082087 -419.052716 68 89.371816 -142.082087 69 -409.467243 89.371816 70 NA -409.467243 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] 633.628174 337.613562 [2,] -89.508636 633.628174 [3,] -109.691526 -89.508636 [4,] -144.527698 -109.691526 [5,] -238.209971 -144.527698 [6,] -29.549664 -238.209971 [7,] 34.735464 -29.549664 [8,] -358.112709 34.735464 [9,] -334.993989 -358.112709 [10,] 313.334977 -334.993989 [11,] 324.235035 313.334977 [12,] -254.089034 324.235035 [13,] -190.194006 -254.089034 [14,] -218.482846 -190.194006 [15,] -369.893981 -218.482846 [16,] -186.725348 -369.893981 [17,] -473.555053 -186.725348 [18,] 33.921674 -473.555053 [19,] -101.039792 33.921674 [20,] -508.921679 -101.039792 [21,] 198.106113 -508.921679 [22,] -336.020253 198.106113 [23,] 166.658348 -336.020253 [24,] 290.112656 166.658348 [25,] -72.396946 290.112656 [26,] -74.022909 -72.396946 [27,] 72.045628 -74.022909 [28,] -27.586772 72.045628 [29,] 193.913124 -27.586772 [30,] -4.689397 193.913124 [31,] -68.084458 -4.689397 [32,] 256.321937 -68.084458 [33,] 391.359672 256.321937 [34,] -566.969594 391.359672 [35,] -5.752077 -566.969594 [36,] -25.717490 -5.752077 [37,] 36.448305 -25.717490 [38,] -249.265718 36.448305 [39,] 489.019304 -249.265718 [40,] 531.425093 489.019304 [41,] 563.636556 531.425093 [42,] 362.029819 563.636556 [43,] -57.168577 362.029819 [44,] 435.354148 -57.168577 [45,] 511.061547 435.354148 [46,] 466.161959 511.061547 [47,] -325.542150 466.161959 [48,] 272.879358 -325.542150 [49,] -291.564083 272.879358 [50,] 148.756322 -291.564083 [51,] 306.746576 148.756322 [52,] -169.123987 306.746576 [53,] 286.052088 -169.123987 [54,] 57.340284 286.052088 [55,] 333.639450 57.340284 [56,] 85.986487 333.639450 [57,] -356.066100 85.986487 [58,] 123.492911 -356.066100 [59,] -159.599156 123.492911 [60,] -620.799053 -159.599156 [61,] -115.921444 -620.799053 [62,] 482.523787 -115.921444 [63,] -388.226002 482.523787 [64,] -3.461287 -388.226002 [65,] -331.836744 -3.461287 [66,] -419.052716 -331.836744 [67,] -142.082087 -419.052716 [68,] 89.371816 -142.082087 [69,] -409.467243 89.371816 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 633.628174 337.613562 2 -89.508636 633.628174 3 -109.691526 -89.508636 4 -144.527698 -109.691526 5 -238.209971 -144.527698 6 -29.549664 -238.209971 7 34.735464 -29.549664 8 -358.112709 34.735464 9 -334.993989 -358.112709 10 313.334977 -334.993989 11 324.235035 313.334977 12 -254.089034 324.235035 13 -190.194006 -254.089034 14 -218.482846 -190.194006 15 -369.893981 -218.482846 16 -186.725348 -369.893981 17 -473.555053 -186.725348 18 33.921674 -473.555053 19 -101.039792 33.921674 20 -508.921679 -101.039792 21 198.106113 -508.921679 22 -336.020253 198.106113 23 166.658348 -336.020253 24 290.112656 166.658348 25 -72.396946 290.112656 26 -74.022909 -72.396946 27 72.045628 -74.022909 28 -27.586772 72.045628 29 193.913124 -27.586772 30 -4.689397 193.913124 31 -68.084458 -4.689397 32 256.321937 -68.084458 33 391.359672 256.321937 34 -566.969594 391.359672 35 -5.752077 -566.969594 36 -25.717490 -5.752077 37 36.448305 -25.717490 38 -249.265718 36.448305 39 489.019304 -249.265718 40 531.425093 489.019304 41 563.636556 531.425093 42 362.029819 563.636556 43 -57.168577 362.029819 44 435.354148 -57.168577 45 511.061547 435.354148 46 466.161959 511.061547 47 -325.542150 466.161959 48 272.879358 -325.542150 49 -291.564083 272.879358 50 148.756322 -291.564083 51 306.746576 148.756322 52 -169.123987 306.746576 53 286.052088 -169.123987 54 57.340284 286.052088 55 333.639450 57.340284 56 85.986487 333.639450 57 -356.066100 85.986487 58 123.492911 -356.066100 59 -159.599156 123.492911 60 -620.799053 -159.599156 61 -115.921444 -620.799053 62 482.523787 -115.921444 63 -388.226002 482.523787 64 -3.461287 -388.226002 65 -331.836744 -3.461287 66 -419.052716 -331.836744 67 -142.082087 -419.052716 68 89.371816 -142.082087 69 -409.467243 89.371816 > 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/7c9we1258565825.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/8xacr1258565825.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/9mefi1258565825.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/106fb51258565825.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/114fku1258565825.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/12jct01258565825.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/133jn61258565825.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/1480yx1258565825.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/15lmg61258565825.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/164e3u1258565825.tab") + } > > system("convert tmp/10xa41258565825.ps tmp/10xa41258565825.png") > system("convert tmp/2sexw1258565825.ps tmp/2sexw1258565825.png") > system("convert tmp/31vp31258565825.ps tmp/31vp31258565825.png") > system("convert tmp/4ocqn1258565825.ps tmp/4ocqn1258565825.png") > system("convert tmp/53zlh1258565825.ps tmp/53zlh1258565825.png") > system("convert tmp/6zn4q1258565825.ps tmp/6zn4q1258565825.png") > system("convert tmp/7c9we1258565825.ps tmp/7c9we1258565825.png") > system("convert tmp/8xacr1258565825.ps tmp/8xacr1258565825.png") > system("convert tmp/9mefi1258565825.ps tmp/9mefi1258565825.png") > system("convert tmp/106fb51258565825.ps tmp/106fb51258565825.png") > > > proc.time() user system elapsed 2.598 1.614 2.980