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(4132 + ,537 + ,4486 + ,4625 + ,3971 + ,3397 + ,4685 + ,543 + ,4132 + ,4486 + ,4625 + ,3971 + ,3172 + ,594 + ,4685 + ,4132 + ,4486 + ,4625 + ,4280 + ,611 + ,3172 + ,4685 + ,4132 + ,4486 + ,4207 + ,613 + ,4280 + ,3172 + ,4685 + ,4132 + ,4158 + ,611 + ,4207 + ,4280 + ,3172 + ,4685 + ,3933 + ,594 + ,4158 + ,4207 + ,4280 + ,3172 + ,3151 + ,595 + ,3933 + ,4158 + ,4207 + ,4280 + ,3616 + ,591 + ,3151 + ,3933 + ,4158 + ,4207 + ,4221 + ,589 + ,3616 + ,3151 + ,3933 + ,4158 + ,4436 + ,584 + ,4221 + ,3616 + ,3151 + ,3933 + ,4807 + ,573 + ,4436 + ,4221 + ,3616 + ,3151 + ,4849 + ,567 + ,4807 + ,4436 + ,4221 + ,3616 + ,5024 + ,569 + ,4849 + ,4807 + ,4436 + ,4221 + ,3521 + ,621 + ,5024 + ,4849 + ,4807 + ,4436 + ,4650 + ,629 + ,3521 + ,5024 + ,4849 + ,4807 + ,5393 + ,628 + ,4650 + ,3521 + ,5024 + ,4849 + ,5147 + ,612 + ,5393 + ,4650 + ,3521 + ,5024 + ,4845 + ,595 + ,5147 + ,5393 + ,4650 + ,3521 + ,3995 + ,597 + ,4845 + ,5147 + ,5393 + ,4650 + ,4493 + ,593 + ,3995 + ,4845 + ,5147 + ,5393 + ,4680 + ,590 + ,4493 + ,3995 + ,4845 + ,5147 + ,5463 + ,580 + ,4680 + ,4493 + ,3995 + ,4845 + ,4761 + ,574 + ,5463 + ,4680 + ,4493 + ,3995 + ,5307 + ,573 + ,4761 + ,5463 + ,4680 + ,4493 + ,5069 + ,573 + ,5307 + ,4761 + ,5463 + ,4680 + ,3501 + ,620 + ,5069 + ,5307 + ,4761 + ,5463 + ,4952 + ,626 + ,3501 + ,5069 + ,5307 + ,4761 + ,5152 + ,620 + ,4952 + ,3501 + ,5069 + ,5307 + ,5317 + ,588 + ,5152 + ,4952 + ,3501 + ,5069 + ,5189 + ,566 + ,5317 + ,5152 + ,4952 + ,3501 + ,4030 + ,557 + ,5189 + ,5317 + ,5152 + ,4952 + ,4420 + ,561 + ,4030 + ,5189 + ,5317 + ,5152 + ,4571 + ,549 + ,4420 + ,4030 + ,5189 + ,5317 + ,4551 + ,532 + ,4571 + ,4420 + ,4030 + ,5189 + ,4819 + ,526 + ,4551 + ,4571 + ,4420 + ,4030 + ,5133 + ,511 + ,4819 + ,4551 + ,4571 + ,4420 + ,4532 + ,499 + ,5133 + ,4819 + ,4551 + ,4571 + ,3339 + ,555 + ,4532 + ,5133 + ,4819 + ,4551 + ,4380 + ,565 + ,3339 + ,4532 + ,5133 + ,4819 + ,4632 + ,542 + ,4380 + ,3339 + ,4532 + ,5133 + ,4719 + ,527 + ,4632 + ,4380 + ,3339 + ,4532 + ,4212 + ,510 + ,4719 + ,4632 + ,4380 + ,3339 + ,3615 + ,514 + ,4212 + ,4719 + ,4632 + ,4380 + ,3420 + ,517 + ,3615 + ,4212 + ,4719 + ,4632 + ,4571 + ,508 + ,3420 + ,3615 + ,4212 + ,4719 + ,4407 + ,493 + ,4571 + ,3420 + ,3615 + ,4212 + ,4386 + ,490 + ,4407 + ,4571 + ,3420 + ,3615 + ,4386 + ,469 + ,4386 + ,4407 + ,4571 + ,3420 + ,4744 + ,478 + ,4386 + ,4386 + ,4407 + ,4571 + ,3185 + ,528 + ,4744 + ,4386 + ,4386 + ,4407 + ,3890 + ,534 + ,3185 + ,4744 + ,4386 + ,4386 + ,4520 + ,518 + ,3890 + ,3185 + ,4744 + ,4386 + ,3990 + ,506 + ,4520 + ,3890 + ,3185 + ,4744 + ,3809 + ,502 + ,3990 + ,4520 + ,3890 + ,3185 + ,3236 + ,516 + ,3809 + ,3990 + ,4520 + ,3890 + ,3551 + ,528 + ,3236 + ,3809 + ,3990 + ,4520 + ,3264 + ,533 + ,3551 + ,3236 + ,3809 + ,3990 + ,3579 + ,536 + ,3264 + ,3551 + ,3236 + ,3809 + ,3537 + ,537 + ,3579 + ,3264 + ,3551 + ,3236 + ,3038 + ,524 + ,3537 + ,3579 + ,3264 + ,3551 + ,2888 + ,536 + ,3038 + ,3537 + ,3579 + ,3264 + ,2198 + ,587 + ,2888 + ,3038 + ,3537 + ,3579) + ,dim=c(6 + ,63) + ,dimnames=list(c('Y' + ,'X' + ,'Y1' + ,'Y2' + ,'Y3' + ,'Y4') + ,1:63)) > y <- array(NA,dim=c(6,63),dimnames=list(c('Y','X','Y1','Y2','Y3','Y4'),1:63)) > for (i in 1:dim(x)[1]) + { + for (j in 1:dim(x)[2]) + { + y[i,j] <- as.numeric(x[i,j]) + } + } > par3 = 'No Linear Trend' > par2 = 'Include Monthly Dummies' > par1 = '1' > #'GNU S' R Code compiled by R2WASP v. 1.0.44 () > #Author: Prof. Dr. P. Wessa > #To cite this work: AUTHOR(S), (YEAR), YOUR SOFTWARE TITLE (vNUMBER) in Free Statistics Software (v$_version), Office for Research Development and Education, URL http://www.wessa.net/rwasp_YOURPAGE.wasp/ > #Source of accompanying publication: Office for Research, Development, and Education > #Technical description: Write here your technical program description (don't use hard returns!) > library(lattice) > library(lmtest) Loading required package: zoo Attaching package: 'zoo' The following object(s) are masked from package:base : as.Date.numeric > n25 <- 25 #minimum number of obs. for Goldfeld-Quandt test > par1 <- as.numeric(par1) > x <- t(y) > k <- length(x[1,]) > n <- length(x[,1]) > x1 <- cbind(x[,par1], x[,1:k!=par1]) > mycolnames <- c(colnames(x)[par1], colnames(x)[1:k!=par1]) > colnames(x1) <- mycolnames #colnames(x)[par1] > x <- x1 > if (par3 == 'First Differences'){ + x2 <- array(0, dim=c(n-1,k), dimnames=list(1:(n-1), paste('(1-B)',colnames(x),sep=''))) + for (i in 1:n-1) { + for (j in 1:k) { + x2[i,j] <- x[i+1,j] - x[i,j] + } + } + x <- x2 + } > if (par2 == 'Include Monthly Dummies'){ + x2 <- array(0, dim=c(n,11), dimnames=list(1:n, paste('M', seq(1:11), sep =''))) + for (i in 1:11){ + x2[seq(i,n,12),i] <- 1 + } + x <- cbind(x, x2) + } > if (par2 == 'Include Quarterly Dummies'){ + x2 <- array(0, dim=c(n,3), dimnames=list(1:n, paste('Q', seq(1:3), sep =''))) + for (i in 1:3){ + x2[seq(i,n,4),i] <- 1 + } + x <- cbind(x, x2) + } > k <- length(x[1,]) > if (par3 == 'Linear Trend'){ + x <- cbind(x, c(1:n)) + colnames(x)[k+1] <- 't' + } > x Y X Y1 Y2 Y3 Y4 M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 1 4132 537 4486 4625 3971 3397 1 0 0 0 0 0 0 0 0 0 0 2 4685 543 4132 4486 4625 3971 0 1 0 0 0 0 0 0 0 0 0 3 3172 594 4685 4132 4486 4625 0 0 1 0 0 0 0 0 0 0 0 4 4280 611 3172 4685 4132 4486 0 0 0 1 0 0 0 0 0 0 0 5 4207 613 4280 3172 4685 4132 0 0 0 0 1 0 0 0 0 0 0 6 4158 611 4207 4280 3172 4685 0 0 0 0 0 1 0 0 0 0 0 7 3933 594 4158 4207 4280 3172 0 0 0 0 0 0 1 0 0 0 0 8 3151 595 3933 4158 4207 4280 0 0 0 0 0 0 0 1 0 0 0 9 3616 591 3151 3933 4158 4207 0 0 0 0 0 0 0 0 1 0 0 10 4221 589 3616 3151 3933 4158 0 0 0 0 0 0 0 0 0 1 0 11 4436 584 4221 3616 3151 3933 0 0 0 0 0 0 0 0 0 0 1 12 4807 573 4436 4221 3616 3151 0 0 0 0 0 0 0 0 0 0 0 13 4849 567 4807 4436 4221 3616 1 0 0 0 0 0 0 0 0 0 0 14 5024 569 4849 4807 4436 4221 0 1 0 0 0 0 0 0 0 0 0 15 3521 621 5024 4849 4807 4436 0 0 1 0 0 0 0 0 0 0 0 16 4650 629 3521 5024 4849 4807 0 0 0 1 0 0 0 0 0 0 0 17 5393 628 4650 3521 5024 4849 0 0 0 0 1 0 0 0 0 0 0 18 5147 612 5393 4650 3521 5024 0 0 0 0 0 1 0 0 0 0 0 19 4845 595 5147 5393 4650 3521 0 0 0 0 0 0 1 0 0 0 0 20 3995 597 4845 5147 5393 4650 0 0 0 0 0 0 0 1 0 0 0 21 4493 593 3995 4845 5147 5393 0 0 0 0 0 0 0 0 1 0 0 22 4680 590 4493 3995 4845 5147 0 0 0 0 0 0 0 0 0 1 0 23 5463 580 4680 4493 3995 4845 0 0 0 0 0 0 0 0 0 0 1 24 4761 574 5463 4680 4493 3995 0 0 0 0 0 0 0 0 0 0 0 25 5307 573 4761 5463 4680 4493 1 0 0 0 0 0 0 0 0 0 0 26 5069 573 5307 4761 5463 4680 0 1 0 0 0 0 0 0 0 0 0 27 3501 620 5069 5307 4761 5463 0 0 1 0 0 0 0 0 0 0 0 28 4952 626 3501 5069 5307 4761 0 0 0 1 0 0 0 0 0 0 0 29 5152 620 4952 3501 5069 5307 0 0 0 0 1 0 0 0 0 0 0 30 5317 588 5152 4952 3501 5069 0 0 0 0 0 1 0 0 0 0 0 31 5189 566 5317 5152 4952 3501 0 0 0 0 0 0 1 0 0 0 0 32 4030 557 5189 5317 5152 4952 0 0 0 0 0 0 0 1 0 0 0 33 4420 561 4030 5189 5317 5152 0 0 0 0 0 0 0 0 1 0 0 34 4571 549 4420 4030 5189 5317 0 0 0 0 0 0 0 0 0 1 0 35 4551 532 4571 4420 4030 5189 0 0 0 0 0 0 0 0 0 0 1 36 4819 526 4551 4571 4420 4030 0 0 0 0 0 0 0 0 0 0 0 37 5133 511 4819 4551 4571 4420 1 0 0 0 0 0 0 0 0 0 0 38 4532 499 5133 4819 4551 4571 0 1 0 0 0 0 0 0 0 0 0 39 3339 555 4532 5133 4819 4551 0 0 1 0 0 0 0 0 0 0 0 40 4380 565 3339 4532 5133 4819 0 0 0 1 0 0 0 0 0 0 0 41 4632 542 4380 3339 4532 5133 0 0 0 0 1 0 0 0 0 0 0 42 4719 527 4632 4380 3339 4532 0 0 0 0 0 1 0 0 0 0 0 43 4212 510 4719 4632 4380 3339 0 0 0 0 0 0 1 0 0 0 0 44 3615 514 4212 4719 4632 4380 0 0 0 0 0 0 0 1 0 0 0 45 3420 517 3615 4212 4719 4632 0 0 0 0 0 0 0 0 1 0 0 46 4571 508 3420 3615 4212 4719 0 0 0 0 0 0 0 0 0 1 0 47 4407 493 4571 3420 3615 4212 0 0 0 0 0 0 0 0 0 0 1 48 4386 490 4407 4571 3420 3615 0 0 0 0 0 0 0 0 0 0 0 49 4386 469 4386 4407 4571 3420 1 0 0 0 0 0 0 0 0 0 0 50 4744 478 4386 4386 4407 4571 0 1 0 0 0 0 0 0 0 0 0 51 3185 528 4744 4386 4386 4407 0 0 1 0 0 0 0 0 0 0 0 52 3890 534 3185 4744 4386 4386 0 0 0 1 0 0 0 0 0 0 0 53 4520 518 3890 3185 4744 4386 0 0 0 0 1 0 0 0 0 0 0 54 3990 506 4520 3890 3185 4744 0 0 0 0 0 1 0 0 0 0 0 55 3809 502 3990 4520 3890 3185 0 0 0 0 0 0 1 0 0 0 0 56 3236 516 3809 3990 4520 3890 0 0 0 0 0 0 0 1 0 0 0 57 3551 528 3236 3809 3990 4520 0 0 0 0 0 0 0 0 1 0 0 58 3264 533 3551 3236 3809 3990 0 0 0 0 0 0 0 0 0 1 0 59 3579 536 3264 3551 3236 3809 0 0 0 0 0 0 0 0 0 0 1 60 3537 537 3579 3264 3551 3236 0 0 0 0 0 0 0 0 0 0 0 61 3038 524 3537 3579 3264 3551 1 0 0 0 0 0 0 0 0 0 0 62 2888 536 3038 3537 3579 3264 0 1 0 0 0 0 0 0 0 0 0 63 2198 587 2888 3038 3537 3579 0 0 1 0 0 0 0 0 0 0 0 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) X Y1 Y2 Y3 Y4 -7.566e+02 1.713e+00 3.284e-01 3.499e-01 2.756e-01 7.049e-02 M1 M2 M3 M4 M5 M6 -1.522e+02 -2.380e+02 -1.680e+03 -2.502e+02 2.504e+02 6.767e+01 M7 M8 M9 M10 M11 -4.556e+02 -1.297e+03 -6.449e+02 -1.376e+01 2.426e+02 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -514.509 -192.215 -7.711 190.032 589.747 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) -7.566e+02 6.416e+02 -1.179 0.2444 X 1.713e+00 1.117e+00 1.534 0.1320 Y1 3.284e-01 1.498e-01 2.192 0.0335 * Y2 3.499e-01 1.591e-01 2.200 0.0329 * Y3 2.756e-01 1.651e-01 1.669 0.1019 Y4 7.049e-02 1.616e-01 0.436 0.6647 M1 -1.522e+02 1.939e+02 -0.785 0.4367 M2 -2.380e+02 2.165e+02 -1.099 0.2775 M3 -1.680e+03 2.396e+02 -7.011 8.76e-09 *** M4 -2.502e+02 3.824e+02 -0.654 0.5162 M5 2.504e+02 3.682e+02 0.680 0.4998 M6 6.767e+01 3.067e+02 0.221 0.8263 M7 -4.556e+02 2.286e+02 -1.993 0.0522 . M8 -1.297e+03 2.540e+02 -5.106 6.16e-06 *** M9 -6.449e+02 3.451e+02 -1.869 0.0680 . M10 -1.376e+01 3.267e+02 -0.042 0.9666 M11 2.426e+02 2.589e+02 0.937 0.3537 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 306.9 on 46 degrees of freedom Multiple R-squared: 0.8647, Adjusted R-squared: 0.8176 F-statistic: 18.37 on 16 and 46 DF, p-value: 8.073e-15 > 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.30257129 0.6051426 0.6974287 [2,] 0.33259733 0.6651947 0.6674027 [3,] 0.35351408 0.7070282 0.6464859 [4,] 0.37961564 0.7592313 0.6203844 [5,] 0.57654238 0.8469152 0.4234576 [6,] 0.48232241 0.9646448 0.5176776 [7,] 0.39427145 0.7885429 0.6057285 [8,] 0.46202493 0.9240499 0.5379751 [9,] 0.40624638 0.8124928 0.5937536 [10,] 0.30738526 0.6147705 0.6926147 [11,] 0.37146315 0.7429263 0.6285368 [12,] 0.50696054 0.9860789 0.4930395 [13,] 0.40874534 0.8174907 0.5912547 [14,] 0.34752142 0.6950428 0.6524786 [15,] 0.29741738 0.5948348 0.7025826 [16,] 0.33006218 0.6601244 0.6699378 [17,] 0.26465750 0.5293150 0.7353425 [18,] 0.36308003 0.7261601 0.6369200 [19,] 0.28484278 0.5696856 0.7151572 [20,] 0.23811566 0.4762313 0.7618843 [21,] 0.15369591 0.3073918 0.8463041 [22,] 0.09002804 0.1800561 0.9099720 [23,] 0.33310073 0.6662015 0.6668993 [24,] 0.57131611 0.8573678 0.4286839 > postscript(file="/var/www/html/rcomp/tmp/12rb91261223874.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/2kaih1261223874.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/33c901261223874.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/4g4v11261223874.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/5vky31261223874.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 = 63 Frequency = 1 1 2 3 4 5 6 -304.391428 268.310513 44.687734 104.258159 -434.675416 -283.290602 7 8 9 10 11 12 -112.949967 -22.444449 151.738007 315.405967 152.593418 429.704183 13 14 15 16 17 18 237.612113 249.458366 -89.911624 -10.008563 338.052529 65.004968 19 20 21 22 23 24 -68.987927 -180.316159 72.909047 -131.647932 431.985549 -417.023201 25 26 27 28 29 30 152.774565 -162.050854 -342.950453 164.986822 -26.096802 251.924041 31 32 33 34 35 36 271.388982 -204.114102 -106.993420 -265.460465 -370.337969 78.478455 37 38 39 40 41 42 420.250004 -276.439173 -108.070978 -17.548728 -7.710884 211.827081 43 44 45 46 47 48 -62.307420 168.237134 -352.030135 589.747115 85.614943 59.252473 49 50 51 52 53 54 8.263634 408.030185 105.424555 -241.687691 130.430574 -245.465488 55 56 57 58 59 60 -27.143668 238.637577 234.376501 -508.044684 -299.855941 -150.411910 61 62 63 -514.508887 -487.309037 390.820767 > postscript(file="/var/www/html/rcomp/tmp/6blw21261223874.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 = 63 Frequency = 1 lag(myerror, k = 1) myerror 0 -304.391428 NA 1 268.310513 -304.391428 2 44.687734 268.310513 3 104.258159 44.687734 4 -434.675416 104.258159 5 -283.290602 -434.675416 6 -112.949967 -283.290602 7 -22.444449 -112.949967 8 151.738007 -22.444449 9 315.405967 151.738007 10 152.593418 315.405967 11 429.704183 152.593418 12 237.612113 429.704183 13 249.458366 237.612113 14 -89.911624 249.458366 15 -10.008563 -89.911624 16 338.052529 -10.008563 17 65.004968 338.052529 18 -68.987927 65.004968 19 -180.316159 -68.987927 20 72.909047 -180.316159 21 -131.647932 72.909047 22 431.985549 -131.647932 23 -417.023201 431.985549 24 152.774565 -417.023201 25 -162.050854 152.774565 26 -342.950453 -162.050854 27 164.986822 -342.950453 28 -26.096802 164.986822 29 251.924041 -26.096802 30 271.388982 251.924041 31 -204.114102 271.388982 32 -106.993420 -204.114102 33 -265.460465 -106.993420 34 -370.337969 -265.460465 35 78.478455 -370.337969 36 420.250004 78.478455 37 -276.439173 420.250004 38 -108.070978 -276.439173 39 -17.548728 -108.070978 40 -7.710884 -17.548728 41 211.827081 -7.710884 42 -62.307420 211.827081 43 168.237134 -62.307420 44 -352.030135 168.237134 45 589.747115 -352.030135 46 85.614943 589.747115 47 59.252473 85.614943 48 8.263634 59.252473 49 408.030185 8.263634 50 105.424555 408.030185 51 -241.687691 105.424555 52 130.430574 -241.687691 53 -245.465488 130.430574 54 -27.143668 -245.465488 55 238.637577 -27.143668 56 234.376501 238.637577 57 -508.044684 234.376501 58 -299.855941 -508.044684 59 -150.411910 -299.855941 60 -514.508887 -150.411910 61 -487.309037 -514.508887 62 390.820767 -487.309037 63 NA 390.820767 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] 268.310513 -304.391428 [2,] 44.687734 268.310513 [3,] 104.258159 44.687734 [4,] -434.675416 104.258159 [5,] -283.290602 -434.675416 [6,] -112.949967 -283.290602 [7,] -22.444449 -112.949967 [8,] 151.738007 -22.444449 [9,] 315.405967 151.738007 [10,] 152.593418 315.405967 [11,] 429.704183 152.593418 [12,] 237.612113 429.704183 [13,] 249.458366 237.612113 [14,] -89.911624 249.458366 [15,] -10.008563 -89.911624 [16,] 338.052529 -10.008563 [17,] 65.004968 338.052529 [18,] -68.987927 65.004968 [19,] -180.316159 -68.987927 [20,] 72.909047 -180.316159 [21,] -131.647932 72.909047 [22,] 431.985549 -131.647932 [23,] -417.023201 431.985549 [24,] 152.774565 -417.023201 [25,] -162.050854 152.774565 [26,] -342.950453 -162.050854 [27,] 164.986822 -342.950453 [28,] -26.096802 164.986822 [29,] 251.924041 -26.096802 [30,] 271.388982 251.924041 [31,] -204.114102 271.388982 [32,] -106.993420 -204.114102 [33,] -265.460465 -106.993420 [34,] -370.337969 -265.460465 [35,] 78.478455 -370.337969 [36,] 420.250004 78.478455 [37,] -276.439173 420.250004 [38,] -108.070978 -276.439173 [39,] -17.548728 -108.070978 [40,] -7.710884 -17.548728 [41,] 211.827081 -7.710884 [42,] -62.307420 211.827081 [43,] 168.237134 -62.307420 [44,] -352.030135 168.237134 [45,] 589.747115 -352.030135 [46,] 85.614943 589.747115 [47,] 59.252473 85.614943 [48,] 8.263634 59.252473 [49,] 408.030185 8.263634 [50,] 105.424555 408.030185 [51,] -241.687691 105.424555 [52,] 130.430574 -241.687691 [53,] -245.465488 130.430574 [54,] -27.143668 -245.465488 [55,] 238.637577 -27.143668 [56,] 234.376501 238.637577 [57,] -508.044684 234.376501 [58,] -299.855941 -508.044684 [59,] -150.411910 -299.855941 [60,] -514.508887 -150.411910 [61,] -487.309037 -514.508887 [62,] 390.820767 -487.309037 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 268.310513 -304.391428 2 44.687734 268.310513 3 104.258159 44.687734 4 -434.675416 104.258159 5 -283.290602 -434.675416 6 -112.949967 -283.290602 7 -22.444449 -112.949967 8 151.738007 -22.444449 9 315.405967 151.738007 10 152.593418 315.405967 11 429.704183 152.593418 12 237.612113 429.704183 13 249.458366 237.612113 14 -89.911624 249.458366 15 -10.008563 -89.911624 16 338.052529 -10.008563 17 65.004968 338.052529 18 -68.987927 65.004968 19 -180.316159 -68.987927 20 72.909047 -180.316159 21 -131.647932 72.909047 22 431.985549 -131.647932 23 -417.023201 431.985549 24 152.774565 -417.023201 25 -162.050854 152.774565 26 -342.950453 -162.050854 27 164.986822 -342.950453 28 -26.096802 164.986822 29 251.924041 -26.096802 30 271.388982 251.924041 31 -204.114102 271.388982 32 -106.993420 -204.114102 33 -265.460465 -106.993420 34 -370.337969 -265.460465 35 78.478455 -370.337969 36 420.250004 78.478455 37 -276.439173 420.250004 38 -108.070978 -276.439173 39 -17.548728 -108.070978 40 -7.710884 -17.548728 41 211.827081 -7.710884 42 -62.307420 211.827081 43 168.237134 -62.307420 44 -352.030135 168.237134 45 589.747115 -352.030135 46 85.614943 589.747115 47 59.252473 85.614943 48 8.263634 59.252473 49 408.030185 8.263634 50 105.424555 408.030185 51 -241.687691 105.424555 52 130.430574 -241.687691 53 -245.465488 130.430574 54 -27.143668 -245.465488 55 238.637577 -27.143668 56 234.376501 238.637577 57 -508.044684 234.376501 58 -299.855941 -508.044684 59 -150.411910 -299.855941 60 -514.508887 -150.411910 61 -487.309037 -514.508887 62 390.820767 -487.309037 > 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/716ez1261223875.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/8rgsc1261223875.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/909yw1261223875.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/10y2b61261223875.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/110ue41261223875.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/12lojd1261223875.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/13fx8f1261223875.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/146gx61261223875.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/15i8jb1261223875.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/16g9uf1261223875.tab") + } > try(system("convert tmp/12rb91261223874.ps tmp/12rb91261223874.png",intern=TRUE)) character(0) > try(system("convert tmp/2kaih1261223874.ps tmp/2kaih1261223874.png",intern=TRUE)) character(0) > try(system("convert tmp/33c901261223874.ps tmp/33c901261223874.png",intern=TRUE)) character(0) > try(system("convert tmp/4g4v11261223874.ps tmp/4g4v11261223874.png",intern=TRUE)) character(0) > try(system("convert tmp/5vky31261223874.ps tmp/5vky31261223874.png",intern=TRUE)) character(0) > try(system("convert tmp/6blw21261223874.ps tmp/6blw21261223874.png",intern=TRUE)) character(0) > try(system("convert tmp/716ez1261223875.ps tmp/716ez1261223875.png",intern=TRUE)) character(0) > try(system("convert tmp/8rgsc1261223875.ps tmp/8rgsc1261223875.png",intern=TRUE)) character(0) > try(system("convert tmp/909yw1261223875.ps tmp/909yw1261223875.png",intern=TRUE)) character(0) > try(system("convert tmp/10y2b61261223875.ps tmp/10y2b61261223875.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.447 1.586 5.146