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(593530 + ,3922 + ,18004 + ,707169 + ,610763 + ,3759 + ,17537 + ,703434 + ,612613 + ,4138 + ,20366 + ,701017 + ,611324 + ,4634 + ,22782 + ,696968 + ,594167 + ,3996 + ,19169 + ,688558 + ,595454 + ,4308 + ,13807 + ,679237 + ,590865 + ,4143 + ,29743 + ,677362 + ,589379 + ,4429 + ,25591 + ,676693 + ,584428 + ,5219 + ,29096 + ,670009 + ,573100 + ,4929 + ,26482 + ,667209 + ,567456 + ,5761 + ,22405 + ,662976 + ,569028 + ,5592 + ,27044 + ,660194 + ,620735 + ,4163 + ,17970 + ,652270 + ,628884 + ,4962 + ,18730 + ,648024 + ,628232 + ,5208 + ,19684 + ,629295 + ,612117 + ,4755 + ,19785 + ,624961 + ,595404 + ,4491 + ,18479 + ,617306 + ,597141 + ,5732 + ,10698 + ,607691 + ,593408 + ,5731 + ,31956 + ,596219 + ,590072 + ,5040 + ,29506 + ,591130 + ,579799 + ,6102 + ,34506 + ,584528 + ,574205 + ,4904 + ,27165 + ,576798 + ,572775 + ,5369 + ,26736 + ,575683 + ,572942 + ,5578 + ,23691 + ,574369 + ,619567 + ,4619 + ,18157 + ,566815 + ,625809 + ,4731 + ,17328 + ,573074 + ,619916 + ,5011 + ,18205 + ,567739 + ,587625 + ,5299 + ,20995 + ,571942 + ,565742 + ,4146 + ,17382 + ,570274 + ,557274 + ,4625 + ,9367 + ,568800 + ,560576 + ,4736 + ,31124 + ,558115 + ,548854 + ,4219 + ,26551 + ,550591 + ,531673 + ,5116 + ,30651 + ,548872 + ,525919 + ,4205 + ,25859 + ,547009 + ,511038 + ,4121 + ,25100 + ,545946 + ,498662 + ,5103 + ,25778 + ,539702 + ,555362 + ,4300 + ,20418 + ,542427 + ,564591 + ,4578 + ,18688 + ,542968 + ,541657 + ,3809 + ,20424 + ,536640 + ,527070 + ,5526 + ,24776 + ,533653 + ,509846 + ,4248 + ,19814 + ,540996 + ,514258 + ,3830 + ,12738 + ,538316 + ,516922 + ,4428 + ,31566 + ,532646 + ,507561 + ,4834 + ,30111 + ,533390 + ,492622 + ,4406 + ,30019 + ,528715 + ,490243 + ,4565 + ,31934 + ,530664 + ,469357 + ,4104 + ,25826 + ,528564 + ,477580 + ,4798 + ,26835 + ,519107 + ,528379 + ,3935 + ,20205 + ,518703 + ,533590 + ,3792 + ,17789 + ,519059 + ,517945 + ,4387 + ,20520 + ,518498 + ,506174 + ,4006 + ,22518 + ,524575 + ,501866 + ,4078 + ,15572 + ,536046 + ,516141 + ,4724 + ,11509 + ,552006 + ,528222 + ,3157 + ,25447 + ,560687 + ,532638 + ,3558 + ,24090 + ,578884 + ,536322 + ,3899 + ,27786 + ,591491 + ,536535 + ,4118 + ,26195 + ,599228 + ,523597 + ,3790 + ,20516 + ,633019 + ,536214 + ,4278 + ,22759 + ,649918 + ,586570 + ,4035 + ,19028 + ,655509) + ,dim=c(4 + ,61) + ,dimnames=list(c('Werk' + ,'Bouwvergun' + ,'Auto' + ,'Hyp') + ,1:61)) > y <- array(NA,dim=c(4,61),dimnames=list(c('Werk','Bouwvergun','Auto','Hyp'),1:61)) > 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 Werk Bouwvergun Auto Hyp M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t 1 593530 3922 18004 707169 1 0 0 0 0 0 0 0 0 0 0 1 2 610763 3759 17537 703434 0 1 0 0 0 0 0 0 0 0 0 2 3 612613 4138 20366 701017 0 0 1 0 0 0 0 0 0 0 0 3 4 611324 4634 22782 696968 0 0 0 1 0 0 0 0 0 0 0 4 5 594167 3996 19169 688558 0 0 0 0 1 0 0 0 0 0 0 5 6 595454 4308 13807 679237 0 0 0 0 0 1 0 0 0 0 0 6 7 590865 4143 29743 677362 0 0 0 0 0 0 1 0 0 0 0 7 8 589379 4429 25591 676693 0 0 0 0 0 0 0 1 0 0 0 8 9 584428 5219 29096 670009 0 0 0 0 0 0 0 0 1 0 0 9 10 573100 4929 26482 667209 0 0 0 0 0 0 0 0 0 1 0 10 11 567456 5761 22405 662976 0 0 0 0 0 0 0 0 0 0 1 11 12 569028 5592 27044 660194 0 0 0 0 0 0 0 0 0 0 0 12 13 620735 4163 17970 652270 1 0 0 0 0 0 0 0 0 0 0 13 14 628884 4962 18730 648024 0 1 0 0 0 0 0 0 0 0 0 14 15 628232 5208 19684 629295 0 0 1 0 0 0 0 0 0 0 0 15 16 612117 4755 19785 624961 0 0 0 1 0 0 0 0 0 0 0 16 17 595404 4491 18479 617306 0 0 0 0 1 0 0 0 0 0 0 17 18 597141 5732 10698 607691 0 0 0 0 0 1 0 0 0 0 0 18 19 593408 5731 31956 596219 0 0 0 0 0 0 1 0 0 0 0 19 20 590072 5040 29506 591130 0 0 0 0 0 0 0 1 0 0 0 20 21 579799 6102 34506 584528 0 0 0 0 0 0 0 0 1 0 0 21 22 574205 4904 27165 576798 0 0 0 0 0 0 0 0 0 1 0 22 23 572775 5369 26736 575683 0 0 0 0 0 0 0 0 0 0 1 23 24 572942 5578 23691 574369 0 0 0 0 0 0 0 0 0 0 0 24 25 619567 4619 18157 566815 1 0 0 0 0 0 0 0 0 0 0 25 26 625809 4731 17328 573074 0 1 0 0 0 0 0 0 0 0 0 26 27 619916 5011 18205 567739 0 0 1 0 0 0 0 0 0 0 0 27 28 587625 5299 20995 571942 0 0 0 1 0 0 0 0 0 0 0 28 29 565742 4146 17382 570274 0 0 0 0 1 0 0 0 0 0 0 29 30 557274 4625 9367 568800 0 0 0 0 0 1 0 0 0 0 0 30 31 560576 4736 31124 558115 0 0 0 0 0 0 1 0 0 0 0 31 32 548854 4219 26551 550591 0 0 0 0 0 0 0 1 0 0 0 32 33 531673 5116 30651 548872 0 0 0 0 0 0 0 0 1 0 0 33 34 525919 4205 25859 547009 0 0 0 0 0 0 0 0 0 1 0 34 35 511038 4121 25100 545946 0 0 0 0 0 0 0 0 0 0 1 35 36 498662 5103 25778 539702 0 0 0 0 0 0 0 0 0 0 0 36 37 555362 4300 20418 542427 1 0 0 0 0 0 0 0 0 0 0 37 38 564591 4578 18688 542968 0 1 0 0 0 0 0 0 0 0 0 38 39 541657 3809 20424 536640 0 0 1 0 0 0 0 0 0 0 0 39 40 527070 5526 24776 533653 0 0 0 1 0 0 0 0 0 0 0 40 41 509846 4248 19814 540996 0 0 0 0 1 0 0 0 0 0 0 41 42 514258 3830 12738 538316 0 0 0 0 0 1 0 0 0 0 0 42 43 516922 4428 31566 532646 0 0 0 0 0 0 1 0 0 0 0 43 44 507561 4834 30111 533390 0 0 0 0 0 0 0 1 0 0 0 44 45 492622 4406 30019 528715 0 0 0 0 0 0 0 0 1 0 0 45 46 490243 4565 31934 530664 0 0 0 0 0 0 0 0 0 1 0 46 47 469357 4104 25826 528564 0 0 0 0 0 0 0 0 0 0 1 47 48 477580 4798 26835 519107 0 0 0 0 0 0 0 0 0 0 0 48 49 528379 3935 20205 518703 1 0 0 0 0 0 0 0 0 0 0 49 50 533590 3792 17789 519059 0 1 0 0 0 0 0 0 0 0 0 50 51 517945 4387 20520 518498 0 0 1 0 0 0 0 0 0 0 0 51 52 506174 4006 22518 524575 0 0 0 1 0 0 0 0 0 0 0 52 53 501866 4078 15572 536046 0 0 0 0 1 0 0 0 0 0 0 53 54 516141 4724 11509 552006 0 0 0 0 0 1 0 0 0 0 0 54 55 528222 3157 25447 560687 0 0 0 0 0 0 1 0 0 0 0 55 56 532638 3558 24090 578884 0 0 0 0 0 0 0 1 0 0 0 56 57 536322 3899 27786 591491 0 0 0 0 0 0 0 0 1 0 0 57 58 536535 4118 26195 599228 0 0 0 0 0 0 0 0 0 1 0 58 59 523597 3790 20516 633019 0 0 0 0 0 0 0 0 0 0 1 59 60 536214 4278 22759 649918 0 0 0 0 0 0 0 0 0 0 0 60 61 586570 4035 19028 655509 1 0 0 0 0 0 0 0 0 0 0 61 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) Bouwvergun Auto Hyp M1 M2 3.864e+05 2.668e+01 -5.168e+00 2.799e-01 3.633e+04 3.399e+04 M3 M4 M5 M6 M7 M8 3.343e+04 2.214e+04 3.594e+03 -3.810e+04 6.599e+04 4.823e+04 M9 M10 M11 t 4.315e+04 3.491e+04 3.147e+03 -7.005e+02 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -38049.1 -9842.7 -325.3 13392.7 33113.9 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 3.864e+05 7.594e+04 5.089 6.84e-06 *** Bouwvergun 2.668e+01 5.305e+00 5.030 8.34e-06 *** Auto -5.168e+00 1.492e+00 -3.464 0.001179 ** Hyp 2.799e-01 6.580e-02 4.253 0.000105 *** M1 3.633e+04 1.451e+04 2.503 0.016014 * M2 3.399e+04 1.617e+04 2.102 0.041215 * M3 3.343e+04 1.454e+04 2.300 0.026138 * M4 2.214e+04 1.267e+04 1.747 0.087434 . M5 3.594e+03 1.615e+04 0.223 0.824852 M6 -3.810e+04 2.333e+04 -1.633 0.109482 M7 6.599e+04 1.436e+04 4.597 3.47e-05 *** M8 4.823e+04 1.267e+04 3.806 0.000424 *** M9 4.315e+04 1.387e+04 3.110 0.003241 ** M10 3.491e+04 1.253e+04 2.785 0.007809 ** M11 3.147e+03 1.180e+04 0.267 0.790854 t -7.005e+02 2.375e+02 -2.949 0.005041 ** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 18170 on 45 degrees of freedom Multiple R-squared: 0.8627, Adjusted R-squared: 0.8169 F-statistic: 18.85 on 15 and 45 DF, p-value: 1.396e-14 > 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.20432302 0.40864605 0.79567698 [2,] 0.09211471 0.18422943 0.90788529 [3,] 0.05231621 0.10463243 0.94768379 [4,] 0.04065209 0.08130418 0.95934791 [5,] 0.03183468 0.06366936 0.96816532 [6,] 0.02275188 0.04550376 0.97724812 [7,] 0.01473671 0.02947342 0.98526329 [8,] 0.03626444 0.07252888 0.96373556 [9,] 0.27949702 0.55899404 0.72050298 [10,] 0.89847764 0.20304472 0.10152236 [11,] 0.97014148 0.05971703 0.02985852 [12,] 0.97088712 0.05822576 0.02911288 [13,] 0.97079755 0.05840489 0.02920245 [14,] 0.96814117 0.06371766 0.03185883 [15,] 0.96018771 0.07962459 0.03981229 [16,] 0.95165076 0.09669848 0.04834924 [17,] 0.97951646 0.04096708 0.02048354 [18,] 0.98526089 0.02947823 0.01473911 [19,] 0.96763374 0.06473253 0.03236626 [20,] 0.93888096 0.12223809 0.06111904 [21,] 0.89035744 0.21928512 0.10964256 [22,] 0.87954284 0.24091433 0.12045716 [23,] 0.81168681 0.37662637 0.18831319 [24,] 0.88801863 0.22396274 0.11198137 > postscript(file="/var/www/html/rcomp/tmp/14zzk1261155886.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/2dcgl1261155886.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/3dim81261155886.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/4hn141261155886.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/5o80a1261155886.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 = 61 Frequency = 1 1 2 3 4 5 6 -38049.0735 -14792.3419 -6502.8957 4590.0895 7380.5198 17635.5048 7 8 9 10 11 12 -3054.7228 -14984.0243 -15240.5252 -22616.2049 -37884.7651 -3201.5689 13 14 15 16 17 18 6320.9683 1312.8044 5523.1319 15223.7005 20192.3152 -6308.0355 19 20 21 22 23 24 -325.2811 21994.9311 16863.4984 16395.2981 33113.8890 16182.1290 25 26 27 28 29 30 26276.0652 26536.9015 20452.4955 5716.2530 15633.6499 -4229.8832 31 32 33 34 35 36 8158.5662 7159.4657 -6496.0965 -3248.9700 12945.4752 -16530.5761 37 38 39 40 41 42 -2501.1678 -6738.5427 2840.3520 -22231.3462 -13814.2136 8324.3734 43 44 45 46 47 48 -9459.9838 -18921.9999 -15824.1326 -4151.1384 -11259.3049 -9842.6919 49 50 51 52 53 54 -5801.7034 -6318.8212 -22313.0837 -3298.6968 -29392.2713 -15421.9595 55 56 57 58 59 60 4681.4216 4751.6274 20697.2558 13621.0152 3084.7058 13392.7080 61 13754.9112 > postscript(file="/var/www/html/rcomp/tmp/6vzkm1261155886.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 = 61 Frequency = 1 lag(myerror, k = 1) myerror 0 -38049.0735 NA 1 -14792.3419 -38049.0735 2 -6502.8957 -14792.3419 3 4590.0895 -6502.8957 4 7380.5198 4590.0895 5 17635.5048 7380.5198 6 -3054.7228 17635.5048 7 -14984.0243 -3054.7228 8 -15240.5252 -14984.0243 9 -22616.2049 -15240.5252 10 -37884.7651 -22616.2049 11 -3201.5689 -37884.7651 12 6320.9683 -3201.5689 13 1312.8044 6320.9683 14 5523.1319 1312.8044 15 15223.7005 5523.1319 16 20192.3152 15223.7005 17 -6308.0355 20192.3152 18 -325.2811 -6308.0355 19 21994.9311 -325.2811 20 16863.4984 21994.9311 21 16395.2981 16863.4984 22 33113.8890 16395.2981 23 16182.1290 33113.8890 24 26276.0652 16182.1290 25 26536.9015 26276.0652 26 20452.4955 26536.9015 27 5716.2530 20452.4955 28 15633.6499 5716.2530 29 -4229.8832 15633.6499 30 8158.5662 -4229.8832 31 7159.4657 8158.5662 32 -6496.0965 7159.4657 33 -3248.9700 -6496.0965 34 12945.4752 -3248.9700 35 -16530.5761 12945.4752 36 -2501.1678 -16530.5761 37 -6738.5427 -2501.1678 38 2840.3520 -6738.5427 39 -22231.3462 2840.3520 40 -13814.2136 -22231.3462 41 8324.3734 -13814.2136 42 -9459.9838 8324.3734 43 -18921.9999 -9459.9838 44 -15824.1326 -18921.9999 45 -4151.1384 -15824.1326 46 -11259.3049 -4151.1384 47 -9842.6919 -11259.3049 48 -5801.7034 -9842.6919 49 -6318.8212 -5801.7034 50 -22313.0837 -6318.8212 51 -3298.6968 -22313.0837 52 -29392.2713 -3298.6968 53 -15421.9595 -29392.2713 54 4681.4216 -15421.9595 55 4751.6274 4681.4216 56 20697.2558 4751.6274 57 13621.0152 20697.2558 58 3084.7058 13621.0152 59 13392.7080 3084.7058 60 13754.9112 13392.7080 61 NA 13754.9112 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -14792.3419 -38049.0735 [2,] -6502.8957 -14792.3419 [3,] 4590.0895 -6502.8957 [4,] 7380.5198 4590.0895 [5,] 17635.5048 7380.5198 [6,] -3054.7228 17635.5048 [7,] -14984.0243 -3054.7228 [8,] -15240.5252 -14984.0243 [9,] -22616.2049 -15240.5252 [10,] -37884.7651 -22616.2049 [11,] -3201.5689 -37884.7651 [12,] 6320.9683 -3201.5689 [13,] 1312.8044 6320.9683 [14,] 5523.1319 1312.8044 [15,] 15223.7005 5523.1319 [16,] 20192.3152 15223.7005 [17,] -6308.0355 20192.3152 [18,] -325.2811 -6308.0355 [19,] 21994.9311 -325.2811 [20,] 16863.4984 21994.9311 [21,] 16395.2981 16863.4984 [22,] 33113.8890 16395.2981 [23,] 16182.1290 33113.8890 [24,] 26276.0652 16182.1290 [25,] 26536.9015 26276.0652 [26,] 20452.4955 26536.9015 [27,] 5716.2530 20452.4955 [28,] 15633.6499 5716.2530 [29,] -4229.8832 15633.6499 [30,] 8158.5662 -4229.8832 [31,] 7159.4657 8158.5662 [32,] -6496.0965 7159.4657 [33,] -3248.9700 -6496.0965 [34,] 12945.4752 -3248.9700 [35,] -16530.5761 12945.4752 [36,] -2501.1678 -16530.5761 [37,] -6738.5427 -2501.1678 [38,] 2840.3520 -6738.5427 [39,] -22231.3462 2840.3520 [40,] -13814.2136 -22231.3462 [41,] 8324.3734 -13814.2136 [42,] -9459.9838 8324.3734 [43,] -18921.9999 -9459.9838 [44,] -15824.1326 -18921.9999 [45,] -4151.1384 -15824.1326 [46,] -11259.3049 -4151.1384 [47,] -9842.6919 -11259.3049 [48,] -5801.7034 -9842.6919 [49,] -6318.8212 -5801.7034 [50,] -22313.0837 -6318.8212 [51,] -3298.6968 -22313.0837 [52,] -29392.2713 -3298.6968 [53,] -15421.9595 -29392.2713 [54,] 4681.4216 -15421.9595 [55,] 4751.6274 4681.4216 [56,] 20697.2558 4751.6274 [57,] 13621.0152 20697.2558 [58,] 3084.7058 13621.0152 [59,] 13392.7080 3084.7058 [60,] 13754.9112 13392.7080 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -14792.3419 -38049.0735 2 -6502.8957 -14792.3419 3 4590.0895 -6502.8957 4 7380.5198 4590.0895 5 17635.5048 7380.5198 6 -3054.7228 17635.5048 7 -14984.0243 -3054.7228 8 -15240.5252 -14984.0243 9 -22616.2049 -15240.5252 10 -37884.7651 -22616.2049 11 -3201.5689 -37884.7651 12 6320.9683 -3201.5689 13 1312.8044 6320.9683 14 5523.1319 1312.8044 15 15223.7005 5523.1319 16 20192.3152 15223.7005 17 -6308.0355 20192.3152 18 -325.2811 -6308.0355 19 21994.9311 -325.2811 20 16863.4984 21994.9311 21 16395.2981 16863.4984 22 33113.8890 16395.2981 23 16182.1290 33113.8890 24 26276.0652 16182.1290 25 26536.9015 26276.0652 26 20452.4955 26536.9015 27 5716.2530 20452.4955 28 15633.6499 5716.2530 29 -4229.8832 15633.6499 30 8158.5662 -4229.8832 31 7159.4657 8158.5662 32 -6496.0965 7159.4657 33 -3248.9700 -6496.0965 34 12945.4752 -3248.9700 35 -16530.5761 12945.4752 36 -2501.1678 -16530.5761 37 -6738.5427 -2501.1678 38 2840.3520 -6738.5427 39 -22231.3462 2840.3520 40 -13814.2136 -22231.3462 41 8324.3734 -13814.2136 42 -9459.9838 8324.3734 43 -18921.9999 -9459.9838 44 -15824.1326 -18921.9999 45 -4151.1384 -15824.1326 46 -11259.3049 -4151.1384 47 -9842.6919 -11259.3049 48 -5801.7034 -9842.6919 49 -6318.8212 -5801.7034 50 -22313.0837 -6318.8212 51 -3298.6968 -22313.0837 52 -29392.2713 -3298.6968 53 -15421.9595 -29392.2713 54 4681.4216 -15421.9595 55 4751.6274 4681.4216 56 20697.2558 4751.6274 57 13621.0152 20697.2558 58 3084.7058 13621.0152 59 13392.7080 3084.7058 60 13754.9112 13392.7080 > 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/73k7z1261155886.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/860i41261155886.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/9w4le1261155886.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/10nujl1261155886.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/11i1mr1261155886.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/12z3681261155886.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/13g5s91261155886.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/142v2f1261155886.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/15wy8t1261155886.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/16qs0z1261155886.tab") + } > > try(system("convert tmp/14zzk1261155886.ps tmp/14zzk1261155886.png",intern=TRUE)) character(0) > try(system("convert tmp/2dcgl1261155886.ps tmp/2dcgl1261155886.png",intern=TRUE)) character(0) > try(system("convert tmp/3dim81261155886.ps tmp/3dim81261155886.png",intern=TRUE)) character(0) > try(system("convert tmp/4hn141261155886.ps tmp/4hn141261155886.png",intern=TRUE)) character(0) > try(system("convert tmp/5o80a1261155886.ps tmp/5o80a1261155886.png",intern=TRUE)) character(0) > try(system("convert tmp/6vzkm1261155886.ps tmp/6vzkm1261155886.png",intern=TRUE)) character(0) > try(system("convert tmp/73k7z1261155886.ps tmp/73k7z1261155886.png",intern=TRUE)) character(0) > try(system("convert tmp/860i41261155886.ps tmp/860i41261155886.png",intern=TRUE)) character(0) > try(system("convert tmp/9w4le1261155886.ps tmp/9w4le1261155886.png",intern=TRUE)) character(0) > try(system("convert tmp/10nujl1261155886.ps tmp/10nujl1261155886.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.401 1.577 3.340