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(3499 + ,1 + ,4164 + ,3902 + ,3186 + ,3353 + ,4145 + ,1 + ,3499 + ,4164 + ,3902 + ,3186 + ,3796 + ,1 + ,4145 + ,3499 + ,4164 + ,3902 + ,3711 + ,1 + ,3796 + ,4145 + ,3499 + ,4164 + ,3949 + ,1 + ,3711 + ,3796 + ,4145 + ,3499 + ,3740 + ,1 + ,3949 + ,3711 + ,3796 + ,4145 + ,3243 + ,1 + ,3740 + ,3949 + ,3711 + ,3796 + ,4407 + ,1 + ,3243 + ,3740 + ,3949 + ,3711 + ,4814 + ,1 + ,4407 + ,3243 + ,3740 + ,3949 + ,3908 + ,1 + ,4814 + ,4407 + ,3243 + ,3740 + ,5250 + ,1 + ,3908 + ,4814 + ,4407 + ,3243 + ,3937 + ,1 + ,5250 + ,3908 + ,4814 + ,4407 + ,4004 + ,1 + ,3937 + ,5250 + ,3908 + ,4814 + ,5560 + ,1 + ,4004 + ,3937 + ,5250 + ,3908 + ,3922 + ,1 + ,5560 + ,4004 + ,3937 + ,5250 + ,3759 + ,1 + ,3922 + ,5560 + ,4004 + ,3937 + ,4138 + ,1 + ,3759 + ,3922 + ,5560 + ,4004 + ,4634 + ,1 + ,4138 + ,3759 + ,3922 + ,5560 + ,3996 + ,1 + ,4634 + ,4138 + ,3759 + ,3922 + ,4308 + ,1 + ,3996 + ,4634 + ,4138 + ,3759 + ,4143 + ,0 + ,4308 + ,3996 + ,4634 + ,4138 + ,4429 + ,0 + ,4143 + ,4308 + ,3996 + ,4634 + ,5219 + ,0 + ,4429 + ,4143 + ,4308 + ,3996 + ,4929 + ,0 + ,5219 + ,4429 + ,4143 + ,4308 + ,5755 + ,0 + ,4929 + ,5219 + ,4429 + ,4143 + ,5592 + ,0 + ,5755 + ,4929 + ,5219 + ,4429 + ,4163 + ,0 + ,5592 + ,5755 + ,4929 + ,5219 + ,4962 + ,0 + ,4163 + ,5592 + ,5755 + ,4929 + ,5208 + ,0 + ,4962 + ,4163 + ,5592 + ,5755 + ,4755 + ,0 + ,5208 + ,4962 + ,4163 + ,5592 + ,4491 + ,0 + ,4755 + ,5208 + ,4962 + ,4163 + ,5732 + ,0 + ,4491 + ,4755 + ,5208 + ,4962 + ,5731 + ,0 + ,5732 + ,4491 + ,4755 + ,5208 + ,5040 + ,0 + ,5731 + ,5732 + ,4491 + ,4755 + ,6102 + ,0 + ,5040 + ,5731 + ,5732 + ,4491 + ,4904 + ,0 + ,6102 + ,5040 + ,5731 + ,5732 + ,5369 + ,0 + ,4904 + ,6102 + ,5040 + ,5731 + ,5578 + ,0 + ,5369 + ,4904 + ,6102 + ,5040 + ,4619 + ,0 + ,5578 + ,5369 + ,4904 + ,6102 + ,4731 + ,0 + ,4619 + ,5578 + ,5369 + ,4904 + ,5011 + ,0 + ,4731 + ,4619 + ,5578 + ,5369 + ,5299 + ,0 + ,5011 + ,4731 + ,4619 + ,5578 + ,4146 + ,0 + ,5299 + ,5011 + ,4731 + ,4619 + ,4625 + ,0 + ,4146 + ,5299 + ,5011 + ,4731 + ,4736 + ,0 + ,4625 + ,4146 + ,5299 + ,5011 + ,4219 + ,0 + ,4736 + ,4625 + ,4146 + ,5299 + ,5116 + ,0 + ,4219 + ,4736 + ,4625 + ,4146 + ,4205 + ,0 + ,5116 + ,4219 + ,4736 + ,4625 + ,4121 + ,0 + ,4205 + ,5116 + ,4219 + ,4736 + ,5103 + ,1 + ,4121 + ,4205 + ,5116 + ,4219 + ,4300 + ,1 + ,5103 + ,4121 + ,4205 + ,5116 + ,4578 + ,1 + ,4300 + ,5103 + ,4121 + ,4205 + ,3809 + ,1 + ,4578 + ,4300 + ,5103 + ,4121 + ,5526 + ,1 + ,3809 + ,4578 + ,4300 + ,5103 + ,4247 + ,1 + ,5526 + ,3809 + ,4578 + ,4300 + ,3830 + ,1 + ,4247 + ,5526 + ,3809 + ,4578 + ,4394 + ,1 + ,3830 + ,4247 + ,5526 + ,3809) + ,dim=c(6 + ,57) + ,dimnames=list(c('Y' + ,'X' + ,'Y1' + ,'Y2' + ,'Y3' + ,'Y4') + ,1:57)) > y <- array(NA,dim=c(6,57),dimnames=list(c('Y','X','Y1','Y2','Y3','Y4'),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 Y3 Y4 M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t 1 3499 1 4164 3902 3186 3353 1 0 0 0 0 0 0 0 0 0 0 1 2 4145 1 3499 4164 3902 3186 0 1 0 0 0 0 0 0 0 0 0 2 3 3796 1 4145 3499 4164 3902 0 0 1 0 0 0 0 0 0 0 0 3 4 3711 1 3796 4145 3499 4164 0 0 0 1 0 0 0 0 0 0 0 4 5 3949 1 3711 3796 4145 3499 0 0 0 0 1 0 0 0 0 0 0 5 6 3740 1 3949 3711 3796 4145 0 0 0 0 0 1 0 0 0 0 0 6 7 3243 1 3740 3949 3711 3796 0 0 0 0 0 0 1 0 0 0 0 7 8 4407 1 3243 3740 3949 3711 0 0 0 0 0 0 0 1 0 0 0 8 9 4814 1 4407 3243 3740 3949 0 0 0 0 0 0 0 0 1 0 0 9 10 3908 1 4814 4407 3243 3740 0 0 0 0 0 0 0 0 0 1 0 10 11 5250 1 3908 4814 4407 3243 0 0 0 0 0 0 0 0 0 0 1 11 12 3937 1 5250 3908 4814 4407 0 0 0 0 0 0 0 0 0 0 0 12 13 4004 1 3937 5250 3908 4814 1 0 0 0 0 0 0 0 0 0 0 13 14 5560 1 4004 3937 5250 3908 0 1 0 0 0 0 0 0 0 0 0 14 15 3922 1 5560 4004 3937 5250 0 0 1 0 0 0 0 0 0 0 0 15 16 3759 1 3922 5560 4004 3937 0 0 0 1 0 0 0 0 0 0 0 16 17 4138 1 3759 3922 5560 4004 0 0 0 0 1 0 0 0 0 0 0 17 18 4634 1 4138 3759 3922 5560 0 0 0 0 0 1 0 0 0 0 0 18 19 3996 1 4634 4138 3759 3922 0 0 0 0 0 0 1 0 0 0 0 19 20 4308 1 3996 4634 4138 3759 0 0 0 0 0 0 0 1 0 0 0 20 21 4143 0 4308 3996 4634 4138 0 0 0 0 0 0 0 0 1 0 0 21 22 4429 0 4143 4308 3996 4634 0 0 0 0 0 0 0 0 0 1 0 22 23 5219 0 4429 4143 4308 3996 0 0 0 0 0 0 0 0 0 0 1 23 24 4929 0 5219 4429 4143 4308 0 0 0 0 0 0 0 0 0 0 0 24 25 5755 0 4929 5219 4429 4143 1 0 0 0 0 0 0 0 0 0 0 25 26 5592 0 5755 4929 5219 4429 0 1 0 0 0 0 0 0 0 0 0 26 27 4163 0 5592 5755 4929 5219 0 0 1 0 0 0 0 0 0 0 0 27 28 4962 0 4163 5592 5755 4929 0 0 0 1 0 0 0 0 0 0 0 28 29 5208 0 4962 4163 5592 5755 0 0 0 0 1 0 0 0 0 0 0 29 30 4755 0 5208 4962 4163 5592 0 0 0 0 0 1 0 0 0 0 0 30 31 4491 0 4755 5208 4962 4163 0 0 0 0 0 0 1 0 0 0 0 31 32 5732 0 4491 4755 5208 4962 0 0 0 0 0 0 0 1 0 0 0 32 33 5731 0 5732 4491 4755 5208 0 0 0 0 0 0 0 0 1 0 0 33 34 5040 0 5731 5732 4491 4755 0 0 0 0 0 0 0 0 0 1 0 34 35 6102 0 5040 5731 5732 4491 0 0 0 0 0 0 0 0 0 0 1 35 36 4904 0 6102 5040 5731 5732 0 0 0 0 0 0 0 0 0 0 0 36 37 5369 0 4904 6102 5040 5731 1 0 0 0 0 0 0 0 0 0 0 37 38 5578 0 5369 4904 6102 5040 0 1 0 0 0 0 0 0 0 0 0 38 39 4619 0 5578 5369 4904 6102 0 0 1 0 0 0 0 0 0 0 0 39 40 4731 0 4619 5578 5369 4904 0 0 0 1 0 0 0 0 0 0 0 40 41 5011 0 4731 4619 5578 5369 0 0 0 0 1 0 0 0 0 0 0 41 42 5299 0 5011 4731 4619 5578 0 0 0 0 0 1 0 0 0 0 0 42 43 4146 0 5299 5011 4731 4619 0 0 0 0 0 0 1 0 0 0 0 43 44 4625 0 4146 5299 5011 4731 0 0 0 0 0 0 0 1 0 0 0 44 45 4736 0 4625 4146 5299 5011 0 0 0 0 0 0 0 0 1 0 0 45 46 4219 0 4736 4625 4146 5299 0 0 0 0 0 0 0 0 0 1 0 46 47 5116 0 4219 4736 4625 4146 0 0 0 0 0 0 0 0 0 0 1 47 48 4205 0 5116 4219 4736 4625 0 0 0 0 0 0 0 0 0 0 0 48 49 4121 0 4205 5116 4219 4736 1 0 0 0 0 0 0 0 0 0 0 49 50 5103 1 4121 4205 5116 4219 0 1 0 0 0 0 0 0 0 0 0 50 51 4300 1 5103 4121 4205 5116 0 0 1 0 0 0 0 0 0 0 0 51 52 4578 1 4300 5103 4121 4205 0 0 0 1 0 0 0 0 0 0 0 52 53 3809 1 4578 4300 5103 4121 0 0 0 0 1 0 0 0 0 0 0 53 54 5526 1 3809 4578 4300 5103 0 0 0 0 0 1 0 0 0 0 0 54 55 4247 1 5526 3809 4578 4300 0 0 0 0 0 0 1 0 0 0 0 55 56 3830 1 4247 5526 3809 4578 0 0 0 0 0 0 0 1 0 0 0 56 57 4394 1 3830 4247 5526 3809 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 Y3 Y4 815.44005 -146.98586 0.32207 -0.09803 0.38574 0.12049 M1 M2 M3 M4 M5 M6 756.04155 1003.38138 -76.43364 546.36980 196.75508 882.12846 M7 M8 M9 M10 M11 t 58.57740 847.25487 597.63691 482.01412 1430.83046 -1.58386 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -672.83 -240.73 -83.28 229.57 1009.44 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 815.44005 1073.55646 0.760 0.452079 X -146.98586 193.28943 -0.760 0.451562 Y1 0.32207 0.15600 2.064 0.045668 * Y2 -0.09803 0.15672 -0.626 0.535254 Y3 0.38574 0.15882 2.429 0.019858 * Y4 0.12049 0.17061 0.706 0.484230 M1 756.04155 385.70046 1.960 0.057147 . M2 1003.38138 327.00956 3.068 0.003904 ** M3 -76.43364 327.67708 -0.233 0.816780 M4 546.36980 392.63877 1.392 0.171951 M5 196.75508 335.58480 0.586 0.561049 M6 882.12846 378.26228 2.332 0.024954 * M7 58.57740 314.27992 0.186 0.853108 M8 847.25487 376.57453 2.250 0.030172 * M9 597.63691 315.11334 1.897 0.065308 . M10 482.01412 365.35485 1.319 0.194761 M11 1430.83046 367.60310 3.892 0.000377 *** t -1.58386 4.61848 -0.343 0.733485 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 438.6 on 39 degrees of freedom Multiple R-squared: 0.701, Adjusted R-squared: 0.5707 F-statistic: 5.379 on 17 and 39 DF, p-value: 7.012e-06 > 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.4611570 0.9223141 0.53884296 [2,] 0.3222646 0.6445292 0.67773541 [3,] 0.2823879 0.5647757 0.71761214 [4,] 0.4572472 0.9144945 0.54275277 [5,] 0.8986205 0.2027590 0.10137948 [6,] 0.8298377 0.3403246 0.17016231 [7,] 0.7611462 0.4777076 0.23885382 [8,] 0.7285398 0.5429205 0.27146023 [9,] 0.6465258 0.7069483 0.35347417 [10,] 0.9146312 0.1707377 0.08536884 [11,] 0.9338303 0.1323394 0.06616969 [12,] 0.8917503 0.2164994 0.10824972 [13,] 0.8203169 0.3593662 0.17968310 [14,] 0.8098168 0.3803665 0.19018323 [15,] 0.7428166 0.5143669 0.25718345 [16,] 0.7117627 0.5764745 0.28823727 > postscript(file="/var/www/html/rcomp/tmp/1ukni1258622710.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/24mez1258622710.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/3xu0v1258622710.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/4f00g1258622710.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/51p561258622710.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 7 -515.44692 -131.40949 140.40537 -165.13782 248.16523 -672.82591 -179.20703 8 9 10 11 12 13 14 255.71389 542.24951 -46.61940 290.72712 -408.14009 -240.72737 510.72900 15 16 17 18 19 20 21 -195.66932 -167.44000 -153.60340 -35.08691 289.70263 -57.84209 -518.64906 22 23 24 25 26 27 28 154.62010 -154.37347 787.69842 939.64687 -102.75934 -300.21494 38.14311 29 30 31 32 33 34 35 201.26815 -365.56193 229.56747 532.92396 502.65816 207.26467 97.59244 36 37 38 39 40 41 42 -226.91631 240.23765 -390.11436 44.70643 -170.17828 194.28606 64.03648 43 44 45 46 47 48 49 -256.78290 -286.80234 -336.73333 -315.26536 -233.94610 -152.64202 -423.71023 50 51 52 53 54 55 56 113.55418 310.77246 464.61299 -490.11604 1009.43826 -83.28017 -443.99342 57 -189.52528 > postscript(file="/var/www/html/rcomp/tmp/6ilrx1258622710.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 -515.44692 NA 1 -131.40949 -515.44692 2 140.40537 -131.40949 3 -165.13782 140.40537 4 248.16523 -165.13782 5 -672.82591 248.16523 6 -179.20703 -672.82591 7 255.71389 -179.20703 8 542.24951 255.71389 9 -46.61940 542.24951 10 290.72712 -46.61940 11 -408.14009 290.72712 12 -240.72737 -408.14009 13 510.72900 -240.72737 14 -195.66932 510.72900 15 -167.44000 -195.66932 16 -153.60340 -167.44000 17 -35.08691 -153.60340 18 289.70263 -35.08691 19 -57.84209 289.70263 20 -518.64906 -57.84209 21 154.62010 -518.64906 22 -154.37347 154.62010 23 787.69842 -154.37347 24 939.64687 787.69842 25 -102.75934 939.64687 26 -300.21494 -102.75934 27 38.14311 -300.21494 28 201.26815 38.14311 29 -365.56193 201.26815 30 229.56747 -365.56193 31 532.92396 229.56747 32 502.65816 532.92396 33 207.26467 502.65816 34 97.59244 207.26467 35 -226.91631 97.59244 36 240.23765 -226.91631 37 -390.11436 240.23765 38 44.70643 -390.11436 39 -170.17828 44.70643 40 194.28606 -170.17828 41 64.03648 194.28606 42 -256.78290 64.03648 43 -286.80234 -256.78290 44 -336.73333 -286.80234 45 -315.26536 -336.73333 46 -233.94610 -315.26536 47 -152.64202 -233.94610 48 -423.71023 -152.64202 49 113.55418 -423.71023 50 310.77246 113.55418 51 464.61299 310.77246 52 -490.11604 464.61299 53 1009.43826 -490.11604 54 -83.28017 1009.43826 55 -443.99342 -83.28017 56 -189.52528 -443.99342 57 NA -189.52528 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -131.40949 -515.44692 [2,] 140.40537 -131.40949 [3,] -165.13782 140.40537 [4,] 248.16523 -165.13782 [5,] -672.82591 248.16523 [6,] -179.20703 -672.82591 [7,] 255.71389 -179.20703 [8,] 542.24951 255.71389 [9,] -46.61940 542.24951 [10,] 290.72712 -46.61940 [11,] -408.14009 290.72712 [12,] -240.72737 -408.14009 [13,] 510.72900 -240.72737 [14,] -195.66932 510.72900 [15,] -167.44000 -195.66932 [16,] -153.60340 -167.44000 [17,] -35.08691 -153.60340 [18,] 289.70263 -35.08691 [19,] -57.84209 289.70263 [20,] -518.64906 -57.84209 [21,] 154.62010 -518.64906 [22,] -154.37347 154.62010 [23,] 787.69842 -154.37347 [24,] 939.64687 787.69842 [25,] -102.75934 939.64687 [26,] -300.21494 -102.75934 [27,] 38.14311 -300.21494 [28,] 201.26815 38.14311 [29,] -365.56193 201.26815 [30,] 229.56747 -365.56193 [31,] 532.92396 229.56747 [32,] 502.65816 532.92396 [33,] 207.26467 502.65816 [34,] 97.59244 207.26467 [35,] -226.91631 97.59244 [36,] 240.23765 -226.91631 [37,] -390.11436 240.23765 [38,] 44.70643 -390.11436 [39,] -170.17828 44.70643 [40,] 194.28606 -170.17828 [41,] 64.03648 194.28606 [42,] -256.78290 64.03648 [43,] -286.80234 -256.78290 [44,] -336.73333 -286.80234 [45,] -315.26536 -336.73333 [46,] -233.94610 -315.26536 [47,] -152.64202 -233.94610 [48,] -423.71023 -152.64202 [49,] 113.55418 -423.71023 [50,] 310.77246 113.55418 [51,] 464.61299 310.77246 [52,] -490.11604 464.61299 [53,] 1009.43826 -490.11604 [54,] -83.28017 1009.43826 [55,] -443.99342 -83.28017 [56,] -189.52528 -443.99342 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -131.40949 -515.44692 2 140.40537 -131.40949 3 -165.13782 140.40537 4 248.16523 -165.13782 5 -672.82591 248.16523 6 -179.20703 -672.82591 7 255.71389 -179.20703 8 542.24951 255.71389 9 -46.61940 542.24951 10 290.72712 -46.61940 11 -408.14009 290.72712 12 -240.72737 -408.14009 13 510.72900 -240.72737 14 -195.66932 510.72900 15 -167.44000 -195.66932 16 -153.60340 -167.44000 17 -35.08691 -153.60340 18 289.70263 -35.08691 19 -57.84209 289.70263 20 -518.64906 -57.84209 21 154.62010 -518.64906 22 -154.37347 154.62010 23 787.69842 -154.37347 24 939.64687 787.69842 25 -102.75934 939.64687 26 -300.21494 -102.75934 27 38.14311 -300.21494 28 201.26815 38.14311 29 -365.56193 201.26815 30 229.56747 -365.56193 31 532.92396 229.56747 32 502.65816 532.92396 33 207.26467 502.65816 34 97.59244 207.26467 35 -226.91631 97.59244 36 240.23765 -226.91631 37 -390.11436 240.23765 38 44.70643 -390.11436 39 -170.17828 44.70643 40 194.28606 -170.17828 41 64.03648 194.28606 42 -256.78290 64.03648 43 -286.80234 -256.78290 44 -336.73333 -286.80234 45 -315.26536 -336.73333 46 -233.94610 -315.26536 47 -152.64202 -233.94610 48 -423.71023 -152.64202 49 113.55418 -423.71023 50 310.77246 113.55418 51 464.61299 310.77246 52 -490.11604 464.61299 53 1009.43826 -490.11604 54 -83.28017 1009.43826 55 -443.99342 -83.28017 56 -189.52528 -443.99342 > 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/7ob7h1258622710.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/80y0z1258622710.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/93v2k1258622710.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/10qcvz1258622710.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/11sxkj1258622710.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/12frzn1258622710.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/13ccyd1258622710.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/14i86o1258622710.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/15kct31258622710.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/16dg3k1258622710.tab") + } > > system("convert tmp/1ukni1258622710.ps tmp/1ukni1258622710.png") > system("convert tmp/24mez1258622710.ps tmp/24mez1258622710.png") > system("convert tmp/3xu0v1258622710.ps tmp/3xu0v1258622710.png") > system("convert tmp/4f00g1258622710.ps tmp/4f00g1258622710.png") > system("convert tmp/51p561258622710.ps tmp/51p561258622710.png") > system("convert tmp/6ilrx1258622710.ps tmp/6ilrx1258622710.png") > system("convert tmp/7ob7h1258622710.ps tmp/7ob7h1258622710.png") > system("convert tmp/80y0z1258622710.ps tmp/80y0z1258622710.png") > system("convert tmp/93v2k1258622710.ps tmp/93v2k1258622710.png") > system("convert tmp/10qcvz1258622710.ps tmp/10qcvz1258622710.png") > > > proc.time() user system elapsed 2.333 1.544 2.846