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(209465 + ,555332 + ,213587 + ,216234 + ,204045 + ,543599 + ,209465 + ,213587 + ,200237 + ,536662 + ,204045 + ,209465 + ,203666 + ,542722 + ,200237 + ,204045 + ,241476 + ,593530 + ,203666 + ,200237 + ,260307 + ,610763 + ,241476 + ,203666 + ,243324 + ,612613 + ,260307 + ,241476 + ,244460 + ,611324 + ,243324 + ,260307 + ,233575 + ,594167 + ,244460 + ,243324 + ,237217 + ,595454 + ,233575 + ,244460 + ,235243 + ,590865 + ,237217 + ,233575 + ,230354 + ,589379 + ,235243 + ,237217 + ,227184 + ,584428 + ,230354 + ,235243 + ,221678 + ,573100 + ,227184 + ,230354 + ,217142 + ,567456 + ,221678 + ,227184 + ,219452 + ,569028 + ,217142 + ,221678 + ,256446 + ,620735 + ,219452 + ,217142 + ,265845 + ,628884 + ,256446 + ,219452 + ,248624 + ,628232 + ,265845 + ,256446 + ,241114 + ,612117 + ,248624 + ,265845 + ,229245 + ,595404 + ,241114 + ,248624 + ,231805 + ,597141 + ,229245 + ,241114 + ,219277 + ,593408 + ,231805 + ,229245 + ,219313 + ,590072 + ,219277 + ,231805 + ,212610 + ,579799 + ,219313 + ,219277 + ,214771 + ,574205 + ,212610 + ,219313 + ,211142 + ,572775 + ,214771 + ,212610 + ,211457 + ,572942 + ,211142 + ,214771 + ,240048 + ,619567 + ,211457 + ,211142 + ,240636 + ,625809 + ,240048 + ,211457 + ,230580 + ,619916 + ,240636 + ,240048 + ,208795 + ,587625 + ,230580 + ,240636 + ,197922 + ,565742 + ,208795 + ,230580 + ,194596 + ,557274 + ,197922 + ,208795 + ,194581 + ,560576 + ,194596 + ,197922 + ,185686 + ,548854 + ,194581 + ,194596 + ,178106 + ,531673 + ,185686 + ,194581 + ,172608 + ,525919 + ,178106 + ,185686 + ,167302 + ,511038 + ,172608 + ,178106 + ,168053 + ,498662 + ,167302 + ,172608 + ,202300 + ,555362 + ,168053 + ,167302 + ,202388 + ,564591 + ,202300 + ,168053 + ,182516 + ,541657 + ,202388 + ,202300 + ,173476 + ,527070 + ,182516 + ,202388 + ,166444 + ,509846 + ,173476 + ,182516 + ,171297 + ,514258 + ,166444 + ,173476 + ,169701 + ,516922 + ,171297 + ,166444 + ,164182 + ,507561 + ,169701 + ,171297 + ,161914 + ,492622 + ,164182 + ,169701 + ,159612 + ,490243 + ,161914 + ,164182 + ,151001 + ,469357 + ,159612 + ,161914 + ,158114 + ,477580 + ,151001 + ,159612 + ,186530 + ,528379 + ,158114 + ,151001 + ,187069 + ,533590 + ,186530 + ,158114 + ,174330 + ,517945 + ,187069 + ,186530 + ,169362 + ,506174 + ,174330 + ,187069 + ,166827 + ,501866 + ,169362 + ,174330 + ,178037 + ,516141 + ,166827 + ,169362 + ,186412 + ,528222 + ,178037 + ,166827 + ,189226 + ,532638 + ,186412 + ,178037 + ,191563 + ,536322 + ,189226 + ,186412 + ,188906 + ,536535 + ,191563 + ,189226 + ,186005 + ,523597 + ,188906 + ,191563 + ,195309 + ,536214 + ,186005 + ,188906 + ,223532 + ,586570 + ,195309 + ,186005 + ,226899 + ,596594 + ,223532 + ,195309 + ,214126 + ,580523 + ,226899 + ,223532) + ,dim=c(4 + ,67) + ,dimnames=list(c('Werkl' + ,'x' + ,'y-1' + ,'y-2') + ,1:67)) > y <- array(NA,dim=c(4,67),dimnames=list(c('Werkl','x','y-1','y-2'),1:67)) > 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 Werkl x y-1 y-2 M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t 1 209465 555332 213587 216234 1 0 0 0 0 0 0 0 0 0 0 1 2 204045 543599 209465 213587 0 1 0 0 0 0 0 0 0 0 0 2 3 200237 536662 204045 209465 0 0 1 0 0 0 0 0 0 0 0 3 4 203666 542722 200237 204045 0 0 0 1 0 0 0 0 0 0 0 4 5 241476 593530 203666 200237 0 0 0 0 1 0 0 0 0 0 0 5 6 260307 610763 241476 203666 0 0 0 0 0 1 0 0 0 0 0 6 7 243324 612613 260307 241476 0 0 0 0 0 0 1 0 0 0 0 7 8 244460 611324 243324 260307 0 0 0 0 0 0 0 1 0 0 0 8 9 233575 594167 244460 243324 0 0 0 0 0 0 0 0 1 0 0 9 10 237217 595454 233575 244460 0 0 0 0 0 0 0 0 0 1 0 10 11 235243 590865 237217 233575 0 0 0 0 0 0 0 0 0 0 1 11 12 230354 589379 235243 237217 0 0 0 0 0 0 0 0 0 0 0 12 13 227184 584428 230354 235243 1 0 0 0 0 0 0 0 0 0 0 13 14 221678 573100 227184 230354 0 1 0 0 0 0 0 0 0 0 0 14 15 217142 567456 221678 227184 0 0 1 0 0 0 0 0 0 0 0 15 16 219452 569028 217142 221678 0 0 0 1 0 0 0 0 0 0 0 16 17 256446 620735 219452 217142 0 0 0 0 1 0 0 0 0 0 0 17 18 265845 628884 256446 219452 0 0 0 0 0 1 0 0 0 0 0 18 19 248624 628232 265845 256446 0 0 0 0 0 0 1 0 0 0 0 19 20 241114 612117 248624 265845 0 0 0 0 0 0 0 1 0 0 0 20 21 229245 595404 241114 248624 0 0 0 0 0 0 0 0 1 0 0 21 22 231805 597141 229245 241114 0 0 0 0 0 0 0 0 0 1 0 22 23 219277 593408 231805 229245 0 0 0 0 0 0 0 0 0 0 1 23 24 219313 590072 219277 231805 0 0 0 0 0 0 0 0 0 0 0 24 25 212610 579799 219313 219277 1 0 0 0 0 0 0 0 0 0 0 25 26 214771 574205 212610 219313 0 1 0 0 0 0 0 0 0 0 0 26 27 211142 572775 214771 212610 0 0 1 0 0 0 0 0 0 0 0 27 28 211457 572942 211142 214771 0 0 0 1 0 0 0 0 0 0 0 28 29 240048 619567 211457 211142 0 0 0 0 1 0 0 0 0 0 0 29 30 240636 625809 240048 211457 0 0 0 0 0 1 0 0 0 0 0 30 31 230580 619916 240636 240048 0 0 0 0 0 0 1 0 0 0 0 31 32 208795 587625 230580 240636 0 0 0 0 0 0 0 1 0 0 0 32 33 197922 565742 208795 230580 0 0 0 0 0 0 0 0 1 0 0 33 34 194596 557274 197922 208795 0 0 0 0 0 0 0 0 0 1 0 34 35 194581 560576 194596 197922 0 0 0 0 0 0 0 0 0 0 1 35 36 185686 548854 194581 194596 0 0 0 0 0 0 0 0 0 0 0 36 37 178106 531673 185686 194581 1 0 0 0 0 0 0 0 0 0 0 37 38 172608 525919 178106 185686 0 1 0 0 0 0 0 0 0 0 0 38 39 167302 511038 172608 178106 0 0 1 0 0 0 0 0 0 0 0 39 40 168053 498662 167302 172608 0 0 0 1 0 0 0 0 0 0 0 40 41 202300 555362 168053 167302 0 0 0 0 1 0 0 0 0 0 0 41 42 202388 564591 202300 168053 0 0 0 0 0 1 0 0 0 0 0 42 43 182516 541657 202388 202300 0 0 0 0 0 0 1 0 0 0 0 43 44 173476 527070 182516 202388 0 0 0 0 0 0 0 1 0 0 0 44 45 166444 509846 173476 182516 0 0 0 0 0 0 0 0 1 0 0 45 46 171297 514258 166444 173476 0 0 0 0 0 0 0 0 0 1 0 46 47 169701 516922 171297 166444 0 0 0 0 0 0 0 0 0 0 1 47 48 164182 507561 169701 171297 0 0 0 0 0 0 0 0 0 0 0 48 49 161914 492622 164182 169701 1 0 0 0 0 0 0 0 0 0 0 49 50 159612 490243 161914 164182 0 1 0 0 0 0 0 0 0 0 0 50 51 151001 469357 159612 161914 0 0 1 0 0 0 0 0 0 0 0 51 52 158114 477580 151001 159612 0 0 0 1 0 0 0 0 0 0 0 52 53 186530 528379 158114 151001 0 0 0 0 1 0 0 0 0 0 0 53 54 187069 533590 186530 158114 0 0 0 0 0 1 0 0 0 0 0 54 55 174330 517945 187069 186530 0 0 0 0 0 0 1 0 0 0 0 55 56 169362 506174 174330 187069 0 0 0 0 0 0 0 1 0 0 0 56 57 166827 501866 169362 174330 0 0 0 0 0 0 0 0 1 0 0 57 58 178037 516141 166827 169362 0 0 0 0 0 0 0 0 0 1 0 58 59 186412 528222 178037 166827 0 0 0 0 0 0 0 0 0 0 1 59 60 189226 532638 186412 178037 0 0 0 0 0 0 0 0 0 0 0 60 61 191563 536322 189226 186412 1 0 0 0 0 0 0 0 0 0 0 61 62 188906 536535 191563 189226 0 1 0 0 0 0 0 0 0 0 0 62 63 186005 523597 188906 191563 0 0 1 0 0 0 0 0 0 0 0 63 64 195309 536214 186005 188906 0 0 0 1 0 0 0 0 0 0 0 64 65 223532 586570 195309 186005 0 0 0 0 1 0 0 0 0 0 0 65 66 226899 596594 223532 195309 0 0 0 0 0 1 0 0 0 0 0 66 67 214126 580523 226899 223532 0 0 0 0 0 0 1 0 0 0 0 67 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) x `y-1` `y-2` M1 M2 -3.791e+04 1.679e-01 9.837e-01 -2.621e-01 8.562e+02 1.422e+03 M3 M4 M5 M6 M7 M8 6.456e+02 7.996e+03 2.677e+04 -1.099e+02 -1.023e+04 -1.533e+02 M9 M10 M11 t -1.876e+03 7.809e+03 -1.116e+00 -5.474e+01 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -13802 -2754 -141 3118 11949 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) -3.791e+04 2.460e+04 -1.541 0.12949 x 1.679e-01 9.346e-02 1.797 0.07831 . `y-1` 9.837e-01 1.552e-01 6.339 6.02e-08 *** `y-2` -2.621e-01 1.500e-01 -1.748 0.08651 . M1 8.562e+02 3.092e+03 0.277 0.78294 M2 1.422e+03 3.124e+03 0.455 0.65078 M3 6.456e+02 3.282e+03 0.197 0.84481 M4 7.996e+03 3.116e+03 2.566 0.01326 * M5 2.677e+04 5.381e+03 4.976 7.78e-06 *** M6 -1.099e+02 5.996e+03 -0.018 0.98544 M7 -1.023e+04 3.436e+03 -2.976 0.00445 ** M8 -1.533e+02 4.000e+03 -0.038 0.96958 M9 -1.876e+03 3.545e+03 -0.529 0.59895 M10 7.809e+03 3.303e+03 2.364 0.02190 * M11 -1.116e+00 3.288e+03 -0.000339 0.99973 t -5.474e+01 5.502e+01 -0.995 0.32452 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 4997 on 51 degrees of freedom Multiple R-squared: 0.977, Adjusted R-squared: 0.9702 F-statistic: 144.5 on 15 and 51 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.01830029 0.0366005734 0.9816997133 [2,] 0.01807828 0.0361565567 0.9819217216 [3,] 0.00626334 0.0125266795 0.9937366603 [4,] 0.00660126 0.0132025202 0.9933987399 [5,] 0.17377174 0.3475434740 0.8262282630 [6,] 0.18147055 0.3629411003 0.8185294499 [7,] 0.16111988 0.3222397531 0.8388801234 [8,] 0.51340214 0.9731957231 0.4865978616 [9,] 0.44979118 0.8995823603 0.5502088198 [10,] 0.35767384 0.7153476721 0.6423261639 [11,] 0.59611523 0.8077695384 0.4038847692 [12,] 0.96124738 0.0775052420 0.0387526210 [13,] 0.98273119 0.0345376135 0.0172688068 [14,] 0.97109955 0.0578009092 0.0289004546 [15,] 0.98756070 0.0248786045 0.0124393022 [16,] 0.98894913 0.0221017446 0.0110508723 [17,] 0.99550683 0.0089863380 0.0044931690 [18,] 0.99214927 0.0157014635 0.0078507317 [19,] 0.99135716 0.0172856791 0.0086428396 [20,] 0.98353140 0.0329372074 0.0164686037 [21,] 0.99157575 0.0168484929 0.0084242464 [22,] 0.99679438 0.0064112429 0.0032056214 [23,] 0.99964069 0.0007186131 0.0003593066 [24,] 0.99894598 0.0021080397 0.0010540198 [25,] 0.99682094 0.0063581217 0.0031790609 [26,] 0.99155936 0.0168812706 0.0084406353 [27,] 0.98935398 0.0212920330 0.0106460165 [28,] 0.99463604 0.0107279264 0.0053639632 [29,] 0.98195061 0.0360987850 0.0180493925 [30,] 0.99857916 0.0028416717 0.0014208359 > postscript(file="/var/www/html/rcomp/tmp/1kxek1259925883.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/2k7ve1259925883.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/36w6z1259925883.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/4prnq1259925883.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/5sfpo1259925883.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 = 67 Frequency = 1 1 2 3 4 5 6 -96.2286 -696.4670 1742.9236 -816.1947 5367.5098 11948.8038 7 8 9 10 11 12 -3786.1363 9190.2675 -2605.5376 2195.3704 2420.7815 731.4457 13 14 15 16 17 18 1883.1375 -395.2960 1433.1238 -797.7770 5328.8817 4512.9392 19 20 21 22 23 24 -1975.5778 2606.0760 -1805.6707 539.1875 -9126.7303 4517.8463 25 26 27 28 29 30 -4581.0628 4611.0508 -1829.2524 -4701.6261 -3924.3638 -5488.0760 31 32 33 34 35 36 2533.0603 -13801.8290 -428.9978 -6978.2634 738.5906 -6991.5226 37 38 39 40 41 42 -3741.9481 -3660.4161 -2214.7968 -2902.9835 969.9722 -7044.7948 43 44 45 46 47 48 -4003.6082 -1041.5300 279.6550 -690.8677 -1486.6306 -2537.9694 49 50 51 52 53 54 1911.7399 282.1368 -2320.2813 3983.4038 -4108.3481 -3593.7780 55 56 57 58 59 60 3384.2590 3047.0154 4560.5511 4934.5732 7453.9887 4280.2000 61 62 63 64 65 66 4624.3621 -141.0085 3188.2832 5235.1774 -3633.6517 -335.0942 67 3848.0029 > postscript(file="/var/www/html/rcomp/tmp/6yldu1259925883.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 = 67 Frequency = 1 lag(myerror, k = 1) myerror 0 -96.2286 NA 1 -696.4670 -96.2286 2 1742.9236 -696.4670 3 -816.1947 1742.9236 4 5367.5098 -816.1947 5 11948.8038 5367.5098 6 -3786.1363 11948.8038 7 9190.2675 -3786.1363 8 -2605.5376 9190.2675 9 2195.3704 -2605.5376 10 2420.7815 2195.3704 11 731.4457 2420.7815 12 1883.1375 731.4457 13 -395.2960 1883.1375 14 1433.1238 -395.2960 15 -797.7770 1433.1238 16 5328.8817 -797.7770 17 4512.9392 5328.8817 18 -1975.5778 4512.9392 19 2606.0760 -1975.5778 20 -1805.6707 2606.0760 21 539.1875 -1805.6707 22 -9126.7303 539.1875 23 4517.8463 -9126.7303 24 -4581.0628 4517.8463 25 4611.0508 -4581.0628 26 -1829.2524 4611.0508 27 -4701.6261 -1829.2524 28 -3924.3638 -4701.6261 29 -5488.0760 -3924.3638 30 2533.0603 -5488.0760 31 -13801.8290 2533.0603 32 -428.9978 -13801.8290 33 -6978.2634 -428.9978 34 738.5906 -6978.2634 35 -6991.5226 738.5906 36 -3741.9481 -6991.5226 37 -3660.4161 -3741.9481 38 -2214.7968 -3660.4161 39 -2902.9835 -2214.7968 40 969.9722 -2902.9835 41 -7044.7948 969.9722 42 -4003.6082 -7044.7948 43 -1041.5300 -4003.6082 44 279.6550 -1041.5300 45 -690.8677 279.6550 46 -1486.6306 -690.8677 47 -2537.9694 -1486.6306 48 1911.7399 -2537.9694 49 282.1368 1911.7399 50 -2320.2813 282.1368 51 3983.4038 -2320.2813 52 -4108.3481 3983.4038 53 -3593.7780 -4108.3481 54 3384.2590 -3593.7780 55 3047.0154 3384.2590 56 4560.5511 3047.0154 57 4934.5732 4560.5511 58 7453.9887 4934.5732 59 4280.2000 7453.9887 60 4624.3621 4280.2000 61 -141.0085 4624.3621 62 3188.2832 -141.0085 63 5235.1774 3188.2832 64 -3633.6517 5235.1774 65 -335.0942 -3633.6517 66 3848.0029 -335.0942 67 NA 3848.0029 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] -696.4670 -96.2286 [2,] 1742.9236 -696.4670 [3,] -816.1947 1742.9236 [4,] 5367.5098 -816.1947 [5,] 11948.8038 5367.5098 [6,] -3786.1363 11948.8038 [7,] 9190.2675 -3786.1363 [8,] -2605.5376 9190.2675 [9,] 2195.3704 -2605.5376 [10,] 2420.7815 2195.3704 [11,] 731.4457 2420.7815 [12,] 1883.1375 731.4457 [13,] -395.2960 1883.1375 [14,] 1433.1238 -395.2960 [15,] -797.7770 1433.1238 [16,] 5328.8817 -797.7770 [17,] 4512.9392 5328.8817 [18,] -1975.5778 4512.9392 [19,] 2606.0760 -1975.5778 [20,] -1805.6707 2606.0760 [21,] 539.1875 -1805.6707 [22,] -9126.7303 539.1875 [23,] 4517.8463 -9126.7303 [24,] -4581.0628 4517.8463 [25,] 4611.0508 -4581.0628 [26,] -1829.2524 4611.0508 [27,] -4701.6261 -1829.2524 [28,] -3924.3638 -4701.6261 [29,] -5488.0760 -3924.3638 [30,] 2533.0603 -5488.0760 [31,] -13801.8290 2533.0603 [32,] -428.9978 -13801.8290 [33,] -6978.2634 -428.9978 [34,] 738.5906 -6978.2634 [35,] -6991.5226 738.5906 [36,] -3741.9481 -6991.5226 [37,] -3660.4161 -3741.9481 [38,] -2214.7968 -3660.4161 [39,] -2902.9835 -2214.7968 [40,] 969.9722 -2902.9835 [41,] -7044.7948 969.9722 [42,] -4003.6082 -7044.7948 [43,] -1041.5300 -4003.6082 [44,] 279.6550 -1041.5300 [45,] -690.8677 279.6550 [46,] -1486.6306 -690.8677 [47,] -2537.9694 -1486.6306 [48,] 1911.7399 -2537.9694 [49,] 282.1368 1911.7399 [50,] -2320.2813 282.1368 [51,] 3983.4038 -2320.2813 [52,] -4108.3481 3983.4038 [53,] -3593.7780 -4108.3481 [54,] 3384.2590 -3593.7780 [55,] 3047.0154 3384.2590 [56,] 4560.5511 3047.0154 [57,] 4934.5732 4560.5511 [58,] 7453.9887 4934.5732 [59,] 4280.2000 7453.9887 [60,] 4624.3621 4280.2000 [61,] -141.0085 4624.3621 [62,] 3188.2832 -141.0085 [63,] 5235.1774 3188.2832 [64,] -3633.6517 5235.1774 [65,] -335.0942 -3633.6517 [66,] 3848.0029 -335.0942 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 -696.4670 -96.2286 2 1742.9236 -696.4670 3 -816.1947 1742.9236 4 5367.5098 -816.1947 5 11948.8038 5367.5098 6 -3786.1363 11948.8038 7 9190.2675 -3786.1363 8 -2605.5376 9190.2675 9 2195.3704 -2605.5376 10 2420.7815 2195.3704 11 731.4457 2420.7815 12 1883.1375 731.4457 13 -395.2960 1883.1375 14 1433.1238 -395.2960 15 -797.7770 1433.1238 16 5328.8817 -797.7770 17 4512.9392 5328.8817 18 -1975.5778 4512.9392 19 2606.0760 -1975.5778 20 -1805.6707 2606.0760 21 539.1875 -1805.6707 22 -9126.7303 539.1875 23 4517.8463 -9126.7303 24 -4581.0628 4517.8463 25 4611.0508 -4581.0628 26 -1829.2524 4611.0508 27 -4701.6261 -1829.2524 28 -3924.3638 -4701.6261 29 -5488.0760 -3924.3638 30 2533.0603 -5488.0760 31 -13801.8290 2533.0603 32 -428.9978 -13801.8290 33 -6978.2634 -428.9978 34 738.5906 -6978.2634 35 -6991.5226 738.5906 36 -3741.9481 -6991.5226 37 -3660.4161 -3741.9481 38 -2214.7968 -3660.4161 39 -2902.9835 -2214.7968 40 969.9722 -2902.9835 41 -7044.7948 969.9722 42 -4003.6082 -7044.7948 43 -1041.5300 -4003.6082 44 279.6550 -1041.5300 45 -690.8677 279.6550 46 -1486.6306 -690.8677 47 -2537.9694 -1486.6306 48 1911.7399 -2537.9694 49 282.1368 1911.7399 50 -2320.2813 282.1368 51 3983.4038 -2320.2813 52 -4108.3481 3983.4038 53 -3593.7780 -4108.3481 54 3384.2590 -3593.7780 55 3047.0154 3384.2590 56 4560.5511 3047.0154 57 4934.5732 4560.5511 58 7453.9887 4934.5732 59 4280.2000 7453.9887 60 4624.3621 4280.2000 61 -141.0085 4624.3621 62 3188.2832 -141.0085 63 5235.1774 3188.2832 64 -3633.6517 5235.1774 65 -335.0942 -3633.6517 66 3848.0029 -335.0942 > 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/7k6fk1259925883.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/8cbmr1259925883.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/92dvm1259925883.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/109xzc1259925883.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/112vrk1259925884.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/12p3cj1259925884.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/13g2qm1259925884.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/142euf1259925884.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/15jueq1259925884.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/16ya5e1259925884.tab") + } > > system("convert tmp/1kxek1259925883.ps tmp/1kxek1259925883.png") > system("convert tmp/2k7ve1259925883.ps tmp/2k7ve1259925883.png") > system("convert tmp/36w6z1259925883.ps tmp/36w6z1259925883.png") > system("convert tmp/4prnq1259925883.ps tmp/4prnq1259925883.png") > system("convert tmp/5sfpo1259925883.ps tmp/5sfpo1259925883.png") > system("convert tmp/6yldu1259925883.ps tmp/6yldu1259925883.png") > system("convert tmp/7k6fk1259925883.ps tmp/7k6fk1259925883.png") > system("convert tmp/8cbmr1259925883.ps tmp/8cbmr1259925883.png") > system("convert tmp/92dvm1259925883.ps tmp/92dvm1259925883.png") > system("convert tmp/109xzc1259925883.ps tmp/109xzc1259925883.png") > > > proc.time() user system elapsed 2.460 1.594 3.358