R version 2.8.0 (2008-10-20) Copyright (C) 2008 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. Natural language support but running in an English locale 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(35532 + ,37903 + ,36763 + ,40399 + ,44164 + ,35533 + ,35532 + ,37903 + ,36763 + ,40399 + ,32110 + ,35533 + ,35532 + ,37903 + ,36763 + ,33374 + ,32110 + ,35533 + ,35532 + ,37903 + ,35462 + ,33374 + ,32110 + ,35533 + ,35532 + ,33508 + ,35462 + ,33374 + ,32110 + ,35533 + ,36080 + ,33508 + ,35462 + ,33374 + ,32110 + ,34560 + ,36080 + ,33508 + ,35462 + ,33374 + ,38737 + ,34560 + ,36080 + ,33508 + ,35462 + ,38144 + ,38737 + ,34560 + ,36080 + ,33508 + ,37594 + ,38144 + ,38737 + ,34560 + ,36080 + ,36424 + ,37594 + ,38144 + ,38737 + ,34560 + ,36843 + ,36424 + ,37594 + ,38144 + ,38737 + ,37246 + ,36843 + ,36424 + ,37594 + ,38144 + ,38661 + ,37246 + ,36843 + ,36424 + ,37594 + ,40454 + ,38661 + ,37246 + ,36843 + ,36424 + ,44928 + ,40454 + ,38661 + ,37246 + ,36843 + ,48441 + ,44928 + ,40454 + ,38661 + ,37246 + ,48140 + ,48441 + ,44928 + ,40454 + ,38661 + ,45998 + ,48140 + ,48441 + ,44928 + ,40454 + ,47369 + ,45998 + ,48140 + ,48441 + ,44928 + ,49554 + ,47369 + ,45998 + ,48140 + ,48441 + ,47510 + ,49554 + ,47369 + ,45998 + ,48140 + ,44873 + ,47510 + ,49554 + ,47369 + ,45998 + ,45344 + ,44873 + ,47510 + ,49554 + ,47369 + ,42413 + ,45344 + ,44873 + ,47510 + ,49554 + ,36912 + ,42413 + ,45344 + ,44873 + ,47510 + ,43452 + ,36912 + ,42413 + ,45344 + ,44873 + ,42142 + ,43452 + ,36912 + ,42413 + ,45344 + ,44382 + ,42142 + ,43452 + ,36912 + ,42413 + ,43636 + ,44382 + ,42142 + ,43452 + ,36912 + ,44167 + ,43636 + ,44382 + ,42142 + ,43452 + ,44423 + ,44167 + ,43636 + ,44382 + ,42142 + ,42868 + ,44423 + ,44167 + ,43636 + ,44382 + ,43908 + ,42868 + ,44423 + ,44167 + ,43636 + ,42013 + ,43908 + ,42868 + ,44423 + ,44167 + ,38846 + ,42013 + ,43908 + ,42868 + ,44423 + ,35087 + ,38846 + ,42013 + ,43908 + ,42868 + ,33026 + ,35087 + ,38846 + ,42013 + ,43908 + ,34646 + ,33026 + ,35087 + ,38846 + ,42013 + ,37135 + ,34646 + ,33026 + ,35087 + ,38846 + ,37985 + ,37135 + ,34646 + ,33026 + ,35087 + ,43121 + ,37985 + ,37135 + ,34646 + ,33026 + ,43722 + ,43121 + ,37985 + ,37135 + ,34646 + ,43630 + ,43722 + ,43121 + ,37985 + ,37135 + ,42234 + ,43630 + ,43722 + ,43121 + ,37985 + ,39351 + ,42234 + ,43630 + ,43722 + ,43121 + ,39327 + ,39351 + ,42234 + ,43630 + ,43722 + ,35704 + ,39327 + ,39351 + ,42234 + ,43630 + ,30466 + ,35704 + ,39327 + ,39351 + ,42234 + ,28155 + ,30466 + ,35704 + ,39327 + ,39351 + ,29257 + ,28155 + ,30466 + ,35704 + ,39327 + ,29998 + ,29257 + ,28155 + ,30466 + ,35704 + ,32529 + ,29998 + ,29257 + ,28155 + ,30466 + ,34787 + ,32529 + ,29998 + ,29257 + ,28155 + ,33855 + ,34787 + ,32529 + ,29998 + ,29257 + ,34556 + ,33855 + ,34787 + ,32529 + ,29998 + ,31348 + ,34556 + ,33855 + ,34787 + ,32529 + ,30805 + ,31348 + ,34556 + ,33855 + ,34787 + ,28353 + ,30805 + ,31348 + ,34556 + ,33855 + ,24514 + ,28353 + ,30805 + ,31348 + ,34556 + ,21106 + ,24514 + ,28353 + ,30805 + ,31348 + ,21346 + ,21106 + ,24514 + ,28353 + ,30805 + ,23335 + ,21346 + ,21106 + ,24514 + ,28353 + ,24379 + ,23335 + ,21346 + ,21106 + ,24514 + ,26290 + ,24379 + ,23335 + ,21346 + ,21106 + ,30084 + ,26290 + ,24379 + ,23335 + ,21346 + ,29429 + ,30084 + ,26290 + ,24379 + ,23335 + ,30632 + ,29429 + ,30084 + ,26290 + ,24379 + ,27349 + ,30632 + ,29429 + ,30084 + ,26290 + ,27264 + ,27349 + ,30632 + ,29429 + ,30084 + ,27474 + ,27264 + ,27349 + ,30632 + ,29429 + ,24482 + ,27474 + ,27264 + ,27349 + ,30632 + ,21453 + ,24482 + ,27474 + ,27264 + ,27349 + ,18788 + ,21453 + ,24482 + ,27474 + ,27264 + ,19282 + ,18788 + ,21453 + ,24482 + ,27474 + ,19713 + ,19282 + ,18788 + ,21453 + ,24482 + ,21917 + ,19713 + ,19282 + ,18788 + ,21453 + ,23812 + ,21917 + ,19713 + ,19282 + ,18788 + ,23785 + ,23812 + ,21917 + ,19713 + ,19282 + ,24696 + ,23785 + ,23812 + ,21917 + ,19713 + ,24562 + ,24696 + ,23785 + ,23812 + ,21917 + ,23580 + ,24562 + ,24696 + ,23785 + ,23812 + ,24939 + ,23580 + ,24562 + ,24696 + ,23785 + ,23899 + ,24939 + ,23580 + ,24562 + ,24696 + ,21454 + ,23899 + ,24939 + ,23580 + ,24562 + ,19761 + ,21454 + ,23899 + ,24939 + ,23580 + ,19815 + ,19761 + ,21454 + ,23899 + ,24939 + ,20780 + ,19815 + ,19761 + ,21454 + ,23899 + ,23462 + ,20780 + ,19815 + ,19761 + ,21454 + ,25005 + ,23462 + ,20780 + ,19815 + ,19761 + ,24725 + ,25005 + ,23462 + ,20780 + ,19815 + ,26198 + ,24725 + ,25005 + ,23462 + ,20780 + ,27543 + ,26198 + ,24725 + ,25005 + ,23462 + ,26471 + ,27543 + ,26198 + ,24725 + ,25005 + ,26558 + ,26471 + ,27543 + ,26198 + ,24725 + ,25317 + ,26558 + ,26471 + ,27543 + ,26198 + ,22896 + ,25317 + ,26558 + ,26471 + ,27543) + ,dim=c(5 + ,98) + ,dimnames=list(c('OPENVAC' + ,'X1' + ,'X2' + ,'X3' + ,'X4') + ,1:98)) > y <- array(NA,dim=c(5,98),dimnames=list(c('OPENVAC','X1','X2','X3','X4'),1:98)) > 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 = 'Do not include Seasonal 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 OPENVAC X1 X2 X3 X4 1 35532 37903 36763 40399 44164 2 35533 35532 37903 36763 40399 3 32110 35533 35532 37903 36763 4 33374 32110 35533 35532 37903 5 35462 33374 32110 35533 35532 6 33508 35462 33374 32110 35533 7 36080 33508 35462 33374 32110 8 34560 36080 33508 35462 33374 9 38737 34560 36080 33508 35462 10 38144 38737 34560 36080 33508 11 37594 38144 38737 34560 36080 12 36424 37594 38144 38737 34560 13 36843 36424 37594 38144 38737 14 37246 36843 36424 37594 38144 15 38661 37246 36843 36424 37594 16 40454 38661 37246 36843 36424 17 44928 40454 38661 37246 36843 18 48441 44928 40454 38661 37246 19 48140 48441 44928 40454 38661 20 45998 48140 48441 44928 40454 21 47369 45998 48140 48441 44928 22 49554 47369 45998 48140 48441 23 47510 49554 47369 45998 48140 24 44873 47510 49554 47369 45998 25 45344 44873 47510 49554 47369 26 42413 45344 44873 47510 49554 27 36912 42413 45344 44873 47510 28 43452 36912 42413 45344 44873 29 42142 43452 36912 42413 45344 30 44382 42142 43452 36912 42413 31 43636 44382 42142 43452 36912 32 44167 43636 44382 42142 43452 33 44423 44167 43636 44382 42142 34 42868 44423 44167 43636 44382 35 43908 42868 44423 44167 43636 36 42013 43908 42868 44423 44167 37 38846 42013 43908 42868 44423 38 35087 38846 42013 43908 42868 39 33026 35087 38846 42013 43908 40 34646 33026 35087 38846 42013 41 37135 34646 33026 35087 38846 42 37985 37135 34646 33026 35087 43 43121 37985 37135 34646 33026 44 43722 43121 37985 37135 34646 45 43630 43722 43121 37985 37135 46 42234 43630 43722 43121 37985 47 39351 42234 43630 43722 43121 48 39327 39351 42234 43630 43722 49 35704 39327 39351 42234 43630 50 30466 35704 39327 39351 42234 51 28155 30466 35704 39327 39351 52 29257 28155 30466 35704 39327 53 29998 29257 28155 30466 35704 54 32529 29998 29257 28155 30466 55 34787 32529 29998 29257 28155 56 33855 34787 32529 29998 29257 57 34556 33855 34787 32529 29998 58 31348 34556 33855 34787 32529 59 30805 31348 34556 33855 34787 60 28353 30805 31348 34556 33855 61 24514 28353 30805 31348 34556 62 21106 24514 28353 30805 31348 63 21346 21106 24514 28353 30805 64 23335 21346 21106 24514 28353 65 24379 23335 21346 21106 24514 66 26290 24379 23335 21346 21106 67 30084 26290 24379 23335 21346 68 29429 30084 26290 24379 23335 69 30632 29429 30084 26290 24379 70 27349 30632 29429 30084 26290 71 27264 27349 30632 29429 30084 72 27474 27264 27349 30632 29429 73 24482 27474 27264 27349 30632 74 21453 24482 27474 27264 27349 75 18788 21453 24482 27474 27264 76 19282 18788 21453 24482 27474 77 19713 19282 18788 21453 24482 78 21917 19713 19282 18788 21453 79 23812 21917 19713 19282 18788 80 23785 23812 21917 19713 19282 81 24696 23785 23812 21917 19713 82 24562 24696 23785 23812 21917 83 23580 24562 24696 23785 23812 84 24939 23580 24562 24696 23785 85 23899 24939 23580 24562 24696 86 21454 23899 24939 23580 24562 87 19761 21454 23899 24939 23580 88 19815 19761 21454 23899 24939 89 20780 19815 19761 21454 23899 90 23462 20780 19815 19761 21454 91 25005 23462 20780 19815 19761 92 24725 25005 23462 20780 19815 93 26198 24725 25005 23462 20780 94 27543 26198 24725 25005 23462 95 26471 27543 26198 24725 25005 96 26558 26471 27543 26198 24725 97 25317 26558 26471 27543 26198 98 22896 25317 26558 26471 27543 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) X1 X2 X3 X4 1342.02139 1.14792 -0.01779 -0.20173 0.02783 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -4580.0 -1684.1 127.6 1251.8 8390.9 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 1342.02139 943.94558 1.422 0.158 X1 1.14792 0.10356 11.084 <2e-16 *** X2 -0.01779 0.15446 -0.115 0.909 X3 -0.20173 0.15462 -1.305 0.195 X4 0.02783 0.10161 0.274 0.785 --- Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 Residual standard error: 2207 on 93 degrees of freedom Multiple R-squared: 0.936, Adjusted R-squared: 0.9333 F-statistic: 340.1 on 4 and 93 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.5557739 0.8884521527 0.4442260763 [2,] 0.7112647 0.5774705798 0.2887352899 [3,] 0.6640781 0.6718437577 0.3359218789 [4,] 0.5491885 0.9016230384 0.4508115192 [5,] 0.4295921 0.8591841427 0.5704079287 [6,] 0.3487004 0.6974007388 0.6512996306 [7,] 0.2920712 0.5841424665 0.7079287668 [8,] 0.2811981 0.5623961692 0.7188019154 [9,] 0.3183259 0.6366518259 0.6816740870 [10,] 0.5954163 0.8091673143 0.4045836571 [11,] 0.5974395 0.8051210809 0.4025605405 [12,] 0.6118498 0.7763003010 0.3881501505 [13,] 0.5891609 0.8216782200 0.4108391100 [14,] 0.6410869 0.7178262419 0.3589131209 [15,] 0.6835000 0.6330000835 0.3165000418 [16,] 0.6793298 0.6413403170 0.3206701585 [17,] 0.6818324 0.6363352606 0.3181676303 [18,] 0.6513779 0.6972442615 0.3486221308 [19,] 0.6262043 0.7475913614 0.3737956807 [20,] 0.7921127 0.4157746759 0.2078873380 [21,] 0.9942149 0.0115702602 0.0057851301 [22,] 0.9925726 0.0148547546 0.0074273773 [23,] 0.9926983 0.0146034182 0.0073017091 [24,] 0.9891274 0.0217451228 0.0108725614 [25,] 0.9852148 0.0295704549 0.0147852275 [26,] 0.9801670 0.0396659323 0.0198329661 [27,] 0.9730370 0.0539259516 0.0269629758 [28,] 0.9731550 0.0536899318 0.0268449659 [29,] 0.9649654 0.0700692373 0.0350346186 [30,] 0.9686774 0.0626451287 0.0313225643 [31,] 0.9760037 0.0479926146 0.0239963073 [32,] 0.9694545 0.0610910658 0.0305455329 [33,] 0.9736876 0.0526248624 0.0263124312 [34,] 0.9761288 0.0477424201 0.0238712100 [35,] 0.9664147 0.0671705273 0.0335852636 [36,] 0.9947332 0.0105336779 0.0052668389 [37,] 0.9920865 0.0158269799 0.0079134899 [38,] 0.9897578 0.0204844806 0.0102422403 [39,] 0.9872073 0.0255854898 0.0127927449 [40,] 0.9846127 0.0307746062 0.0153873031 [41,] 0.9895396 0.0209208815 0.0104604408 [42,] 0.9889648 0.0220703334 0.0110351667 [43,] 0.9954411 0.0091177988 0.0045588994 [44,] 0.9943084 0.0113832948 0.0056916474 [45,] 0.9960735 0.0078529979 0.0039264989 [46,] 0.9946360 0.0107279367 0.0053639683 [47,] 0.9962738 0.0074523757 0.0037261879 [48,] 0.9974077 0.0051846467 0.0025923233 [49,] 0.9967923 0.0064154425 0.0032077213 [50,] 0.9979261 0.0041478284 0.0020739142 [51,] 0.9979017 0.0041966378 0.0020983189 [52,] 0.9988814 0.0022371945 0.0011185972 [53,] 0.9985216 0.0029568964 0.0014784482 [54,] 0.9985433 0.0029134784 0.0014567392 [55,] 0.9984080 0.0031839222 0.0015919611 [56,] 0.9980600 0.0038799832 0.0019399916 [57,] 0.9984852 0.0030295826 0.0015147913 [58,] 0.9975220 0.0049560867 0.0024780434 [59,] 0.9963023 0.0073953330 0.0036976665 [60,] 0.9987981 0.0024037023 0.0012018511 [61,] 0.9981441 0.0037117656 0.0018558828 [62,] 0.9987854 0.0024292394 0.0012146197 [63,] 0.9991595 0.0016809858 0.0008404929 [64,] 0.9998825 0.0002350201 0.0001175100 [65,] 0.9998961 0.0002078357 0.0001039178 [66,] 0.9998186 0.0003628432 0.0001814216 [67,] 0.9997061 0.0005877641 0.0002938821 [68,] 0.9997457 0.0005086309 0.0002543155 [69,] 0.9995783 0.0008433675 0.0004216838 [70,] 0.9991215 0.0017570759 0.0008785380 [71,] 0.9988621 0.0022757382 0.0011378691 [72,] 0.9975547 0.0048906140 0.0024453070 [73,] 0.9967472 0.0065056965 0.0032528482 [74,] 0.9930796 0.0138408396 0.0069204198 [75,] 0.9896995 0.0206010234 0.0103005117 [76,] 0.9803608 0.0392783526 0.0196391763 [77,] 0.9798396 0.0403208520 0.0201604260 [78,] 0.9747753 0.0504494925 0.0252247463 [79,] 0.9629985 0.0740029204 0.0370014602 [80,] 0.9733620 0.0532759849 0.0266379924 [81,] 0.9564088 0.0871823148 0.0435911574 [82,] 0.9099634 0.1800731074 0.0900365537 [83,] 0.8899502 0.2200995024 0.1100497512 > postscript(file="/var/www/html/freestat/rcomp/tmp/1wrb01293201825.ps",horizontal=F,onefile=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/freestat/rcomp/tmp/2o0al1293201825.ps",horizontal=F,onefile=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/freestat/rcomp/tmp/3o0al1293201825.ps",horizontal=F,onefile=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/freestat/rcomp/tmp/4o0al1293201825.ps",horizontal=F,onefile=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/freestat/rcomp/tmp/5zsro1293201825.ps",horizontal=F,onefile=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 = 98 Frequency = 1 1 2 3 4 5 6 -1745.01031 369.28116 -2765.89491 1917.44059 2559.74570 -2459.18311 7 8 9 10 11 12 2743.25286 -1377.93459 4137.38383 -704.31215 -877.48173 -541.74659 13 14 15 16 17 18 974.67526 781.42904 1520.55095 1813.49207 4324.07639 3007.39747 19 20 21 22 23 24 -924.33475 -1805.66088 2603.01419 3017.61932 -1933.93353 -1849.52121 25 26 27 28 29 30 2014.81801 -1976.91247 -4580.04933 8390.93277 -1128.74312 1703.23933 31 32 33 34 35 36 -165.01797 815.92401 937.43490 -1114.81230 1842.64332 -1236.99762 37 38 39 40 41 42 -2530.99279 -2435.15920 -648.67845 2684.16842 2606.68898 317.16700 43 44 45 46 47 48 4905.87189 83.28140 -505.03651 -772.30049 -2076.12006 1149.22469 49 50 51 52 53 54 -2776.57403 -4398.81245 -686.05716 2245.40147 724.42905 2103.98779 55 56 57 58 59 60 1756.39279 -1603.77391 697.22442 -2946.97765 -45.81329 -1764.21702 61 62 63 64 65 66 -3464.82659 -2529.83742 1074.45390 2021.10914 205.49207 1096.70013 67 68 69 70 71 72 3110.15456 -1710.81382 668.03255 -3295.38769 171.93779 682.01071 73 74 75 76 77 78 -3248.32427 -2764.78599 -1961.22702 928.67871 217.40927 1482.12236 79 80 81 82 83 84 1028.58217 -1061.32285 347.00644 -512.28670 -1382.43765 1285.96782 85 86 87 88 89 90 -1383.91596 -2805.26631 -1408.61569 297.70148 706.30238 2008.02606 91 92 93 94 95 96 547.46843 -1262.89436 1073.16413 958.92526 -1730.24917 -83.80363 97 98 -1213.40886 -2461.97088 > postscript(file="/var/www/html/freestat/rcomp/tmp/6zsro1293201825.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) > dum <- cbind(lag(myerror,k=1),myerror) > dum Time Series: Start = 0 End = 98 Frequency = 1 lag(myerror, k = 1) myerror 0 -1745.01031 NA 1 369.28116 -1745.01031 2 -2765.89491 369.28116 3 1917.44059 -2765.89491 4 2559.74570 1917.44059 5 -2459.18311 2559.74570 6 2743.25286 -2459.18311 7 -1377.93459 2743.25286 8 4137.38383 -1377.93459 9 -704.31215 4137.38383 10 -877.48173 -704.31215 11 -541.74659 -877.48173 12 974.67526 -541.74659 13 781.42904 974.67526 14 1520.55095 781.42904 15 1813.49207 1520.55095 16 4324.07639 1813.49207 17 3007.39747 4324.07639 18 -924.33475 3007.39747 19 -1805.66088 -924.33475 20 2603.01419 -1805.66088 21 3017.61932 2603.01419 22 -1933.93353 3017.61932 23 -1849.52121 -1933.93353 24 2014.81801 -1849.52121 25 -1976.91247 2014.81801 26 -4580.04933 -1976.91247 27 8390.93277 -4580.04933 28 -1128.74312 8390.93277 29 1703.23933 -1128.74312 30 -165.01797 1703.23933 31 815.92401 -165.01797 32 937.43490 815.92401 33 -1114.81230 937.43490 34 1842.64332 -1114.81230 35 -1236.99762 1842.64332 36 -2530.99279 -1236.99762 37 -2435.15920 -2530.99279 38 -648.67845 -2435.15920 39 2684.16842 -648.67845 40 2606.68898 2684.16842 41 317.16700 2606.68898 42 4905.87189 317.16700 43 83.28140 4905.87189 44 -505.03651 83.28140 45 -772.30049 -505.03651 46 -2076.12006 -772.30049 47 1149.22469 -2076.12006 48 -2776.57403 1149.22469 49 -4398.81245 -2776.57403 50 -686.05716 -4398.81245 51 2245.40147 -686.05716 52 724.42905 2245.40147 53 2103.98779 724.42905 54 1756.39279 2103.98779 55 -1603.77391 1756.39279 56 697.22442 -1603.77391 57 -2946.97765 697.22442 58 -45.81329 -2946.97765 59 -1764.21702 -45.81329 60 -3464.82659 -1764.21702 61 -2529.83742 -3464.82659 62 1074.45390 -2529.83742 63 2021.10914 1074.45390 64 205.49207 2021.10914 65 1096.70013 205.49207 66 3110.15456 1096.70013 67 -1710.81382 3110.15456 68 668.03255 -1710.81382 69 -3295.38769 668.03255 70 171.93779 -3295.38769 71 682.01071 171.93779 72 -3248.32427 682.01071 73 -2764.78599 -3248.32427 74 -1961.22702 -2764.78599 75 928.67871 -1961.22702 76 217.40927 928.67871 77 1482.12236 217.40927 78 1028.58217 1482.12236 79 -1061.32285 1028.58217 80 347.00644 -1061.32285 81 -512.28670 347.00644 82 -1382.43765 -512.28670 83 1285.96782 -1382.43765 84 -1383.91596 1285.96782 85 -2805.26631 -1383.91596 86 -1408.61569 -2805.26631 87 297.70148 -1408.61569 88 706.30238 297.70148 89 2008.02606 706.30238 90 547.46843 2008.02606 91 -1262.89436 547.46843 92 1073.16413 -1262.89436 93 958.92526 1073.16413 94 -1730.24917 958.92526 95 -83.80363 -1730.24917 96 -1213.40886 -83.80363 97 -2461.97088 -1213.40886 98 NA -2461.97088 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] 369.28116 -1745.01031 [2,] -2765.89491 369.28116 [3,] 1917.44059 -2765.89491 [4,] 2559.74570 1917.44059 [5,] -2459.18311 2559.74570 [6,] 2743.25286 -2459.18311 [7,] -1377.93459 2743.25286 [8,] 4137.38383 -1377.93459 [9,] -704.31215 4137.38383 [10,] -877.48173 -704.31215 [11,] -541.74659 -877.48173 [12,] 974.67526 -541.74659 [13,] 781.42904 974.67526 [14,] 1520.55095 781.42904 [15,] 1813.49207 1520.55095 [16,] 4324.07639 1813.49207 [17,] 3007.39747 4324.07639 [18,] -924.33475 3007.39747 [19,] -1805.66088 -924.33475 [20,] 2603.01419 -1805.66088 [21,] 3017.61932 2603.01419 [22,] -1933.93353 3017.61932 [23,] -1849.52121 -1933.93353 [24,] 2014.81801 -1849.52121 [25,] -1976.91247 2014.81801 [26,] -4580.04933 -1976.91247 [27,] 8390.93277 -4580.04933 [28,] -1128.74312 8390.93277 [29,] 1703.23933 -1128.74312 [30,] -165.01797 1703.23933 [31,] 815.92401 -165.01797 [32,] 937.43490 815.92401 [33,] -1114.81230 937.43490 [34,] 1842.64332 -1114.81230 [35,] -1236.99762 1842.64332 [36,] -2530.99279 -1236.99762 [37,] -2435.15920 -2530.99279 [38,] -648.67845 -2435.15920 [39,] 2684.16842 -648.67845 [40,] 2606.68898 2684.16842 [41,] 317.16700 2606.68898 [42,] 4905.87189 317.16700 [43,] 83.28140 4905.87189 [44,] -505.03651 83.28140 [45,] -772.30049 -505.03651 [46,] -2076.12006 -772.30049 [47,] 1149.22469 -2076.12006 [48,] -2776.57403 1149.22469 [49,] -4398.81245 -2776.57403 [50,] -686.05716 -4398.81245 [51,] 2245.40147 -686.05716 [52,] 724.42905 2245.40147 [53,] 2103.98779 724.42905 [54,] 1756.39279 2103.98779 [55,] -1603.77391 1756.39279 [56,] 697.22442 -1603.77391 [57,] -2946.97765 697.22442 [58,] -45.81329 -2946.97765 [59,] -1764.21702 -45.81329 [60,] -3464.82659 -1764.21702 [61,] -2529.83742 -3464.82659 [62,] 1074.45390 -2529.83742 [63,] 2021.10914 1074.45390 [64,] 205.49207 2021.10914 [65,] 1096.70013 205.49207 [66,] 3110.15456 1096.70013 [67,] -1710.81382 3110.15456 [68,] 668.03255 -1710.81382 [69,] -3295.38769 668.03255 [70,] 171.93779 -3295.38769 [71,] 682.01071 171.93779 [72,] -3248.32427 682.01071 [73,] -2764.78599 -3248.32427 [74,] -1961.22702 -2764.78599 [75,] 928.67871 -1961.22702 [76,] 217.40927 928.67871 [77,] 1482.12236 217.40927 [78,] 1028.58217 1482.12236 [79,] -1061.32285 1028.58217 [80,] 347.00644 -1061.32285 [81,] -512.28670 347.00644 [82,] -1382.43765 -512.28670 [83,] 1285.96782 -1382.43765 [84,] -1383.91596 1285.96782 [85,] -2805.26631 -1383.91596 [86,] -1408.61569 -2805.26631 [87,] 297.70148 -1408.61569 [88,] 706.30238 297.70148 [89,] 2008.02606 706.30238 [90,] 547.46843 2008.02606 [91,] -1262.89436 547.46843 [92,] 1073.16413 -1262.89436 [93,] 958.92526 1073.16413 [94,] -1730.24917 958.92526 [95,] -83.80363 -1730.24917 [96,] -1213.40886 -83.80363 [97,] -2461.97088 -1213.40886 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 369.28116 -1745.01031 2 -2765.89491 369.28116 3 1917.44059 -2765.89491 4 2559.74570 1917.44059 5 -2459.18311 2559.74570 6 2743.25286 -2459.18311 7 -1377.93459 2743.25286 8 4137.38383 -1377.93459 9 -704.31215 4137.38383 10 -877.48173 -704.31215 11 -541.74659 -877.48173 12 974.67526 -541.74659 13 781.42904 974.67526 14 1520.55095 781.42904 15 1813.49207 1520.55095 16 4324.07639 1813.49207 17 3007.39747 4324.07639 18 -924.33475 3007.39747 19 -1805.66088 -924.33475 20 2603.01419 -1805.66088 21 3017.61932 2603.01419 22 -1933.93353 3017.61932 23 -1849.52121 -1933.93353 24 2014.81801 -1849.52121 25 -1976.91247 2014.81801 26 -4580.04933 -1976.91247 27 8390.93277 -4580.04933 28 -1128.74312 8390.93277 29 1703.23933 -1128.74312 30 -165.01797 1703.23933 31 815.92401 -165.01797 32 937.43490 815.92401 33 -1114.81230 937.43490 34 1842.64332 -1114.81230 35 -1236.99762 1842.64332 36 -2530.99279 -1236.99762 37 -2435.15920 -2530.99279 38 -648.67845 -2435.15920 39 2684.16842 -648.67845 40 2606.68898 2684.16842 41 317.16700 2606.68898 42 4905.87189 317.16700 43 83.28140 4905.87189 44 -505.03651 83.28140 45 -772.30049 -505.03651 46 -2076.12006 -772.30049 47 1149.22469 -2076.12006 48 -2776.57403 1149.22469 49 -4398.81245 -2776.57403 50 -686.05716 -4398.81245 51 2245.40147 -686.05716 52 724.42905 2245.40147 53 2103.98779 724.42905 54 1756.39279 2103.98779 55 -1603.77391 1756.39279 56 697.22442 -1603.77391 57 -2946.97765 697.22442 58 -45.81329 -2946.97765 59 -1764.21702 -45.81329 60 -3464.82659 -1764.21702 61 -2529.83742 -3464.82659 62 1074.45390 -2529.83742 63 2021.10914 1074.45390 64 205.49207 2021.10914 65 1096.70013 205.49207 66 3110.15456 1096.70013 67 -1710.81382 3110.15456 68 668.03255 -1710.81382 69 -3295.38769 668.03255 70 171.93779 -3295.38769 71 682.01071 171.93779 72 -3248.32427 682.01071 73 -2764.78599 -3248.32427 74 -1961.22702 -2764.78599 75 928.67871 -1961.22702 76 217.40927 928.67871 77 1482.12236 217.40927 78 1028.58217 1482.12236 79 -1061.32285 1028.58217 80 347.00644 -1061.32285 81 -512.28670 347.00644 82 -1382.43765 -512.28670 83 1285.96782 -1382.43765 84 -1383.91596 1285.96782 85 -2805.26631 -1383.91596 86 -1408.61569 -2805.26631 87 297.70148 -1408.61569 88 706.30238 297.70148 89 2008.02606 706.30238 90 547.46843 2008.02606 91 -1262.89436 547.46843 92 1073.16413 -1262.89436 93 958.92526 1073.16413 94 -1730.24917 958.92526 95 -83.80363 -1730.24917 96 -1213.40886 -83.80363 97 -2461.97088 -1213.40886 > 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/freestat/rcomp/tmp/7sjrr1293201825.ps",horizontal=F,onefile=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/freestat/rcomp/tmp/8sjrr1293201825.ps",horizontal=F,onefile=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/freestat/rcomp/tmp/9ksqc1293201825.ps",horizontal=F,onefile=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/freestat/rcomp/tmp/10ksqc1293201825.ps",horizontal=F,onefile=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/freestat/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/html/freestat/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/freestat/rcomp/tmp/11tev61293201825.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/freestat/rcomp/tmp/129tno1293201825.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/freestat/rcomp/tmp/1353ke1293201825.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/freestat/rcomp/tmp/14ql121293201825.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/freestat/rcomp/tmp/15cmi81293201825.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/freestat/rcomp/tmp/16xngw1293201825.tab") + } > > try(system("convert tmp/1wrb01293201825.ps tmp/1wrb01293201825.png",intern=TRUE)) character(0) > try(system("convert tmp/2o0al1293201825.ps tmp/2o0al1293201825.png",intern=TRUE)) character(0) > try(system("convert tmp/3o0al1293201825.ps tmp/3o0al1293201825.png",intern=TRUE)) character(0) > try(system("convert tmp/4o0al1293201825.ps tmp/4o0al1293201825.png",intern=TRUE)) character(0) > try(system("convert tmp/5zsro1293201825.ps tmp/5zsro1293201825.png",intern=TRUE)) character(0) > try(system("convert tmp/6zsro1293201825.ps tmp/6zsro1293201825.png",intern=TRUE)) character(0) > try(system("convert tmp/7sjrr1293201825.ps tmp/7sjrr1293201825.png",intern=TRUE)) character(0) > try(system("convert tmp/8sjrr1293201825.ps tmp/8sjrr1293201825.png",intern=TRUE)) character(0) > try(system("convert tmp/9ksqc1293201825.ps tmp/9ksqc1293201825.png",intern=TRUE)) character(0) > try(system("convert tmp/10ksqc1293201825.ps tmp/10ksqc1293201825.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 4.490 2.582 4.838