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(3111 + ,5140 + ,17153 + ,2.5 + ,766 + ,332 + ,2.4 + ,3995 + ,4749 + ,15579 + ,1.8 + ,294 + ,369 + ,2.4 + ,5245 + ,3635 + ,16755 + ,7.3 + ,235 + ,384 + ,2.4 + ,5588 + ,4305 + ,16585 + ,9.9 + ,462 + ,373 + ,2.1 + ,10681 + ,5805 + ,16572 + ,13.2 + ,919 + ,378 + ,2 + ,10516 + ,4260 + ,16325 + ,17.8 + ,346 + ,426 + ,2 + ,7496 + ,3869 + ,17913 + ,18.8 + ,298 + ,423 + ,2.1 + ,9935 + ,7325 + ,17572 + ,19.3 + ,92 + ,397 + ,2.1 + ,10249 + ,9280 + ,17338 + ,13.9 + ,516 + ,422 + ,2 + ,6271 + ,6222 + ,17087 + ,7.5 + ,843 + ,409 + ,2 + ,3616 + ,3272 + ,15864 + ,8 + ,395 + ,430 + ,2 + ,3724 + ,7598 + ,15554 + ,4 + ,961 + ,412 + ,1.7 + ,2886 + ,1345 + ,16229 + ,3.6 + ,1231 + ,470 + ,1.3 + ,3318 + ,1900 + ,15180 + ,4.8 + ,794 + ,491 + ,1.2 + ,4166 + ,1480 + ,16215 + ,5.9 + ,420 + ,504 + ,1.1 + ,6401 + ,1472 + ,15801 + ,10.4 + ,331 + ,484 + ,1.4 + ,9209 + ,3823 + ,15751 + ,12.3 + ,312 + ,474 + ,1.5 + ,9820 + ,4454 + ,16477 + ,15.5 + ,692 + ,508 + ,1.4 + ,7470 + ,3357 + ,17324 + ,16.7 + ,1221 + ,492 + ,1.1 + ,8207 + ,5393 + ,16919 + ,18.8 + ,1272 + ,452 + ,1.1 + ,9564 + ,8329 + ,16438 + ,15.2 + ,622 + ,457 + ,1 + ,5309 + ,4152 + ,16239 + ,11.3 + ,479 + ,457 + ,1.4 + ,3385 + ,4042 + ,15613 + ,6.3 + ,757 + ,471 + ,1.3 + ,3706 + ,7747 + ,15821 + ,3.2 + ,463 + ,451 + ,1.2 + ,2733 + ,1451 + ,15678 + ,5.3 + ,534 + ,493 + ,1.5 + ,3045 + ,911 + ,14671 + ,2.4 + ,731 + ,514 + ,1.6 + ,3449 + ,406 + ,15876 + ,6.5 + ,498 + ,522 + ,1.8 + ,5542 + ,1387 + ,15563 + ,10.4 + ,629 + ,490 + ,1.5 + ,10072 + ,2150 + ,15711 + ,12.6 + ,542 + ,484 + ,1.3 + ,9418 + ,1577 + ,15583 + ,16.8 + ,519 + ,506 + ,1.6 + ,7516 + ,2642 + ,16405 + ,17.7 + ,1585 + ,501 + ,1.6 + ,7840 + ,4273 + ,16701 + ,16.2 + ,956 + ,462 + ,1.8 + ,10081 + ,8064 + ,16194 + ,15.7 + ,633 + ,465 + ,1.8 + ,4956 + ,3243 + ,16024 + ,13.3 + ,561 + ,454 + ,1.6 + ,3641 + ,1112 + ,14728 + ,6.9 + ,976 + ,464 + ,1.8 + ,3970 + ,2280 + ,14776 + ,4 + ,565 + ,427 + ,2 + ,2931 + ,505 + ,15399 + ,1.5 + ,151 + ,460 + ,1.3 + ,3170 + ,744 + ,14286 + ,2.9 + ,588 + ,473 + ,1.1 + ,3889 + ,1369 + ,15646 + ,3.9 + ,1043 + ,465 + ,1 + ,4850 + ,531 + ,14543 + ,9 + ,398 + ,422 + ,1.2 + ,8037 + ,1041 + ,15673 + ,14.5 + ,902 + ,415 + ,1.2 + ,12370 + ,2076 + ,15171 + ,16.7 + ,180 + ,413 + ,1.3 + ,6712 + ,577 + ,15999 + ,22.3 + ,150 + ,420 + ,1.3 + ,7297 + ,5080 + ,16260 + ,16.4 + ,1805 + ,363 + ,1.4 + ,10613 + ,6584 + ,16123 + ,17.9 + ,86 + ,376 + ,1.1 + ,5184 + ,3761 + ,16144 + ,13.6 + ,1093 + ,380 + ,0.9 + ,3506 + ,294 + ,15005 + ,9.2 + ,925 + ,384 + ,1 + ,3810 + ,5020 + ,14806 + ,6.5 + ,750 + ,346 + ,1.1 + ,2692 + ,1141 + ,15019 + ,7.1 + ,1038 + ,389 + ,1.4 + ,3073 + ,3805 + ,13909 + ,6 + ,679 + ,407 + ,1.5 + ,3713 + ,2127 + ,15211 + ,8 + ,848 + ,393 + ,1.8 + ,4555 + ,2531 + ,14385 + ,13.1 + ,300 + ,346 + ,1.8 + ,7807 + ,3682 + ,15144 + ,14.1 + ,1379 + ,348 + ,1.8 + ,10869 + ,3263 + ,14659 + ,17.5 + ,901 + ,353 + ,1.7 + ,9682 + ,2798 + ,15989 + ,17 + ,1606 + ,364 + ,1.5 + ,7704 + ,5936 + ,16262 + ,17.1 + ,422 + ,305 + ,1.1 + ,9826 + ,10568 + ,16021 + ,13.8 + ,968 + ,307 + ,1.3 + ,5456 + ,5296 + ,15662 + ,10.1 + ,319 + ,312 + ,1.6 + ,3677 + ,1870 + ,14531 + ,6.9 + ,583 + ,312 + ,1.9 + ,3431 + ,4390 + ,14544 + ,2.4 + ,765 + ,286 + ,1.9 + ,2765 + ,3707 + ,15071 + ,6.5 + ,963 + ,324 + ,2 + ,3483 + ,5201 + ,14236 + ,5.1 + ,392 + ,336 + ,2.2 + ,3445 + ,3748 + ,14771 + ,5.9 + ,919 + ,327 + ,2.2 + ,6081 + ,5282 + ,14804 + ,8.9 + ,339 + ,302 + ,2 + ,8767 + ,5349 + ,15597 + ,15.7 + ,327 + ,299 + ,2.3 + ,9407 + ,6249 + ,15418 + ,16.5 + ,397 + ,311 + ,2.6 + ,6551 + ,5517 + ,16903 + ,18.1 + ,1268 + ,315 + ,3.2 + ,12480 + ,8640 + ,16350 + ,17.4 + ,1137 + ,264 + ,3.2 + ,9530 + ,15767 + ,16393 + ,13.6 + ,1000 + ,278 + ,3.1 + ,5960 + ,8850 + ,15685 + ,10.1 + ,915 + ,278 + ,2.8 + ,3252 + ,5582 + ,14556 + ,6.9 + ,905 + ,287 + ,2.3 + ,3717 + ,6496 + ,14850 + ,2.4 + ,243 + ,279 + ,1.9 + ,2642 + ,3255 + ,15391 + ,0.8 + ,537 + ,324 + ,1.9 + ,2989 + ,6189 + ,13704 + ,3.3 + ,551 + ,354 + ,2 + ,3607 + ,6452 + ,15409 + ,6.3 + ,482 + ,354 + ,2 + ,5366 + ,5099 + ,15098 + ,12.2 + ,199 + ,360 + ,1.8 + ,8898 + ,6833 + ,15254 + ,13.9 + ,650 + ,363 + ,1.6 + ,9435 + ,7046 + ,15522 + ,15.6 + ,533 + ,385 + ,1.4 + ,7328 + ,7739 + ,16669 + ,18.1 + ,1071 + ,412 + ,0.2 + ,8594 + ,10142 + ,16238 + ,18.5 + ,469 + ,370 + ,0.3 + ,11349 + ,16054 + ,16246 + ,15 + ,335 + ,389 + ,0.4 + ,5797 + ,7721 + ,15424 + ,10.7 + ,598 + ,395 + ,0.7 + ,3621 + ,6182 + ,14952 + ,9.5 + ,1200 + ,417 + ,1 + ,3851 + ,6490 + ,15008 + ,2.2 + ,844 + ,404 + ,1.1) + ,dim=c(7 + ,84) + ,dimnames=list(c('Huwelijken' + ,'Bevolkingsgroei' + ,'Geboren' + ,'Temperatuur' + ,'Neerslag' + ,'Werkloosheid' + ,'Inflatie') + ,1:84)) > y <- array(NA,dim=c(7,84),dimnames=list(c('Huwelijken','Bevolkingsgroei','Geboren','Temperatuur','Neerslag','Werkloosheid','Inflatie'),1:84)) > 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 Huwelijken Bevolkingsgroei Geboren Temperatuur Neerslag Werkloosheid 1 3111 5140 17153 2.5 766 332 2 3995 4749 15579 1.8 294 369 3 5245 3635 16755 7.3 235 384 4 5588 4305 16585 9.9 462 373 5 10681 5805 16572 13.2 919 378 6 10516 4260 16325 17.8 346 426 7 7496 3869 17913 18.8 298 423 8 9935 7325 17572 19.3 92 397 9 10249 9280 17338 13.9 516 422 10 6271 6222 17087 7.5 843 409 11 3616 3272 15864 8.0 395 430 12 3724 7598 15554 4.0 961 412 13 2886 1345 16229 3.6 1231 470 14 3318 1900 15180 4.8 794 491 15 4166 1480 16215 5.9 420 504 16 6401 1472 15801 10.4 331 484 17 9209 3823 15751 12.3 312 474 18 9820 4454 16477 15.5 692 508 19 7470 3357 17324 16.7 1221 492 20 8207 5393 16919 18.8 1272 452 21 9564 8329 16438 15.2 622 457 22 5309 4152 16239 11.3 479 457 23 3385 4042 15613 6.3 757 471 24 3706 7747 15821 3.2 463 451 25 2733 1451 15678 5.3 534 493 26 3045 911 14671 2.4 731 514 27 3449 406 15876 6.5 498 522 28 5542 1387 15563 10.4 629 490 29 10072 2150 15711 12.6 542 484 30 9418 1577 15583 16.8 519 506 31 7516 2642 16405 17.7 1585 501 32 7840 4273 16701 16.2 956 462 33 10081 8064 16194 15.7 633 465 34 4956 3243 16024 13.3 561 454 35 3641 1112 14728 6.9 976 464 36 3970 2280 14776 4.0 565 427 37 2931 505 15399 1.5 151 460 38 3170 744 14286 2.9 588 473 39 3889 1369 15646 3.9 1043 465 40 4850 531 14543 9.0 398 422 41 8037 1041 15673 14.5 902 415 42 12370 2076 15171 16.7 180 413 43 6712 577 15999 22.3 150 420 44 7297 5080 16260 16.4 1805 363 45 10613 6584 16123 17.9 86 376 46 5184 3761 16144 13.6 1093 380 47 3506 294 15005 9.2 925 384 48 3810 5020 14806 6.5 750 346 49 2692 1141 15019 7.1 1038 389 50 3073 3805 13909 6.0 679 407 51 3713 2127 15211 8.0 848 393 52 4555 2531 14385 13.1 300 346 53 7807 3682 15144 14.1 1379 348 54 10869 3263 14659 17.5 901 353 55 9682 2798 15989 17.0 1606 364 56 7704 5936 16262 17.1 422 305 57 9826 10568 16021 13.8 968 307 58 5456 5296 15662 10.1 319 312 59 3677 1870 14531 6.9 583 312 60 3431 4390 14544 2.4 765 286 61 2765 3707 15071 6.5 963 324 62 3483 5201 14236 5.1 392 336 63 3445 3748 14771 5.9 919 327 64 6081 5282 14804 8.9 339 302 65 8767 5349 15597 15.7 327 299 66 9407 6249 15418 16.5 397 311 67 6551 5517 16903 18.1 1268 315 68 12480 8640 16350 17.4 1137 264 69 9530 15767 16393 13.6 1000 278 70 5960 8850 15685 10.1 915 278 71 3252 5582 14556 6.9 905 287 72 3717 6496 14850 2.4 243 279 73 2642 3255 15391 0.8 537 324 74 2989 6189 13704 3.3 551 354 75 3607 6452 15409 6.3 482 354 76 5366 5099 15098 12.2 199 360 77 8898 6833 15254 13.9 650 363 78 9435 7046 15522 15.6 533 385 79 7328 7739 16669 18.1 1071 412 80 8594 10142 16238 18.5 469 370 81 11349 16054 16246 15.0 335 389 82 5797 7721 15424 10.7 598 395 83 3621 6182 14952 9.5 1200 417 84 3851 6490 15008 2.2 844 404 Inflatie 1 2.4 2 2.4 3 2.4 4 2.1 5 2.0 6 2.0 7 2.1 8 2.1 9 2.0 10 2.0 11 2.0 12 1.7 13 1.3 14 1.2 15 1.1 16 1.4 17 1.5 18 1.4 19 1.1 20 1.1 21 1.0 22 1.4 23 1.3 24 1.2 25 1.5 26 1.6 27 1.8 28 1.5 29 1.3 30 1.6 31 1.6 32 1.8 33 1.8 34 1.6 35 1.8 36 2.0 37 1.3 38 1.1 39 1.0 40 1.2 41 1.2 42 1.3 43 1.3 44 1.4 45 1.1 46 0.9 47 1.0 48 1.1 49 1.4 50 1.5 51 1.8 52 1.8 53 1.8 54 1.7 55 1.5 56 1.1 57 1.3 58 1.6 59 1.9 60 1.9 61 2.0 62 2.2 63 2.2 64 2.0 65 2.3 66 2.6 67 3.2 68 3.2 69 3.1 70 2.8 71 2.3 72 1.9 73 1.9 74 2.0 75 2.0 76 1.8 77 1.6 78 1.4 79 0.2 80 0.3 81 0.4 82 0.7 83 1.0 84 1.1 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) Bevolkingsgroei Geboren Temperatuur 168.8345 0.2799 -0.1749 404.3768 Neerslag Werkloosheid Inflatie -0.6047 6.7320 547.2348 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -3286.4 -950.4 -175.9 838.1 4137.0 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 168.83447 3247.53402 0.052 0.959 Bevolkingsgroei 0.27994 0.06594 4.245 6.04e-05 *** Geboren -0.17487 0.24892 -0.703 0.484 Temperatuur 404.37675 34.23012 11.813 < 2e-16 *** Neerslag -0.60471 0.43523 -1.389 0.169 Werkloosheid 6.73205 3.35067 2.009 0.048 * Inflatie 547.23479 329.27994 1.662 0.101 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 1439 on 77 degrees of freedom Multiple R-squared: 0.7614, Adjusted R-squared: 0.7428 F-statistic: 40.96 on 6 and 77 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.10361755 0.2072351 0.8963825 [2,] 0.08991660 0.1798332 0.9100834 [3,] 0.07357965 0.1471593 0.9264204 [4,] 0.48334016 0.9666803 0.5166598 [5,] 0.44635110 0.8927022 0.5536489 [6,] 0.57401033 0.8519793 0.4259897 [7,] 0.50910801 0.9817840 0.4908920 [8,] 0.54787294 0.9042541 0.4521271 [9,] 0.48218122 0.9643624 0.5178188 [10,] 0.44857725 0.8971545 0.5514227 [11,] 0.44749627 0.8949925 0.5525037 [12,] 0.36944051 0.7388810 0.6305595 [13,] 0.35252089 0.7050418 0.6474791 [14,] 0.35165115 0.7033023 0.6483488 [15,] 0.28288434 0.5657687 0.7171157 [16,] 0.25123853 0.5024771 0.7487615 [17,] 0.19528068 0.3905614 0.8047193 [18,] 0.15890841 0.3178168 0.8410916 [19,] 0.11808411 0.2361682 0.8819159 [20,] 0.33353374 0.6670675 0.6664663 [21,] 0.27996211 0.5599242 0.7200379 [22,] 0.26517271 0.5303454 0.7348273 [23,] 0.21900944 0.4380189 0.7809906 [24,] 0.17476092 0.3495218 0.8252391 [25,] 0.27212828 0.5442566 0.7278717 [26,] 0.23475757 0.4695151 0.7652424 [27,] 0.18676056 0.3735211 0.8132394 [28,] 0.16289886 0.3257977 0.8371011 [29,] 0.13116278 0.2623256 0.8688372 [30,] 0.14608978 0.2921796 0.8539102 [31,] 0.12167843 0.2433569 0.8783216 [32,] 0.12288404 0.2457681 0.8771160 [33,] 0.52085957 0.9582809 0.4791404 [34,] 0.77627743 0.4474451 0.2237226 [35,] 0.73635332 0.5272934 0.2636467 [36,] 0.74484423 0.5103115 0.2551558 [37,] 0.73103986 0.5379203 0.2689601 [38,] 0.68021310 0.6395738 0.3197869 [39,] 0.63904596 0.7219081 0.3609540 [40,] 0.58480501 0.8303900 0.4151950 [41,] 0.56972624 0.8605475 0.4302738 [42,] 0.50976419 0.9804716 0.4902358 [43,] 0.59077929 0.8184414 0.4092207 [44,] 0.54699575 0.9060085 0.4530043 [45,] 0.64777444 0.7044511 0.3522256 [46,] 0.81749130 0.3650174 0.1825087 [47,] 0.79057334 0.4188533 0.2094267 [48,] 0.77933386 0.4413323 0.2206661 [49,] 0.73008428 0.5398314 0.2699157 [50,] 0.66160486 0.6767903 0.3383951 [51,] 0.61587487 0.7682503 0.3841251 [52,] 0.56152916 0.8769417 0.4384708 [53,] 0.50656080 0.9868784 0.4934392 [54,] 0.42603960 0.8520792 0.5739604 [55,] 0.34727486 0.6945497 0.6527251 [56,] 0.27401015 0.5480203 0.7259898 [57,] 0.21235190 0.4247038 0.7876481 [58,] 0.31078394 0.6215679 0.6892161 [59,] 0.69937551 0.6012490 0.3006245 [60,] 0.61372231 0.7725554 0.3862777 [61,] 0.52060017 0.9587997 0.4793998 [62,] 0.44181943 0.8836389 0.5581806 [63,] 0.31876996 0.6375399 0.6812300 [64,] 0.31391719 0.6278344 0.6860828 [65,] 0.20272606 0.4054521 0.7972739 > postscript(file="/var/www/html/rcomp/tmp/1k3b71292948361.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/rcomp/tmp/2cuaa1292948361.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/rcomp/tmp/3cuaa1292948361.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/rcomp/tmp/4cuaa1292948361.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/rcomp/tmp/5cuaa1292948361.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 = 84 Frequency = 1 1 2 3 4 5 6 406.70145 873.46464 280.22952 -269.94228 3363.85406 1058.39052 7 8 9 10 11 12 -2042.39142 -782.20736 1270.05306 977.47447 -1680.05265 -592.14408 13 14 15 16 17 18 591.79210 -151.17223 291.62097 553.42000 1927.33828 1250.27331 19 20 21 22 23 24 -537.99761 -990.83876 543.91235 -1304.89207 -1157.09881 -571.74254 25 26 27 28 29 30 -1060.44404 322.35210 -883.70816 -238.31571 3311.57411 771.02790 31 32 33 34 35 36 -971.01569 -672.52655 405.24643 -2289.44499 -572.33270 501.88997 37 38 39 40 41 42 990.21794 687.74556 1448.95608 179.33081 1548.99394 4136.98424 43 44 45 46 47 48 -3286.37480 -200.65981 1100.94586 -1103.83722 -414.46118 -281.15167 49 50 51 52 53 54 -798.14930 -1305.18266 -744.24800 -2237.08268 1060.08168 2511.69243 55 56 57 58 59 60 2351.34522 -597.68816 1727.20963 -323.84086 -52.07804 1103.54265 61 62 63 64 65 66 -1127.85736 -943.49357 -425.42013 500.81283 405.73614 236.36541 67 68 69 70 71 72 -2630.60632 2874.63087 -648.69380 -878.09496 -1367.70430 584.97141 73 74 75 76 77 78 1033.69532 -994.80361 -1407.12915 -1811.66209 936.74431 664.13301 79 80 81 82 83 84 -1646.97677 -1426.79767 826.27353 -843.46481 -2134.16776 788.87020 > postscript(file="/var/www/html/rcomp/tmp/65l9d1292948361.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 = 84 Frequency = 1 lag(myerror, k = 1) myerror 0 406.70145 NA 1 873.46464 406.70145 2 280.22952 873.46464 3 -269.94228 280.22952 4 3363.85406 -269.94228 5 1058.39052 3363.85406 6 -2042.39142 1058.39052 7 -782.20736 -2042.39142 8 1270.05306 -782.20736 9 977.47447 1270.05306 10 -1680.05265 977.47447 11 -592.14408 -1680.05265 12 591.79210 -592.14408 13 -151.17223 591.79210 14 291.62097 -151.17223 15 553.42000 291.62097 16 1927.33828 553.42000 17 1250.27331 1927.33828 18 -537.99761 1250.27331 19 -990.83876 -537.99761 20 543.91235 -990.83876 21 -1304.89207 543.91235 22 -1157.09881 -1304.89207 23 -571.74254 -1157.09881 24 -1060.44404 -571.74254 25 322.35210 -1060.44404 26 -883.70816 322.35210 27 -238.31571 -883.70816 28 3311.57411 -238.31571 29 771.02790 3311.57411 30 -971.01569 771.02790 31 -672.52655 -971.01569 32 405.24643 -672.52655 33 -2289.44499 405.24643 34 -572.33270 -2289.44499 35 501.88997 -572.33270 36 990.21794 501.88997 37 687.74556 990.21794 38 1448.95608 687.74556 39 179.33081 1448.95608 40 1548.99394 179.33081 41 4136.98424 1548.99394 42 -3286.37480 4136.98424 43 -200.65981 -3286.37480 44 1100.94586 -200.65981 45 -1103.83722 1100.94586 46 -414.46118 -1103.83722 47 -281.15167 -414.46118 48 -798.14930 -281.15167 49 -1305.18266 -798.14930 50 -744.24800 -1305.18266 51 -2237.08268 -744.24800 52 1060.08168 -2237.08268 53 2511.69243 1060.08168 54 2351.34522 2511.69243 55 -597.68816 2351.34522 56 1727.20963 -597.68816 57 -323.84086 1727.20963 58 -52.07804 -323.84086 59 1103.54265 -52.07804 60 -1127.85736 1103.54265 61 -943.49357 -1127.85736 62 -425.42013 -943.49357 63 500.81283 -425.42013 64 405.73614 500.81283 65 236.36541 405.73614 66 -2630.60632 236.36541 67 2874.63087 -2630.60632 68 -648.69380 2874.63087 69 -878.09496 -648.69380 70 -1367.70430 -878.09496 71 584.97141 -1367.70430 72 1033.69532 584.97141 73 -994.80361 1033.69532 74 -1407.12915 -994.80361 75 -1811.66209 -1407.12915 76 936.74431 -1811.66209 77 664.13301 936.74431 78 -1646.97677 664.13301 79 -1426.79767 -1646.97677 80 826.27353 -1426.79767 81 -843.46481 826.27353 82 -2134.16776 -843.46481 83 788.87020 -2134.16776 84 NA 788.87020 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] 873.46464 406.70145 [2,] 280.22952 873.46464 [3,] -269.94228 280.22952 [4,] 3363.85406 -269.94228 [5,] 1058.39052 3363.85406 [6,] -2042.39142 1058.39052 [7,] -782.20736 -2042.39142 [8,] 1270.05306 -782.20736 [9,] 977.47447 1270.05306 [10,] -1680.05265 977.47447 [11,] -592.14408 -1680.05265 [12,] 591.79210 -592.14408 [13,] -151.17223 591.79210 [14,] 291.62097 -151.17223 [15,] 553.42000 291.62097 [16,] 1927.33828 553.42000 [17,] 1250.27331 1927.33828 [18,] -537.99761 1250.27331 [19,] -990.83876 -537.99761 [20,] 543.91235 -990.83876 [21,] -1304.89207 543.91235 [22,] -1157.09881 -1304.89207 [23,] -571.74254 -1157.09881 [24,] -1060.44404 -571.74254 [25,] 322.35210 -1060.44404 [26,] -883.70816 322.35210 [27,] -238.31571 -883.70816 [28,] 3311.57411 -238.31571 [29,] 771.02790 3311.57411 [30,] -971.01569 771.02790 [31,] -672.52655 -971.01569 [32,] 405.24643 -672.52655 [33,] -2289.44499 405.24643 [34,] -572.33270 -2289.44499 [35,] 501.88997 -572.33270 [36,] 990.21794 501.88997 [37,] 687.74556 990.21794 [38,] 1448.95608 687.74556 [39,] 179.33081 1448.95608 [40,] 1548.99394 179.33081 [41,] 4136.98424 1548.99394 [42,] -3286.37480 4136.98424 [43,] -200.65981 -3286.37480 [44,] 1100.94586 -200.65981 [45,] -1103.83722 1100.94586 [46,] -414.46118 -1103.83722 [47,] -281.15167 -414.46118 [48,] -798.14930 -281.15167 [49,] -1305.18266 -798.14930 [50,] -744.24800 -1305.18266 [51,] -2237.08268 -744.24800 [52,] 1060.08168 -2237.08268 [53,] 2511.69243 1060.08168 [54,] 2351.34522 2511.69243 [55,] -597.68816 2351.34522 [56,] 1727.20963 -597.68816 [57,] -323.84086 1727.20963 [58,] -52.07804 -323.84086 [59,] 1103.54265 -52.07804 [60,] -1127.85736 1103.54265 [61,] -943.49357 -1127.85736 [62,] -425.42013 -943.49357 [63,] 500.81283 -425.42013 [64,] 405.73614 500.81283 [65,] 236.36541 405.73614 [66,] -2630.60632 236.36541 [67,] 2874.63087 -2630.60632 [68,] -648.69380 2874.63087 [69,] -878.09496 -648.69380 [70,] -1367.70430 -878.09496 [71,] 584.97141 -1367.70430 [72,] 1033.69532 584.97141 [73,] -994.80361 1033.69532 [74,] -1407.12915 -994.80361 [75,] -1811.66209 -1407.12915 [76,] 936.74431 -1811.66209 [77,] 664.13301 936.74431 [78,] -1646.97677 664.13301 [79,] -1426.79767 -1646.97677 [80,] 826.27353 -1426.79767 [81,] -843.46481 826.27353 [82,] -2134.16776 -843.46481 [83,] 788.87020 -2134.16776 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 873.46464 406.70145 2 280.22952 873.46464 3 -269.94228 280.22952 4 3363.85406 -269.94228 5 1058.39052 3363.85406 6 -2042.39142 1058.39052 7 -782.20736 -2042.39142 8 1270.05306 -782.20736 9 977.47447 1270.05306 10 -1680.05265 977.47447 11 -592.14408 -1680.05265 12 591.79210 -592.14408 13 -151.17223 591.79210 14 291.62097 -151.17223 15 553.42000 291.62097 16 1927.33828 553.42000 17 1250.27331 1927.33828 18 -537.99761 1250.27331 19 -990.83876 -537.99761 20 543.91235 -990.83876 21 -1304.89207 543.91235 22 -1157.09881 -1304.89207 23 -571.74254 -1157.09881 24 -1060.44404 -571.74254 25 322.35210 -1060.44404 26 -883.70816 322.35210 27 -238.31571 -883.70816 28 3311.57411 -238.31571 29 771.02790 3311.57411 30 -971.01569 771.02790 31 -672.52655 -971.01569 32 405.24643 -672.52655 33 -2289.44499 405.24643 34 -572.33270 -2289.44499 35 501.88997 -572.33270 36 990.21794 501.88997 37 687.74556 990.21794 38 1448.95608 687.74556 39 179.33081 1448.95608 40 1548.99394 179.33081 41 4136.98424 1548.99394 42 -3286.37480 4136.98424 43 -200.65981 -3286.37480 44 1100.94586 -200.65981 45 -1103.83722 1100.94586 46 -414.46118 -1103.83722 47 -281.15167 -414.46118 48 -798.14930 -281.15167 49 -1305.18266 -798.14930 50 -744.24800 -1305.18266 51 -2237.08268 -744.24800 52 1060.08168 -2237.08268 53 2511.69243 1060.08168 54 2351.34522 2511.69243 55 -597.68816 2351.34522 56 1727.20963 -597.68816 57 -323.84086 1727.20963 58 -52.07804 -323.84086 59 1103.54265 -52.07804 60 -1127.85736 1103.54265 61 -943.49357 -1127.85736 62 -425.42013 -943.49357 63 500.81283 -425.42013 64 405.73614 500.81283 65 236.36541 405.73614 66 -2630.60632 236.36541 67 2874.63087 -2630.60632 68 -648.69380 2874.63087 69 -878.09496 -648.69380 70 -1367.70430 -878.09496 71 584.97141 -1367.70430 72 1033.69532 584.97141 73 -994.80361 1033.69532 74 -1407.12915 -994.80361 75 -1811.66209 -1407.12915 76 936.74431 -1811.66209 77 664.13301 936.74431 78 -1646.97677 664.13301 79 -1426.79767 -1646.97677 80 826.27353 -1426.79767 81 -843.46481 826.27353 82 -2134.16776 -843.46481 83 788.87020 -2134.16776 > 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/7yd9g1292948361.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/rcomp/tmp/8yd9g1292948361.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/rcomp/tmp/98mq01292948361.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/rcomp/tmp/108mq01292948361.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/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/11umoo1292948361.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/12x55c1292948361.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/13bxll1292948361.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/14fx191292948361.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/15iyzx1292948361.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/163yyl1292948361.tab") + } > > try(system("convert tmp/1k3b71292948361.ps tmp/1k3b71292948361.png",intern=TRUE)) character(0) > try(system("convert tmp/2cuaa1292948361.ps tmp/2cuaa1292948361.png",intern=TRUE)) character(0) > try(system("convert tmp/3cuaa1292948361.ps tmp/3cuaa1292948361.png",intern=TRUE)) character(0) > try(system("convert tmp/4cuaa1292948361.ps tmp/4cuaa1292948361.png",intern=TRUE)) character(0) > try(system("convert tmp/5cuaa1292948361.ps tmp/5cuaa1292948361.png",intern=TRUE)) character(0) > try(system("convert tmp/65l9d1292948361.ps tmp/65l9d1292948361.png",intern=TRUE)) character(0) > try(system("convert tmp/7yd9g1292948361.ps tmp/7yd9g1292948361.png",intern=TRUE)) character(0) > try(system("convert tmp/8yd9g1292948361.ps tmp/8yd9g1292948361.png",intern=TRUE)) character(0) > try(system("convert tmp/98mq01292948361.ps tmp/98mq01292948361.png",intern=TRUE)) character(0) > try(system("convert tmp/108mq01292948361.ps tmp/108mq01292948361.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 2.800 1.648 6.230