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(318672 + ,441977 + ,326225 + ,327532 + ,338653 + ,344744 + ,317756 + ,439148 + ,318672 + ,326225 + ,327532 + ,338653 + ,337302 + ,488180 + ,317756 + ,318672 + ,326225 + ,327532 + ,349420 + ,520564 + ,337302 + ,317756 + ,318672 + ,326225 + ,336923 + ,501492 + ,349420 + ,337302 + ,317756 + ,318672 + ,330758 + ,485025 + ,336923 + ,349420 + ,337302 + ,317756 + ,321002 + ,464196 + ,330758 + ,336923 + ,349420 + ,337302 + ,320820 + ,460170 + ,321002 + ,330758 + ,336923 + ,349420 + ,327032 + ,467037 + ,320820 + ,321002 + ,330758 + ,336923 + ,324047 + ,460070 + ,327032 + ,320820 + ,321002 + ,330758 + ,316735 + ,447988 + ,324047 + ,327032 + ,320820 + ,321002 + ,315710 + ,442867 + ,316735 + ,324047 + ,327032 + ,320820 + ,313427 + ,436087 + ,315710 + ,316735 + ,324047 + ,327032 + ,310527 + ,431328 + ,313427 + ,315710 + ,316735 + ,324047 + ,330962 + ,484015 + ,310527 + ,313427 + ,315710 + ,316735 + ,339015 + ,509673 + ,330962 + ,310527 + ,313427 + ,315710 + ,341332 + ,512927 + ,339015 + ,330962 + ,310527 + ,313427 + ,339092 + ,502831 + ,341332 + ,339015 + ,330962 + ,310527 + ,323308 + ,470984 + ,339092 + ,341332 + ,339015 + ,330962 + ,325849 + ,471067 + ,323308 + ,339092 + ,341332 + ,339015 + ,330675 + ,476049 + ,325849 + ,323308 + ,339092 + ,341332 + ,332225 + ,474605 + ,330675 + ,325849 + ,323308 + ,339092 + ,331735 + ,470439 + ,332225 + ,330675 + ,325849 + ,323308 + ,328047 + ,461251 + ,331735 + ,332225 + ,330675 + ,325849 + ,326165 + ,454724 + ,328047 + ,331735 + ,332225 + ,330675 + ,327081 + ,455626 + ,326165 + ,328047 + ,331735 + ,332225 + ,346764 + ,516847 + ,327081 + ,326165 + ,328047 + ,331735 + ,344190 + ,525192 + ,346764 + ,327081 + ,326165 + ,328047 + ,343333 + ,522975 + ,344190 + ,346764 + ,327081 + ,326165 + ,345777 + ,518585 + ,343333 + ,344190 + ,346764 + ,327081 + ,344094 + ,509239 + ,345777 + ,343333 + ,344190 + ,346764 + ,348609 + ,512238 + ,344094 + ,345777 + ,343333 + ,344190 + ,354846 + ,519164 + ,348609 + ,344094 + ,345777 + ,343333 + ,356427 + ,517009 + ,354846 + ,348609 + ,344094 + ,345777 + ,353467 + ,509933 + ,356427 + ,354846 + ,348609 + ,344094 + ,355996 + ,509127 + ,353467 + ,356427 + ,354846 + ,348609 + ,352487 + ,500857 + ,355996 + ,353467 + ,356427 + ,354846 + ,355178 + ,506971 + ,352487 + ,355996 + ,353467 + ,356427 + ,374556 + ,569323 + ,355178 + ,352487 + ,355996 + ,353467 + ,375021 + ,579714 + ,374556 + ,355178 + ,352487 + ,355996 + ,375787 + ,577992 + ,375021 + ,374556 + ,355178 + ,352487 + ,372720 + ,565464 + ,375787 + ,375021 + ,374556 + ,355178 + ,364431 + ,547344 + ,372720 + ,375787 + ,375021 + ,374556 + ,370490 + ,554788 + ,364431 + ,372720 + ,375787 + ,375021 + ,376974 + ,562325 + ,370490 + ,364431 + ,372720 + ,375787 + ,377632 + ,560854 + ,376974 + ,370490 + ,364431 + ,372720 + ,378205 + ,555332 + ,377632 + ,376974 + ,370490 + ,364431 + ,370861 + ,543599 + ,378205 + ,377632 + ,376974 + ,370490 + ,369167 + ,536662 + ,370861 + ,378205 + ,377632 + ,376974 + ,371551 + ,542722 + ,369167 + ,370861 + ,378205 + ,377632 + ,382842 + ,593530 + ,371551 + ,369167 + ,370861 + ,378205 + ,381903 + ,610763 + ,382842 + ,371551 + ,369167 + ,370861 + ,384502 + ,612613 + ,381903 + ,382842 + ,371551 + ,369167 + ,392058 + ,611324 + ,384502 + ,381903 + ,382842 + ,371551 + ,384359 + ,594167 + ,392058 + ,384502 + ,381903 + ,382842 + ,388884 + ,595454 + ,384359 + ,392058 + ,384502 + ,381903 + ,386586 + ,590865 + ,388884 + ,384359 + ,392058 + ,384502 + ,387495 + ,589379 + ,386586 + ,388884 + ,384359 + ,392058 + ,385705 + ,584428 + ,387495 + ,386586 + ,388884 + ,384359 + ,378670 + ,573100 + ,385705 + ,387495 + ,386586 + ,388884 + ,377367 + ,567456 + ,378670 + ,385705 + ,387495 + ,386586 + ,376911 + ,569028 + ,377367 + ,378670 + ,385705 + ,387495 + ,389827 + ,620735 + ,376911 + ,377367 + ,378670 + ,385705 + ,387820 + ,628884 + ,389827 + ,376911 + ,377367 + ,378670 + ,387267 + ,628232 + ,387820 + ,389827 + ,376911 + ,377367 + ,380575 + ,612117 + ,387267 + ,387820 + ,389827 + ,376911 + ,372402 + ,595404 + ,380575 + ,387267 + ,387820 + ,389827 + ,376740 + ,597141 + ,372402 + ,380575 + ,387267 + ,387820) + ,dim=c(6 + ,68) + ,dimnames=list(c('Y' + ,'X' + ,'yt-1' + ,'yt-2' + ,'yt-3' + ,'yt-4') + ,1:68)) > y <- array(NA,dim=c(6,68),dimnames=list(c('Y','X','yt-1','yt-2','yt-3','yt-4'),1:68)) > 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 yt-1 yt-2 yt-3 yt-4 M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 1 318672 441977 326225 327532 338653 344744 1 0 0 0 0 0 0 0 0 0 0 2 317756 439148 318672 326225 327532 338653 0 1 0 0 0 0 0 0 0 0 0 3 337302 488180 317756 318672 326225 327532 0 0 1 0 0 0 0 0 0 0 0 4 349420 520564 337302 317756 318672 326225 0 0 0 1 0 0 0 0 0 0 0 5 336923 501492 349420 337302 317756 318672 0 0 0 0 1 0 0 0 0 0 0 6 330758 485025 336923 349420 337302 317756 0 0 0 0 0 1 0 0 0 0 0 7 321002 464196 330758 336923 349420 337302 0 0 0 0 0 0 1 0 0 0 0 8 320820 460170 321002 330758 336923 349420 0 0 0 0 0 0 0 1 0 0 0 9 327032 467037 320820 321002 330758 336923 0 0 0 0 0 0 0 0 1 0 0 10 324047 460070 327032 320820 321002 330758 0 0 0 0 0 0 0 0 0 1 0 11 316735 447988 324047 327032 320820 321002 0 0 0 0 0 0 0 0 0 0 1 12 315710 442867 316735 324047 327032 320820 0 0 0 0 0 0 0 0 0 0 0 13 313427 436087 315710 316735 324047 327032 1 0 0 0 0 0 0 0 0 0 0 14 310527 431328 313427 315710 316735 324047 0 1 0 0 0 0 0 0 0 0 0 15 330962 484015 310527 313427 315710 316735 0 0 1 0 0 0 0 0 0 0 0 16 339015 509673 330962 310527 313427 315710 0 0 0 1 0 0 0 0 0 0 0 17 341332 512927 339015 330962 310527 313427 0 0 0 0 1 0 0 0 0 0 0 18 339092 502831 341332 339015 330962 310527 0 0 0 0 0 1 0 0 0 0 0 19 323308 470984 339092 341332 339015 330962 0 0 0 0 0 0 1 0 0 0 0 20 325849 471067 323308 339092 341332 339015 0 0 0 0 0 0 0 1 0 0 0 21 330675 476049 325849 323308 339092 341332 0 0 0 0 0 0 0 0 1 0 0 22 332225 474605 330675 325849 323308 339092 0 0 0 0 0 0 0 0 0 1 0 23 331735 470439 332225 330675 325849 323308 0 0 0 0 0 0 0 0 0 0 1 24 328047 461251 331735 332225 330675 325849 0 0 0 0 0 0 0 0 0 0 0 25 326165 454724 328047 331735 332225 330675 1 0 0 0 0 0 0 0 0 0 0 26 327081 455626 326165 328047 331735 332225 0 1 0 0 0 0 0 0 0 0 0 27 346764 516847 327081 326165 328047 331735 0 0 1 0 0 0 0 0 0 0 0 28 344190 525192 346764 327081 326165 328047 0 0 0 1 0 0 0 0 0 0 0 29 343333 522975 344190 346764 327081 326165 0 0 0 0 1 0 0 0 0 0 0 30 345777 518585 343333 344190 346764 327081 0 0 0 0 0 1 0 0 0 0 0 31 344094 509239 345777 343333 344190 346764 0 0 0 0 0 0 1 0 0 0 0 32 348609 512238 344094 345777 343333 344190 0 0 0 0 0 0 0 1 0 0 0 33 354846 519164 348609 344094 345777 343333 0 0 0 0 0 0 0 0 1 0 0 34 356427 517009 354846 348609 344094 345777 0 0 0 0 0 0 0 0 0 1 0 35 353467 509933 356427 354846 348609 344094 0 0 0 0 0 0 0 0 0 0 1 36 355996 509127 353467 356427 354846 348609 0 0 0 0 0 0 0 0 0 0 0 37 352487 500857 355996 353467 356427 354846 1 0 0 0 0 0 0 0 0 0 0 38 355178 506971 352487 355996 353467 356427 0 1 0 0 0 0 0 0 0 0 0 39 374556 569323 355178 352487 355996 353467 0 0 1 0 0 0 0 0 0 0 0 40 375021 579714 374556 355178 352487 355996 0 0 0 1 0 0 0 0 0 0 0 41 375787 577992 375021 374556 355178 352487 0 0 0 0 1 0 0 0 0 0 0 42 372720 565464 375787 375021 374556 355178 0 0 0 0 0 1 0 0 0 0 0 43 364431 547344 372720 375787 375021 374556 0 0 0 0 0 0 1 0 0 0 0 44 370490 554788 364431 372720 375787 375021 0 0 0 0 0 0 0 1 0 0 0 45 376974 562325 370490 364431 372720 375787 0 0 0 0 0 0 0 0 1 0 0 46 377632 560854 376974 370490 364431 372720 0 0 0 0 0 0 0 0 0 1 0 47 378205 555332 377632 376974 370490 364431 0 0 0 0 0 0 0 0 0 0 1 48 370861 543599 378205 377632 376974 370490 0 0 0 0 0 0 0 0 0 0 0 49 369167 536662 370861 378205 377632 376974 1 0 0 0 0 0 0 0 0 0 0 50 371551 542722 369167 370861 378205 377632 0 1 0 0 0 0 0 0 0 0 0 51 382842 593530 371551 369167 370861 378205 0 0 1 0 0 0 0 0 0 0 0 52 381903 610763 382842 371551 369167 370861 0 0 0 1 0 0 0 0 0 0 0 53 384502 612613 381903 382842 371551 369167 0 0 0 0 1 0 0 0 0 0 0 54 392058 611324 384502 381903 382842 371551 0 0 0 0 0 1 0 0 0 0 0 55 384359 594167 392058 384502 381903 382842 0 0 0 0 0 0 1 0 0 0 0 56 388884 595454 384359 392058 384502 381903 0 0 0 0 0 0 0 1 0 0 0 57 386586 590865 388884 384359 392058 384502 0 0 0 0 0 0 0 0 1 0 0 58 387495 589379 386586 388884 384359 392058 0 0 0 0 0 0 0 0 0 1 0 59 385705 584428 387495 386586 388884 384359 0 0 0 0 0 0 0 0 0 0 1 60 378670 573100 385705 387495 386586 388884 0 0 0 0 0 0 0 0 0 0 0 61 377367 567456 378670 385705 387495 386586 1 0 0 0 0 0 0 0 0 0 0 62 376911 569028 377367 378670 385705 387495 0 1 0 0 0 0 0 0 0 0 0 63 389827 620735 376911 377367 378670 385705 0 0 1 0 0 0 0 0 0 0 0 64 387820 628884 389827 376911 377367 378670 0 0 0 1 0 0 0 0 0 0 0 65 387267 628232 387820 389827 376911 377367 0 0 0 0 1 0 0 0 0 0 0 66 380575 612117 387267 387820 389827 376911 0 0 0 0 0 1 0 0 0 0 0 67 372402 595404 380575 387267 387820 389827 0 0 0 0 0 0 1 0 0 0 0 68 376740 597141 372402 380575 387267 387820 0 0 0 0 0 0 0 1 0 0 0 t 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 37 38 38 39 39 40 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 48 49 49 50 50 51 51 52 52 53 53 54 54 55 55 56 56 57 57 58 58 59 59 60 60 61 61 62 62 63 63 64 64 65 65 66 66 67 67 68 68 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) X `yt-1` `yt-2` `yt-3` `yt-4` 4.516e+04 4.920e-01 4.691e-01 -7.892e-02 8.727e-02 -2.897e-01 M1 M2 M3 M4 M5 M6 3.347e+03 4.680e+03 -5.912e+03 -2.011e+04 -2.037e+04 -1.701e+04 M7 M8 M9 M10 M11 t -1.061e+04 -2.692e+03 -2.070e+03 -1.154e+03 -2.543e+03 -3.112e+02 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -5753.3 -2055.0 151.1 1857.2 4559.8 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 4.516e+04 1.465e+04 3.082 0.003341 ** X 4.920e-01 6.991e-02 7.039 5.22e-09 *** `yt-1` 4.691e-01 1.239e-01 3.786 0.000411 *** `yt-2` -7.892e-02 1.378e-01 -0.573 0.569312 `yt-3` 8.727e-02 1.382e-01 0.631 0.530666 `yt-4` -2.897e-01 1.022e-01 -2.834 0.006616 ** M1 3.347e+03 1.934e+03 1.731 0.089674 . M2 4.680e+03 1.974e+03 2.371 0.021626 * M3 -5.912e+03 4.091e+03 -1.445 0.154636 M4 -2.011e+04 4.439e+03 -4.530 3.68e-05 *** M5 -2.037e+04 4.237e+03 -4.809 1.43e-05 *** M6 -1.701e+04 3.546e+03 -4.796 1.50e-05 *** M7 -1.061e+04 1.998e+03 -5.313 2.50e-06 *** M8 -2.692e+03 2.419e+03 -1.113 0.271104 M9 -2.070e+03 2.473e+03 -0.837 0.406544 M10 -1.154e+03 2.414e+03 -0.478 0.634603 M11 -2.543e+03 1.988e+03 -1.279 0.206776 t -3.112e+02 8.490e+01 -3.666 0.000597 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 2934 on 50 degrees of freedom Multiple R-squared: 0.9896, Adjusted R-squared: 0.9861 F-statistic: 281.2 on 17 and 50 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.2134646 0.4269293 0.78653537 [2,] 0.1772989 0.3545978 0.82270110 [3,] 0.3265507 0.6531014 0.67344928 [4,] 0.2986866 0.5973733 0.70131335 [5,] 0.3647815 0.7295630 0.63521851 [6,] 0.3020137 0.6040274 0.69798632 [7,] 0.9106133 0.1787733 0.08938667 [8,] 0.9371435 0.1257129 0.06285645 [9,] 0.9055472 0.1889055 0.09445275 [10,] 0.8625601 0.2748798 0.13743991 [11,] 0.7995053 0.4009893 0.20049467 [12,] 0.8592967 0.2814066 0.14070330 [13,] 0.8221988 0.3556025 0.17780123 [14,] 0.7488434 0.5023131 0.25115656 [15,] 0.7747290 0.4505421 0.22527104 [16,] 0.7591796 0.4816408 0.24082038 [17,] 0.7493460 0.5013081 0.25065403 [18,] 0.7287258 0.5425484 0.27127418 [19,] 0.8398721 0.3202558 0.16012792 [20,] 0.7865630 0.4268741 0.21343704 [21,] 0.7016745 0.5966509 0.29832546 [22,] 0.5925124 0.8149752 0.40748759 [23,] 0.5040558 0.9918883 0.49594417 [24,] 0.3968839 0.7937678 0.60311610 [25,] 0.2985531 0.5971063 0.70144685 [26,] 0.2656545 0.5313090 0.73434550 [27,] 0.1612793 0.3225585 0.83872075 > postscript(file="/var/www/html/rcomp/tmp/1t5el1258561298.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/2uoop1258561298.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/3imqo1258561298.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/4j7lu1258561298.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/5c1j91258561298.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 = 68 Frequency = 1 1 2 3 4 5 6 -3846.863376 -1747.035591 1302.865382 3031.785023 -5753.301539 -2024.090400 7 8 9 10 11 12 -1101.957927 1777.109427 532.433956 -3491.857996 -4078.810032 -2216.674916 13 14 15 16 17 18 -2235.944143 -3052.779902 1513.108288 1534.753791 255.080655 -3147.484502 19 20 21 22 23 24 -2891.727030 1355.411813 1848.444094 2169.747708 289.177594 -442.820457 25 26 27 28 29 30 804.645116 1338.576760 1403.794565 -835.373348 2111.556025 2406.696733 31 32 33 34 35 36 3953.855228 -306.242056 -500.157803 -177.638623 913.343476 3883.819047 37 38 39 40 41 42 1656.857589 2879.583869 -135.807855 1883.532219 4134.076423 2941.856722 43 44 45 46 47 48 4559.784314 3059.091854 2517.081627 565.937329 2829.184463 -1.073411 49 50 51 52 53 54 3993.113836 2729.186571 -520.683150 -2521.438555 377.496665 3924.356787 55 56 57 58 59 60 -1400.162812 -1410.450617 -4397.801873 933.811583 47.104499 -1223.250263 61 62 63 64 65 66 -371.809023 -2147.531706 -3563.277231 -3093.259130 -1124.908228 -4101.335340 67 68 -3119.791773 -4474.920421 > postscript(file="/var/www/html/rcomp/tmp/69ej81258561298.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 = 68 Frequency = 1 lag(myerror, k = 1) myerror 0 -3846.863376 NA 1 -1747.035591 -3846.863376 2 1302.865382 -1747.035591 3 3031.785023 1302.865382 4 -5753.301539 3031.785023 5 -2024.090400 -5753.301539 6 -1101.957927 -2024.090400 7 1777.109427 -1101.957927 8 532.433956 1777.109427 9 -3491.857996 532.433956 10 -4078.810032 -3491.857996 11 -2216.674916 -4078.810032 12 -2235.944143 -2216.674916 13 -3052.779902 -2235.944143 14 1513.108288 -3052.779902 15 1534.753791 1513.108288 16 255.080655 1534.753791 17 -3147.484502 255.080655 18 -2891.727030 -3147.484502 19 1355.411813 -2891.727030 20 1848.444094 1355.411813 21 2169.747708 1848.444094 22 289.177594 2169.747708 23 -442.820457 289.177594 24 804.645116 -442.820457 25 1338.576760 804.645116 26 1403.794565 1338.576760 27 -835.373348 1403.794565 28 2111.556025 -835.373348 29 2406.696733 2111.556025 30 3953.855228 2406.696733 31 -306.242056 3953.855228 32 -500.157803 -306.242056 33 -177.638623 -500.157803 34 913.343476 -177.638623 35 3883.819047 913.343476 36 1656.857589 3883.819047 37 2879.583869 1656.857589 38 -135.807855 2879.583869 39 1883.532219 -135.807855 40 4134.076423 1883.532219 41 2941.856722 4134.076423 42 4559.784314 2941.856722 43 3059.091854 4559.784314 44 2517.081627 3059.091854 45 565.937329 2517.081627 46 2829.184463 565.937329 47 -1.073411 2829.184463 48 3993.113836 -1.073411 49 2729.186571 3993.113836 50 -520.683150 2729.186571 51 -2521.438555 -520.683150 52 377.496665 -2521.438555 53 3924.356787 377.496665 54 -1400.162812 3924.356787 55 -1410.450617 -1400.162812 56 -4397.801873 -1410.450617 57 933.811583 -4397.801873 58 47.104499 933.811583 59 -1223.250263 47.104499 60 -371.809023 -1223.250263 61 -2147.531706 -371.809023 62 -3563.277231 -2147.531706 63 -3093.259130 -3563.277231 64 -1124.908228 -3093.259130 65 -4101.335340 -1124.908228 66 -3119.791773 -4101.335340 67 -4474.920421 -3119.791773 68 NA -4474.920421 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -1747.035591 -3846.863376 [2,] 1302.865382 -1747.035591 [3,] 3031.785023 1302.865382 [4,] -5753.301539 3031.785023 [5,] -2024.090400 -5753.301539 [6,] -1101.957927 -2024.090400 [7,] 1777.109427 -1101.957927 [8,] 532.433956 1777.109427 [9,] -3491.857996 532.433956 [10,] -4078.810032 -3491.857996 [11,] -2216.674916 -4078.810032 [12,] -2235.944143 -2216.674916 [13,] -3052.779902 -2235.944143 [14,] 1513.108288 -3052.779902 [15,] 1534.753791 1513.108288 [16,] 255.080655 1534.753791 [17,] -3147.484502 255.080655 [18,] -2891.727030 -3147.484502 [19,] 1355.411813 -2891.727030 [20,] 1848.444094 1355.411813 [21,] 2169.747708 1848.444094 [22,] 289.177594 2169.747708 [23,] -442.820457 289.177594 [24,] 804.645116 -442.820457 [25,] 1338.576760 804.645116 [26,] 1403.794565 1338.576760 [27,] -835.373348 1403.794565 [28,] 2111.556025 -835.373348 [29,] 2406.696733 2111.556025 [30,] 3953.855228 2406.696733 [31,] -306.242056 3953.855228 [32,] -500.157803 -306.242056 [33,] -177.638623 -500.157803 [34,] 913.343476 -177.638623 [35,] 3883.819047 913.343476 [36,] 1656.857589 3883.819047 [37,] 2879.583869 1656.857589 [38,] -135.807855 2879.583869 [39,] 1883.532219 -135.807855 [40,] 4134.076423 1883.532219 [41,] 2941.856722 4134.076423 [42,] 4559.784314 2941.856722 [43,] 3059.091854 4559.784314 [44,] 2517.081627 3059.091854 [45,] 565.937329 2517.081627 [46,] 2829.184463 565.937329 [47,] -1.073411 2829.184463 [48,] 3993.113836 -1.073411 [49,] 2729.186571 3993.113836 [50,] -520.683150 2729.186571 [51,] -2521.438555 -520.683150 [52,] 377.496665 -2521.438555 [53,] 3924.356787 377.496665 [54,] -1400.162812 3924.356787 [55,] -1410.450617 -1400.162812 [56,] -4397.801873 -1410.450617 [57,] 933.811583 -4397.801873 [58,] 47.104499 933.811583 [59,] -1223.250263 47.104499 [60,] -371.809023 -1223.250263 [61,] -2147.531706 -371.809023 [62,] -3563.277231 -2147.531706 [63,] -3093.259130 -3563.277231 [64,] -1124.908228 -3093.259130 [65,] -4101.335340 -1124.908228 [66,] -3119.791773 -4101.335340 [67,] -4474.920421 -3119.791773 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -1747.035591 -3846.863376 2 1302.865382 -1747.035591 3 3031.785023 1302.865382 4 -5753.301539 3031.785023 5 -2024.090400 -5753.301539 6 -1101.957927 -2024.090400 7 1777.109427 -1101.957927 8 532.433956 1777.109427 9 -3491.857996 532.433956 10 -4078.810032 -3491.857996 11 -2216.674916 -4078.810032 12 -2235.944143 -2216.674916 13 -3052.779902 -2235.944143 14 1513.108288 -3052.779902 15 1534.753791 1513.108288 16 255.080655 1534.753791 17 -3147.484502 255.080655 18 -2891.727030 -3147.484502 19 1355.411813 -2891.727030 20 1848.444094 1355.411813 21 2169.747708 1848.444094 22 289.177594 2169.747708 23 -442.820457 289.177594 24 804.645116 -442.820457 25 1338.576760 804.645116 26 1403.794565 1338.576760 27 -835.373348 1403.794565 28 2111.556025 -835.373348 29 2406.696733 2111.556025 30 3953.855228 2406.696733 31 -306.242056 3953.855228 32 -500.157803 -306.242056 33 -177.638623 -500.157803 34 913.343476 -177.638623 35 3883.819047 913.343476 36 1656.857589 3883.819047 37 2879.583869 1656.857589 38 -135.807855 2879.583869 39 1883.532219 -135.807855 40 4134.076423 1883.532219 41 2941.856722 4134.076423 42 4559.784314 2941.856722 43 3059.091854 4559.784314 44 2517.081627 3059.091854 45 565.937329 2517.081627 46 2829.184463 565.937329 47 -1.073411 2829.184463 48 3993.113836 -1.073411 49 2729.186571 3993.113836 50 -520.683150 2729.186571 51 -2521.438555 -520.683150 52 377.496665 -2521.438555 53 3924.356787 377.496665 54 -1400.162812 3924.356787 55 -1410.450617 -1400.162812 56 -4397.801873 -1410.450617 57 933.811583 -4397.801873 58 47.104499 933.811583 59 -1223.250263 47.104499 60 -371.809023 -1223.250263 61 -2147.531706 -371.809023 62 -3563.277231 -2147.531706 63 -3093.259130 -3563.277231 64 -1124.908228 -3093.259130 65 -4101.335340 -1124.908228 66 -3119.791773 -4101.335340 67 -4474.920421 -3119.791773 > 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/7a5xp1258561298.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/8uoqj1258561298.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/9l37a1258561298.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/10jmpu1258561298.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/115ufa1258561298.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/122i2v1258561298.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/133m1v1258561298.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/14qcfc1258561298.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/15ivxi1258561298.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/16rh2q1258561298.tab") + } > > system("convert tmp/1t5el1258561298.ps tmp/1t5el1258561298.png") > system("convert tmp/2uoop1258561298.ps tmp/2uoop1258561298.png") > system("convert tmp/3imqo1258561298.ps tmp/3imqo1258561298.png") > system("convert tmp/4j7lu1258561298.ps tmp/4j7lu1258561298.png") > system("convert tmp/5c1j91258561298.ps tmp/5c1j91258561298.png") > system("convert tmp/69ej81258561298.ps tmp/69ej81258561298.png") > system("convert tmp/7a5xp1258561298.ps tmp/7a5xp1258561298.png") > system("convert tmp/8uoqj1258561298.ps tmp/8uoqj1258561298.png") > system("convert tmp/9l37a1258561298.ps tmp/9l37a1258561298.png") > system("convert tmp/10jmpu1258561298.ps tmp/10jmpu1258561298.png") > > > proc.time() user system elapsed 2.609 1.638 7.509