R version 2.15.1 (2012-06-22) -- "Roasted Marshmallows" Copyright (C) 2012 The R Foundation for Statistical Computing ISBN 3-900051-07-0 Platform: i686-pc-linux-gnu (32-bit) 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(18.2 + ,2687 + ,1870 + ,1890 + ,145.7 + ,352.2 + ,0 + ,0 + ,143.8 + ,13271 + ,9115 + ,8190 + ,-279.0 + ,83.0 + ,0 + ,0 + ,23.4 + ,13621 + ,4848 + ,4572 + ,485.0 + ,898.9 + ,0 + ,0 + ,1.1 + ,3614 + ,367 + ,90 + ,14.1 + ,24.6 + ,1 + ,0 + ,49.5 + ,6425 + ,6131 + ,2448 + ,345.8 + ,682.5 + ,1 + ,0 + ,4.8 + ,1022 + ,1754 + ,1370 + ,72.0 + ,119.5 + ,0 + ,1 + ,20.8 + ,1093 + ,1679 + ,1070 + ,100.9 + ,164.5 + ,0 + ,1 + ,19.4 + ,1529 + ,1295 + ,444 + ,25.6 + ,137.0 + ,0 + ,0 + ,2.1 + ,2788 + ,271 + ,304 + ,23.5 + ,28.9 + ,1 + ,0 + ,79.4 + ,19788 + ,9084 + ,10636 + ,1092.9 + ,2576.8 + ,1 + ,0 + ,2.8 + ,327 + ,542 + ,959 + ,54.1 + ,72.5 + ,1 + ,0 + ,3.8 + ,1117 + ,1038 + ,478 + ,59.7 + ,91.7 + ,0 + ,0 + ,4.1 + ,5401 + ,550 + ,376 + ,25.6 + ,37.5 + ,1 + ,0 + ,13.2 + ,1128 + ,1516 + ,430 + ,-47.0 + ,26.7 + ,0 + ,1 + ,2.8 + ,1633 + ,701 + ,679 + ,74.3 + ,135.9 + ,0 + ,0 + ,48.5 + ,44736 + ,16197 + ,4653 + ,-732.5 + ,-651.9 + ,1 + ,0 + ,6.2 + ,5651 + ,1254 + ,2002 + ,310.7 + ,407.9 + ,0 + ,0 + ,10.8 + ,5835 + ,4053 + ,1601 + ,-93.8 + ,173.8 + ,0 + ,0 + ,3.8 + ,278 + ,205 + ,853 + ,44.8 + ,50.5 + ,1 + ,0 + ,21.9 + ,5074 + ,2557 + ,1892 + ,239.9 + ,578.3 + ,1 + ,0 + ,12.6 + ,866 + ,1487 + ,944 + ,71.7 + ,115.4 + ,0 + ,0 + ,128.0 + ,4418 + ,8793 + ,4459 + ,283.6 + ,456.5 + ,1 + ,0 + ,87.3 + ,6914 + ,7029 + ,7957 + ,400.6 + ,754.7 + ,0 + ,1 + ,16.0 + ,862 + ,1601 + ,1093 + ,66.9 + ,106.8 + ,1 + ,0 + ,0.7 + ,401 + ,176 + ,1084 + ,55.6 + ,57.0 + ,1 + ,0 + ,22.5 + ,430 + ,1155 + ,1045 + ,55.7 + ,70.8 + ,0 + ,1 + ,15.4 + ,799 + ,1140 + ,683 + ,57.6 + ,89.2 + ,0 + ,0 + ,3.0 + ,4789 + ,453 + ,367 + ,40.2 + ,51.4 + ,1 + ,0 + ,2.1 + ,2548 + ,264 + ,181 + ,22.2 + ,26.2 + ,1 + ,0 + ,4.1 + ,5249 + ,527 + ,346 + ,37.8 + ,56.2 + ,1 + ,0 + ,6.4 + ,3494 + ,1653 + ,1442 + ,160.9 + ,320.3 + ,0 + ,0 + ,26.6 + ,1804 + ,2564 + ,483 + ,70.5 + ,164.9 + ,0 + ,1 + ,304.0 + ,26432 + ,28285 + ,33172 + ,2336.0 + ,3562.0 + ,0 + ,1 + ,18.6 + ,623 + ,2247 + ,797 + ,57.0 + ,93.8 + ,1 + ,0 + ,65.0 + ,1608 + ,6615 + ,829 + ,56.1 + ,134.0 + ,1 + ,0 + ,66.2 + ,4662 + ,4781 + ,2988 + ,28.7 + ,371.5 + ,0 + ,1 + ,83.0 + ,5769 + ,6571 + ,9462 + ,482.0 + ,792.0 + ,0 + ,1 + ,62.0 + ,6259 + ,4152 + ,3090 + ,283.7 + ,524.5 + ,1 + ,0 + ,1.6 + ,1654 + ,451 + ,779 + ,84.8 + ,130.4 + ,0 + ,0 + ,400.2 + ,52634 + ,50056 + ,95697 + ,6555.0 + ,9874.0 + ,0 + ,1 + ,23.3 + ,999 + ,1878 + ,393 + ,-173.5 + ,-108.1 + ,1 + ,0 + ,4.6 + ,1679 + ,1354 + ,687 + ,93.8 + ,154.6 + ,0 + ,0 + ,164.6 + ,4178 + ,17124 + ,2091 + ,180.8 + ,390.4 + ,1 + ,0 + ,1.9 + ,223 + ,557 + ,1040 + ,60.6 + ,63.7 + ,0 + ,0 + ,57.5 + ,6307 + ,8199 + ,598 + ,-771.5 + ,-524.3 + ,0 + ,1 + ,2.4 + ,3720 + ,356 + ,211 + ,26.6 + ,34.8 + ,1 + ,0 + ,77.3 + ,3442 + ,5080 + ,2673 + ,235.4 + ,361.5 + ,1 + ,0 + ,15.8 + ,33406 + ,3222 + ,1413 + ,201.7 + ,246.7 + ,1 + ,0 + ,0.6 + ,1257 + ,355 + ,181 + ,167.5 + ,304.0 + ,0 + ,0 + ,3.5 + ,1743 + ,597 + ,717 + ,121.6 + ,172.4 + ,0 + ,0 + ,9.0 + ,12505 + ,1302 + ,702 + ,108.4 + ,131.4 + ,1 + ,0 + ,62.0 + ,3940 + ,4317 + ,3940 + ,315.2 + ,566.3 + ,0 + ,1 + ,7.4 + ,8998 + ,882 + ,988 + ,93.0 + ,119.0 + ,1 + ,0 + ,15.6 + ,21419 + ,2516 + ,930 + ,107.6 + ,164.7 + ,1 + ,0 + ,25.2 + ,2366 + ,3305 + ,1117 + ,131.2 + ,256.5 + ,0 + ,1 + ,25.4 + ,2448 + ,3484 + ,1036 + ,48.8 + ,257.1 + ,1 + ,0 + ,3.5 + ,1440 + ,1617 + ,639 + ,81.7 + ,126.4 + ,0 + ,0 + ,27.3 + ,14045 + ,15636 + ,2754 + ,418.0 + ,1462.0 + ,0 + ,0 + ,37.5 + ,4084 + ,4346 + ,3023 + ,302.7 + ,521.7 + ,0 + ,1 + ,3.4 + ,3010 + ,749 + ,1120 + ,146.3 + ,209.2 + ,0 + ,0 + ,14.3 + ,1286 + ,1734 + ,361 + ,69.2 + ,145.7 + ,1 + ,0 + ,6.1 + ,707 + ,706 + ,275 + ,61.4 + ,77.8 + ,1 + ,0 + ,4.9 + ,3086 + ,1739 + ,1507 + ,202.7 + ,335.2 + ,0 + ,0 + ,3.3 + ,252 + ,312 + ,883 + ,41.7 + ,60.6 + ,1 + ,0 + ,7.0 + ,11052 + ,1097 + ,606 + ,64.9 + ,97.6 + ,1 + ,0 + ,8.2 + ,9672 + ,1037 + ,829 + ,92.6 + ,118.2 + ,1 + ,0 + ,43.5 + ,1112 + ,3689 + ,542 + ,30.3 + ,96.9 + ,1 + ,0 + ,48.5 + ,1104 + ,5123 + ,910 + ,63.7 + ,133.3 + ,1 + ,0 + ,5.4 + ,478 + ,672 + ,866 + ,67.1 + ,101.6 + ,0 + ,1 + ,49.5 + ,10348 + ,5721 + ,1915 + ,223.6 + ,322.5 + ,0 + ,1 + ,29.1 + ,2769 + ,3725 + ,663 + ,-208.4 + ,12.4 + ,1 + ,0 + ,2.6 + ,752 + ,2149 + ,101 + ,11.1 + ,15.2 + ,0 + ,1 + ,0.8 + ,4989 + ,518 + ,53 + ,-3.1 + ,-0.3 + ,1 + ,0 + ,184.8 + ,10528 + ,14992 + ,5377 + ,312.7 + ,710.7 + ,0 + ,1 + ,2.3 + ,1995 + ,2662 + ,341 + ,34.7 + ,100.7 + ,0 + ,0 + ,8.0 + ,2286 + ,2235 + ,2306 + ,195.3 + ,219.0 + ,0 + ,0 + ,10.3 + ,952 + ,1307 + ,309 + ,35.4 + ,92.8 + ,1 + ,0 + ,50.0 + ,2957 + ,2806 + ,457 + ,40.6 + ,93.5 + ,1 + ,0 + ,118.1 + ,2535 + ,5958 + ,1921 + ,177.0 + ,288.0 + ,1 + ,0) + ,dim=c(8 + ,79) + ,dimnames=list(c('Aantal_Werknemers' + ,'Activa' + ,'Omzet' + ,'Marktwaarde' + ,'Winst' + ,'Cashflow' + ,'Dienst' + ,'Product') + ,1:79)) > y <- array(NA,dim=c(8,79),dimnames=list(c('Aantal_Werknemers','Activa','Omzet','Marktwaarde','Winst','Cashflow','Dienst','Product'),1:79)) > 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' > 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, 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 Aantal_Werknemers Activa Omzet Marktwaarde Winst Cashflow Dienst Product 1 18.2 2687 1870 1890 145.7 352.2 0 0 2 143.8 13271 9115 8190 -279.0 83.0 0 0 3 23.4 13621 4848 4572 485.0 898.9 0 0 4 1.1 3614 367 90 14.1 24.6 1 0 5 49.5 6425 6131 2448 345.8 682.5 1 0 6 4.8 1022 1754 1370 72.0 119.5 0 1 7 20.8 1093 1679 1070 100.9 164.5 0 1 8 19.4 1529 1295 444 25.6 137.0 0 0 9 2.1 2788 271 304 23.5 28.9 1 0 10 79.4 19788 9084 10636 1092.9 2576.8 1 0 11 2.8 327 542 959 54.1 72.5 1 0 12 3.8 1117 1038 478 59.7 91.7 0 0 13 4.1 5401 550 376 25.6 37.5 1 0 14 13.2 1128 1516 430 -47.0 26.7 0 1 15 2.8 1633 701 679 74.3 135.9 0 0 16 48.5 44736 16197 4653 -732.5 -651.9 1 0 17 6.2 5651 1254 2002 310.7 407.9 0 0 18 10.8 5835 4053 1601 -93.8 173.8 0 0 19 3.8 278 205 853 44.8 50.5 1 0 20 21.9 5074 2557 1892 239.9 578.3 1 0 21 12.6 866 1487 944 71.7 115.4 0 0 22 128.0 4418 8793 4459 283.6 456.5 1 0 23 87.3 6914 7029 7957 400.6 754.7 0 1 24 16.0 862 1601 1093 66.9 106.8 1 0 25 0.7 401 176 1084 55.6 57.0 1 0 26 22.5 430 1155 1045 55.7 70.8 0 1 27 15.4 799 1140 683 57.6 89.2 0 0 28 3.0 4789 453 367 40.2 51.4 1 0 29 2.1 2548 264 181 22.2 26.2 1 0 30 4.1 5249 527 346 37.8 56.2 1 0 31 6.4 3494 1653 1442 160.9 320.3 0 0 32 26.6 1804 2564 483 70.5 164.9 0 1 33 304.0 26432 28285 33172 2336.0 3562.0 0 1 34 18.6 623 2247 797 57.0 93.8 1 0 35 65.0 1608 6615 829 56.1 134.0 1 0 36 66.2 4662 4781 2988 28.7 371.5 0 1 37 83.0 5769 6571 9462 482.0 792.0 0 1 38 62.0 6259 4152 3090 283.7 524.5 1 0 39 1.6 1654 451 779 84.8 130.4 0 0 40 400.2 52634 50056 95697 6555.0 9874.0 0 1 41 23.3 999 1878 393 -173.5 -108.1 1 0 42 4.6 1679 1354 687 93.8 154.6 0 0 43 164.6 4178 17124 2091 180.8 390.4 1 0 44 1.9 223 557 1040 60.6 63.7 0 0 45 57.5 6307 8199 598 -771.5 -524.3 0 1 46 2.4 3720 356 211 26.6 34.8 1 0 47 77.3 3442 5080 2673 235.4 361.5 1 0 48 15.8 33406 3222 1413 201.7 246.7 1 0 49 0.6 1257 355 181 167.5 304.0 0 0 50 3.5 1743 597 717 121.6 172.4 0 0 51 9.0 12505 1302 702 108.4 131.4 1 0 52 62.0 3940 4317 3940 315.2 566.3 0 1 53 7.4 8998 882 988 93.0 119.0 1 0 54 15.6 21419 2516 930 107.6 164.7 1 0 55 25.2 2366 3305 1117 131.2 256.5 0 1 56 25.4 2448 3484 1036 48.8 257.1 1 0 57 3.5 1440 1617 639 81.7 126.4 0 0 58 27.3 14045 15636 2754 418.0 1462.0 0 0 59 37.5 4084 4346 3023 302.7 521.7 0 1 60 3.4 3010 749 1120 146.3 209.2 0 0 61 14.3 1286 1734 361 69.2 145.7 1 0 62 6.1 707 706 275 61.4 77.8 1 0 63 4.9 3086 1739 1507 202.7 335.2 0 0 64 3.3 252 312 883 41.7 60.6 1 0 65 7.0 11052 1097 606 64.9 97.6 1 0 66 8.2 9672 1037 829 92.6 118.2 1 0 67 43.5 1112 3689 542 30.3 96.9 1 0 68 48.5 1104 5123 910 63.7 133.3 1 0 69 5.4 478 672 866 67.1 101.6 0 1 70 49.5 10348 5721 1915 223.6 322.5 0 1 71 29.1 2769 3725 663 -208.4 12.4 1 0 72 2.6 752 2149 101 11.1 15.2 0 1 73 0.8 4989 518 53 -3.1 -0.3 1 0 74 184.8 10528 14992 5377 312.7 710.7 0 1 75 2.3 1995 2662 341 34.7 100.7 0 0 76 8.0 2286 2235 2306 195.3 219.0 0 0 77 10.3 952 1307 309 35.4 92.8 1 0 78 50.0 2957 2806 457 40.6 93.5 1 0 79 118.1 2535 5958 1921 177.0 288.0 1 0 > k <- length(x[1,]) > df <- as.data.frame(x) > (mylm <- lm(df)) Call: lm(formula = df) Coefficients: (Intercept) Activa Omzet Marktwaarde Winst Cashflow -2.1200016 -0.0015291 0.0100733 0.0006661 0.0374020 -0.0315420 Dienst Product 12.3288015 14.2438423 > (mysum <- summary(mylm)) Call: lm(formula = df) Residuals: Min 1Q Median 3Q Max -77.964 -9.773 -3.441 4.345 81.992 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) -2.1200016 5.1128573 -0.415 0.67965 Activa -0.0015291 0.0004476 -3.416 0.00105 ** Omzet 0.0100733 0.0009712 10.373 7.24e-16 *** Marktwaarde 0.0006661 0.0011999 0.555 0.58057 Winst 0.0374020 0.0274722 1.361 0.17768 Cashflow -0.0315420 0.0175943 -1.793 0.07727 . Dienst 12.3288015 6.1397495 2.008 0.04845 * Product 14.2438423 7.5683765 1.882 0.06393 . --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 22.38 on 71 degrees of freedom Multiple R-squared: 0.8904, Adjusted R-squared: 0.8796 F-statistic: 82.44 on 7 and 71 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.090716671 0.18143334 0.909283329 [2,] 0.032703851 0.06540770 0.967296149 [3,] 0.010133986 0.02026797 0.989866014 [4,] 0.008420946 0.01684189 0.991579054 [5,] 0.002695350 0.00539070 0.997304650 [6,] 0.073864272 0.14772854 0.926135728 [7,] 0.046245751 0.09249150 0.953754249 [8,] 0.076965758 0.15393152 0.923034242 [9,] 0.067036528 0.13407306 0.932963472 [10,] 0.050803828 0.10160766 0.949196172 [11,] 0.030861969 0.06172394 0.969138031 [12,] 0.030107754 0.06021551 0.969892246 [13,] 0.067751490 0.13550298 0.932248510 [14,] 0.056382092 0.11276418 0.943617908 [15,] 0.050696179 0.10139236 0.949303821 [16,] 0.045925872 0.09185174 0.954074128 [17,] 0.030391265 0.06078253 0.969608735 [18,] 0.024860026 0.04972005 0.975139974 [19,] 0.015890116 0.03178023 0.984109884 [20,] 0.013013816 0.02602763 0.986986184 [21,] 0.008457892 0.01691578 0.991542108 [22,] 0.007392791 0.01478558 0.992607209 [23,] 0.052283801 0.10456760 0.947716199 [24,] 0.048530640 0.09706128 0.951469360 [25,] 0.036601047 0.07320209 0.963398953 [26,] 0.054228386 0.10845677 0.945771614 [27,] 0.044442218 0.08888444 0.955557782 [28,] 0.095610475 0.19122095 0.904389525 [29,] 0.070682772 0.14136554 0.929317228 [30,] 0.938712647 0.12257471 0.061287353 [31,] 0.919962172 0.16007566 0.080037828 [32,] 0.896488016 0.20702397 0.103511984 [33,] 0.968225552 0.06354890 0.031774448 [34,] 0.953894344 0.09221131 0.046105656 [35,] 0.975204913 0.04959017 0.024795087 [36,] 0.962438438 0.07512312 0.037561562 [37,] 0.954796886 0.09040623 0.045203114 [38,] 0.966916254 0.06616749 0.033083746 [39,] 0.990383995 0.01923201 0.009616005 [40,] 0.990798413 0.01840317 0.009201587 [41,] 0.984784878 0.03043024 0.015215122 [42,] 0.978952111 0.04209578 0.021047889 [43,] 0.967398202 0.06520360 0.032601798 [44,] 0.951869046 0.09626191 0.048130954 [45,] 0.936500124 0.12699975 0.063499876 [46,] 0.907264291 0.18547142 0.092735709 [47,] 0.873671909 0.25265618 0.126328091 [48,] 0.978694523 0.04261095 0.021305477 [49,] 0.975785584 0.04842883 0.024214416 [50,] 0.969920914 0.06015817 0.030079086 [51,] 0.959310111 0.08137978 0.040689889 [52,] 0.938807875 0.12238425 0.061192125 [53,] 0.906424103 0.18715179 0.093575897 [54,] 0.867650888 0.26469822 0.132349112 [55,] 0.784922898 0.43015420 0.215077102 [56,] 0.667470035 0.66505993 0.332529965 [57,] 0.529411050 0.94117790 0.470588950 [58,] 0.680139696 0.63972061 0.319860304 > postscript(file="/var/fisher/rcomp/tmp/1aame1351700586.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/fisher/rcomp/tmp/2huis1351700586.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/fisher/rcomp/tmp/3jxqe1351700586.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/fisher/rcomp/tmp/4fdw31351700586.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/fisher/rcomp/tmp/54vu11351700586.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 = 79 Frequency = 1 1 2 3 4 5 6 9.9923146 81.9922962 4.6802413 -7.0909216 -5.6806767 -23.2659182 7 8 9 10 11 12 -5.8635591 13.8810559 -6.7454056 41.2593831 -12.7439428 -2.4869933 13 14 15 16 17 18 -3.4155635 -10.1565374 1.4109463 -52.7252336 4.2407098 -11.0609925 19 20 21 22 23 24 -8.6996365 1.7001434 1.3946081 36.7936419 18.4644997 -8.8796458 25 26 27 28 29 30 -11.6722100 -1.1471886 7.4624174 -4.5759007 -6.9964913 -3.2627871 31 32 33 34 35 36 0.3359115 -6.3506533 50.2558274 -12.9950881 -7.8089264 21.6984149 37 38 39 40 41 42 14.1568314 23.4120405 2.1285833 -33.1369621 -1.4811646 -3.4414366 43 44 45 46 47 48 -7.5570767 -2.1999020 -15.6512355 -5.7444206 21.9994223 23.5123598 49 50 51 52 53 54 4.2694252 2.6836330 4.4197973 15.8630483 1.6824140 13.3495860 55 56 57 58 59 60 -14.1589809 -10.5668803 -7.9611290 -77.9644433 -9.0373534 2.9583494 61 62 63 64 65 66 -9.6425406 -10.1651841 -3.7909908 -9.9027019 2.8878559 2.0472930 67 68 69 70 71 72 -0.6068501 -10.4104595 -12.6440327 -3.8965673 -6.6538062 -30.0245556 73 74 75 76 77 78 -6.9269178 44.8949225 -17.6933636 -10.8312411 -10.2216946 17.1732324 79 52.9349572 > postscript(file="/var/fisher/rcomp/tmp/6rqr21351700586.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 = 79 Frequency = 1 lag(myerror, k = 1) myerror 0 9.9923146 NA 1 81.9922962 9.9923146 2 4.6802413 81.9922962 3 -7.0909216 4.6802413 4 -5.6806767 -7.0909216 5 -23.2659182 -5.6806767 6 -5.8635591 -23.2659182 7 13.8810559 -5.8635591 8 -6.7454056 13.8810559 9 41.2593831 -6.7454056 10 -12.7439428 41.2593831 11 -2.4869933 -12.7439428 12 -3.4155635 -2.4869933 13 -10.1565374 -3.4155635 14 1.4109463 -10.1565374 15 -52.7252336 1.4109463 16 4.2407098 -52.7252336 17 -11.0609925 4.2407098 18 -8.6996365 -11.0609925 19 1.7001434 -8.6996365 20 1.3946081 1.7001434 21 36.7936419 1.3946081 22 18.4644997 36.7936419 23 -8.8796458 18.4644997 24 -11.6722100 -8.8796458 25 -1.1471886 -11.6722100 26 7.4624174 -1.1471886 27 -4.5759007 7.4624174 28 -6.9964913 -4.5759007 29 -3.2627871 -6.9964913 30 0.3359115 -3.2627871 31 -6.3506533 0.3359115 32 50.2558274 -6.3506533 33 -12.9950881 50.2558274 34 -7.8089264 -12.9950881 35 21.6984149 -7.8089264 36 14.1568314 21.6984149 37 23.4120405 14.1568314 38 2.1285833 23.4120405 39 -33.1369621 2.1285833 40 -1.4811646 -33.1369621 41 -3.4414366 -1.4811646 42 -7.5570767 -3.4414366 43 -2.1999020 -7.5570767 44 -15.6512355 -2.1999020 45 -5.7444206 -15.6512355 46 21.9994223 -5.7444206 47 23.5123598 21.9994223 48 4.2694252 23.5123598 49 2.6836330 4.2694252 50 4.4197973 2.6836330 51 15.8630483 4.4197973 52 1.6824140 15.8630483 53 13.3495860 1.6824140 54 -14.1589809 13.3495860 55 -10.5668803 -14.1589809 56 -7.9611290 -10.5668803 57 -77.9644433 -7.9611290 58 -9.0373534 -77.9644433 59 2.9583494 -9.0373534 60 -9.6425406 2.9583494 61 -10.1651841 -9.6425406 62 -3.7909908 -10.1651841 63 -9.9027019 -3.7909908 64 2.8878559 -9.9027019 65 2.0472930 2.8878559 66 -0.6068501 2.0472930 67 -10.4104595 -0.6068501 68 -12.6440327 -10.4104595 69 -3.8965673 -12.6440327 70 -6.6538062 -3.8965673 71 -30.0245556 -6.6538062 72 -6.9269178 -30.0245556 73 44.8949225 -6.9269178 74 -17.6933636 44.8949225 75 -10.8312411 -17.6933636 76 -10.2216946 -10.8312411 77 17.1732324 -10.2216946 78 52.9349572 17.1732324 79 NA 52.9349572 > dum1 <- dum[2:length(myerror),] > dum1 lag(myerror, k = 1) myerror [1,] 81.9922962 9.9923146 [2,] 4.6802413 81.9922962 [3,] -7.0909216 4.6802413 [4,] -5.6806767 -7.0909216 [5,] -23.2659182 -5.6806767 [6,] -5.8635591 -23.2659182 [7,] 13.8810559 -5.8635591 [8,] -6.7454056 13.8810559 [9,] 41.2593831 -6.7454056 [10,] -12.7439428 41.2593831 [11,] -2.4869933 -12.7439428 [12,] -3.4155635 -2.4869933 [13,] -10.1565374 -3.4155635 [14,] 1.4109463 -10.1565374 [15,] -52.7252336 1.4109463 [16,] 4.2407098 -52.7252336 [17,] -11.0609925 4.2407098 [18,] -8.6996365 -11.0609925 [19,] 1.7001434 -8.6996365 [20,] 1.3946081 1.7001434 [21,] 36.7936419 1.3946081 [22,] 18.4644997 36.7936419 [23,] -8.8796458 18.4644997 [24,] -11.6722100 -8.8796458 [25,] -1.1471886 -11.6722100 [26,] 7.4624174 -1.1471886 [27,] -4.5759007 7.4624174 [28,] -6.9964913 -4.5759007 [29,] -3.2627871 -6.9964913 [30,] 0.3359115 -3.2627871 [31,] -6.3506533 0.3359115 [32,] 50.2558274 -6.3506533 [33,] -12.9950881 50.2558274 [34,] -7.8089264 -12.9950881 [35,] 21.6984149 -7.8089264 [36,] 14.1568314 21.6984149 [37,] 23.4120405 14.1568314 [38,] 2.1285833 23.4120405 [39,] -33.1369621 2.1285833 [40,] -1.4811646 -33.1369621 [41,] -3.4414366 -1.4811646 [42,] -7.5570767 -3.4414366 [43,] -2.1999020 -7.5570767 [44,] -15.6512355 -2.1999020 [45,] -5.7444206 -15.6512355 [46,] 21.9994223 -5.7444206 [47,] 23.5123598 21.9994223 [48,] 4.2694252 23.5123598 [49,] 2.6836330 4.2694252 [50,] 4.4197973 2.6836330 [51,] 15.8630483 4.4197973 [52,] 1.6824140 15.8630483 [53,] 13.3495860 1.6824140 [54,] -14.1589809 13.3495860 [55,] -10.5668803 -14.1589809 [56,] -7.9611290 -10.5668803 [57,] -77.9644433 -7.9611290 [58,] -9.0373534 -77.9644433 [59,] 2.9583494 -9.0373534 [60,] -9.6425406 2.9583494 [61,] -10.1651841 -9.6425406 [62,] -3.7909908 -10.1651841 [63,] -9.9027019 -3.7909908 [64,] 2.8878559 -9.9027019 [65,] 2.0472930 2.8878559 [66,] -0.6068501 2.0472930 [67,] -10.4104595 -0.6068501 [68,] -12.6440327 -10.4104595 [69,] -3.8965673 -12.6440327 [70,] -6.6538062 -3.8965673 [71,] -30.0245556 -6.6538062 [72,] -6.9269178 -30.0245556 [73,] 44.8949225 -6.9269178 [74,] -17.6933636 44.8949225 [75,] -10.8312411 -17.6933636 [76,] -10.2216946 -10.8312411 [77,] 17.1732324 -10.2216946 [78,] 52.9349572 17.1732324 > z <- as.data.frame(dum1) > z lag(myerror, k = 1) myerror 1 81.9922962 9.9923146 2 4.6802413 81.9922962 3 -7.0909216 4.6802413 4 -5.6806767 -7.0909216 5 -23.2659182 -5.6806767 6 -5.8635591 -23.2659182 7 13.8810559 -5.8635591 8 -6.7454056 13.8810559 9 41.2593831 -6.7454056 10 -12.7439428 41.2593831 11 -2.4869933 -12.7439428 12 -3.4155635 -2.4869933 13 -10.1565374 -3.4155635 14 1.4109463 -10.1565374 15 -52.7252336 1.4109463 16 4.2407098 -52.7252336 17 -11.0609925 4.2407098 18 -8.6996365 -11.0609925 19 1.7001434 -8.6996365 20 1.3946081 1.7001434 21 36.7936419 1.3946081 22 18.4644997 36.7936419 23 -8.8796458 18.4644997 24 -11.6722100 -8.8796458 25 -1.1471886 -11.6722100 26 7.4624174 -1.1471886 27 -4.5759007 7.4624174 28 -6.9964913 -4.5759007 29 -3.2627871 -6.9964913 30 0.3359115 -3.2627871 31 -6.3506533 0.3359115 32 50.2558274 -6.3506533 33 -12.9950881 50.2558274 34 -7.8089264 -12.9950881 35 21.6984149 -7.8089264 36 14.1568314 21.6984149 37 23.4120405 14.1568314 38 2.1285833 23.4120405 39 -33.1369621 2.1285833 40 -1.4811646 -33.1369621 41 -3.4414366 -1.4811646 42 -7.5570767 -3.4414366 43 -2.1999020 -7.5570767 44 -15.6512355 -2.1999020 45 -5.7444206 -15.6512355 46 21.9994223 -5.7444206 47 23.5123598 21.9994223 48 4.2694252 23.5123598 49 2.6836330 4.2694252 50 4.4197973 2.6836330 51 15.8630483 4.4197973 52 1.6824140 15.8630483 53 13.3495860 1.6824140 54 -14.1589809 13.3495860 55 -10.5668803 -14.1589809 56 -7.9611290 -10.5668803 57 -77.9644433 -7.9611290 58 -9.0373534 -77.9644433 59 2.9583494 -9.0373534 60 -9.6425406 2.9583494 61 -10.1651841 -9.6425406 62 -3.7909908 -10.1651841 63 -9.9027019 -3.7909908 64 2.8878559 -9.9027019 65 2.0472930 2.8878559 66 -0.6068501 2.0472930 67 -10.4104595 -0.6068501 68 -12.6440327 -10.4104595 69 -3.8965673 -12.6440327 70 -6.6538062 -3.8965673 71 -30.0245556 -6.6538062 72 -6.9269178 -30.0245556 73 44.8949225 -6.9269178 74 -17.6933636 44.8949225 75 -10.8312411 -17.6933636 76 -10.2216946 -10.8312411 77 17.1732324 -10.2216946 78 52.9349572 17.1732324 > 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/fisher/rcomp/tmp/76gi71351700586.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/fisher/rcomp/tmp/8ky7q1351700586.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/fisher/rcomp/tmp/9iqcp1351700586.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/fisher/rcomp/tmp/103o8x1351700586.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/fisher/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/fisher/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/fisher/rcomp/tmp/11mzyi1351700586.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/fisher/rcomp/tmp/12la071351700586.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/fisher/rcomp/tmp/13ccbl1351700586.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/fisher/rcomp/tmp/14wcm01351700586.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/fisher/rcomp/tmp/15naps1351700586.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/fisher/rcomp/tmp/16yaep1351700586.tab") + } > > try(system("convert tmp/1aame1351700586.ps tmp/1aame1351700586.png",intern=TRUE)) character(0) > try(system("convert tmp/2huis1351700586.ps tmp/2huis1351700586.png",intern=TRUE)) character(0) > try(system("convert tmp/3jxqe1351700586.ps tmp/3jxqe1351700586.png",intern=TRUE)) character(0) > try(system("convert tmp/4fdw31351700586.ps tmp/4fdw31351700586.png",intern=TRUE)) character(0) > try(system("convert tmp/54vu11351700586.ps tmp/54vu11351700586.png",intern=TRUE)) character(0) > try(system("convert tmp/6rqr21351700586.ps tmp/6rqr21351700586.png",intern=TRUE)) character(0) > try(system("convert tmp/76gi71351700586.ps tmp/76gi71351700586.png",intern=TRUE)) character(0) > try(system("convert tmp/8ky7q1351700586.ps tmp/8ky7q1351700586.png",intern=TRUE)) character(0) > try(system("convert tmp/9iqcp1351700586.ps tmp/9iqcp1351700586.png",intern=TRUE)) character(0) > try(system("convert tmp/103o8x1351700586.ps tmp/103o8x1351700586.png",intern=TRUE)) character(0) > > > proc.time() user system elapsed 6.419 1.067 7.488